コード例 #1
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)
         {
             bool firstShow = !_toolBoxControlsFirstShowPassed.Any(c => c == control);
             control.Activate(firstShow);
             if (!firstShow)
             {
                 _toolBoxControlsFirstShowPassed.Add(control);
             }
             if (null != _lastSelectedcontrol)
             {
                 _lastSelectedcontrol.Deactivated();
                 _lastSelectedcontrol = null;
             }
         }
     }
     catch (Exception exception)
     {
         ErrorForm.ShowError(this, exception, ErrorCategory.NonCritical, CurrentLanguageID);
     }
 }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: zyfzgt/NetOffice
 private void TranslationEditor_UserClose(object sender, EventArgs e)
 {
     try
     {
         LanguageEditorVisible = false;
     }
     catch (Exception exception)
     {
         ErrorForm.ShowError(this, exception, ErrorCategory.NonCritical, CurrentLanguageID);
     }
 }
コード例 #3
0
ファイル: ErrorForm.cs プロジェクト: swatt6400/NetOffice
 /// <summary>
 /// Creates an instance of ErrorForm and show
 /// </summary>
 /// <param name="exception">exception as any</param>
 /// <param name="category">error category</param>
 /// <param name="currentLanguageID">current user language</param>
 public static void ShowError(Exception exception, ErrorCategory category, int currentLanguageID)
 {
     ErrorForm form = new ErrorForm(exception, category, currentLanguageID);
     if (null != MainForm.Singleton && MainForm.Singleton.Visible)
         form.ShowDialog(MainForm.Singleton);
     else
     {
         form.StartPosition = FormStartPosition.CenterScreen;
         form.ShowDialog();
     }
 }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: zyfzgt/NetOffice
 private void MainForm_Shown(object sender, EventArgs e)
 {
     try
     {
         _toolboxControls[0].Activate(true);
         _toolBoxControlsFirstShowPassed.Add(_toolboxControls[0]);
     }
     catch (Exception exception)
     {
         ErrorForm.ShowError(this, exception, ErrorCategory.NonCritical, CurrentLanguageID);
     }
 }
コード例 #5
0
        /// <summary>
        /// Creates an instance of ErrorForm and show
        /// </summary>
        /// <param name="exception">exception as any</param>
        /// <param name="category">error category</param>
        /// <param name="currentLanguageID">current user language</param>
        public static void ShowError(Exception exception, ErrorCategory category, int currentLanguageID)
        {
            ErrorForm form = new ErrorForm(exception, category, currentLanguageID);

            if (null != MainForm.Singleton && MainForm.Singleton.Visible)
            {
                form.ShowDialog(MainForm.Singleton);
            }
            else
            {
                form.StartPosition = FormStartPosition.CenterScreen;
                form.ShowDialog();
            }
        }
コード例 #6
0
ファイル: MainForm.cs プロジェクト: realzhaorong/NetOffice
 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);
     }
 }
コード例 #7
0
ファイル: MainForm.cs プロジェクト: zyfzgt/NetOffice
 private void MainForm_Resize(object sender, EventArgs e)
 {
     try
     {
         if ((FormWindowState.Minimized == this.WindowState))
         {
             RaiseMinimized();
         }
     }
     catch (Exception exception)
     {
         ErrorForm.ShowError(this, exception, ErrorCategory.NonCritical, CurrentLanguageID);
     }
 }
コード例 #8
0
ファイル: MainForm.cs プロジェクト: zyfzgt/NetOffice
 private void TranslationEditor_LanguageChanged(object sender, int lcid)
 {
     try
     {
         if (lcid == CurrentLanguageID)
         {
             CurrentLanguageID = lcid;
         }
     }
     catch (Exception exception)
     {
         ErrorForm.ShowError(this, exception, ErrorCategory.NonCritical, CurrentLanguageID);
     }
 }
コード例 #9
0
ファイル: MainForm.cs プロジェクト: realzhaorong/NetOffice
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     try
     {
         SaveConfiguration();
         foreach (IToolboxControl item in ToolboxControls)
         {
             item.Release();
             item.Dispose();
         }
     }
     catch (Exception exception)
     {
         ErrorForm.ShowError(this, exception, ErrorCategory.NonCritical);
     }
 }
コード例 #10
0
ファイル: MainForm.cs プロジェクト: zyfzgt/NetOffice
        private void TabControlMain_Deselecting(object sender, TabControlCancelEventArgs e)
        {
            try
            {
                IToolboxControl lastControl = null;

                if (null != tabControlMain.SelectedTab)
                {
                    lastControl = tabControlMain.SelectedTab.Tag as IToolboxControl;
                }

                _lastSelectedcontrol = lastControl;
            }
            catch (Exception exception)
            {
                ErrorForm.ShowError(this, exception, ErrorCategory.NonCritical, CurrentLanguageID);
            }
        }
コード例 #11
0
ファイル: MainForm.cs プロジェクト: zyfzgt/NetOffice
        private void TranslationEditor_UserTranslationAbout(object sender, EventArgs e)
        {
            try
            {
                // nearly impossible but dont trust anyone
                foreach (Control item in splitContainer1.Panel1.Controls)
                {
                    if (item is Controls.Custom.InviteControl)
                    {
                        return;
                    }
                }

                Controls.Custom.InviteControl ctrl = new Controls.Custom.InviteControl();
                Controls.Add(ctrl);
                ctrl.Dock = DockStyle.Fill;
                ctrl.BringToFront();
            }
            catch (Exception exception)
            {
                ErrorForm.ShowError(this, exception, ErrorCategory.NonCritical, CurrentLanguageID);
            }
        }
コード例 #12
0
        /// <summary>
        /// Creates an instance of ErrorForm and show
        /// </summary>
        /// <param name="parent">modal parent</param>
        /// <param name="exception">exception as any</param>
        public static void ShowError(IWin32Window parent, Exception exception)
        {
            ErrorForm form = new ErrorForm(exception, ErrorCategory.NonCritical);

            form.ShowDialog(parent);
        }
コード例 #13
0
        /// <summary>
        /// Creates an instance of ErrorForm and show
        /// </summary>
        /// <param name="parent">modal parent</param>
        /// <param name="exception">exception as any</param>
        /// <param name="category">error category</param>
        /// <param name="currentLanguageID">current user language</param>
        public static void ShowError(IWin32Window parent, Exception exception, ErrorCategory category, int currentLanguageID)
        {
            ErrorForm form = new ErrorForm(exception, category, currentLanguageID);

            form.ShowDialog(parent);
        }
コード例 #14
0
ファイル: ErrorForm.cs プロジェクト: swatt6400/NetOffice
 /// <summary>
 /// Creates an instance of ErrorForm and show
 /// </summary>
 /// <param name="parent">modal parent</param>
 /// <param name="exception">exception as any</param>
 /// <param name="category">error category</param>
 /// <param name="currentLanguageID">current user language</param>
 public static void ShowError(IWin32Window parent, Exception exception, ErrorCategory category, int currentLanguageID)
 {
     ErrorForm form = new ErrorForm(exception, category, currentLanguageID);
     form.ShowDialog(parent);
 }
コード例 #15
0
ファイル: ErrorForm.cs プロジェクト: swatt6400/NetOffice
 /// <summary>
 /// Creates an instance of ErrorForm and show
 /// </summary>
 /// <param name="parent">modal parent</param>
 /// <param name="exception">exception as any</param>
 /// <param name="category">error category</param>
 public static void ShowError(IWin32Window parent, Exception exception, ErrorCategory category)
 {
     ErrorForm form = new ErrorForm(exception, category, Forms.MainForm.Singleton.CurrentLanguageID );
     form.ShowDialog(parent);
 }
コード例 #16
0
        /// <summary>
        /// Creates an instance of ErrorForm and show
        /// </summary>
        /// <param name="parent">modal parent</param>
        /// <param name="exception">exception as any</param>
        /// <param name="category">error category</param>
        /// <param name="message">friendly header message for the user</param>
        public static void ShowError(IWin32Window parent, Exception exception, ErrorCategory category, string message)
        {
            ErrorForm form = new ErrorForm(exception, message, category);

            form.ShowDialog(parent);
        }
コード例 #17
0
ファイル: MainForm.cs プロジェクト: zyfzgt/NetOffice
        private void MainForm_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                bool handled = false;
                if (e.Modifiers == Keys.Alt)
                {
                    // use Alt + number key as tab change command
                    switch (e.KeyCode)
                    {
                    case Keys.D1:
                        SwitchTo(_toolboxControls[0].ControlName);
                        handled = true;
                        break;

                    case Keys.D2:
                        SwitchTo(_toolboxControls[1].ControlName);
                        handled = true;
                        break;

                    case Keys.D3:
                        SwitchTo(_toolboxControls[2].ControlName);
                        handled = true;
                        break;

                    case Keys.D4:
                        SwitchTo(_toolboxControls[3].ControlName);
                        handled = true;
                        break;

                    case Keys.D5:
                        SwitchTo(_toolboxControls[4].ControlName);
                        handled = true;
                        break;

                    case Keys.D6:
                        SwitchTo(_toolboxControls[5].ControlName);
                        handled = true;
                        break;

                    case Keys.D7:
                        SwitchTo(_toolboxControls[6].ControlName);
                        handled = true;
                        break;

                    case Keys.D8:
                        SwitchTo(_toolboxControls[7].ControlName);
                        handled = true;
                        break;

                    case Keys.D9:
                        SwitchTo(_toolboxControls[8].ControlName);
                        handled = true;
                        break;
                    }
                }

                // no tab change command, we shift key input to current visible toolbox control(s)
                if (!handled)
                {
                    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);
            }
        }
コード例 #18
0
        /// <summary>
        /// Creates an instance of ErrorForm and show
        /// </summary>
        /// <param name="parent">modal parent</param>
        /// <param name="exception">exception as any</param>
        /// <param name="category">error category</param>
        public static void ShowError(IWin32Window parent, Exception exception, ErrorCategory category)
        {
            ErrorForm form = new ErrorForm(exception, category, Forms.MainForm.Singleton.CurrentLanguageID);

            form.ShowDialog(parent);
        }