private void buttonSelect_Click(object sender, EventArgs e)
 {
     try
     {
         Result = DialogResult.OK;
         this.Hide();
         _eventHandler(SelectedApplication);
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
 }
Esempio n. 2
0
        private void toolStripDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (treeViewOfficeUI.SelectedNodes.Count == 0)
                {
                    return;
                }

                List <TreeNode> listDelete = new List <TreeNode>();
                foreach (TreeNode node in treeViewOfficeUI.SelectedNodes)
                {
                    if (node.Tag is OfficeApi.CommandBar)
                    {
                        OfficeApi.CommandBar commandBar = node.Tag as OfficeApi.CommandBar;
                        commandBar.Delete();
                        listDelete.Add(node);
                    }
                    else if (node.Tag is OfficeApi.CommandBarControl)
                    {
                        OfficeApi.CommandBarControl control = node.Tag as OfficeApi.CommandBarControl;
                        control.Delete();
                        listDelete.Add(node);
                    }
                }

                foreach (TreeNode node in listDelete)
                {
                    node.Remove();
                }
            }
            catch (Exception exception)
            {
                ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
                errorForm.ShowDialog(this);
            }
        }
Esempio n. 3
0
        public static void ShowError(IWin32Window parent, Exception exception)
        {
            ErrorForm form = new ErrorForm(exception, ErrorCategory.NonCritical, ProjectWizardControl.CurrentLanguageID);

            form.ShowDialog(parent);
        }
Esempio n. 4
0
        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 _controls)
                    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 errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
                errorForm.ShowDialog(this);
            }
        }
Esempio n. 5
0
        private void toolStripDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (treeViewOfficeUI.SelectedNodes.Count == 0)
                    return;

                List<TreeNode> listDelete = new List<TreeNode>();
                foreach (TreeNode node in treeViewOfficeUI.SelectedNodes)
                {
                    if (node.Tag is OfficeApi.CommandBar)
                    {
                        OfficeApi.CommandBar commandBar = node.Tag as OfficeApi.CommandBar;
                        commandBar.Delete();
                        listDelete.Add(node);
                    }
                    else if (node.Tag is OfficeApi.CommandBarControl)
                    {
                        OfficeApi.CommandBarControl control = node.Tag as OfficeApi.CommandBarControl;
                        control.Delete();
                        listDelete.Add(node);
                    }
                }

                foreach (TreeNode node in listDelete)
                    node.Remove();

            }
            catch (Exception exception)
            {
                ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
                errorForm.ShowDialog(this);
            }
        }
Esempio n. 6
0
 private void buttonChooseFolder_Click(object sender, EventArgs e)
 {
     try
     {
          FolderBrowserDialog dialog = new FolderBrowserDialog();
         if (DialogResult.OK == dialog.ShowDialog(this))
             textBoxCustomFolder.Text = dialog.SelectedPath;
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, 1033);
         errorForm.ShowDialog(this);
     }
 }
Esempio n. 7
0
        private void Form1_Shown(object sender, EventArgs e)
        {
            try
            {
                bool minimize = false;

                if (true == checkBoxStartAppMinimized.Checked)
                    minimize = true;

                if (null != _args)
                {
                    foreach (string item in _args)
                        if (true == item.Trim().ToLower().Equals("-min", StringComparison.InvariantCultureIgnoreCase))
                            minimize = true;
                }

                if (minimize)
                    this.WindowState = FormWindowState.Minimized;
            }
            catch (Exception exception)
            {
                ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
                errorForm.ShowDialog(this);             
            }
        }
Esempio n. 8
0
        private void treeViewOfficeUI_AfterSelect(object sender, TreeViewEventArgs e)
        {
            try
            {
                if (!checkBoxScanForProperties.Checked)
                {
                    propertyGridItems.SelectedObject = null;
                    return;
                }

                if (e.Node.Tag is OfficeApi.CommandBar)
                {
                    if (!_wait)
                        ShowWaitPanel(false);
                    OfficeApi.CommandBar commandBar = e.Node.Tag as OfficeApi.CommandBar;
                    propertyGridItems.SelectedObject = commandBar;
                    if (!_wait)
                        HideWaitPanel();
                }
                else if (e.Node.Tag is OfficeApi.CommandBarControl)
                {
                    if (!_wait)
                        ShowWaitPanel(false);
                    OfficeApi.CommandBarControl commandBarControl = e.Node.Tag as OfficeApi.CommandBarControl;
                    propertyGridItems.SelectedObject = commandBarControl;
                    if (!_wait)
                        HideWaitPanel();
                }
                else
                    propertyGridItems.SelectedObject = null;
            }
            catch (Exception exception)
            {
                ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
                errorForm.ShowDialog(this);
            }
            finally
            {
                if (!_wait)
                    HideWaitPanel();
            }
        }
Esempio n. 9
0
 void _notify_Click(object sender, EventArgs e)
 {
     try
     {
         this.Show();
         _notify.Visible = false;
         this.WindowState = FormWindowState.Normal;
         this.Activate();
     }
     catch (Exception exception)
     {
        ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
        errorForm.ShowDialog(this);
     }
 }
Esempio n. 10
0
        private void Form1_Resize(object sender, EventArgs e)
        {
            try
            {
                if ((FormWindowState.Minimized == this.WindowState) && (true == checkBoxMinimizeToTray.Checked))
                {
                    _notify.Visible = true;
                    this.Hide();
                }
                else
                {
                    _notify.Visible = false;
                    ResizeControls();
                }

            }
            catch (Exception exception)
            {
                ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
                errorForm.ShowDialog(this);                
            }
        }
Esempio n. 11
0
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                SaveConfiguration();
                foreach (IToolboxControl item in _controls)
                    item.Dispose();

                SetupTrayIcon(false);
                SetupAutoRunEntry();
            }
            catch (Exception exception)
            {
               ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
               errorForm.ShowDialog(this);
            }
        
        }
Esempio n. 12
0
 private void comboBoxLanguage_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         int languageID = IndexToLanguageID(comboBoxLanguage.SelectedIndex);
         _currentLanguageID = languageID;
         Translator.TranslateControls(this, "MessageTable.txt", languageID);
         foreach (IToolboxControl item in _controls)
             item.SetLanguage(languageID);
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
     
 }
Esempio n. 13
0
 private void pictureBoxLogo_Click(object sender, EventArgs e)
 {
     try
     {
         tabControlMain.SelectedIndex = 1;
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
 }
Esempio n. 14
0
        /// <summary>
        /// Runtime Ctor
        /// </summary>
        /// <param name="args">commandline argument array</param>
        public MainForm(string[] args)
        {
            try
            {
                InitializeComponent();

                ToolboxControls = new List <IToolboxControl>();
                ResizeControls();

                // setup about
                labelVersionText.Text   = String.Format("Version {0}", AssemblyInfo.AssemblyVersion);
                labelVersionHint.Text   = String.Format("Version {0}", AssemblyInfo.AssemblyVersion);
                labelCopyrightText.Text = AssemblyInfo.AssemblyCopyright;
                linkLabelCompany.Text   = AssemblyInfo.AssemblyCompany;

                // load controls
                IntPtr dummyTabPageInsertDoesntWorkWithout = this.tabControlMain.Handle;
                OfficeCompatibilityControl newControl1     = new OfficeCompatibilityControl();
                tabControlMain.TabPages.Insert(tabControlMain.TabPages.Count - 1, newControl1.ControlCaption);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Controls.Add(newControl1);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Tag = newControl1;
                imageListTabMain.Images.Add(newControl1.Icon);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].ImageIndex = imageListTabMain.Images.Count - 1;
                newControl1.Dock = DockStyle.Fill;
                ToolboxControls.Add(newControl1);

                ApplicationObserverControl newControl2 = new ApplicationObserverControl();
                tabControlMain.TabPages.Insert(tabControlMain.TabPages.Count - 1, newControl2.ControlCaption);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Controls.Add(newControl2);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Tag = newControl2;
                imageListTabMain.Images.Add(newControl2.Icon);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].ImageIndex = imageListTabMain.Images.Count - 1;
                newControl2.Dock = DockStyle.Fill;
                ToolboxControls.Add(newControl2);

                RegistryEditorControl newControl3 = new RegistryEditorControl();
                tabControlMain.TabPages.Insert(tabControlMain.TabPages.Count - 1, newControl3.ControlCaption);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Controls.Add(newControl3);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Tag = newControl3;
                imageListTabMain.Images.Add(newControl3.Icon);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].ImageIndex = imageListTabMain.Images.Count - 1;
                newControl3.Dock = DockStyle.Fill;
                ToolboxControls.Add(newControl3);

                AddinGuardControl newControl4 = new AddinGuardControl();
                tabControlMain.TabPages.Insert(tabControlMain.TabPages.Count - 1, newControl4.ControlCaption);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Controls.Add(newControl4);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Tag = newControl4;
                imageListTabMain.Images.Add(newControl4.Icon);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].ImageIndex = imageListTabMain.Images.Count - 1;
                newControl4.Dock = DockStyle.Fill;
                ToolboxControls.Add(newControl4);

                OfficeUIControl newControl6 = new OfficeUIControl();
                tabControlMain.TabPages.Insert(tabControlMain.TabPages.Count - 1, newControl6.ControlCaption);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Controls.Add(newControl6);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Tag = newControl6;
                imageListTabMain.Images.Add(newControl6.Icon);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].ImageIndex = imageListTabMain.Images.Count - 1;
                newControl6.Dock = DockStyle.Fill;
                ToolboxControls.Add(newControl6);

                OutlookSecurityControl newControl5 = new OutlookSecurityControl();
                tabControlMain.TabPages.Insert(tabControlMain.TabPages.Count - 1, newControl5.ControlCaption);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Controls.Add(newControl5);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Tag = newControl5;
                imageListTabMain.Images.Add(newControl5.Icon);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].ImageIndex = imageListTabMain.Images.Count - 1;
                newControl5.Dock = DockStyle.Fill;
                ToolboxControls.Add(newControl5);

                ProjectWizardControl newControl7 = new ProjectWizardControl();
                tabControlMain.TabPages.Insert(tabControlMain.TabPages.Count - 1, newControl7.ControlCaption);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Controls.Add(newControl7);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Tag = newControl7;
                imageListTabMain.Images.Add(newControl7.Icon);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].ImageIndex = imageListTabMain.Images.Count - 1;
                newControl7.Dock = DockStyle.Fill;
                ToolboxControls.Add(newControl7);


                // load configuration
                LoadConfiguration();
                SetupTrayIcon(true);
                CommandLineArgs = args;
            }
            catch (Exception exception)
            {
                ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.Critical, CurrentLanguageID);
                errorForm.ShowDialog(this);
            }
        }
Esempio n. 15
0
 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 errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
        errorForm.ShowDialog(this);             
     }
 }
Esempio n. 16
0
 private void buttonStartApplication_Click(object sender, EventArgs e)
 {
     try
     {
         DisposeCurrentOpenOfficeApplication();
         SelectOfficeAppControl selectBox = new SelectOfficeAppControl(_currentLanguageID, new SelectOfficeEventHandler(Run));
         this.Controls.Add(selectBox);
         selectBox.Dock = DockStyle.Fill;
         selectBox.BringToFront();
         selectBox.Show();
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
 }
Esempio n. 17
0
 private void linkLabelMain_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     try
     {
         LinkLabel label = sender as LinkLabel;
         System.Diagnostics.Process.Start(label.Text);
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);     
     }           
 }
Esempio n. 18
0
        private void treeViewOfficeUI_BeforeExpand(object sender, TreeViewCancelEventArgs e)
        {
            try
            {
                if ((e.Node.Nodes.Count == 1) && (e.Node.Nodes[0].Text == "#stub"))
                {
                    ShowWaitPanel(false);

                    e.Node.Nodes.Clear();

                    if (e.Node.Tag is OfficeApi.CommandBar)
                    {
                        OfficeApi.CommandBar commandBar = e.Node.Tag as OfficeApi.CommandBar;
                        foreach (OfficeApi.CommandBarControl control in commandBar.Controls)
                        {
                            TreeNode subNode = e.Node.Nodes.Add(control.Caption);
                            subNode.ImageIndex = 1;
                            subNode.Tag = control;
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
                errorForm.ShowDialog(this);
            }
            finally
            {
                HideWaitPanel();
            }
        }
Esempio n. 19
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     try
     {
         foreach (IToolboxControl item in _controls)
             item.LoadComplete();
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);     
     }
 }
Esempio n. 20
0
 public static void ShowError(Exception exception)
 {
     ErrorForm form = new ErrorForm(exception, ErrorCategory.NonCritical, ProjectWizardControl.CurrentLanguageID);
     form.ShowDialog();
 }
Esempio n. 21
0
        /// <summary>
        /// Runtime Ctor
        /// </summary>
        /// <param name="args">commandline argument array</param>
        public MainForm(string[] args)
        {
            try
            {
                InitializeComponent();
                
                ToolboxControls = new List<IToolboxControl>();
                ResizeControls();
                
                // setup about
                labelVersionText.Text = String.Format("Version {0}", AssemblyInfo.AssemblyVersion);
                labelVersionHint.Text = String.Format("Version {0}", AssemblyInfo.AssemblyVersion);
                labelCopyrightText.Text = AssemblyInfo.AssemblyCopyright;
                linkLabelCompany.Text = AssemblyInfo.AssemblyCompany;

                // load controls
                IntPtr dummyTabPageInsertDoesntWorkWithout = this.tabControlMain.Handle;
                OfficeCompatibilityControl newControl1 = new OfficeCompatibilityControl();
                tabControlMain.TabPages.Insert(tabControlMain.TabPages.Count - 1, newControl1.ControlCaption);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Controls.Add(newControl1);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Tag = newControl1;
                imageListTabMain.Images.Add(newControl1.Icon);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].ImageIndex = imageListTabMain.Images.Count - 1;
                newControl1.Dock = DockStyle.Fill;
                ToolboxControls.Add(newControl1);

                ApplicationObserverControl newControl2 = new ApplicationObserverControl();
                tabControlMain.TabPages.Insert(tabControlMain.TabPages.Count - 1, newControl2.ControlCaption);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Controls.Add(newControl2);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Tag = newControl2;
                imageListTabMain.Images.Add(newControl2.Icon);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].ImageIndex = imageListTabMain.Images.Count - 1;
                newControl2.Dock = DockStyle.Fill;
                ToolboxControls.Add(newControl2);

                RegistryEditorControl newControl3 = new RegistryEditorControl();
                tabControlMain.TabPages.Insert(tabControlMain.TabPages.Count - 1, newControl3.ControlCaption);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Controls.Add(newControl3);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Tag = newControl3;
                imageListTabMain.Images.Add(newControl3.Icon);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].ImageIndex = imageListTabMain.Images.Count - 1;
                newControl3.Dock = DockStyle.Fill;
                ToolboxControls.Add(newControl3);

                AddinGuardControl newControl4 = new AddinGuardControl();
                tabControlMain.TabPages.Insert(tabControlMain.TabPages.Count - 1, newControl4.ControlCaption);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Controls.Add(newControl4);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Tag = newControl4;
                imageListTabMain.Images.Add(newControl4.Icon);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].ImageIndex = imageListTabMain.Images.Count - 1;
                newControl4.Dock = DockStyle.Fill;
                ToolboxControls.Add(newControl4);

                OfficeUIControl newControl6 = new OfficeUIControl();
                tabControlMain.TabPages.Insert(tabControlMain.TabPages.Count - 1, newControl6.ControlCaption);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Controls.Add(newControl6);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Tag = newControl6;
                imageListTabMain.Images.Add(newControl6.Icon);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].ImageIndex = imageListTabMain.Images.Count - 1;
                newControl6.Dock = DockStyle.Fill;
                ToolboxControls.Add(newControl6);

                OutlookSecurityControl newControl5 = new OutlookSecurityControl();
                tabControlMain.TabPages.Insert(tabControlMain.TabPages.Count - 1, newControl5.ControlCaption);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Controls.Add(newControl5);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Tag = newControl5;
                imageListTabMain.Images.Add(newControl5.Icon);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].ImageIndex = imageListTabMain.Images.Count - 1;
                newControl5.Dock = DockStyle.Fill;
                ToolboxControls.Add(newControl5);

                ProjectWizardControl newControl7 = new ProjectWizardControl();
                tabControlMain.TabPages.Insert(tabControlMain.TabPages.Count - 1, newControl7.ControlCaption);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Controls.Add(newControl7);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].Tag = newControl7;
                imageListTabMain.Images.Add(newControl7.Icon);
                tabControlMain.TabPages[tabControlMain.TabPages.Count - 2].ImageIndex = imageListTabMain.Images.Count - 1;
                newControl7.Dock = DockStyle.Fill;
                ToolboxControls.Add(newControl7);


                // load configuration
                LoadConfiguration();
                SetupTrayIcon(true);
                CommandLineArgs = args;
            }
            catch (Exception exception)
            {
                ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.Critical, CurrentLanguageID);
                errorForm.ShowDialog(this);
            }
        }
Esempio n. 22
0
        public static void ShowError(IWin32Window parent, Exception exception, ErrorCategory category, int currentLanguageID)
        {
            ErrorForm form = new ErrorForm(exception, category, currentLanguageID);

            form.ShowDialog(parent);
        }
Esempio n. 23
0
 public static void ShowError(IWin32Window parent, Exception exception, ErrorCategory category, int currentLanguageID)
 {
     ErrorForm form = new ErrorForm(exception, category, currentLanguageID);
     form.ShowDialog(parent);
 }
Esempio n. 24
0
 private void buttonInfo_Click(object sender, EventArgs e)
 {
     try
     {
         InfoControl infoBox = new InfoControl("ProjectWizard.ProjectWizard.Info." + _currentLanguageID.ToString() + ".rtf", true);
         this.Controls.Add(infoBox);
         infoBox.BringToFront();
         infoBox.Show();
     }
     catch (Exception exception)
     {
         ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
         errorForm.ShowDialog(this);
     }
 }
Esempio n. 25
0
        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 _controls)
                { 
                    item.LoadConfiguration(_configFile.SelectSingleNode("Application/Controls/" + item.ControlName));
                    item.SetLanguage(IndexToLanguageID(comboBoxLanguage.SelectedIndex));
                }
            }
            catch (Exception exception)
            {
                ErrorForm errorForm = new ErrorForm(exception, ErrorCategory.NonCritical, _currentLanguageID);
                errorForm.ShowDialog(this);
            }
        }