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);
}
}
}