pocorall.SCM_Notifier.MainForm.menuItemImportConfig_Click C# (CSharp) Method

menuItemImportConfig_Click() private method

private menuItemImportConfig_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        private void menuItemImportConfig_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog
            {
                Filter = "Ini files (*.ini)|*.ini|All files (*.*)|*.*",
                RestoreDirectory = true
            };

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                if ((folders.Count > 0) && MessageBox.Show ("All current settings will be lost.\n\nDo you really want to change the settings?", "Attention", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes)
                    return;

                try
                {
                    File.Copy (ofd.FileName, Config.iniFileName, true);
                    Config.Init();

                    // Check for correct import configs
                    if (!Config.IsSettingsOK())
                    {
                        Hide();
                        statusUpdateTimer.Stop();
                        notifyIcon.Icon = trayIcon_Unknown;

                        if (new SettingsForm().ShowDialog() != DialogResult.OK)
                        {
                            Application.Exit();
                            return;
                        }
                        ShowInTaskbar = Config.ShowInTaskbar;
                        Show();
                    }

                    FormInit();
                }
                catch (Exception ex)
                {
                    ShowError (ex.Message);
                }
            }
        }
MainForm