コード例 #1
0
        public ApplicationWindow()
        {
            this.Icon        = new Icon(this.GetType().Assembly.GetManifestResourceStream("Resourcer.Application.ico"));
            this.Font        = new Font("Tahoma", 8.25f);
            this.Text        = (this.GetType().Assembly.GetCustomAttributes(typeof(System.Reflection.AssemblyTitleAttribute), false)[0] as System.Reflection.AssemblyTitleAttribute).Title;
            this.Size        = new Size(480, 600);
            this.MinimumSize = new Size(240, 300);

            this.resourceBrowser      = new ResourceBrowser();
            this.resourceBrowser.Dock = DockStyle.Fill;
            this.Controls.Add(this.resourceBrowser);

            this.verticalSplitter             = new Splitter();
            this.verticalSplitter.Dock        = DockStyle.Bottom;
            this.verticalSplitter.BorderStyle = BorderStyle.None;
            this.Controls.Add(this.verticalSplitter);

            this.resourceViewer        = new ResourcerViewer();
            this.resourceViewer.Dock   = DockStyle.Bottom;
            this.resourceViewer.Height = 100;
            this.Controls.Add(this.resourceViewer);

            this.statusBar = new StatusBar();
            this.Controls.Add(this.statusBar);

            this.commandBarManager = new CommandBarManager();
            this.menuBar           = new CommandBar(this.commandBarManager, CommandBarStyle.Menu);
            this.commandBarManager.CommandBars.Add(this.menuBar);
            this.toolBar = new CommandBar(this.commandBarManager, CommandBarStyle.ToolBar);
            this.commandBarManager.CommandBars.Add(this.toolBar);
            this.Controls.Add(this.commandBarManager);
        }
コード例 #2
0
        public ContentsGridPage()
        {
            InitializeComponent();
            InitVisualStates();

            CommandBarManager.SetEvent(AppBarItem.Ok, (s, args) => CommandBarOkSelected())
            .SetEvent(AppBarItem.DeleteMultiple, (s, args) => CommandBarDeleteMultipleSelected())
            .SetEvent(AppBarItem.DownloadMultiple, (s, args) => CommandBarDownloadMultipleSelected())
            .SetEvent(AppBarItem.RotateRight, (s, args) => CommandBarRotateRightSelected())
            .SetEvent(AppBarItem.RotateLeft, (s, args) => CommandBarRotateLeftSelected())
            .SetEvent(AppBarItem.ShowDetailInfo, (s, args) => CommandBarShowDetailInfo())
            .SetEvent(AppBarItem.HideDetailInfo, (s, args) => CommandBarHideDetailInfo())
            .SetEvent(AppBarItem.Resume, (s, args) => CommandBarResumeMovieSelected())
            .SetEvent(AppBarItem.Pause, (s, args) => CommandBarPauseMovieSelected())
            .SetEvent(AppBarItem.Close, (s, args) => CommandBarCloseSelected())
            .SetEvent(AppBarItem.LocalStorage, (s, args) =>
            {
                var tuple = Tuple.Create <string, string>(nameof(StorageType.Local), null);
                Frame.Navigate(typeof(ContentsGridPage), tuple);
            })
            .SetEvent(AppBarItem.RemoteStorage, (s, args) => TopBarRemoteStorage(s as FrameworkElement))
            .SetAccentColor(AppBarItem.RemoteStorage)
            .SetHeartBeat(AppBarItem.RemoteStorage)
            .SetEvent(AppBarItem.CancelSelection, (s, args) =>
            {
                UpdateInnerState(ViewerState.Single);
            });

            PhotoScreen.DetailInfoDisplayStatusUpdated += () => { UpdateAppBar(); };
        }
コード例 #3
0
        /// <summary>
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// <para>
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="NavigationHelper.LoadState"/>
        /// and <see cref="NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.
        /// </para>
        /// </summary>
        /// <param name="e">Provides data for navigation methods and event
        /// handlers that cannot cancel the navigation request.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.navigationHelper.OnNavigatedTo(e);

            if ((App.Current as App).IsFunctionLimited)
            {
                Unlimited.Visibility   = Visibility.Collapsed;
                Trial.Visibility       = Visibility.Collapsed;
                Limited.Visibility     = Visibility.Visible;
                TrialButton.Visibility = Visibility.Visible;
            }
            else if ((App.Current as App).IsTrialVersion)
            {
                Unlimited.Visibility   = Visibility.Collapsed;
                Trial.Visibility       = Visibility.Visible;
                Limited.Visibility     = Visibility.Collapsed;
                TrialButton.Visibility = Visibility.Visible;
            }
            else
            {
                Unlimited.Visibility   = Visibility.Visible;
                Trial.Visibility       = Visibility.Collapsed;
                Limited.Visibility     = Visibility.Collapsed;
                TrialButton.Visibility = Visibility.Collapsed;
            }

            BottomAppBar = CommandBarManager.Clear().Icon(AppBarItem.WifiSetting).CreateNew(0.6);
        }
コード例 #4
0
        public ApplicationWindow()
        {
            this.Icon = new Icon(this.GetType().Assembly.GetManifestResourceStream("Resourcer.Application.ico"));
            this.Font = new Font("Tahoma", 8.25f);
            this.Text = (this.GetType().Assembly.GetCustomAttributes(typeof(System.Reflection.AssemblyTitleAttribute), false)[0] as System.Reflection.AssemblyTitleAttribute).Title;
            this.Size = new Size(480, 600);
            this.MinimumSize = new Size (240, 300);

            this.resourceBrowser = new ResourceBrowser();
            this.resourceBrowser.Dock = DockStyle.Fill;
            this.Controls.Add(this.resourceBrowser);

            this.verticalSplitter = new Splitter ();
            this.verticalSplitter.Dock = DockStyle.Bottom;
            this.verticalSplitter.BorderStyle = BorderStyle.None;
            this.Controls.Add(this.verticalSplitter);

            this.resourceViewer = new ResourcerViewer();
            this.resourceViewer.Dock = DockStyle.Bottom;
            this.resourceViewer.Height = 100;
            this.Controls.Add(this.resourceViewer);

            this.statusBar = new StatusBar();
            this.Controls.Add(this.statusBar);

            this.commandBarManager = new CommandBarManager();
            this.menuBar = new CommandBar(this.commandBarManager, CommandBarStyle.Menu);
            this.commandBarManager.CommandBars.Add(this.menuBar);
            this.toolBar = new CommandBar(this.commandBarManager, CommandBarStyle.ToolBar);
            this.commandBarManager.CommandBars.Add(this.toolBar);
            this.Controls.Add(this.commandBarManager);
        }
コード例 #5
0
ファイル: CommandBar.cs プロジェクト: modulexcite/Resourcer
 public CommandBar(CommandBarManager commandBarManager)
 {
     this.commandBarManager = commandBarManager;
     this.items = new CommandBarItemCollection(this);
     this.SetStyle(ControlStyles.UserPaint, false);
     this.TabStop = false;
     this.Font = SystemInformation.MenuFont;
     this.Dock = DockStyle.Top;
 }
コード例 #6
0
 /// <summary/>
 protected virtual void Dispose(bool fDisposing)
 {
     System.Diagnostics.Debug.WriteLineIf(!fDisposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** ");
     if (fDisposing && !IsDisposed)
     {
         // dispose managed and unmanaged objects
         m_commandBarManager.Dispose();
     }
     m_commandBarManager = null;
     IsDisposed          = true;
 }
コード例 #7
0
        public void Start(ServiceManager serviceManager)
        {
            WindowManager  windowManager  = (WindowManager)serviceManager.GetService(typeof(WindowManager));
            CommandManager commandManager = (CommandManager)serviceManager.GetService(typeof(CommandManager));
            HSCommand      hsCommand      = new HSCommand(windowManager);

            commandManager.Commands.Add(hsCommand);
            CommandBarManager commandBarManager = (CommandBarManager)serviceManager.GetService(typeof(CommandBarManager));

            commandBarManager.AddUICustomizationFile(@"C:\AVEVA\Plant\PDMS12.1.SP4\HangersAndSupports.uic", "HangersAndSupports");
        }
コード例 #8
0
		/// <summary/>
		protected virtual void Dispose(bool fDisposing)
		{
			System.Diagnostics.Debug.WriteLineIf(!fDisposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** ");
			if (fDisposing && !IsDisposed)
			{
				// dispose managed and unmanaged objects
				m_commandBarManager.Dispose();
			}
			m_commandBarManager = null;
			IsDisposed = true;
		}
コード例 #9
0
        public void Start(ServiceManager serviceManager)
        {
            CommandManager     commandManager = (CommandManager)serviceManager.GetService(typeof(CommandManager));
            ExportModelCommand showCommand    = new ExportModelCommand();

            commandManager.Commands.Add(showCommand);

            CommandBarManager commandBarManager = (CommandBarManager)serviceManager.GetService(typeof(CommandBarManager));
            CommandBar        commandBar        = commandBarManager.CommandBars.AddCommandBar("Export Model");

            commandBarManager.RootTools.AddButtonTool(showCommand.Key, "Export Model", null, showCommand);
            commandBar.Tools.AddTool(showCommand.Key);
        }
コード例 #10
0
        public AboutPage()
        {
            this.InitializeComponent();

            this.navigationHelper            = new NavigationHelper(this);
            this.navigationHelper.LoadState += this.NavigationHelper_LoadState;
            this.navigationHelper.SaveState += this.NavigationHelper_SaveState;

            CommandBarManager.SetEvent(AppBarItem.WifiSetting, async(s, args) =>
            {
                await Launcher.LaunchUriAsync(new Uri("ms-settings-wifi:"));
            });
        }
コード例 #11
0
        void IAddin.Start(ServiceManager serviceManager)
        {
            DataTransferAddin.ServiceManager = serviceManager;
            WindowManager     service1 = (WindowManager)serviceManager.GetService(typeof(WindowManager));
            CommandManager    service2 = (CommandManager)serviceManager.GetService(typeof(CommandManager));
            CommandBarManager service3 = (CommandBarManager)serviceManager.GetService(typeof(CommandBarManager));

            service2.Commands.Add((Command) new TS_E3DCommand(service1));
            service3.RootTools.AddButtonTool("TS_E3DCommand", "Tekla Interoperability", (Image)Resources.ResourceManager.GetObject("tekla"), "TS.E3D.TS_E3D");
            if (new FileInfo(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "CompanySettingsForE3DRibbon.txt")).Exists)
            {
                return;
            }
            service3.CommandBars.AddCommandBar("Tekla Interoperability Bar").Tools.AddTool("TS_E3DCommand");
        }
コード例 #12
0
        private void UpdateTopBar()
        {
            CommandBarManager.Clear();

            if (TargetStorageType != StorageType.Local)
            {
                CommandBarManager.Command(AppBarItem.LocalStorage);
            }
            if (CountRemoteStorages() != 0)
            {
                CommandBarManager.Command(AppBarItem.RemoteStorage);
            }

            CommandBarManager.ApplyCommands(TitleBar);
        }
コード例 #13
0
        ///////////////////////////////////////

        public void Start(ServiceManager serviceManager)
        {
            //REGISTER NEW COMMAND

            ServicManag     = serviceManager;
            CommadManag     = (CommandManager)ServicManag.GetService(typeof(CommandManager));
            CommandBarManag = (CommandBarManager)ServicManag.GetService(typeof(CommandBarManager));
            //////////////////////
            //panel
            MyToolBar = CommandBarManag.CommandBars.AddCommandBar("Панелька");
            //buttons
            CommandBarManag.RootTools.AddButtonTool("key1", "Show", null, new CommandFilter("ShowForm"));
            MyToolBar.Tools.AddTool("key1");
            CommandBarManag.RootTools.AddButtonTool("key2", "Form", null, new CommandFilter("ShowForm2"));
            MyToolBar.Tools.AddTool("key2");
        }
コード例 #14
0
        /// <summary>
        /// get the control which is shared by all subclasses
        /// </summary>
        /// <returns></returns>
        public bool GetCommandBarManager()
        {
            //see if a menubar has already created one of these command bar managers
            foreach (Control control in m_window.Controls)
            {
                if (control is CommandBarManager)
                {
                    m_commandBarManager      = (CommandBarManager)control;
                    m_commandBarManager.Name = "CommandBarManager";
                    return(false);
                }
            }

            m_commandBarManager      = new CommandBarManager();
            m_commandBarManager.Name = "CommandBarManager";
            return(true);
        }
コード例 #15
0
		/// <summary>
		/// get the control which is shared by all subclasses
		/// </summary>
		/// <returns></returns>
		public bool GetCommandBarManager()
		{
			//see if a menubar has already created one of these command bar managers
			foreach(Control control in m_window.Controls)
			{
				if (control is CommandBarManager)
				{
					m_commandBarManager = (CommandBarManager)control;
					m_commandBarManager.Name = "CommandBarManager";
					return false;
				}
			}

			m_commandBarManager = new CommandBarManager();
			m_commandBarManager.Name = "CommandBarManager";
			return true;
		}
コード例 #16
0
        public EndUserDesignerForm(string reportName, string reportTemplatePath)
        {
            System.Diagnostics.Debug.Assert(!string.IsNullOrEmpty(reportTemplatePath));

            InitializeComponent();

            // Create new report instance and assign to Report Explorer
            this.arDesigner.Toolbox      = this.arToolbox;
            this.arDesigner.PropertyGrid = this.arPropertyGrid;

            // Add Menu and CommandBar to Form
            this.commandBarManager = this.arDesigner.CommandBarManager;

            // Edit CommandBar
            // NOTE: need check after each used version of ActiveReports - can be changed
            this.commandBarManager.CommandBars.RemoveAt(0);                                                                      // NOTE: remove menu
            CommandBarItem item = this.commandBarManager.CommandBars[0].Items[2];                                                // NOTE: get SaveAs button

            this.commandBarManager.CommandBars[0].Items.Clear();                                                                 // NOTE: remove New, Open, SaveAs buttons
            this.commandBarManager.CommandBars[0].Items.AddButton(item.Image, item.Text, new CommandEventHandler(OnSaveNew), 0); // NOTE: set customize Save routine

            this.Controls.Add(this.commandBarManager);

            // Fill Toolbox
            LoadTools(this.arToolbox);
            // Activate default group on the toolbox
            this.arToolbox.SelectedCategory = "ActiveReports 3.0";

            // Setup Status Bar
            this.arStatus.Panels.Add(new StatusBarPanel());
            this.arStatus.Panels.Add(new StatusBarPanel());
            this.arStatus.Panels[0].AutoSize = StatusBarPanelAutoSize.Spring;
            this.arStatus.Panels[1].AutoSize = StatusBarPanelAutoSize.Spring;
            this.arStatus.ShowPanels         = true;

            ActiveReport3 rpt = new ActiveReport3();

            rpt.LoadLayout(reportTemplatePath);
            arDesigner.Report = rpt;
            if (!string.IsNullOrEmpty(reportName))
            {
                this.Text = reportName;
            }
            templatePath = reportTemplatePath;
        }
コード例 #17
0
        void Aveva.ApplicationFramework.IAddin.Start(ServiceManager serviceManager)
        {
            sServiceManager    = serviceManager;
            sCommandManager    = (CommandManager)sServiceManager.GetService(typeof(CommandManager));
            sCommandBarManager = (CommandBarManager)sServiceManager.GetService(typeof(CommandBarManager));

            //Add ExampleCommand to Command Manager
            sCommandManager.Commands.Add(new ExampleCommand());

            //Create example toolbar menu
            CommandBar myToolBar = sCommandBarManager.CommandBars.AddCommandBar("ExampleCommandBar");
            //sCommandBarManager.RootTools.AddButtonTool("ExampleCommand", "ExampleCommand", null, "ExampleCommand");
            //myToolBar.Tools.AddTool("ExampleCommand");
            ComboBoxTool tool = sCommandBarManager.RootTools.AddComboBoxTool("ExampleCommand", "Examples", null, "ExampleCommand");

            tool.SelectedIndex = 0;
            myToolBar.Tools.AddTool("ExampleCommand");
        }
コード例 #18
0
		/// <summary/>
		protected virtual void Dispose(bool fDisposing)
		{
			System.Diagnostics.Debug.WriteLineIf(!fDisposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** ");
			if (fDisposing && !IsDisposed)
			{
				// dispose managed and unmanaged objects
				foreach (var band in bands)
				{
					var disposable = band as IDisposable;
					if (disposable != null)
						disposable.Dispose();
				}
				bands.Clear();
			}
			bands = null;
			commandBarManager = null;
			IsDisposed = true;
		}
コード例 #19
0
        public CodeMetricWindow(IServiceProvider serviceProvider)
        {
            this.Visible = false;

            this.TabStop = false;
            this.Dock    = DockStyle.Fill;

            this.serviceProvider = serviceProvider;

            this.codeMetricManager = new CodeMetricManager();
            this.codeMetricManager.Register(new TypeCodeMetric());
            this.codeMetricManager.Register(new MethodCodeMetric());
            this.codeMetricManager.Register(new ModuleCodeMetric());

            this.codeMetricManager.BeginRun       += new EventHandler(this.CodeMetricManager_BeginRun);
            this.codeMetricManager.BeginRunMetric += new CodeMetricEventHandler(this.CodeMetricManager_BeginRunMetric);
            this.codeMetricManager.EndRun         += new EventHandler(this.CodeMetricManager_EndRun);
            this.codeMetricManager.EndRunMetric   += new CodeMetricEventHandler(this.CodeMetricManager_EndRunMetric);

            this.contentHost         = new Control();
            this.contentHost.TabStop = false;
            this.contentHost.Dock    = DockStyle.Fill;
            this.Controls.Add(this.contentHost);

            this.commandBarManager = new CommandBarManager();
            this.commandBar        = new CommandBar(this.commandBarManager, CommandBarStyle.ToolBar);

            this.startButton = this.commandBar.Items.AddButton(CommandBarImages.Refresh, "Start Analysis", new EventHandler(this.StartButton_Click), Keys.Control | Keys.E);
            this.commandBar.Items.AddSeparator();
            this.saveButton         = this.commandBar.Items.AddButton(CommandBarImages.Save, "Save", new EventHandler(this.SaveButton_Click), Keys.Control | Keys.S);
            this.copyButton         = this.commandBar.Items.AddButton(CommandBarImages.Copy, "Copy", new EventHandler(this.CopyButton_Click), Keys.Control | Keys.C);
            this.codeMetricComboBox = this.commandBar.Items.AddComboBox("Code Metric Selector", new ComboBox());
            this.codeMetricComboBox.ComboBox.DropDownStyle         = ComboBoxStyle.DropDownList;
            this.codeMetricComboBox.ComboBox.SelectedIndexChanged += new EventHandler(this.CodeMetricComboBox_SelectedIndexChanged);

            this.commandBarManager.CommandBars.Add(this.commandBar);
            this.Controls.Add(this.commandBarManager);

            this.assemblySelector = new AssemblySelectorControl(serviceProvider, this.codeMetricManager);

            this.NewAnalysis();
        }
コード例 #20
0
        public void Start(ServiceManager serviceManager)
        {
            // Create Addins Windows
            // Get the WindowManager service
            WindowManager windowManager = (WindowManager)serviceManager.GetService(typeof(WindowManager));

            attributeListControl = new AttributeListControl();
            // Create a docked window to host an AttributeListControl
            attributeListWindow       = windowManager.CreateDockedWindow("Aveva.AttributeBrowser.AttributeList", "Attributes", attributeListControl, DockedPosition.Right);
            attributeListWindow.Width = 200;
            // Docked windows created at addin start should ensure their layout is saved between sessions.
            attributeListWindow.SaveLayout = true;

            // Create and register addins commands
            // Get the CommandManager
            CommandManager commandManager           = (CommandManager)serviceManager.GetService(typeof(CommandManager));
            ShowAttributeBrowserCommand showCommand = new ShowAttributeBrowserCommand(attributeListWindow);

            commandManager.Commands.Add(showCommand);

            // Add event handler for current element changed event.
            CurrentElement.CurrentElementChanged += new CurrentElementChangedEventHandler(CurrentElement_CurrentElementChanged);

            // Get the ResourceManager service.
            ResourceManager resourceManager = (ResourceManager)serviceManager.GetService(typeof(ResourceManager));

            resourceManager.LoadResourceFile("AttributeBrowserAddin");

            // Add a new panel to contain the project name.
            StatusBar          statusBar        = windowManager.StatusBar;
            StatusBarTextPanel projectNamePanel = statusBar.Panels.AddTextPanel("Aveva.ProjectName", "Project : " + Project.CurrentProject.Name);

            projectNamePanel.SizingMode = PanelSizingMode.Automatic;
            // Get the panel image from the addins resource file.
            projectNamePanel.Image = resourceManager.GetImage("ID_PROJECT_ICON");

            // Load a UIC file for the AttributeBrowser.
            CommandBarManager commandBarManager = (CommandBarManager)serviceManager.GetService(typeof(CommandBarManager));

            commandBarManager.AddUICustomizationFile("AttributeBrowser.uic", "AttributeBrowser");
        }
コード例 #21
0
        void Aveva.ApplicationFramework.IAddin.Start(ServiceManager serviceManager)
        {
            sServiceManager    = serviceManager;
            sCommandManager    = (CommandManager)sServiceManager.GetService(typeof(CommandManager));
            sCommandBarManager = (CommandBarManager)sServiceManager.GetService(typeof(CommandBarManager));

            //Add ExampleCommand to Command Manager

            SpecForm    specForm = new SpecForm();
            SpecCommand command1 = new SpecCommand();

            command1.specForm = specForm;
            sCommandManager.Commands.Add(command1);


            //Create example toolbar menu
            CommandBar myToolBar = sCommandBarManager.CommandBars.AddCommandBar("SpecCommandBar");

            sCommandBarManager.RootTools.AddButtonTool("SpecCommand", "temp", null, "SpecCommand");
            myToolBar.Tools.AddTool("SpecCommand");
        }
コード例 #22
0
        void Aveva.ApplicationFramework.IAddin.Start(ServiceManager serviceManager)
        {
            mServiceManager    = serviceManager;
            mWindowManager     = (WindowManager)serviceManager.GetService(typeof(WindowManager));
            mCommandBarManager = (CommandBarManager)serviceManager.GetService(typeof(CommandBarManager));

            mCommandBarManager.RootTools.ToolAdded += new ToolEventHandler(RootTools_ToolAdded);

            //Create an instance of Addin control
            mAddinControl = new NetGridAddinControl();

            //Add the Addin
            mAddinWindow       = (DockedWindow)mWindowManager.CreateDockedWindow("Grid Control Addin", "Grid Control Addin", mAddinControl, DockedPosition.Left);
            mAddinWindow.Width = 225;

            mAddinWindow.Closing += new System.ComponentModel.CancelEventHandler(mAddinWindow_Closing);

            //Hide
            mAddinWindow.Hide();

            //Load custom menus
            mCommandBarManager.UILoaded += new EventHandler(mCommandBarManager_UILoaded);
        }
コード例 #23
0
        private void Global_KeyDown(CoreWindow sender, KeyEventArgs args)
        {
            if (args.KeyStatus.RepeatCount == 1)
            {
                switch (args.VirtualKey)
                {
                case VirtualKey.Control:
                    IsCtlKeyPressed = true;
                    break;

                case VirtualKey.Shift:
                    IsShiftKeyPressed = true;
                    break;

                case VirtualKey.Menu:
                    IsAltKeyPressed = true;
                    break;

                case VirtualKey.Z:
                    if (IsCtlKeyPressed)     // Control+Z (Switch semantic zoom)
                    {
                        if (InnerState == ViewerState.Single || InnerState == ViewerState.Multi)
                        {
                            GridHolder.IsZoomedInViewActive = !GridHolder.IsZoomedInViewActive;
                            args.Handled = true;
                        }
                    }
                    break;

                case VirtualKey.R:
                    if (IsCtlKeyPressed)     // Control+R (Switch multiple removal mode)
                    {
                        if (CommandBarManager.IsEnabled(AppBarItemType.Command, AppBarItem.DeleteMultiple) &&
                            Operator?.ContentsCollection.SelectivityFactor != SelectivityFactor.Delete)
                        {
                            CommandBarDeleteMultipleSelected();
                        }
                        else
                        {
                            UpdateInnerState(ViewerState.Single);
                        }
                        args.Handled = true;
                    }
                    break;

                case VirtualKey.L:
                    if (IsCtlKeyPressed)     // Control+L (Switch multiple download mode)
                    {
                        if (CommandBarManager.IsEnabled(AppBarItemType.Command, AppBarItem.DownloadMultiple) &&
                            Operator?.ContentsCollection.SelectivityFactor != SelectivityFactor.Download)
                        {
                            CommandBarDownloadMultipleSelected();
                        }
                        else
                        {
                            UpdateInnerState(ViewerState.Single);
                        }
                        args.Handled = true;
                    }
                    break;

                case VirtualKey.C:
                    if (IsCtlKeyPressed)     // Control+C (Close: Equivalent to cross button)
                    {
                        if (CommandBarManager.IsEnabled(AppBarItemType.Command, AppBarItem.Close))
                        {
                            CommandBarCloseSelected();
                            args.Handled = true;
                        }
                    }
                    break;

                case VirtualKey.X:
                    if (IsCtlKeyPressed)     // Control+X (Execute: Equivalent to check button)
                    {
                        if (CommandBarManager.IsEnabled(AppBarItemType.Command, AppBarItem.Ok))
                        {
                            CommandBarOkSelected();
                            args.Handled = true;
                        }
                    }
                    break;

                case VirtualKey.P:
                    if (IsCtlKeyPressed)     // Control+P (Switch movie play/pause)
                    {
                        if (MoviePlayer.PlaybackState == MoviePlaybackScreen.PlayerState.PausedOrStopped)
                        {
                            CommandBarResumeMovieSelected();
                        }
                        else if (MoviePlayer.PlaybackState == MoviePlaybackScreen.PlayerState.Playing)
                        {
                            CommandBarPauseMovieSelected();
                        }
                        args.Handled = true;
                    }
                    break;

                case VirtualKey.I:
                    if (IsCtlKeyPressed)     // Control+I (Switch photo detail info display visibility)
                    {
                        if (PhotoScreen.DetailInfoDisplayed)
                        {
                            CommandBarHideDetailInfo();
                        }
                        else
                        {
                            CommandBarShowDetailInfo();
                        }
                        args.Handled = true;
                    }
                    break;

                case VirtualKey.Left:
                    if (IsCtlKeyPressed)     // Control+Left (Turn photo left)
                    {
                        if (CommandBarManager.IsEnabled(AppBarItemType.Command, AppBarItem.RotateLeft))
                        {
                            CommandBarRotateLeftSelected();
                            args.Handled = true;
                        }
                    }
                    break;

                case VirtualKey.Right:
                    if (IsCtlKeyPressed)     // Control+Right (Turn photo right)
                    {
                        if (CommandBarManager.IsEnabled(AppBarItemType.Command, AppBarItem.RotateRight))
                        {
                            CommandBarRotateRightSelected();
                            args.Handled = true;
                        }
                    }
                    break;
                }
            }
        }
コード例 #24
0
ファイル: CommandBar.cs プロジェクト: modulexcite/Resourcer
 public CommandBar(CommandBarManager commandBarManager, CommandBarStyle style)
     : this(commandBarManager)
 {
     this.style = style;
 }
コード例 #25
0
        public ContentsGridPage()
        {
            this.InitializeComponent();
            InitVisualStates();

            CommandBarManager.SetEvent(AppBarItem.Ok, async(s, args) =>
            {
                DebugUtil.Log(() => "Ok clicked");
                switch (InnerState)
                {
                case ViewerState.Multi:
                    switch (Operator.ContentsCollection.SelectivityFactor)
                    {
                    case SelectivityFactor.Delete:
                        await DeleteSelectedFiles();
                        break;

                    case SelectivityFactor.Download:
                        FetchSelectedImages();
                        break;

                    default:
                        DebugUtil.Log(() => "Nothing to do for current SelectivityFactor: " + Operator.ContentsCollection.SelectivityFactor);
                        break;
                    }
                    UpdateSelectionMode(SelectivityFactor.None);
                    UpdateInnerState(ViewerState.Single);
                    break;

                default:
                    DebugUtil.Log(() => "Nothing to do for current InnerState: " + InnerState);
                    break;
                }
            })
            .SetEvent(AppBarItem.DeleteMultiple, (s, args) =>
            {
                UpdateSelectionMode(SelectivityFactor.Delete);
                UpdateInnerState(ViewerState.Multi);
            })
            .SetEvent(AppBarItem.DownloadMultiple, (s, args) =>
            {
                UpdateSelectionMode(SelectivityFactor.Download);
                UpdateInnerState(ViewerState.Multi);
            })
            .SetEvent(AppBarItem.RotateRight, (s, args) =>
            {
                PhotoScreen.RotateImage(Rotation.Right);
            })
            .SetEvent(AppBarItem.RotateLeft, (s, args) =>
            {
                PhotoScreen.RotateImage(Rotation.Left);
            })
            .SetEvent(AppBarItem.ShowDetailInfo, async(s, args) =>
            {
                PhotoScreen.DetailInfoDisplayed = true;
                await Task.Delay(500);
                UpdateAppBar();
            })
            .SetEvent(AppBarItem.HideDetailInfo, async(s, args) =>
            {
                PhotoScreen.DetailInfoDisplayed = false;
                await Task.Delay(500);
                UpdateAppBar();
            })
            .SetEvent(AppBarItem.Resume, (s, args) =>
            {
                MoviePlayer.Resume();
            })
            .SetEvent(AppBarItem.Pause, (s, args) =>
            {
                MoviePlayer.Pause();
            })
            .SetEvent(AppBarItem.Close, (s, args) =>
            {
                switch (InnerState)
                {
                case ViewerState.StillPlayback:
                    ReleaseDetail();
                    break;

                case ViewerState.MoviePlayback:
                    FinishMoviePlayback();
                    break;
                }
                UpdateInnerState(ViewerState.Single);
            })
            .SetEvent(AppBarItem.LocalStorage, (s, args) =>
            {
                var tuple = Tuple.Create <string, string>(nameof(StorageType.Local), null);
                Frame.Navigate(typeof(ContentsGridPage), tuple);
            })
            .SetEvent(AppBarItem.RemoteStorage, (s, args) =>
            {
                var menuFlyout = CreateRemoteDrivesMenuFlyout();

                switch (menuFlyout.Items.Count)
                {
                case 0:
                    UpdateTopBar();
                    break;

                // case 1:
                // TODO Transit directly
                // break;
                default:
                    FlyoutBase.SetAttachedFlyout(s as FrameworkElement, menuFlyout);
                    FlyoutBase.ShowAttachedFlyout(s as FrameworkElement);
                    break;
                }
            })
            .SetAccentColor(AppBarItem.RemoteStorage)
            .SetHeartBeat(AppBarItem.RemoteStorage)
            .SetEvent(AppBarItem.CancelSelection, (s, args) =>
            {
                UpdateInnerState(ViewerState.Single);
            });

            PhotoScreen.DetailInfoDisplayStatusUpdated += () => { UpdateAppBar(); };
        }
コード例 #26
0
 public Configure_Menu(CommandBarManager sCommandBarManager)
 {
     this.sCommandBarManager = sCommandBarManager;
 }
コード例 #27
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.arToolbox  = new DataDynamics.ActiveReports.Design.Toolbox.Toolbox();
     this.pnlToolbox = new System.Windows.Forms.Panel();
     this.splitterToolboxDesigner = new System.Windows.Forms.Splitter();
     this.arDesigner                         = new DataDynamics.ActiveReports.Design.Designer();
     this.arPropertyGrid                     = new System.Windows.Forms.PropertyGrid();
     this.splitterDesignerProperties         = new System.Windows.Forms.Splitter();
     this.pnlProperties                      = new System.Windows.Forms.Panel();
     this.splitterReportExplorerPropertyGrid = new System.Windows.Forms.Splitter();
     this.arStatus          = new System.Windows.Forms.StatusBar();
     this.commandBarManager = new DataDynamics.ActiveReports.Design.CommandBarManager();
     ((System.ComponentModel.ISupportInitialize)(this.arToolbox)).BeginInit();
     this.pnlToolbox.SuspendLayout();
     this.pnlProperties.SuspendLayout();
     this.SuspendLayout();
     //
     // arToolbox
     //
     this.arToolbox.Dock        = System.Windows.Forms.DockStyle.Fill;
     this.arToolbox.LargeImages = null;
     this.arToolbox.Location    = new System.Drawing.Point(0, 0);
     this.arToolbox.Name        = "arToolbox";
     this.arToolbox.Selected    = null;
     this.arToolbox.Size        = new System.Drawing.Size(200, 578);
     this.arToolbox.SmallImages = null;
     this.arToolbox.TabIndex    = 0;
     //
     // pnlToolbox
     //
     this.pnlToolbox.Controls.Add(this.arToolbox);
     this.pnlToolbox.Dock     = System.Windows.Forms.DockStyle.Left;
     this.pnlToolbox.Location = new System.Drawing.Point(0, 0);
     this.pnlToolbox.Name     = "pnlToolbox";
     this.pnlToolbox.Size     = new System.Drawing.Size(200, 578);
     this.pnlToolbox.TabIndex = 0;
     //
     // splitterToolboxDesigner
     //
     this.splitterToolboxDesigner.BackColor   = System.Drawing.SystemColors.Control;
     this.splitterToolboxDesigner.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     this.splitterToolboxDesigner.Location    = new System.Drawing.Point(200, 0);
     this.splitterToolboxDesigner.Name        = "splitterToolboxDesigner";
     this.splitterToolboxDesigner.Size        = new System.Drawing.Size(3, 578);
     this.splitterToolboxDesigner.TabIndex    = 1;
     this.splitterToolboxDesigner.TabStop     = false;
     //
     // arDesigner
     //
     this.arDesigner.Dock               = System.Windows.Forms.DockStyle.Fill;
     this.arDesigner.IsDirty            = false;
     this.arDesigner.Location           = new System.Drawing.Point(203, 0);
     this.arDesigner.LockControls       = false;
     this.arDesigner.Name               = "arDesigner";
     this.arDesigner.PropertyGrid       = this.arPropertyGrid;
     this.arDesigner.ReportTabsVisible  = true;
     this.arDesigner.ShowDataSourceIcon = true;
     this.arDesigner.Size               = new System.Drawing.Size(397, 578);
     this.arDesigner.TabIndex           = 2;
     this.arDesigner.Toolbox            = null;
     this.arDesigner.ToolBoxItem        = null;
     this.arDesigner.SelectionChanged  += new DataDynamics.ActiveReports.Design.SelectionChangedEventHandler(this.arDesigner_SelectionChanged);
     //
     // arPropertyGrid
     //
     this.arPropertyGrid.CommandsVisibleIfAvailable = true;
     this.arPropertyGrid.Dock          = System.Windows.Forms.DockStyle.Fill;
     this.arPropertyGrid.LargeButtons  = false;
     this.arPropertyGrid.LineColor     = System.Drawing.SystemColors.ScrollBar;
     this.arPropertyGrid.Location      = new System.Drawing.Point(0, 231);
     this.arPropertyGrid.Name          = "arPropertyGrid";
     this.arPropertyGrid.Size          = new System.Drawing.Size(200, 347);
     this.arPropertyGrid.TabIndex      = 2;
     this.arPropertyGrid.Text          = "propertyGrid1";
     this.arPropertyGrid.ViewBackColor = System.Drawing.SystemColors.Window;
     this.arPropertyGrid.ViewForeColor = System.Drawing.SystemColors.WindowText;
     //
     // splitterDesignerProperties
     //
     this.splitterDesignerProperties.BackColor   = System.Drawing.SystemColors.Control;
     this.splitterDesignerProperties.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     this.splitterDesignerProperties.Dock        = System.Windows.Forms.DockStyle.Right;
     this.splitterDesignerProperties.Location    = new System.Drawing.Point(597, 0);
     this.splitterDesignerProperties.Name        = "splitterDesignerProperties";
     this.splitterDesignerProperties.Size        = new System.Drawing.Size(3, 578);
     this.splitterDesignerProperties.TabIndex    = 3;
     this.splitterDesignerProperties.TabStop     = false;
     //
     // pnlProperties
     //
     this.pnlProperties.Controls.Add(this.arPropertyGrid);
     this.pnlProperties.Controls.Add(this.splitterReportExplorerPropertyGrid);
     this.pnlProperties.Dock     = System.Windows.Forms.DockStyle.Right;
     this.pnlProperties.Location = new System.Drawing.Point(600, 0);
     this.pnlProperties.Name     = "pnlProperties";
     this.pnlProperties.Size     = new System.Drawing.Size(200, 578);
     this.pnlProperties.TabIndex = 4;
     //
     // splitterReportExplorerPropertyGrid
     //
     this.splitterReportExplorerPropertyGrid.Dock     = System.Windows.Forms.DockStyle.Top;
     this.splitterReportExplorerPropertyGrid.Location = new System.Drawing.Point(0, 228);
     this.splitterReportExplorerPropertyGrid.Name     = "splitterReportExplorerPropertyGrid";
     this.splitterReportExplorerPropertyGrid.Size     = new System.Drawing.Size(200, 3);
     this.splitterReportExplorerPropertyGrid.TabIndex = 1;
     this.splitterReportExplorerPropertyGrid.TabStop  = false;
     //
     // arStatus
     //
     this.arStatus.Location = new System.Drawing.Point(0, 578);
     this.arStatus.Name     = "arStatus";
     this.arStatus.Size     = new System.Drawing.Size(800, 22);
     this.arStatus.TabIndex = 5;
     //
     // commandBarManager
     //
     this.commandBarManager.Dock     = System.Windows.Forms.DockStyle.Top;
     this.commandBarManager.Location = new System.Drawing.Point(0, 0);
     this.commandBarManager.Name     = "commandBarManager";
     this.commandBarManager.Size     = new System.Drawing.Size(800, 0);
     this.commandBarManager.TabIndex = 6;
     this.commandBarManager.TabStop  = false;
     //
     // EndUserDesignerMainForm
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize        = new System.Drawing.Size(800, 600);
     this.Controls.Add(this.splitterDesignerProperties);
     this.Controls.Add(this.arDesigner);
     this.Controls.Add(this.splitterToolboxDesigner);
     this.Controls.Add(this.pnlToolbox);
     this.Controls.Add(this.pnlProperties);
     this.Controls.Add(this.arStatus);
     this.Controls.Add(this.commandBarManager);
     this.Name = "EndUserDesignerMainForm";
     this.Text = (string)App.Current.FindResource("ActiveReportsTitle");
     ((System.ComponentModel.ISupportInitialize)(this.arToolbox)).EndInit();
     this.pnlToolbox.ResumeLayout(false);
     this.pnlProperties.ResumeLayout(false);
     this.ResumeLayout(false);
 }
コード例 #28
0
ファイル: HelloWorld.cs プロジェクト: modulexcite/CommandBar
    public HelloWorld()
    {
        this.Icon = SystemIcons.Application;
            this.Text = "Hello World";
            this.Size = new Size(500, 500);
            this.Controls.Add(new StatusBar());

            this.commandBarManager = new CommandBarManager();
            this.menuBar = new CommandBar(this.commandBarManager, CommandBarStyle.Menu);
            this.toolBar = new CommandBar(this.commandBarManager, CommandBarStyle.ToolBar);

            // Menu and toolbar
            CommandBarButton newButton = new CommandBarButton(Images.New, "&New", null, Keys.Control | Keys.N);
            CommandBarButton openButton = new CommandBarButton(Images.Open, "&Open...", null, Keys.Control | Keys.O);
            CommandBarButton saveButton = new CommandBarButton(Images.Save, "&Save", null, Keys.Control | Keys.S);

            toolBar.Items.Add(newButton);
            toolBar.Items.Add(openButton);
            toolBar.Items.Add(saveButton);
            toolBar.Items.AddSeparator();

            CommandBarButton cutButton = new CommandBarButton(Images.Cut, "Cu&t", null, Keys.Control | Keys.X);
            CommandBarItem copyButton = new CommandBarButton(Images.Copy, "&Copy", null, Keys.Control | Keys.C);
            CommandBarItem pasteButton = new CommandBarButton(Images.Paste, "&Paste", null, Keys.Control | Keys.V);
            CommandBarItem deleteButton = new CommandBarButton(Images.Delete, "&Delete", null, Keys.Delete);

            this.toolBar.Items.Add(cutButton);
            this.toolBar.Items.Add(copyButton);
            this.toolBar.Items.Add(pasteButton);
            this.toolBar.Items.Add(deleteButton);
            this.toolBar.Items.AddSeparator();

            CommandBarButton undoButton = new CommandBarButton(Images.Undo, "&Undo", null, Keys.Control | Keys.Z);
            CommandBarButton redoButton = new CommandBarButton(Images.Redo, "&Redo", null, Keys.Control | Keys.Y);

            this.toolBar.Items.Add(undoButton);
            this.toolBar.Items.Add(redoButton);
            this.toolBar.Items.AddSeparator();

            CommandBarMenu fileMenu = menuBar.Items.AddMenu("&File");
            fileMenu.Items.Add(newButton);
            fileMenu.Items.Add(openButton);
            fileMenu.Items.Add(saveButton);
            fileMenu.Items.AddButton("&Save As...", null);
            fileMenu.Items.AddSeparator();
            fileMenu.Items.AddButton(Images.Preview, "Print Pre&view", null);
            fileMenu.Items.AddButton(Images.Print, "&Print", null, Keys.Control | Keys.P);
            fileMenu.Items.AddSeparator();
            fileMenu.Items.AddButton("E&xit", new EventHandler(this.Exit_Click));

            CommandBarMenu editMenu = this.menuBar.Items.AddMenu("&Edit");
            editMenu.Items.Add(undoButton);
            editMenu.Items.Add(redoButton);
            editMenu.Items.AddSeparator();
            editMenu.Items.Add(cutButton);
            editMenu.Items.Add(copyButton);
            editMenu.Items.Add(pasteButton);
            editMenu.Items.Add(deleteButton);
            editMenu.Items.AddSeparator();
            editMenu.Items.AddButton("Select &All", null, Keys.Control | Keys.A);

            CommandBarMenu viewMenu = this.menuBar.Items.AddMenu("&View");
            CommandBarMenu goToMenu = viewMenu.Items.AddMenu("&Go To");
            goToMenu.Items.AddButton(Images.Back, "&Back", null, Keys.Alt | Keys.Left);
            goToMenu.Items.AddButton(Images.Forward, "&Forward", null, Keys.Alt | Keys.Right);
            goToMenu.Items.AddSeparator();
            goToMenu.Items.AddButton(Images.Home, "&Home", null);

            viewMenu.Items.AddButton(Images.Stop, "&Stop", null, Keys.Escape);
            viewMenu.Items.AddButton(Images.Refresh, "&Refresh", null, Keys.F5);

            this.enabledButton = new CommandBarButton(Images.Tiles, "&Enabled", null);
            this.enabledButton.Enabled = false;
            this.visibleButton = new CommandBarButton(Images.Icons, "&Visible", null);
            this.visibleButton.Visible = false;
            CommandBarCheckBox checkedPlainCheckBox = new CommandBarCheckBox("&Checked Plain");
            checkedPlainCheckBox.IsChecked = true;
            CommandBarCheckBox checkedBitmapCheckBox = new CommandBarCheckBox(Images.List, "&Checked Bitmap");
            checkedBitmapCheckBox.IsChecked = true;

            toolBar.Items.Add(enabledButton);
            toolBar.Items.Add(visibleButton);
            toolBar.Items.Add(checkedPlainCheckBox);
            toolBar.Items.Add(checkedBitmapCheckBox);

            toolBar.Items.AddSeparator();

            ComboBox comboBox = new ComboBox();
            comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
            comboBox.Width = 100;
            toolBar.Items.AddComboBox("Combo Box", comboBox);

            toolBar.Items.AddSeparator();

            CommandBarMenu testMenu = menuBar.Items.AddMenu("&Test");
            testMenu.Items.AddButton("&Enabled On/Off", new EventHandler(ToggleEnabled_Click));
            testMenu.Items.Add(this.enabledButton);
            testMenu.Items.AddSeparator();
            testMenu.Items.AddButton("&Visible On/Off", new EventHandler(ToggleVisible_Click));
            testMenu.Items.Add(this.visibleButton);
            testMenu.Items.AddSeparator();
            testMenu.Items.Add(checkedPlainCheckBox);
            testMenu.Items.Add(checkedBitmapCheckBox);
            testMenu.Items.AddSeparator();
            testMenu.Items.AddButton("Change Font", new EventHandler(this.ChangeFont_Click));

            CommandBarMenu helpMenu = menuBar.Items.AddMenu("&Help");
            helpMenu.Items.AddButton(Images.Mail, "&Your Feedback", null);
            helpMenu.Items.AddSeparator();
            helpMenu.Items.AddButton("&About", null);

            this.commandBarManager.CommandBars.Add(this.menuBar);
            this.commandBarManager.CommandBars.Add(this.toolBar);
            this.Controls.Add(this.commandBarManager);

            // Context menu
            CommandBarContextMenu contextMenu = new CommandBarContextMenu();
            contextMenu.Items.Add(undoButton);
            contextMenu.Items.Add(redoButton);
            contextMenu.Items.AddSeparator();
            contextMenu.Items.Add(cutButton);
            contextMenu.Items.Add(copyButton);
            contextMenu.Items.Add(pasteButton);
            contextMenu.Items.Add(deleteButton);
            this.ContextMenu = contextMenu;
    }
コード例 #29
0
 public CommandBarCollection(CommandBarManager commandBarManager)
 {
     this.commandBarManager = commandBarManager;
 }
コード例 #30
0
    public HelloWorld()
    {
        this.Icon = SystemIcons.Application;
        this.Text = "Hello World";
        this.Size = new Size(500, 500);
        this.Controls.Add(new StatusBar());

        this.commandBarManager = new CommandBarManager();
        this.menuBar           = new CommandBar(this.commandBarManager, CommandBarStyle.Menu);
        this.toolBar           = new CommandBar(this.commandBarManager, CommandBarStyle.ToolBar);

        // Menu and toolbar
        CommandBarButton newButton  = new CommandBarButton(Images.New, "&New", null, Keys.Control | Keys.N);
        CommandBarButton openButton = new CommandBarButton(Images.Open, "&Open...", null, Keys.Control | Keys.O);
        CommandBarButton saveButton = new CommandBarButton(Images.Save, "&Save", null, Keys.Control | Keys.S);

        toolBar.Items.Add(newButton);
        toolBar.Items.Add(openButton);
        toolBar.Items.Add(saveButton);
        toolBar.Items.AddSeparator();

        CommandBarButton cutButton    = new CommandBarButton(Images.Cut, "Cu&t", null, Keys.Control | Keys.X);
        CommandBarItem   copyButton   = new CommandBarButton(Images.Copy, "&Copy", null, Keys.Control | Keys.C);
        CommandBarItem   pasteButton  = new CommandBarButton(Images.Paste, "&Paste", null, Keys.Control | Keys.V);
        CommandBarItem   deleteButton = new CommandBarButton(Images.Delete, "&Delete", null, Keys.Delete);

        this.toolBar.Items.Add(cutButton);
        this.toolBar.Items.Add(copyButton);
        this.toolBar.Items.Add(pasteButton);
        this.toolBar.Items.Add(deleteButton);
        this.toolBar.Items.AddSeparator();

        CommandBarButton undoButton = new CommandBarButton(Images.Undo, "&Undo", null, Keys.Control | Keys.Z);
        CommandBarButton redoButton = new CommandBarButton(Images.Redo, "&Redo", null, Keys.Control | Keys.Y);

        this.toolBar.Items.Add(undoButton);
        this.toolBar.Items.Add(redoButton);
        this.toolBar.Items.AddSeparator();

        CommandBarMenu fileMenu = menuBar.Items.AddMenu("&File");

        fileMenu.Items.Add(newButton);
        fileMenu.Items.Add(openButton);
        fileMenu.Items.Add(saveButton);
        fileMenu.Items.AddButton("&Save As...", null);
        fileMenu.Items.AddSeparator();
        fileMenu.Items.AddButton(Images.Preview, "Print Pre&view", null);
        fileMenu.Items.AddButton(Images.Print, "&Print", null, Keys.Control | Keys.P);
        fileMenu.Items.AddSeparator();
        fileMenu.Items.AddButton("E&xit", new EventHandler(this.Exit_Click));

        CommandBarMenu editMenu = this.menuBar.Items.AddMenu("&Edit");

        editMenu.Items.Add(undoButton);
        editMenu.Items.Add(redoButton);
        editMenu.Items.AddSeparator();
        editMenu.Items.Add(cutButton);
        editMenu.Items.Add(copyButton);
        editMenu.Items.Add(pasteButton);
        editMenu.Items.Add(deleteButton);
        editMenu.Items.AddSeparator();
        editMenu.Items.AddButton("Select &All", null, Keys.Control | Keys.A);

        CommandBarMenu viewMenu = this.menuBar.Items.AddMenu("&View");
        CommandBarMenu goToMenu = viewMenu.Items.AddMenu("&Go To");

        goToMenu.Items.AddButton(Images.Back, "&Back", null, Keys.Alt | Keys.Left);
        goToMenu.Items.AddButton(Images.Forward, "&Forward", null, Keys.Alt | Keys.Right);
        goToMenu.Items.AddSeparator();
        goToMenu.Items.AddButton(Images.Home, "&Home", null);

        viewMenu.Items.AddButton(Images.Stop, "&Stop", null, Keys.Escape);
        viewMenu.Items.AddButton(Images.Refresh, "&Refresh", null, Keys.F5);

        this.enabledButton         = new CommandBarButton(Images.Tiles, "&Enabled", null);
        this.enabledButton.Enabled = false;
        this.visibleButton         = new CommandBarButton(Images.Icons, "&Visible", null);
        this.visibleButton.Visible = false;
        CommandBarCheckBox checkedPlainCheckBox = new CommandBarCheckBox("&Checked Plain");

        checkedPlainCheckBox.IsChecked = true;
        CommandBarCheckBox checkedBitmapCheckBox = new CommandBarCheckBox(Images.List, "&Checked Bitmap");

        checkedBitmapCheckBox.IsChecked = true;

        toolBar.Items.Add(enabledButton);
        toolBar.Items.Add(visibleButton);
        toolBar.Items.Add(checkedPlainCheckBox);
        toolBar.Items.Add(checkedBitmapCheckBox);

        toolBar.Items.AddSeparator();

        ComboBox comboBox = new ComboBox();

        comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
        comboBox.Width         = 100;
        toolBar.Items.AddComboBox("Combo Box", comboBox);

        toolBar.Items.AddSeparator();

        CommandBarMenu testMenu = menuBar.Items.AddMenu("&Test");

        testMenu.Items.AddButton("&Enabled On/Off", new EventHandler(ToggleEnabled_Click));
        testMenu.Items.Add(this.enabledButton);
        testMenu.Items.AddSeparator();
        testMenu.Items.AddButton("&Visible On/Off", new EventHandler(ToggleVisible_Click));
        testMenu.Items.Add(this.visibleButton);
        testMenu.Items.AddSeparator();
        testMenu.Items.Add(checkedPlainCheckBox);
        testMenu.Items.Add(checkedBitmapCheckBox);
        testMenu.Items.AddSeparator();
        testMenu.Items.AddButton("Change Font", new EventHandler(this.ChangeFont_Click));

        CommandBarMenu helpMenu = menuBar.Items.AddMenu("&Help");

        helpMenu.Items.AddButton(Images.Mail, "&Your Feedback", null);
        helpMenu.Items.AddSeparator();
        helpMenu.Items.AddButton("&About", null);

        this.commandBarManager.CommandBars.Add(this.menuBar);
        this.commandBarManager.CommandBars.Add(this.toolBar);
        this.Controls.Add(this.commandBarManager);

        // Context menu
        CommandBarContextMenu contextMenu = new CommandBarContextMenu();

        contextMenu.Items.Add(undoButton);
        contextMenu.Items.Add(redoButton);
        contextMenu.Items.AddSeparator();
        contextMenu.Items.Add(cutButton);
        contextMenu.Items.Add(copyButton);
        contextMenu.Items.Add(pasteButton);
        contextMenu.Items.Add(deleteButton);
        this.ContextMenu = contextMenu;
    }