示例#1
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                try
                {
                    NControlHelper.BeginUpdate(Form.CommandBarsManager.ParentControl);

                    Form.CommandBarsManager.Commander.Commands.Remove(customDiagramButtonCommand);
                    Form.CommandBarsManager.ToolbarsBuilder = originalDiagramToolbarsBuilder;
                    Form.CommandBarsManager.Recreate();
                    NControlHelper.EndUpdate(Form.CommandBarsManager.ParentControl, true);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }

                if (components != null)
                {
                    components.Dispose();
                }
            }

            base.Dispose(disposing);
        }
示例#2
0
        protected override void LoadExample()
        {
            // store a reference to the original toolbar builder
            if (originalDiagramToolbarsBuilder == null)
            {
                originalDiagramToolbarsBuilder = Form.CommandBarsManager.ToolbarsBuilder;
            }

            // create the custom buttom command if not already craated
            if (customDiagramButtonCommand == null)
            {
                customDiagramButtonCommand = new NCustomDiagramButtonCommand();
                Form.CommandBarsManager.Commander.Commands.Add(customDiagramButtonCommand);
            }

            NControlHelper.BeginUpdate(Form.CommandBarsManager.ParentControl);

            // replace the toolbar builder with a custom one
            Form.CommandBarsManager.ToolbarsBuilder = new NCustomDiagramToolbarsBuilder();

            // recreate the command bars. Since we have replaced the toolbars builder,
            // this will add the new command in the toolbars
            Form.CommandBarsManager.Recreate();

            NControlHelper.EndUpdate(Form.CommandBarsManager.ParentControl, true);
        }
示例#3
0
        protected override void LoadExample()
        {
            // store a reference to the original toolbar builder
            if (originalDiagramContextMenuBuilder == null)
            {
                originalDiagramContextMenuBuilder = Form.CommandBarsManager.ContextMenuBuilder;
            }

            // create the custom buttom command if not already craated
            if (customDiagramButtonCommand == null)
            {
                customDiagramButtonCommand = new NCustomContextMenuDiagramButtonCommand();
                Form.CommandBarsManager.Commander.Commands.Add(customDiagramButtonCommand);
            }

            NControlHelper.BeginUpdate(Form.CommandBarsManager.ParentControl);

            // replace the context menu builder with a custom one
            Form.CommandBarsManager.ContextMenuBuilder = new NCustomDiagramContextMenuBuilder();

            // recreate the command bars. This is needed because custom commands
            // need to be exported to Nevron UI command contexts also
            Form.CommandBarsManager.Recreate();

            Form.View.DelegateBuildContextMenu = BuildContextMenu;


            NControlHelper.EndUpdate(Form.CommandBarsManager.ParentControl, true);
        }