Ejemplo n.º 1
0
        public void Execute_LaunchAndClose_DoesNotCrash()
        {
            var tester       = new ModalFormTester();
            var buttonTester = new ButtonTester("_okButton");

            tester.ExpectModal("ShowReleaseNotesDialog", () => buttonTester.FireEvent("Click"));
            var cmd = new ReleaseNotesCommand();

            cmd.Execute();
            tester.Verify();
        }
Ejemplo n.º 2
0
        protected override void OnPreLoad(EventArgs e)
        {
            base.OnPreLoad(e);

            // Menu Commands
            _connect    = ToolboxApp.Services.Get <ConnectCommand>();
            _disconnect = ToolboxApp.Services.Get <DisconnectCommand>();

            var log      = ToolboxApp.Services.Get <ShowLogViewerCommand>();
            var quit     = ToolboxApp.Services.Get <QuitCommand>();
            var settings = ToolboxApp.Services.Get <SettingsCommand>();
            var onTop    = ToolboxApp.Services.Get <ToggleStayOnTopCommand>();

            _newPage = ToolboxApp.Services.Get <NewPageCommand>();
            _save    = ToolboxApp.Services.Get <SaveXamlCommand>();

            var feedback     = new FeedbackCommand();
            var update       = new UpdateCommand();
            var releaseNotes = new ReleaseNotesCommand();
            var lpac         = new LoadProjectAssembliesCommand();
            var newType      = new RegisterNewTypeCommand();
            var newView      = new RegisterNewViewCommand();

            // Styling
            _save.Enabled    = false;
            _newPage.Enabled = false;

            Title       = AppResource.Title_disconnected;
            Padding     = new Padding(5);
            Maximizable = false;
            Resizable   = true;
            Icon        = AppImages.Xf;
            ClientSize  = new Size(FormWidth, FormHeight);
            Location    = GetFormLocation();

            // Menubar
            Menu = new MenuBar
            {
                Items =
                {
                    // File
                    new ButtonMenuItem
                    {
                        Text  = AppResource.File_menu_label,
                        Items =
                        {
                            _connect,
                            _disconnect,
                            new SeparatorMenuItem(),
                            _newPage,
                            new SeparatorMenuItem(),
                            _save
                        }
                    },

                    new ButtonMenuItem
                    {
                        Text  = "&Edit",
                        Items =
                        {
                            new ButtonMenuItem {
                                Text = "&Undo", Enabled = false
                            },
                            new ButtonMenuItem {
                                Text = "&Redo", Enabled = false
                            },
                            new SeparatorMenuItem(),
                            new ButtonMenuItem {
                                Text = "&Cut", Enabled = false
                            },
                            new ButtonMenuItem {
                                Text = "&Copy", Enabled = false
                            },
                            new ButtonMenuItem {
                                Text = "&Paste", Enabled = false
                            },
                        }
                    },

                    // Tools
                    new ButtonMenuItem
                    {
                        Text  = AppResource.Tools_menu_label,
                        Items =
                        {
                            newView,
                            newType,
                            lpac,
                            new SeparatorMenuItem(),
                            settings
                        }
                    },

                    // Plugins
                    // This item will be replaced on connect & disconnect from a design server
                    new ButtonMenuItem
                    {
                        Text    = AppResource.Plugins_menu_label,
                        Enabled = false
                    },

                    // Window
                    new ButtonMenuItem
                    {
                        Text  = AppResource.Window_menu_label,
                        Items =
                        {
                            onTop,
                            new SeparatorMenuItem(),
                            new ResetViewCommand()
                        }
                    }
                },

                // Help
                HelpItems =
                {
                    feedback,
                    releaseNotes,
                    log,
                    new SeparatorMenuItem(),
                    update
                },

                QuitItem  = quit,
                AboutItem = new AboutCommand(),
            };

            ToolBar = new ToolBar
            {
                Items =
                {
                    _connect,
                    _newPage,
                    _save,
                    settings,
                    new SeparatorToolItem(),
                    onTop,
                    feedback,
                }
            };

            Application.Instance.Terminating += (s, _) => ToolboxApp.IsTerminating = true;
        }