SaveState() public method

public SaveState ( string path ) : void
path string
return void
Example #1
0
 public void SaveOptions(string path)
 {
     try
     {
         OptionsSerializer os = new OptionsSerializer();
         bool restart         = false;
         foreach (OptionsControlBase page in mPages)
         {
             os.SOptions.Add(page.ControlledOption);
             if ((page.ControlledOption is EnvironmentOption))
             {
                 restart = true;
             }
         }
         os.SaveState(path);
         if (restart)
         {
             if (MessageBox.Show(this, "Environment has been changed. Restart Application?", "Environment setting", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.OK)
             {
                 Environment.SetEnvironmentVariable("SPOCLIENT", "");
                 Application.Exit();
                 Process.Start(".\\PKStudioLauncher.exe");
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(Strings.ERROR_CANT_SAVE_OPTIONS + ": " + ex.Message, Strings.Error + "!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         //throw;
     }
 }
Example #2
0
        public void SaveOptions(string path)
        {
            try
            {
                OptionsSerializer os = new OptionsSerializer();
                bool restart = false;
                foreach (OptionsControlBase page in mPages)
	            {
                    os.SOptions.Add(page.ControlledOption);
                    if ((page.ControlledOption is EnvironmentOption))
                    {
                        restart = true;
                    }
	            }
                os.SaveState(path);
                if (restart)
                {
                    if (MessageBox.Show(this, "Environment has been changed. Restart Application?", "Environment setting", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.OK)
                    {
                        Environment.SetEnvironmentVariable("SPOCLIENT","");
                        Application.Exit();
                        Process.Start(".\\PKStudioLauncher.exe");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(Strings.ERROR_CANT_SAVE_OPTIONS + ": " + ex.Message, Strings.Error + "!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //throw;
            }
        }