Exemplo n.º 1
0
        private void btnChangeKeyMap_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            // Create local copy of application settings
            var settings = new ApplicationSettings(this._settings);

            // newSettings will contain modified settings or null if user cancelled
            var newSettings = SettingsForm.ShowSettingsDialog(this, settings);

            if (newSettings == null)
            {
                // user cancelled - do not change anything
                return;
            }

            // user OK'd, need to save new key configuration
            this._settings = newSettings;
            if (!ApplicationSettingsJson.SaveToFile(newSettings))
            {
                MessageBox.Show(@"Unable to save to file.", @"Application error");
            }

            // And re-register hot keys
            this.UnregisterHotKeys();
            this.RegisterHotKeys();
        }
Exemplo n.º 2
0
        /// <summary>
        ///  Constructor - no special processing.
        /// </summary>
        public MainForm()
        {
            InitializeComponent();

            // Replace default tooltip text of tray icon with application name
            this.notifyIcon_Main.Text = Application.ProductName;

            // Load key configuration from file when form is created
            this._settings = ApplicationSettingsJson.LoadFromFile();

            // register hot keys in the application
            this.RegisterHotKeys();
        }