Ejemplo n.º 1
0
        public ManualsViewModel(IContainer container)
        {
            _controller = container.Resolve <ManualsController>();

            OpenDocumentCommand.Subscribe(OnOpenDocument);
            OpenUrlCommand.Subscribe(OnOpenUrl);
        }
Ejemplo n.º 2
0
        private void InitializeComponents()
        {
            Images = new List <RemoteImage>();

            InsertRemotePicture = new InsertRemotePictureCommand(CurrentWindow, Images);
            InsertQuote         = new InsertQuoteCommand(CurrentWindow);
            InsertCheckList     = new InsertCheckListCommand();
            ImportMarkDown      = new InportMarkDownCommand();
            ExportToMarkDown    = new ExportToMarkDownCommand();
            OpenOptions         = new OpenOptionsCommand(CurrentWindow);
            ToggleTheme         = new ToggleThemeCommand(CurrentWindow);
            ToggleFullScreen    = new ToggleFullScreenCommand(CurrentWindow);

            OpenCommand = new OpenCommand(CurrentWindow);
            Open        = new OpenDocumentCommand(OpenCommand);
            SaveCommand = new SaveCommand(CurrentWindow);
            Save        = new SaveDocumentCommand(SaveCommand);

            MainMenu = new List <MenuItem>
            {
                new NewCommand(CurrentWindow.TextEditor),
                OpenCommand,
                SaveCommand,
                new EmptyCommand(),
                new PrintCommand(CurrentWindow.TextEditor),
                new EmptyCommand(),
                new ShortcutsCommand(CurrentWindow),
                new AboutCommand(CurrentWindow),
                new ExitCommand(CurrentWindow)
            };

            PinIcon = ConfigurationHandler.Current.IsToolbarFixed ?
                      PackIconModernKind.ArrowUp :
                      PackIconModernKind.ArrowDown;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes the ribbon.
        /// <para />
        /// Use this method to hook up views to ribbon items.
        /// </summary>
        /// <param name="ribbonService">The ribbon service.</param>
        protected override void InitializeRibbon(IRibbonService ribbonService)
        {
            LoadResourceDictionary();

            orchestraService = GetService <IOrchestraService>();

            // Module specific
            var typeFactory = TypeFactory.Default;

            //ribbonService.RegisterRibbonItem(new RibbonButton(HomeRibbonTabName, ModuleName, "Open", new Command(() => NewDocumentCommand.Execute(null))) { ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/Edit_WordWrap32.png" });
            ribbonService.RegisterRibbonItem(new RibbonButton(OrchestraResources.HomeRibbonTabName, ModuleName, "Open", new Command(() =>
            {
                var textEditorViewModel = typeFactory.CreateInstance <TextEditorViewModel>();
                orchestraService.ShowDocument(textEditorViewModel);
            }))
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/Edit_WordWrap32.png"
            });

            // View specific
            #region File Buttons

            // View specific
            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "File", "New", new Command(() => NewDocumentCommand.Execute(null)))
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/File_New32.png"
            },
                ModuleName);

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "File", "Open", new Command(() => OpenDocumentCommand.Execute(null)))
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/File_Open32.png"
            },
                ModuleName);

            //ribbonService.RegisterContextualRibbonItem<TextEditorView>(
            //   new RibbonButton(Name, "File", "Open", "OpenDocumentCommand") { ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/File_Open32.png" },
            //   ModuleName);

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "File", "Save", "SaveCommand")
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/File_Save32.png"
            },
                ModuleName);

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "File", "SaveAs", "SaveAsCommand")
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/File_SaveAs32.png"
            },
                ModuleName);

            //ribbonService.RegisterContextualRibbonItem<TextEditorView>(
            //  new RibbonButton(Name, "File", "CloseMe", new Command(() => CloseDocumentCommand.Execute(null)))
            //  {
            //      ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/action_close.png",
            //      ToolTip = new RibbonToolTip { Title = "Close (Ctrl+X)", Text = "Closes the file." }
            //  },
            //ModuleName);

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "File", "CloseMe", "CloseDocument")
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/action_close.png",
                ToolTip   = new RibbonToolTip {
                    Title = "Close (Ctrl+X)", Text = "Closes the file."
                }
            },
                ModuleName);
            #endregion

            #region Edit Buttons

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "Edit", "Copy", ApplicationCommands.Copy)
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/Edit_Copy32.png"
            },
                ModuleName);

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "Edit", "Cut", ApplicationCommands.Cut)
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/Edit_Cut32.png"
            },
                ModuleName);

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "Edit", "Paste", ApplicationCommands.Paste)
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/Edit_Paste32.png"
            },
                ModuleName);

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "Edit", "Delete", ApplicationCommands.Delete)
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/Edit_Delete32.png"
            },
                ModuleName);

            #endregion

            #region Undo / Redo Buttons

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "Undo", "Undo", ApplicationCommands.Undo)
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/Edit_Undo32.png"
            },
                ModuleName);

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "Undo", "Redo", ApplicationCommands.Redo)
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/Edit_Redo32.png"
            },
                ModuleName);

            #endregion

            #region Text Editor Buttons
            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "Text Editor", "WordWrap", "WordWrapCommand")
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/Edit_WordWrap32.png"
            },
                ModuleName);

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "Text Editor", "LineNumbers", "ShowLineNumbersCommand")
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/Edit_Numbers32.png"
            },
                ModuleName);
            #endregion

            #region ScriptCS  Buttons
            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "Run ScriptCS", "ScriptCS", "ScriptCSCommand")
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/cs_32.png"
            },
                ModuleName);

            #endregion

            //ribbonService.RegisterContextualRibbonItem<TextEditorView>(
            // new RibbonButton(Name, "Document", "Map", new Command(() => ShowDocumentMapCommand.Execute(null))) { ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/ShowWordWrap32.png" },
            // ModuleName);

            ribbonService.RegisterContextualRibbonItem <TextEditorView>(
                new RibbonButton(Name, "Document", "Map", "DocumentMapOpenCommand")
            {
                ItemImage = "/Orchestra.Modules.TextEditor;component/Resources/Images/App/ShowWordWrap32.png"
            },
                ModuleName);

            #region TextEditor Module

            // Language selection combobox
            //ribbonService.RegisterContextualRibbonItem<TextEditorView>(new RibbonComboBox(Name, "Languages")
            //{
            //    ItemsSource = "SyntaxHighlighting",
            //    SelectedItem = "SelectedLanguage",
            //    Layout = new RibbonItemLayout { Width = 100 },
            //    Style = Application.Current.Resources["SelectedSitesComboBoxStyle"] as Style
            //}, ModuleName);

            // Find the template to show as dynamic content. TODO: Refactor, make more elegant.
            var template = Application.Current.Resources["TestTemplate"] as DataTemplate;


            ribbonService.RegisterRibbonItem(new RibbonButton(OrchestraResources.ViewRibbonTabName, ModuleName, "TextEditor properties", new Command(() =>
            {
                orchestraService.ShowDocumentIfHidden <PropertiesViewModel>();
            }))
            {
                ItemImage = "/rchestra.Modules.TextEditor;component/Resources/Images/App/Edit_WordWrap32.png"
            });

            #endregion

            var dockingSettings = new DockingSettings();
            dockingSettings.DockLocation = DockLocation.Right;
            dockingSettings.Width        = 225;

            // Demo: register contextual view related to browserview
            var contextualViewModelManager = GetService <IContextualViewModelManager>();
            contextualViewModelManager.RegisterContextualView <TextEditorViewModel, PropertiesViewModel>("Document Map", DockLocation.Right);

            // Open blank document during application start
            var currenttextEditorViewModel = typeFactory.CreateInstanceWithParametersAndAutoCompletion <TextEditorViewModel>("Orchestra", this);
            //orchestraViewModel.Url = "http://www.github.com/Orcomp/Orchestra";
            orchestraService.ShowDocument(currenttextEditorViewModel, "New Document");
        }