コード例 #1
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            Text = Resources.FormMain_FormMain_Load_Automated_Mover;
            FormBorderStyle = FormBorderStyle.FixedSingle;
            buttonStop.Enabled = false;
            try
            {
                Configuration configManager = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                KeyValueConfigurationCollection confCollection = configManager.AppSettings.Settings;

                if (confCollection.Count == 0)
                {
                    MessageBox.Show(Resources.FormMain_FormMain_Load_Configuration_not_found__opening_the_settings_windows_);
                    var formConfig = new FormConfiguration();
                    if (formConfig.ShowDialog() != DialogResult.OK)
                    {
                        MessageBox.Show(Resources.FormMain_FormMain_Load_No_settings_saved__stopping_program_);
                        Application.Exit();
                    }
                    else
                    {
                        LoadConfig(confCollection);
                        ReloadConfigInfo(confCollection);
                    }
                }
                else
                {
                    LoadConfig(confCollection);
                    ReloadConfigInfo(confCollection);

                }
            }
            catch (Exception ex)
            {
                Application.Exit();
            }

            notifyIconMain.Icon = Icon;
            notifyIconMain.Text = Resources.FormMain_FormMain_Load_Simple_AutoMover;
        }
コード例 #2
0
        private void buttonConfiguration_Click(object sender, EventArgs e)
        {
            //Not so cool
            LogtoListBox("Shutting down service, opening configuration.");
            if (isRunning)
                buttonStop_Click(null, null);
            Configuration configManager = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            KeyValueConfigurationCollection confCollection = configManager.AppSettings.Settings;

            var formConfig = new FormConfiguration();
            if (formConfig.ShowDialog() == DialogResult.OK)
            {
                LoadConfig(confCollection);
                ReloadConfigInfo(confCollection);
            }
        }