Exemplo n.º 1
0
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     try
     {
         if (monitorPack != null)
         {
             if (monitorPack.BusyPolling) //still busy with previous polling instance
             {
                 //Attempting to abort it.
                 monitorPack.AbortPolling = true;
             }
             if (System.IO.File.Exists(Properties.Settings.Default.LastMonitorPack))
             {
                 monitorPack.Save(Properties.Settings.Default.LastMonitorPack);
             }
             monitorPack.ClosePerformanceCounters();
         }
         ClosePerformanceCounters();
         ToolStripManager.SaveSettings(this, "QuickMon.MainToolbar");
     }
     catch { }
     if (WindowState == FormWindowState.Normal)
     {
         Properties.Settings.Default.MainWindowLocation = this.Location;
         Properties.Settings.Default.MainWindowSize     = this.Size;
     }
     Properties.Settings.Default.Save();
 }
Exemplo n.º 2
0
        private void FormMain_Shown(object sender, EventArgs e)
        {
            setting.RestoreFormRect(this);

            // https://alexpkent.wordpress.com/2011/05/11/25/
            ToolStripManager.LoadSettings(this);

            this.FormClosed += (s, a) =>
            {
                setting.SaveFormRect(this);
                ToolStripManager.SaveSettings(this);
                setting.OnSysProxyChanged -= OnSysProxyChangedHandler;
                formMainCtrl.Cleanup();
                servers.LazyGC();
            };

            this.Text = string.Format(
                "{0} v{1}",
                Properties.Resources.AppName,
                Properties.Resources.Version);

            formMainCtrl = InitFormMainCtrl();

            BindToolStripButtonToMenuItem();

            toolMenuItemCurrentSysProxy.Text = GetCurrentSysProxySetting();
            setting.OnSysProxyChanged       += OnSysProxyChangedHandler;
        }
Exemplo n.º 3
0
 private void Main_FormClosing(object sender, FormClosingEventArgs e)
 {
     ToolStripManager.SaveSettings(this);
     settings.FormSize      = Size; // Preserve Size property, since databinding to Size doesn't work well.
     settings.ToolStripDock = toolStripLists.Parent.Dock;
     settings.Save();
 }
Exemplo n.º 4
0
        private void ExitApplication()
        {
            if (_documentChanged)
            {
                if (MessageBox.Show(@"You have un saved changes. Would you like to save your document?",
                                    @"Save Your Changes?",
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    SaveDocument();
                }
            }

            ToolStripManager.SaveSettings(this, "SecureNotePad");

            SaveSettings();

            if (_findForm != null)
            {
                _findForm.Dispose();
                _findForm = null;
            }

            Application.Exit();
        }
Exemplo n.º 5
0
 private void MonitorPackManagement_FormClosing(object sender, FormClosingEventArgs e)
 {
     try
     {
         ToolStripManager.SaveSettings(this, "QuickMon.ConfigurationEditorToolbar");
     }
     catch { }
 }
Exemplo n.º 6
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            MainForm form = new MainForm();

            ToolStripManager.LoadSettings(form, "BLToolkit.Demo");

            form.FormClosing += delegate
            {
                ToolStripManager.SaveSettings(form, "BLToolkit.Demo");
            };

            Application.Run(form);
        }
Exemplo n.º 7
0
        // Save settings when closing
        private void JustTalk_FormClosed(object sender, FormClosedEventArgs e)
        {
            // Save size
            if (this.WindowState == FormWindowState.Normal)
            {
                Properties.Settings.Default.WindowSize = this.Size;
            }
            else
            {
                Properties.Settings.Default.WindowSize = this.RestoreBounds.Size;
            }

            Properties.Settings.Default.Save();                         // Save setting manually
            ToolStripManager.SaveSettings(this);                        // Save toolstrips state
            this.disconnect();                                          // Disconnect from server
        }
Exemplo n.º 8
0
        // Exit
        private void exitTrayMenuItem_Click(object sender, EventArgs e)
        {
            // Save size
            if (this.WindowState == FormWindowState.Normal)
            {
                Properties.Settings.Default.WindowSize = this.Size;
            }
            else
            {
                Properties.Settings.Default.WindowSize = this.RestoreBounds.Size;
            }

            Properties.Settings.Default.Save();                         // Save setting manually
            ToolStripManager.SaveSettings(this);                        // Save toolstrips state
            this.disconnect();                                          // Disconnect from server
            this.Dispose(true);
        }
Exemplo n.º 9
0
 private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     // save toolstrip settings
     ToolStripManager.SaveSettings(this, Name);
     // do not save window position if StartMaximized property is set
     if (Settings.Default.StartMaximized)
     {
         return;
     }
     // save window position
     if (null == Settings.Default.MainFormSettings)
     {
         Settings.Default.MainFormSettings = new WindowSettings();
     }
     Settings.Default.MainFormSettings.Record(this);
     Settings.Default.Save();
 }
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            ToolStripManager.SaveSettings(this);

            //this.Visible = false;
            MittoDeveloper.Properties.Settings.Default.MainForm_WindowState = this.WindowState;
            if (this.WindowState != FormWindowState.Normal)
            {
                this.WindowState = FormWindowState.Normal;
            }
            MittoDeveloper.Properties.Settings.Default.MainForm_Location  = this.Location;
            MittoDeveloper.Properties.Settings.Default.MainForm_Size      = this.Size;
            MittoDeveloper.Properties.Settings.Default.MainForm_Splitter1 = splitContainer1.SplitterDistance;
            MittoDeveloper.Properties.Settings.Default.MainForm_Splitter2 = splitContainer2.SplitterDistance;

            MittoDeveloper.Properties.Settings.Default.Save();
        }
Exemplo n.º 11
0
        private void MainWindow_FormClosing(object sender, FormClosingEventArgs e)
        {
            Properties.Settings.Default.MainWindowLocation = Location;

            if (WindowState == FormWindowState.Normal)
            {
                Properties.Settings.Default.MainWindowSize = Size;
            }
            else
            {
                Properties.Settings.Default.MainWindowSize = RestoreBounds.Size;
            }

            Properties.Settings.Default.CaptureCursor   = CaptureCursor.Checked;
            Properties.Settings.Default.HighlightCursor = HighlightCursor.Checked;
            ToolStripManager.SaveSettings(this);
            Properties.Settings.Default.Save();
        }
Exemplo n.º 12
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            string lastProject = App.Project.GetPath();

            if (!App.Map.ShapeEditor.SaveChanges())
            {
                e.Cancel = true;
                return;
            }

            if (!App.Project.TryClose())
            {
                e.Cancel = true;
                return;
            }

            AppSettings.Instance.LastProject = lastProject;
            AppSettings.Save();

            ToolStripManager.SaveSettings(this);
        }
Exemplo n.º 13
0
        protected override void OnClosing(CancelEventArgs e)
        {
            HistoryListener.Write("Exiting...");

            base.OnClosing(e);

            // Close Workbench


            // Close Workplace, always asking for confirmation
            if (!workbench.CloseAllDocuments(true))
            {
                e.Cancel = true;
                return;
            }


            // Save ToolStripPanels
            ToolStripManager.SaveSettings(this);

            // Save Workbench Layout
            workbench.SaveLayout();

            // Save settings before closing
            Properties.Settings.Default.main_FirstLoad   = false;
            Properties.Settings.Default.main_WindowState = this.WindowState;
            if (this.WindowState == FormWindowState.Normal)
            {
                Properties.Settings.Default.main_Size     = this.Size;
                Properties.Settings.Default.main_Location = this.Location;
            }
            else
            {
                Properties.Settings.Default.main_Size     = this.RestoreBounds.Size;
                Properties.Settings.Default.main_Location = this.RestoreBounds.Location;
            }
        }
Exemplo n.º 14
0
 /// <summary>
 /// sourceFormに配置されたToolStripPanel内のToolStripの位置を保存する
 /// </summary>
 /// <param name="sourceForm"></param>
 public static void SaveSettings(Form sourceForm)
 {
     ToolStripManager.SaveSettings(sourceForm);
     ToolStripManager2.InternalSaveSettings(sourceForm);
 }
Exemplo n.º 15
0
 private void cmdSave_Click(object sender, EventArgs e)
 {
     ToolStripManager.SaveSettings(this, "Test");
 }
Exemplo n.º 16
0
 private void SaveToolbarLayoutToolStripMenuItemClick(object sender, EventArgs e)
 {
     ToolStripManager.SaveSettings(this, "SecureNotePad");
 }
Exemplo n.º 17
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     ToolStripManager.SaveSettings(this);
 }
Exemplo n.º 18
0
        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            ToolStripManager.SaveSettings(this, "toolsettings");

            base.OnFormClosing(e);
        }