示例#1
0
        private void toolStripReset_Click(object sender, EventArgs e)
        {
            try
            {
                if (treeViewOfficeUI.SelectedNodes.Count == 0)
                {
                    return;
                }

                foreach (TreeNode node in treeViewOfficeUI.SelectedNodes)
                {
                    if (node.Tag is OfficeApi.CommandBar)
                    {
                        OfficeApi.CommandBar commandBar = node.Tag as OfficeApi.CommandBar;
                        commandBar.Reset();
                    }
                    else if (node.Tag is OfficeApi.CommandBarControl)
                    {
                        OfficeApi.CommandBarControl control = node.Tag as OfficeApi.CommandBarControl;
                        control.Reset();
                    }
                }
            }
            catch (Exception exception)
            {
                Forms.ErrorForm.ShowError(exception, ErrorCategory.NonCritical, Host.CurrentLanguageID);
            }
        }
示例#2
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();
                }
            }
        }
示例#3
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);
            }
        }