コード例 #1
0
        public void SaveConfiguration()
        {
            plotPanel.SetCurrentSettings();

            foreach (TreeColumn column in treeView.Columns)
            {
                settings.SetValue($"treeView.Columns.{column.Header}.Width", column.Width);
            }

            settings.SetValue("listenerPort", server.ListenerPort);

            string fileName = Path.ChangeExtension(Application.ExecutablePath, ".config");

            try
            {
                settings.Save(fileName);
            }
            catch (UnauthorizedAccessException)
            {
                MessageBox.Show($"Access to the path '{fileName}' is denied. The current settings could not be saved.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (IOException)
            {
                MessageBox.Show($"The path '{fileName}' is not writeable. The current settings could not be saved.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        private void SaveConfiguration()
        {
            plotPanel.SetCurrentSettings();
            foreach (TreeColumn column in treeView.Columns)
            {
                settings.SetValue("treeView.Columns." + column.Header + ".Width",
                                  column.Width);
            }

            this.settings.SetValue("listenerPort", server.ListenerPort);

            string fileName = Path.ChangeExtension(
                System.Windows.Forms.Application.ExecutablePath, ".config");

            try {
                settings.Save(fileName);
            } catch (UnauthorizedAccessException) {
                MessageBox.Show("Access to the path '" + fileName + "' is denied. " +
                                "The current settings could not be saved.",
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            } catch (IOException) {
                MessageBox.Show("The path '" + fileName + "' is not writeable. " +
                                "The current settings could not be saved.",
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: tianve/hwmonitor
        private void SaveConfiguration()
        {
            if (settings == null)
            {
                return;
            }


            if (server != null)
            {
                this.settings.SetValue("listenerPort", server.ListenerPort);
            }

            string fileName = Path.ChangeExtension(
                System.Windows.Forms.Application.ExecutablePath, ".config");

            try {
                settings.Save(fileName);
            } catch (UnauthorizedAccessException) {
                MessageBox.Show("Access to the path '" + fileName + "' is denied. " +
                                "The current settings could not be saved.",
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            } catch (IOException) {
                MessageBox.Show("The path '" + fileName + "' is not writeable. " +
                                "The current settings could not be saved.",
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #4
0
 public void Save()
 {
     persistentSettings.Save("Path", ApplicationFilePath);
     persistentSettings.Save("Arguments", Arguments);
     persistentSettings.Save("Folder", WorkingFolderPath);
     persistentSettings.Save("RegFile", RegFilePath);
     persistentSettings.Save("Shortcut", ShortcutName);
     persistentSettings.Save("OneInstance", OneInstance);
     persistentSettings.Save("DisableThemes", DisableThemes);
 }
コード例 #5
0
        async Task Save()
        {
            try
            {
                await PersistentSettings.Save();

                await js.AlertSuccess(Loc["Saved"], Loc["SettingsSaved"]);
            }
            catch (Exception ex)
            {
                await js.AlertError(ex.GetType().Name, ex.Message);
            }
        }
コード例 #6
0
 private void SaveConfiguration(PersistentSettings settings, string filename)
 {
     try
     {
         settings.Save(filename);
     }
     catch (UnauthorizedAccessException)
     {
         System.Console.WriteLine("Access to the path '" + filename + "' is denied. " +
                                  "The current settings could not be saved.");
     }
     catch (IOException)
     {
         System.Console.WriteLine("The path '" + filename + "' is not writable. " +
                                  "The current settings could not be saved.");
     }
 }
コード例 #7
0
        private void SaveConfiguration()
        {
            if (WindowState != FormWindowState.Minimized)
            {
                settings.SetValue("mainForm.Location.X", Location.X);
                settings.SetValue("mainForm.Location.Y", Location.Y);
                settings.SetValue("mainForm.Width", ClientSize.Width);
                settings.SetValue("mainForm.Height", ClientSize.Height);
            }

            foreach (TreeColumn column in treeView.Columns)
            {
                settings.SetValue("treeView.Columns." + column.Header + ".Width",
                                  column.Width);
            }

            settings.Save(Path.ChangeExtension(
                              System.Windows.Forms.Application.ExecutablePath, ".config"));
        }
コード例 #8
0
        private void SaveConfiguration()
        {
            if (_plotPanel == null || _settings == null)
            {
                return;
            }


            _plotPanel.SetCurrentSettings();

            foreach (TreeColumn column in treeView.Columns)
            {
                _settings.SetValue("treeView.Columns." + column.Header + ".Width", column.Width);
            }

            _settings.SetValue("listenerPort", Server.ListenerPort);
            _settings.SetValue("authenticationEnabled", Server.AuthEnabled);
            _settings.SetValue("authenticationUserName", Server.UserName);
            _settings.SetValue("authenticationPassword", Server.Password);

            string fileName = Path.ChangeExtension(Application.ExecutablePath, ".config");

            try
            {
                _settings.Save(fileName);
            }
            catch (UnauthorizedAccessException)
            {
                MessageBox.Show("Access to the path '" + fileName + "' is denied. " +
                                "The current settings could not be saved.",
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (IOException)
            {
                MessageBox.Show("The path '" + fileName + "' is not writeable. " +
                                "The current settings could not be saved.",
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #9
0
 public void Save()
 {
     persistentSettings.Save("Path", ApplicationFilePath);
     persistentSettings.Save("DateIndex", DateIndex);
     persistentSettings.Save("DateTime", IsToday(DateTime) ? "0000-00-00" : DateTime.ToString("yyyy-MM-dd"));
     persistentSettings.Save("Span", SpanValue);
     persistentSettings.Save("SpanIndex", SpanIndex);
     persistentSettings.Save("Arguments", Arguments);
     persistentSettings.Save("Folder", WorkingFolderPath);
     persistentSettings.Save("Interval", Interval);
     persistentSettings.Save("Shortcut", ShortcutName);
     persistentSettings.Save("OneInstance", OneInstance);
     persistentSettings.Save("WarningOk", WarningOk);
     persistentSettings.Save("DisableTimeCorr", DisableTimeCorrection);
     persistentSettings.Save("ForceTimeCorr", ForceTimeCorrection);
     persistentSettings.Save("DisableThemes", DisableThemes);
 }
コード例 #10
0
 public void Save()
 {
     persistentSettings.Save("Caption", Caption);
     persistentSettings.Save("Text", Text);
     persistentSettings.Save("IconIndex", IconIndex);
     persistentSettings.Save("ButtonsIndex", ButtonsIndex);
     persistentSettings.Save("DefaultButtonIndex", DefaultButtonIndex);
     persistentSettings.Save("BoxCenterScreen", BoxCenterScreen);
     persistentSettings.Save("DisplayHelpButton", DisplayHelpButton);
     persistentSettings.Save("SetMaximumWidth", SetMaximumWidth);
     persistentSettings.Save("MaximumWidth", MaximumWidth);
     persistentSettings.Save("SetNoWrap", SetNoWrap);
     persistentSettings.Save("SetParentForm", SetParentForm);
     persistentSettings.Save("ShowMessageBox", ShowMessageBox);
     persistentSettings.Save("PrintSoftMargins", PrintSoftMargins);
     persistentSettings.Save("MainFormCenterScreen", MainFormCenterScreen);
     persistentSettings.Save("EscapeFunction", EscapeFunction);
     persistentSettings.Save("DisableThemes", DisableThemes);
     persistentSettings.Save("LastExportDir", LastExportDirectory);
     persistentSettings.Save("ExtFilterIndex", ExtensionFilterIndex);
     persistentSettings.Save("CheckForUpdates", CheckForUpdates);
     persistentSettings.Save("StatusBarNotifOnly", StatusBarNotifOnly);
 }
コード例 #11
0
ファイル: App.xaml.cs プロジェクト: jwg4/gtools
 private void Application_Exit(object sender, ExitEventArgs args)
 {
     PersistentSettings.Save();
     Log.Info("- shutting down pserv -");
 }