private void Form1_Shown(object sender, EventArgs e) { try { bool minimize = false; if (true == checkBoxStartAppMinimized.Checked) { minimize = true; } if (null != CommandLineArgs) { foreach (string item in CommandLineArgs) { if (true == item.Trim().ToLower().Equals("-min", StringComparison.InvariantCultureIgnoreCase)) { minimize = true; } } } if (minimize) { this.WindowState = FormWindowState.Minimized; } } catch (Exception exception) { ErrorForm.ShowError(this, exception, ErrorCategory.NonCritical, CurrentLanguageID); } }
private void PictureBoxLogo_Click(object sender, EventArgs e) { try { tabControlMain.SelectedIndex = 1; } catch (Exception exception) { ErrorForm.ShowError(this, exception, ErrorCategory.NonCritical, CurrentLanguageID); } }
void currentControl_ReadyStateChanged(Control sender) { try { nextButton.Enabled = (sender as IWizardControl).IsReadyForNextStep; } catch (Exception exception) { ErrorForm.ShowError(this, exception); } }
private void LinkLabelMain_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { LinkLabel label = sender as LinkLabel; System.Diagnostics.Process.Start(label.Text); } catch (Exception exception) { ErrorForm.ShowError(this, exception, ErrorCategory.NonCritical, CurrentLanguageID); } }
private void backButton_Click(object sender, EventArgs e) { try { ReturnToPreviousControl(); backButton.Focus(); } catch (Exception exception) { ErrorForm.ShowError(this, exception); } }
private void nextButton_Click(object sender, EventArgs e) { try { GoToNextControl(); nextButton.Focus(); } catch (Exception exception) { ErrorForm.ShowError(this, exception); } }
private void MainForm_Load(object sender, EventArgs e) { try { foreach (IToolboxControl item in ToolboxControls) { item.LoadComplete(); } } catch (Exception exception) { ErrorForm.ShowError(this, exception, ErrorCategory.NonCritical, CurrentLanguageID); } }
private void TrayNotifyIcon_Click(object sender, EventArgs e) { try { this.Show(); TrayIcon.Visible = false; this.WindowState = FormWindowState.Normal; this.Activate(); } catch (Exception exception) { ErrorForm.ShowError(this, exception, ErrorCategory.NonCritical, CurrentLanguageID); } }
private void finishButton_Click(object sender, EventArgs e) { try { string message = CurrentLanguageID == 1031 ? "Das Projekt wurde erstellt." : "The project is complete."; string resultFolder = ProjectConverter.ConvertProjectTemplate(_listControls); FinishDialog dialog = new FinishDialog(resultFolder); dialog.ShowDialog(this); Reset(); } catch (Exception exception) { ErrorForm.ShowError(this, exception); } }
private void TabControlMain_SelectedIndexChanged(object sender, EventArgs e) { try { TabPage currentTab = tabControlMain.TabPages[tabControlMain.SelectedIndex]; IToolboxControl control = currentTab.Tag as IToolboxControl; if (null != control) { control.Activate(); } } catch (Exception exception) { ErrorForm.ShowError(this, exception, ErrorCategory.NonCritical, CurrentLanguageID); } }
private void ComboBoxLanguage_SelectedIndexChanged(object sender, EventArgs e) { try { int languageID = IndexToLanguageID(comboBoxLanguage.SelectedIndex); CurrentLanguageID = languageID; Translator.TranslateControls(this, "Ressources.MessageTable.txt", languageID); foreach (IToolboxControl item in ToolboxControls) { item.SetLanguage(languageID); } } catch (Exception exception) { ErrorForm.ShowError(this, exception, ErrorCategory.NonCritical, CurrentLanguageID); } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { try { SaveConfiguration(); foreach (IToolboxControl item in ToolboxControls) { item.Dispose(); } SetupTrayIcon(false); SetupAutoRunEntry(); } catch (Exception exception) { ErrorForm.ShowError(this, exception, ErrorCategory.NonCritical, CurrentLanguageID); } }
private void MainForm_KeyDown(object sender, KeyEventArgs e) { try { foreach (var item in ToolboxControls) { Control winControl = item as Control; if (winControl.Visible) { item.KeyDown(e); return; } } } catch (Exception exception) { ErrorForm.ShowError(this, exception, ErrorCategory.NonCritical, CurrentLanguageID); } }
private void Form1_Resize(object sender, EventArgs e) { try { if ((FormWindowState.Minimized == this.WindowState) && (true == checkBoxMinimizeToTray.Checked)) { TrayIcon.Visible = true; this.Hide(); } else { TrayIcon.Visible = false; ResizeControls(); } } catch (Exception exception) { ErrorForm.ShowError(this, exception, ErrorCategory.NonCritical, CurrentLanguageID); } }
/// <summary> /// Load the configuration file from LocalApplicationData folder or load the Ressources.DefaultConfiguration.xml(embedded ressource) /// </summary> private void LoadConfiguration() { try { string filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "DeveloperToolbox.Settings.xml"); ConfigFile = new XmlDocument(); if (File.Exists(filePath)) { ConfigFile.Load(filePath); if (!ValidateConfigFileVersion()) { File.Delete(filePath); string assemblyName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name; ConfigFile.Load(this.GetType().Assembly.GetManifestResourceStream(assemblyName + ".DefaultConfiguration.xml")); } } else { string assemblyName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name; ConfigFile.Load(this.GetType().Assembly.GetManifestResourceStream(assemblyName + ".DefaultConfiguration.xml")); } XmlNode appNode = ConfigFile.SelectSingleNode("Application"); checkBoxStartAppMinimized.Checked = Convert.ToBoolean(appNode.Attributes.Item(0).Value); checkBoxMinimizeToTray.Checked = Convert.ToBoolean(appNode.Attributes.Item(1).Value); checkBoxStartAppWithWindows.Checked = Convert.ToBoolean(appNode.Attributes.Item(2).Value); comboBoxLanguage.SelectedIndex = Convert.ToInt32((appNode.Attributes.Item(3).Value)); foreach (IToolboxControl item in ToolboxControls) { item.LoadConfiguration(ConfigFile.SelectSingleNode("Application/Controls/" + item.ControlName)); item.SetLanguage(IndexToLanguageID(comboBoxLanguage.SelectedIndex)); } } catch (Exception exception) { ErrorForm.ShowError(this, exception, ErrorCategory.NonCritical, CurrentLanguageID); } }
/// <summary> /// Save the configuration to LocalApplicationData folder /// </summary> private void SaveConfiguration() { try { XmlNode appNode = ConfigFile.SelectSingleNode("Application"); appNode.Attributes.Item(0).Value = checkBoxStartAppMinimized.Checked.ToString(); appNode.Attributes.Item(1).Value = checkBoxMinimizeToTray.Checked.ToString(); appNode.Attributes.Item(2).Value = checkBoxStartAppWithWindows.Checked.ToString(); appNode.Attributes.Item(3).Value = comboBoxLanguage.SelectedIndex.ToString(); foreach (IToolboxControl item in ToolboxControls) { item.SaveConfiguration(ConfigFile.SelectSingleNode("Application/Controls/" + item.ControlName)); } string filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "DeveloperToolbox.Settings.xml"); ConfigFile.Save(filePath); } catch (Exception exception) { ErrorForm.ShowError(this, exception, ErrorCategory.NonCritical, CurrentLanguageID); } }
private void linkLabelNSTOInfo_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { switch (ProjectWizardControl.CurrentLanguageID) { case 1049: System.Diagnostics.Process.Start("http://netoffice.codeplex.com/wikipage?title=Tools_RS"); break; case 1031: System.Diagnostics.Process.Start("http://netoffice.codeplex.com/wikipage?title=Tools_DE"); break; default: System.Diagnostics.Process.Start("http://netoffice.codeplex.com/wikipage?title=Tools_EN"); break; } } catch (Exception exception) { ErrorForm.ShowError(this, exception, ErrorCategory.NonCritical, 1033); } }