Exemple #1
0
        public static void ToggleCommand(ICommandView a, ICommandView b)
        {
            var c = new CommandView(a);

            SetCommand(a, b);
            SetCommand(b, c);
        }
Exemple #2
0
        /// <summary>
        /// Konstruktor.
        /// </summary>
        /// <param name="viewManager">Obiekt menadżera widoków.</param>
        /// <param name="view">Obiekt zarządzanego przez prezentera widoku.</param>
        /// <param name="undoRedoManager">Menadżer cofania/przywracania zmian.</param>
        public UndoCommandPresenter(IViewManager viewManager, ICommandView view, IUndoRedoManager undoRedoManager)
            : base(viewManager, view)
        {
            this.undoRedoManager = undoRedoManager;
            this.undoRedoManager.CanUndoChanged += new EventHandler <EventArgs <bool> >(CanUndoChangedHandler);

            this.View.IsExecutable = this.undoRedoManager.CanUndo;
        }
Exemple #3
0
        /// <summary>
        /// Konstruktor.
        /// </summary>
        /// <param name="viewManager">Obiekt menadżera widoków.</param>
        /// <param name="view">Obiekt zarządzanego przez prezentera widoku.</param>
        /// <param name="editor">Obiekt menadżera zajmującego się edycjią napisów.</param>
        public CopyCommandPresenter(IViewManager viewManager, ICommandView view, SubtitlesEditor subtitlesEditor)
            : base(viewManager, view)
        {
            this.subtitlesEditor = subtitlesEditor;
            this.subtitlesEditor.Clipboard.CanCopyChanged += new EventHandler <EventArgs <bool> >(ClipboardCanCopyChangedHandler);

            this.View.IsExecutable = this.subtitlesEditor.Clipboard.CanCopy;
        }
Exemple #4
0
        /// <summary>
        /// Konstruktor.
        /// </summary>
        /// <param name="viewManager">Obiekt menadżera widoków.</param>
        /// <param name="view">Obiekt zarządzanego przez prezentera widoku.</param>
        /// <param name="subtitlesManager">Obiekt menadżera zarządzającego obiektami reprezentującymi napisy.</param>
        /// <param name="editor">Obiekt menadżera zajmującego się edycjią napisów.</param>
        /// <param name="tool">Obiekt narzędzia odpowiadającego za synchronizację napisów.</param>
        public SynchronizationCommandPresenter(IViewManager viewManager, ICommandView view, SubtitlesManager subtitlesManager, SynchronizationTool tool)
            : base(viewManager, view)
        {
            this.subtitlesManager = subtitlesManager;

            this.tool = tool;

            this.View.IsExecutable = true;
        }
        public void RegisterMethod <T>(ICommandView commandView, Guid methodGuid, EventHandler <T> eventHandler)
        {
            if (_methods.ContainsKey(methodGuid))
            {
                throw new ArgumentException("There is already a method with the give guid");
            }

            _methods.Add(methodGuid, new CrossViewMethod <T>(commandView, eventHandler));
        }
 private void CrossViewManagerOnOpenCommandView(object sender, ICommandView commandView)
 {
     if (_commandViewWindows.ContainsKey(commandView))
     {
         _commandViewWindows[commandView].Activate();
     }
     else
     {
         OpenCommandInExternalWindowCommand.Execute(commandView);
     }
 }
Exemple #7
0
        /// <summary>
        /// Constructs a CmdButtonSpriteGroup instance.
        /// </summary>
        /// <param name="cmdPanelView">Reference to the command panel view.</param>
        /// <param name="btnState">The button state for which this sprite group belongs to.</param>
        public CmdButtonSpriteGroup(ICommandView cmdPanelView, CommandButtonStateEnum btnState)
            : base()
        {
            if (cmdPanelView == null)
            {
                throw new ArgumentNullException("cmdPanelView");
            }

            this.commandPanelView = cmdPanelView;
            this.buttonState      = btnState;
        }
Exemple #8
0
 public static void SetCommand(ICommandView command, ICommandView value)
 {
     if (command != null && value != null)
     {
         command.Image       = value.Image;
         command.Label       = value.Label;
         command.ToolTipText = value.ToolTipText;
         command.Size        = value.Size;
         command.Action      = value.Action;
     }
 }
Exemple #9
0
 public CommandView(ICommandView value)
 {
     if (value != null)
     {
         this.Image       = value.Image;
         this.Label       = value.Label;
         this.ToolTipText = value.ToolTipText;
         this.Size        = value.Size;
         this.Action      = value.Action;
     }
 }
Exemple #10
0
        /// <summary>
        /// Konstruktor.
        /// </summary>
        /// <param name="viewManager">Obiekt menadżera widoków.</param>
        /// <param name="view">Obiekt zarządzanego przez prezentera widoku.</param>
        /// <param name="subtitlesManager">Obiekt menadżera zarządzającego obiektami reprezentującymi napisy.</param>
        /// <param name="editor">Obiekt menadżera zajmującego się edycjią napisów.</param>
        /// <param name="tool">OBiekt narzędzia służącego do dostosowywania timingów.</param>
        public TimingAdjustmentCommandPresenter(
            IViewManager viewManager,
            ICommandView view,
            SubtitlesManager subtitlesManager,
            SubtitlesEditor editor,
            TimingAdjustmentTool tool)
            : base(viewManager, view)
        {
            this.manager = subtitlesManager;

            this.editor = editor;

            this.tool = tool;

            this.View.IsExecutable = true;
        }
Exemple #11
0
        private void InitializeCommands()
        {
            ICommandView        cutCmdView      = (ICommandView)ViewManager.GetView("ContextMenuCutView");
            CutCommandPresenter cutCmdPresenter = new CutCommandPresenter(ViewManager, cutCmdView, editor);

            ICommandView         copyCmdView      = (ICommandView)ViewManager.GetView("ContextMenuCopyView");
            CopyCommandPresenter copyCmdPresenter = new CopyCommandPresenter(ViewManager, copyCmdView, editor);

            ICommandView          pasteCmdView      = (ICommandView)ViewManager.GetView("ContextMenuPasteView");
            PasteCommandPresenter pasteCmdPresenter = new PasteCommandPresenter(ViewManager, pasteCmdView, editor);

            ICommandView selectAllCmdView = (ICommandView)ViewManager.GetView("ContextMenuSelectAllView");
            SelectAllCommandPresenter selectAllCmdPresenter = new SelectAllCommandPresenter(ViewManager, selectAllCmdView, editor);

            ICommandView selectFromCmdView = (ICommandView)ViewManager.GetView("ContextMenuSelectFromView");
            SelectFromCommandPresenter selectFromCmdPresenter = new SelectFromCommandPresenter(ViewManager, selectFromCmdView, editor);
        }
        private void Initialize(Command clientCommand, Orcus.Administration.Plugins.CommandViewPlugin.Command administrationCommand,
                                ICommandView commandView, FrameworkElement view)
        {
            _clientVirtualizer = new ClientVirtualizer(administrationCommand, clientCommand);
            try
            {
                commandView.Initialize(_clientVirtualizer.ClientController, new CrossViewManager());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            CommandView = commandView;
            CommandView.LoadView(false);
            FrameworkElement             = view;
            FrameworkElement.DataContext = commandView;
        }
Exemple #13
0
 public ToolbarButton(ICommandView command) : base(command)
 {
 }
Exemple #14
0
        static void Main()
        {
#if DEBUG
            System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");
#endif

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            IViewManager viewManager = new WinFormsViewManager();

            SubtitlesManager subtitlesManager = new SubtitlesManager();

            //Określenie obsługiwanych formatów przed wczytaniem pliku.
            subtitlesManager.AddSupportedSubtitles(new AssFileFormat());
            subtitlesManager.AddSupportedSubtitles(new SSAFileFormat());
            subtitlesManager.AddSupportedSubtitles(new SubripFileFormat());
            subtitlesManager.AddSupportedSubtitles(new MicroDVDFileFormat());
            subtitlesManager.AddSupportedSubtitles(new TMPlayerFileFormat());

            MainFormView mainFormView = new MainFormView(Subeditor.Properties.Resources.NameMainView);
            viewManager.AddView(mainFormView);

            ApplicationManager appManager        = new ApplicationManager(viewManager);
            MainFormPresenter  mainFormPresenter = new MainFormPresenter(viewManager, mainFormView, appManager, subtitlesManager);

            UndoRedoManager undoRedoManager = new UndoRedoManager();

            ClipboardAssistant assistant = new ClipboardAssistant();
            mainFormView.ClipboardChanged += assistant.OnClipboardChanged;

            SubtitlesEditor editor = new SubtitlesEditor(subtitlesManager, undoRedoManager);
            (editor.Clipboard as SubtitlesClipboard).ClipboardAssistant = assistant;

            //<--------------------------------------------------------------Tools-------------------------------------------------------------->

            TimingAdjustmentTool timingAdjustmentTool = new TimingAdjustmentTool(subtitlesManager, editor);
            SynchronizationTool  synchronizationTool  = new SynchronizationTool(subtitlesManager, editor);

            //<-------------------------------------------------------SubtitlesPresenter-------------------------------------------------------->

            ISubtitlesView     subtitlesFileView      = (ISubtitlesView)viewManager.GetView("SubtitlesView");
            SubtitlesPresenter subtitlesFilePresenter = new SubtitlesPresenter(viewManager, subtitlesFileView, subtitlesManager, editor);

            //<-------------------------------------------------------Menu File Commands-------------------------------------------------------->

            ICommandView             openFileCmdView      = (ICommandView)viewManager.GetView("MenuOpenView");
            OpenFileCommandPresenter openFileCmdPresenter = new OpenFileCommandPresenter(viewManager, openFileCmdView, subtitlesManager);

            ICommandView             saveFileCmdView          = (ICommandView)viewManager.GetView("MenuSaveView");
            SaveFileCommandPresenter saveFileCommandPResenter = new SaveFileCommandPresenter(viewManager, saveFileCmdView, subtitlesManager);

            ICommandView saveAsFileCmddView = (ICommandView)viewManager.GetView("MenuSaveAsView");
            SaveAsFileCommandPresenter saveAsFileCmdPResenter = new SaveAsFileCommandPresenter(viewManager, saveAsFileCmddView, subtitlesManager);

            ICommandView         exitCmdView      = (ICommandView)viewManager.GetView("MenuExitView");
            ExitCommandPresenter exitCmdPresenter = new ExitCommandPresenter(viewManager, exitCmdView, appManager);

            //<--------------------------------------------------------------------------------------------------------------------------------->

            //<-------------------------------------------------------Menu Edit Commands-------------------------------------------------------->

            ICommandView        cutCmdView      = (ICommandView)viewManager.GetView("MenuCutView");
            CutCommandPresenter cutCmdPresenter = new CutCommandPresenter(viewManager, cutCmdView, editor);

            ICommandView         copyCmdView      = (ICommandView)viewManager.GetView("MenuCopyView");
            CopyCommandPresenter copyCmdPresenter = new CopyCommandPresenter(viewManager, copyCmdView, editor);

            ICommandView          pasteCmdView      = (ICommandView)viewManager.GetView("MenuPasteView");
            PasteCommandPresenter pasteCmdPresenter = new PasteCommandPresenter(viewManager, pasteCmdView, editor);

            ICommandView selectAllCmdView = (ICommandView)viewManager.GetView("MenuSelectAllView");
            SelectAllCommandPresenter selectAllCmdPresenter = new SelectAllCommandPresenter(viewManager, selectAllCmdView, editor);

            ICommandView selectFromCmdView = (ICommandView)viewManager.GetView("MenuSelectFromView");
            SelectFromCommandPresenter selectFromCmdPresenter = new SelectFromCommandPresenter(viewManager, selectFromCmdView, editor);

            ICommandView         menuUndoCmdView      = (ICommandView)viewManager.GetView("MenuUndoView");
            UndoCommandPresenter menuUndoCmdPresenter = new UndoCommandPresenter(viewManager, menuUndoCmdView, undoRedoManager);

            ICommandView         menuRedoCmdView      = (ICommandView)viewManager.GetView("MenuRedoView");
            RedoCommandPresenter menuRedoCmdPresenter = new RedoCommandPresenter(viewManager, menuRedoCmdView, undoRedoManager);

            //<--------------------------------------------------------------------------------------------------------------------------------->

            //<-------------------------------------------------------Menu Tools Commands------------------------------------------------------->

            ICommandView adjustTimingCmdView = (ICommandView)viewManager.GetView("MenuTimingAdjustmentView");
            TimingAdjustmentCommandPresenter adjustTimingCmdPresenter = new TimingAdjustmentCommandPresenter(
                viewManager,
                adjustTimingCmdView,
                subtitlesManager,
                editor,
                timingAdjustmentTool);

            ICommandView synchronizationCmdView = (ICommandView)viewManager.GetView("MenuSynchronizationView");
            SynchronizationCommandPresenter synchronizationCmdPresenter = new SynchronizationCommandPresenter(
                viewManager,
                synchronizationCmdView,
                subtitlesManager,
                synchronizationTool);

            //<--------------------------------------------------------------------------------------------------------------------------------->

            //<-----------------------------------------------------------Toolbar -------------------------------------------------------------->

            ICommandView             toolbarOpenFileCmdView      = (ICommandView)viewManager.GetView("ToolbarOpenFileView");
            OpenFileCommandPresenter toolbarOpenFileCmdPresenter = new OpenFileCommandPresenter(viewManager, toolbarOpenFileCmdView, subtitlesManager);

            ICommandView             toolbarSaveFileCmdView      = (ICommandView)viewManager.GetView("ToolbarSaveFileView");
            SaveFileCommandPresenter toolbarSaveFileCmdPResenter = new SaveFileCommandPresenter(viewManager, toolbarSaveFileCmdView, subtitlesManager);

            ICommandView toolbarSaveAsFileCmdView = (ICommandView)viewManager.GetView("ToolbarSaveAsFileView");
            SaveAsFileCommandPresenter toolbarSaveAsFileCmdPResenter = new SaveAsFileCommandPresenter(viewManager, toolbarSaveAsFileCmdView, subtitlesManager);

            ICommandView        toolbarCutCmdView      = (ICommandView)viewManager.GetView("ToolbarCutView");
            CutCommandPresenter toolbarCutCmdPresenter = new CutCommandPresenter(viewManager, toolbarCutCmdView, editor);

            ICommandView         toolbarCopyCmdView      = (ICommandView)viewManager.GetView("ToolbarCopyView");
            CopyCommandPresenter toolbarCopyCmdPresenter = new CopyCommandPresenter(viewManager, toolbarCopyCmdView, editor);

            ICommandView          toolbarPasteCmdView      = (ICommandView)viewManager.GetView("ToolbarPasteView");
            PasteCommandPresenter toolbarPasteCmdPresenter = new PasteCommandPresenter(viewManager, toolbarPasteCmdView, editor);

            ICommandView         toolbarUndoCmdView      = (ICommandView)viewManager.GetView("ToolbarUndoView");
            UndoCommandPresenter toolbarUndoCmdPresenter = new UndoCommandPresenter(viewManager, toolbarUndoCmdView, undoRedoManager);

            ICommandView         toolbarRedoCmdView      = (ICommandView)viewManager.GetView("ToolbarRedoView");
            RedoCommandPresenter toolbarRedoCmdPresenter = new RedoCommandPresenter(viewManager, toolbarRedoCmdView, undoRedoManager);

            IToolStripComboBoxView    toolbarEncodingView      = (IToolStripComboBoxView)viewManager.GetView("ToolbarEncodingView");
            EncodingComboBoxPresenter toolbarEncodingPresenter = new EncodingComboBoxPresenter(viewManager, toolbarEncodingView, subtitlesManager);

            //<--------------------------------------------------------------------------------------------------------------------------------->

            //<-------------------------------------------------------Context Menu-------------------------------------------------------------->
            MainContextMenuStripView mainContextMenuStripView = new MainContextMenuStripView();
            (subtitlesFileView as IHierarchicalView).AddChildView(mainContextMenuStripView);
            MainContextMenuStripPresenter mainContextMenuStripPresenter = new MainContextMenuStripPresenter(viewManager, mainContextMenuStripView, editor);

            //<--------------------------------------------------------------------------------------------------------------------------------->

            //Próbuje otworzyć plik, w sytuacji gdy użytkownik uruchomił program poprzez polecenie "otwórz za pomocą".
            bool operationResult = subtitlesManager.TryLoadFromClickOnceDeploymentSystem();
            if (operationResult == false)
            {
                subtitlesManager.TryLoadFromLineArgs();
            }

            //<--------------------------------------------------------------------------------------------------------------------------------->

            viewManager.ShowView(mainFormView);
        }
Exemple #15
0
 /// <summary>
 /// Konstruktor.
 /// </summary>
 /// <param name="viewManager">Obiekt menadżera widoków.</param>
 /// <param name="view">Obiekt zarządzanego przez prezentera widoku.</param>
 /// <param name="editor">Obiekt menadżera zajmującego się edycjią napisów.</param>
 public SelectFromCommandPresenter(IViewManager viewManager, ICommandView view, SubtitlesEditor editor)
     : base(viewManager, view)
 {
     this.editor = editor;
 }
Exemple #16
0
 public ToolbarItem(ICommandView command)
 {
     this.SetCommand(command);
 }
Exemple #17
0
        protected virtual void Compose()
        {
            var options = new AlignerOptions {
                Dimension       = Dimension.X,
                PointOrderDelta = 40,
                Collisions      = Collisions.NextFree //| Collisions.Toggle
            };

            Action action = () => Columns(options);

            LogicalLayoutLeafCommand = new CommandView {
                Action = (s) => {
                    action = () => LogicalLayoutLeaf(options);
                    action();
                },
                Image       = Iconery.LogicalLayoutLeaf,
                Size        = DefaultSize,
                ToolTipText = "arrange leaf of selected"
            };

            LogicalLayoutCommand = new CommandView {
                Action = (s) => {
                    action = () => LogicalLayout(options);
                    action();
                },
                Image       = Iconery.LogicalLayout,
                Size        = DefaultSize,
                ToolTipText = "arrange siblings of selected"
            };

            FullLayoutCommand = new CommandView {
                Action = (s) => {
                    action = () => FullLayout(options);
                    action();
                },
                Image       = Iconery.FullLayout,
                Size        = DefaultSize,
                ToolTipText = "arrange all"
            };

            ColumnsCommand = new CommandView {
                Action = (s) => {
                    action = () => Columns(options);
                    action();
                },
                Image       = Iconery.ArrageRows,
                Size        = DefaultSize,
                ToolTipText = "arrange in columns"
            };

            OneColumnCommand = new CommandView {
                Action = (s) => {
                    action = () => OneColumn(options);
                    action();
                },
                Image       = Iconery.ArrangeOneRow,
                Size        = DefaultSize,
                ToolTipText = "arrange in one column"
            };

            ArrangeLeftCommand = new CommandView {
                Action = (s) => {
                    options.AlignX = Alignment.Start;
                    action();
                },
                Image       = Iconery.ArrangeLeft,
                Size        = DefaultSize,
                ToolTipText = "align left"
            };

            ArrangeCenterCommand = new CommandView {
                Action = (s) => {
                    options.AlignX = Alignment.Center;
                    action();
                },
                Image       = Iconery.ArrangeCenter,
                Size        = DefaultSize,
                ToolTipText = "align center"
            };

            ArrangeRightCommand = new CommandView {
                Action = (s) => {
                    options.AlignX = Alignment.End;
                    action();
                },
                Image       = Iconery.ArrangeRight,
                Size        = DefaultSize,
                ToolTipText = "align rigth"
            };

            ArrangeTopCommand = new CommandView {
                Action = (s) => {
                    options.AlignY = Alignment.Start;
                    action();
                },
                Image       = Iconery.ArrangeTop,
                Size        = DefaultSize,
                ToolTipText = "align top"
            };

            ArrangeCenterVCommand = new CommandView {
                Action = (s) => {
                    options.AlignY = Alignment.Center;
                    action();
                },
                Image       = Iconery.ArrangeMiddle,
                Size        = DefaultSize,
                ToolTipText = "align middle"
            };

            ArrangeBottomCommand = new CommandView {
                Action = (s) => {
                    options.AlignY = Alignment.End;
                    action();
                },
                Image       = Iconery.ArrangeBottom,
                Size        = DefaultSize,
                ToolTipText = "align bottom"
            };

            DimensionXCommand = new CommandView {
                Action = (s) => {
                    options.Dimension = Dimension.X;
                    action();
                },
                Image       = Iconery.DimensionX,
                Size        = DefaultSize,
                ToolTipText = "arrange left to right"
            };

            DimensionYCommand = new CommandView {
                Action = (s) => {
                    options.Dimension = Dimension.Y;
                    action();
                },
                Image       = Iconery.DimensionY,
                Size        = DefaultSize,
                ToolTipText = "arrange top to bottom"
            };

            UndoCommand = new CommandView {
                Action      = (s) => Undo(),
                Size        = DefaultSize,
                Image       = Iconery.Undo,
                ToolTipText = "undo last arrange"
            };

            var horizontalButton = new ToolbarDropDownButton(ArrangeLeftCommand);

            horizontalButton.AddItems(
                new ToolbarButton(ArrangeCenterCommand)
            {
                ToggleOnClick = horizontalButton
            },
                new ToolbarButton(ArrangeRightCommand)
            {
                ToggleOnClick = horizontalButton
            }
                );

            var verticalButton = new ToolbarDropDownButton(ArrangeTopCommand);

            verticalButton.AddItems(
                new ToolbarButton(ArrangeCenterVCommand)
            {
                ToggleOnClick = verticalButton
            },
                new ToolbarButton(ArrangeBottomCommand)
            {
                ToggleOnClick = verticalButton
            }
                );

            var layoutButton = new ToolbarDropDownButton(LogicalLayoutLeafCommand);

            layoutButton.AddItems(
                new ToolbarButton(LogicalLayoutCommand)
            {
                ToggleOnClick = layoutButton
            },
                new ToolbarButton(ColumnsCommand)
            {
                ToggleOnClick = layoutButton
            },
                new ToolbarButton(OneColumnCommand)
            {
                ToggleOnClick = layoutButton
            },
                new ToolbarButton(FullLayoutCommand)
                );

            var dimensionButton = new ToolbarDropDownButton(DimensionXCommand);

            dimensionButton.AddItems(
                new ToolbarButton(DimensionYCommand)
            {
                ToggleOnClick = dimensionButton
            }
                );

            this.AddItems(
                layoutButton,
                horizontalButton,
                verticalButton,
                dimensionButton,
                new ToolbarButton(UndoCommand),
                new ToolbarSeparator()
                );
        }
 public CrossViewMethod(ICommandView commandView, EventHandler <T> eventHandler)
 {
     CommandView   = commandView;
     _eventHandler = eventHandler;
 }
 public ToolbarDropDownButton(ICommandView command) : base(command)
 {
 }
Exemple #20
0
        protected virtual void Compose()
        {
            BoldButton = new ToolbarButton {
                IsCheckable = true
            };
            BoldCommand = new CommandView {
                Action = s => ToggleAttribute <FontWeightTextAttribute> (
                    (a, bold) => a.Weight = (bold ? FontWeight.Bold : FontWeight.Normal), BoldButton),
                Image       = Iconery.FontBoldIcon,
                Size        = DefaultSize,
                ToolTipText = "Bold"
            };
            BoldButton.SetCommand(BoldCommand);

            ItalicButton = new ToolbarButton {
                IsCheckable = true
            };
            ItalicCommand = new CommandView {
                Action = s => ToggleAttribute <FontStyleTextAttribute> (
                    (a, italic) => a.Style = (italic ? FontStyle.Italic : FontStyle.Normal), ItalicButton),
                Image       = Iconery.FontItalicIcon,
                Size        = DefaultSize,
                ToolTipText = "Italic"
            };
            ItalicButton.SetCommand(ItalicCommand);

            StrikeThroughButton = new ToolbarButton {
                IsCheckable = true
            };
            StrikeThroughCommand = new CommandView {
                Action = s => ToggleAttribute <StrikethroughTextAttribute> (
                    (a, value) => a.Strikethrough = value, StrikeThroughButton),
                Image       = Iconery.FontStrikeThroughIcon,
                Size        = DefaultSize,
                ToolTipText = "StrikeThrough"
            };
            StrikeThroughButton.SetCommand(StrikeThroughCommand);

            UnderlineButton = new ToolbarButton {
                IsCheckable = true
            };
            UnderlineCommand = new CommandView {
                Action = s => ToggleAttribute <UnderlineTextAttribute> (
                    (a, value) => a.Underline = value, UnderlineButton),
                Image       = Iconery.FontUnderlineIcon,
                Size        = DefaultSize,
                ToolTipText = "Underline"
            };
            UnderlineButton.SetCommand(UnderlineCommand);

            FontFamilyCombo = new ComboBox {
                Width = 100
            };
            Font.AvailableFontFamilies.ForEach(f =>
                                               FontFamilyCombo.Items.Add(f));
            FontFamilyCombo.SelectionChanged += (s, e) => {
                var attr = new FontDataAttribute {
                    FontFamily = FontFamilyCombo.SelectedItem as string
                };
                TextViewer.SetAttribute(attr);
            };

            var fontFamilyComboHost = new ToolbarItemHost {
                Child = FontFamilyCombo
            };

            FontSizeCombo = new ComboBox {
                Width = 50
            };
            new int[] { 6, 8, 10, 12, 14, 16, 18, 24, 32 }
            .ForEach(s => FontSizeCombo.Items.Add(s.ToString()));

            FontSizeCombo.SelectionChanged += (s, e) => {
                var i = -1d;
                if (FontSizeCombo.SelectedItem != null && double.TryParse(FontSizeCombo.SelectedItem.ToString(), out i))
                {
                    var attr = new FontDataAttribute {
                        FontSize = i
                    };
                    TextViewer.SetAttribute(attr);
                }
            };
            var fontSizeComboHost = new ToolbarItemHost {
                Child = FontSizeCombo
            };

            this.AddItems(BoldButton, ItalicButton, UnderlineButton, StrikeThroughButton,
                          fontFamilyComboHost, fontSizeComboHost);
        }
Exemple #21
0
 /// <summary>
 /// Konstruktor.
 /// </summary>
 /// <param name="viewManager">Obiekt menadżera widoków.</param>
 /// <param name="view">Obiekt zarządzanego przez prezentera widoku.</param>
 /// <param name="appManager">Menadżer aplikacji.</param>
 public ExitCommandPresenter(IViewManager viewManager, ICommandView view, ApplicationManager appManager)
     : base(viewManager, view)
 {
     this.applicationManager = appManager;
 }
Exemple #22
0
 public void SetCommand(ICommandView command)
 {
     VidgetUtils.SetCommand(this, command);
 }
 public CommandViewModel(FrameworkElement view, ICommandView commandView)
 {
     View = view;
     Icon = commandView.Icon;
 }
Exemple #24
0
 /// <summary>
 /// Konstruktor.
 /// </summary>
 /// <param name="viewManager">Obiekt menadżera widoków.</param>
 /// <param name="view">Obiekt zarządzanego przez prezentera widoku.</param>
 /// <param name="subtitlesManager">Obiekt menadżera zarządzającego obiektami reprezentującymi napisy.</param>
 public OpenFileCommandPresenter(IViewManager viewManager, ICommandView view, SubtitlesManager subtitlesManager)
     : base(viewManager, view)
 {
     this.subtitlesManager = subtitlesManager;
 }
 public void RegisterMethod<T>(ICommandView commandView, Guid methodGuid, EventHandler<T> eventHandler)
 {
 }