当前位置: 首页>>代码示例>>C#>>正文


C# Settings.Save方法代码示例

本文整理汇总了C#中Settings.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Settings.Save方法的具体用法?C# Settings.Save怎么用?C# Settings.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Settings的用法示例。


在下文中一共展示了Settings.Save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WindowManipulationService

        internal WindowManipulationService(
            Window window,
            Func<double> getWindowTopSetting,
            Action<double> setWindowTopSetting,
            Func<double> getWindowLeftSetting,
            Action<double> setWindowLeftSetting,
            Func<double> getWindowHeightSetting,
            Action<double> setWindowHeightSetting,
            Func<double> getWindowWidthSetting,
            Action<double> setWindowWidthSetting,
            Func<WindowState> getWindowStateSetting,
            Action<WindowState> setWindowStateSetting,
            Settings settings,
            bool loadSavedState = false,
            bool saveStateOnClose = false)
        {
            this.window = window;
            this.getWindowTopSetting = getWindowTopSetting;
            this.getWindowLeftSetting = getWindowLeftSetting;
            this.getWindowHeightSetting = getWindowHeightSetting;
            this.getWindowWidthSetting = getWindowWidthSetting;
            this.getWindowStateSetting = getWindowStateSetting;

            if(loadSavedState)
            {
                LoadState();
            }

            window.Closing += (sender, args) =>
            {
                if (saveStateOnClose)
                {
                    //Check window is not in minimised state (either as a ssmall icon on the screen, or the window is actually minimised)
                    if (!windowIsMinimised
                        && window.WindowState != WindowState.Minimized
                        && window.WindowState != WindowState.Maximized)
                    {
                        setWindowTopSetting(window.Top);
                        setWindowLeftSetting(window.Left);
                        setWindowHeightSetting(window.Height);
                        setWindowWidthSetting(window.Width);
                        setWindowStateSetting(window.WindowState);

                        settings.Save();
                    }
                }

                if (otherWindowsShouldBeMaximisedOnExit)
                {
                    //Maximise all windows if they were arranged at some point
                    var thisHwnd = new WindowInteropHelper(window).Handle;
                    var otherWindows = Windows.GetVisibleOverlappedWindows(thisHwnd);
                    foreach (var otherWindow in otherWindows)
                    {
                        Log.DebugFormat("Maximising window '{0}' before we exit", otherWindow.Item1);
                        PInvoke.ShowWindow(otherWindow.Item2, (int)WindowShowStyle.Maximize);
                    }
                }
            };
        }
开发者ID:jacek-kurlit,项目名称:OptiKey,代码行数:60,代码来源:WindowManipulationService.cs

示例2: LoadSettings

		public Settings LoadSettings(string path = "")
		{
			if (Settings == null || Path != path)
			{
				if (path == "")
				{
					Path = Settings1.Default.FileLocation;
				}
				else Path = path;
				if (File.Exists(Path))
				{
					using (var fileStream = File.Open(Path, FileMode.Open))
					{
						Settings = Settings.Load(fileStream, SerializationMode.Xml);
						Debug.WriteLine("Settings loaded");
						if (Settings.CurrentSkin == null)
							Settings.CurrentSkin = Skin.Null;
						else
							Settings.CurrentSkin = Skin.GetSkin(Settings.CurrentSkin.Name);
						return Settings;
					}
				}
				else
				{
					Settings = new Settings();
					Settings.Save(Path, SerializationMode.Xml);
					return Settings;

				}
			}
			else return Settings;
		}
开发者ID:Epikem,项目名称:EpikemMacro1,代码行数:32,代码来源:MacroService.cs

示例3: MainForm

        public MainForm( SteamContext context )
        {
            try
            {
                sets = Settings.Load( "settings.xml" );

                if ( sets == null )
                {
                    sets = new Settings();
                    sets.Save( "settings.xml" );
                }
            }
            catch ( Exception ex )
            {
                MessageBox.Show( "Unable to load settings!\n\n" + ex.ToString() );
				sets = new Settings();
            }

            InitializeComponent();

            foreach ( string str in sets.NameChanger )
            {
                txtNameChanger.Text += str + "\r\n";
            }

            chkNoEscape.Checked = sets.NoEscape;
            awayMessageBox.Text = sets.NoEscapeString;

            nameEntries = new List<NameEntry>();

            this.context = context;

            friendsList.SteamContext = context;

            txtPersonaName.Text = context.SteamFriends.GetPersonaName();

            for ( int x = -2 ; x < ( int )( EPersonaState.k_EPersonaStateMax + 2 ) ; x++ )
                cmbState.Items.Add( ( EPersonaState )x );

            cmbState.SelectedIndex = ( int )( context.SteamFriends.GetPersonaState() + 2 );

            for ( int i = 0 ; i < context.SteamFriends.GetFriendCount( ( int )EFriendFlags.k_EFriendFlagImmediate ) ; ++i )
            {
                Friend friend = new Friend();

                CSteamID steamId = context.SteamFriends.GetFriendByIndex( i, ( int )EFriendFlags.k_EFriendFlagImmediate );
                string friendName = context.SteamFriends.GetFriendPersonaName( steamId );

                friend.SteamID = steamId;
                friend.PersonaName = friendName;

                friendsList.Items.Add( friend );
            }

            friendsList.Sorted = true;
        }
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:56,代码来源:MainForm.cs

示例4: Main

        private static void Main()
        {
            Settings = Settings.Load<Settings>(SettingsFilename);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());

            Settings.Save(SettingsFilename);
        }
开发者ID:Jaex,项目名称:CodeWorks,代码行数:10,代码来源:Program.cs

示例5: TestClosureCompilerAdvancedOnlineJsEngine

        public void TestClosureCompilerAdvancedOnlineJsEngine()
        {
            Settings settings = new Settings();
            settings.GoogleClosureOffline = false;
            settings.Save();

            string code = "function hello(name) {alert('Hello, ' + name);}hello('New user');";
            //create file for googleClosureCompilerOffline
            string TempFilePath = System.Environment.CurrentDirectory + "\\test.js";
            System.IO.File.WriteAllText(TempFilePath, code);

            code = Zippy.Chirp.Engines.ClosureCompilerEngine.Minify(TempFilePath, code, GetProjectItem(TempFilePath), ClosureCompilerCompressMode.ADVANCED_OPTIMIZATIONS, string.Empty);
            Assert.IsTrue(code == "alert(\"Hello, New user\");\r\n" || code == "alert(\"Hello, New user\");");
        }
开发者ID:cbilson,项目名称:chirpy,代码行数:14,代码来源:ClosureCompilerEngineTest.cs

示例6: TestClosureCompilerAdvancedOnlineDetectFileName

        public void TestClosureCompilerAdvancedOnlineDetectFileName()
        {
            Settings settings = new Settings();
            settings.GoogleClosureOffline = false;
            settings.ChirpJsFile = ".chirp.js";
            settings.Save();

            string code = "function hello(name) {alert('Hello, ' + name);}hello('New user');";
            //create file for googleClosureCompilerOffline
            string TempFilePath = System.Environment.CurrentDirectory + "\\test.chirp.js";
            System.IO.File.WriteAllText(TempFilePath, code);

            ClosureCompilerEngine closureCompilerEngine = new ClosureCompilerEngine();
            code = closureCompilerEngine.Transform(TempFilePath, code, GetProjectItem(TempFilePath));
            Assert.IsTrue(code == "alert(\"Hello, New user\");\r\n" || code == "alert(\"Hello, New user\");");
        }
开发者ID:cbilson,项目名称:chirpy,代码行数:16,代码来源:ClosureCompilerEngineTest.cs

示例7: btnUpdate_Click

 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     lbError.Visible = false;
     Settings s = new Settings();
     s.Where.SettingID.Value = 1;
     if (s.Query.Load())
     {
         if (s.s_Password != Encrypt.EncryptRijndael(tbOldPassword.Text))
         {
             lbError.Visible = true;
             return;
         }
         s.Password = Encrypt.EncryptRijndael(text_Password.Text);
         s.Save();
     }
     btnCancel_Click(sender, e);
 }
开发者ID:ivladyka,项目名称:Ekran,代码行数:17,代码来源:ChangePassword.ascx.cs

示例8: TestJsHintEngine

        public void TestJsHintEngine()
        {
            Settings settings = new Settings();
            settings.JsHintOptions.bitwise = true;
            settings.JsHintOptions.boss = true;
            settings.JsHintOptions.curly = true;
            settings.JsHintOptions.debug = true;
            settings.JsHintOptions.devel = true;
            settings.JsHintOptions.eqeqeq = true;
            settings.JsHintOptions.evil = true;
            settings.JsHintOptions.forin = true;
            settings.JsHintOptions.immed = true;
            settings.JsHintOptions.laxbreak = true;
            settings.JsHintOptions.maxerr = 25;
            settings.JsHintOptions.newcap = true;
            settings.JsHintOptions.noarg = true;
            settings.JsHintOptions.noempty = true;
            settings.JsHintOptions.nomen = true;
            settings.JsHintOptions.nonew = true;
            settings.JsHintOptions.onevar = true;
            settings.JsHintOptions.passfail = true;
            settings.JsHintOptions.plusplus = true;
            settings.JsHintOptions.regexp = true;
            settings.JsHintOptions.strict = true;
            settings.JsHintOptions.sub = true;
            settings.JsHintOptions.undef = true;
            settings.JsHintOptions.white = true;
            settings.Save();

            string code = "if(test) {\r\n\t eval('test'); }";
            var filename = System.IO.Path.GetTempFileName();
            try
            {
                System.IO.File.WriteAllText(filename, code);
                using (var jshint = new Zippy.Chirp.Engines.JSHintEngine())
                {
                    jshint.Run(filename, GetProjectItem(filename));
                    Assert.AreNotEqual(0, TaskList.Instance.Errors.Count());
                }
            }
            finally
            {
                System.IO.File.Delete(filename);
            }
        }
开发者ID:Malediction,项目名称:Spartan,代码行数:45,代码来源:JsHintEngineTest.cs

示例9: OnEdit

        public ActionResult OnEdit(int txtFirstTimeLimit, int txtSecondTimeLimit, int txtThirdTimeLimit)
        {
            Settings settings = new Settings();
            settings.FirstTimeLimit = txtFirstTimeLimit;
            settings.SecondTimeLimit = txtSecondTimeLimit;
            settings.ThirdTimeLimit = txtThirdTimeLimit;

            try
            {
                settings.Save(CurrentUserId, null);
            }
            catch (Exception ex)
            {
                string message = ex.Message;
            }

            //return View();
            return Redirect(Url.Action("Index"));
        }
开发者ID:newjakir,项目名称:SpliteMe,代码行数:19,代码来源:SettingsController.cs

示例10: TestConnectDisconnect

		public void TestConnectDisconnect()
		{
			var settings = new Settings {Uri = new Uri("http://localhost"), Login = "admin", DecryptedPassword = "admin",};
			settings.Save();
			var env = new DummyControllerEnvironment();
			Controller ctl;
			using (ctl = new Controller(new DummyTimeTrackingRepository(), new DummyWebServicesFactory(), env))
			{
				Assert.IsFalse(ctl.Connected);
				env.DialogResult = DialogResult.OK;
				ctl.Connect(true);
				Assert.IsTrue(ctl.Connected);
				ctl.Disconnect();
				Assert.IsFalse(ctl.Connected);
				env.DialogResult = DialogResult.Cancel;
				ctl.Connect(true);
				Assert.IsFalse(ctl.Connected);
				env.DialogResult = DialogResult.OK;
				ctl.Connect(true);
				Assert.IsTrue(ctl.Connected);
			}
			Assert.IsFalse(ctl.Connected);
		}
开发者ID:TargetProcess,项目名称:Tp.Integration.Ide.VisualStudio,代码行数:23,代码来源:ControllerTest.cs

示例11: SetsProperties

            public void SetsProperties()
            {
                var settings = new Settings();

                // Get From File Test
                Assert.Equal(true, settings.GetSetting<bool>("TrueSetting", false));

                // Default Setting Test
                Assert.Equal("default", settings.GetSetting("asdf", "default", true));

                // Check Create method
                Assert.Equal("default", settings.GetSetting("asdf", String.Empty));

                // Set Setting Test
                settings.SetSetting("mySetting", "False");
                Assert.Equal("False", settings.GetSetting("mySetting", String.Empty));

                // Remove Setting
                string fileValue = settings.GetSetting("ToBeRemovedSetting", "xmlvalue");
                settings.RemoveSetting("ToBeRemovedSetting");
                Assert.NotEqual(fileValue, settings.GetSetting("ToBeRemovedSetting", "notthexml"));
                settings.Save();
            }
开发者ID:tecnovaldehierro,项目名称:SeeGit,代码行数:23,代码来源:SettingsTests.cs

示例12: UpdateDatHash

        public static void UpdateDatHash()
        {
            Settings settings = new Settings();
            settings.Load();

            // Hash 01.dat and update settings file
            string datHash = Tools.GetMd5Hash(ModManager.ZeroPath);
            settings.GameData.DatHash = datHash;

            settings.Save();
        }
开发者ID:topher-au,项目名称:SnakeBite,代码行数:11,代码来源:SettingsManager.cs

示例13: SetGameData

 public static void SetGameData(GameData NewGameData)
 {
     Settings settings = new Settings();
     settings.Load();
     settings.GameData = NewGameData;
     settings.Save();
 }
开发者ID:topher-au,项目名称:SnakeBite,代码行数:7,代码来源:SettingsManager.cs

示例14: RemoveMod

 public static void RemoveMod(ModEntry Mod)
 {
     Settings settings = new Settings();
     settings.Load();
     ModEntry remMod = settings.ModEntries.Find(entry => entry.Name == Mod.Name);
     settings.ModEntries.Remove(remMod);
     settings.Save();
 }
开发者ID:topher-au,项目名称:SnakeBite,代码行数:8,代码来源:SettingsManager.cs

示例15: ClearAllMods

 public static void ClearAllMods()
 {
     Settings settings = new Settings();
     settings.Load();
     settings.ModEntries = new List<ModEntry>();
     settings.Save();
 }
开发者ID:topher-au,项目名称:SnakeBite,代码行数:7,代码来源:SettingsManager.cs


注:本文中的Settings.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。