Ejemplo n.º 1
0
        /// <summary>
        /// 注册文档工厂
        /// </summary>
        /// <param name="documentFactory">文档工厂.</param>
        public void Register(IDocumentFactory documentFactory)
        {
            documentFactories.Add(documentFactory.Extension, documentFactory);
            openFileDialog.Filter = AppendFilter(openFileDialog.Filter, documentFactory);

            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_FILE_OPEN, documentFactories.Count > 0);
        }
Ejemplo n.º 2
0
        private void UpdateCommandStatus()
        {
            bool enabled = Browser != null;

            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_VIEW_BACK, enabled && Browser.CanBack);
            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_VIEW_FORWARD, enabled && Browser.CanForward);
            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_VIEW_STOP, enabled && Browser.CanStop);
            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_VIEW_HOME, !String.IsNullOrEmpty(HomeUri));
            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_VIEW_REFRESH, enabled && Browser.CanRefresh);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Updates the command status.
        /// </summary>
        private void UpdateCommandStatus()
        {
            bool enabled = (activeDocument != null);

            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_FILE_OPEN, documentFactories.Count > 0 &&
                                            CanExecute(CommandHandlerNames.CMD_FILE_OPEN));
            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_FILE_SAVE, enabled && ActiveDocument.CanSave &&
                                            CanExecute(CommandHandlerNames.CMD_FILE_SAVE));
            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_FILE_SAVEAS, enabled && ActiveDocument.CanSave &&
                                            CanExecute(CommandHandlerNames.CMD_FILE_SAVEAS));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 更新命令处理器的状态
        /// </summary>
        private void UpdateCommandStatus()
        {
            bool enabled = (activeHandler != null);

            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_FILE_PRINT, enabled && activeHandler.CanPrint &&
                                            CanExecute(CommandHandlerNames.CMD_FILE_PRINT));
            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_FILE_QUICKPRINT, enabled && activeHandler.CanQuickPrint &&
                                            CanExecute(CommandHandlerNames.CMD_FILE_QUICKPRINT));
            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_FILE_PREVIEW, enabled && activeHandler.CanPreview &&
                                            CanExecute(CommandHandlerNames.CMD_FILE_PREVIEW));
            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_FILE_PAGESETUP, enabled && activeHandler.CanPageSetup &&
                                            CanExecute(CommandHandlerNames.CMD_FILE_PAGESETUP));
            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_FILE_DESIGN, enabled && activeHandler.CanDesign &&
                                            CanExecute(CommandHandlerNames.CMD_FILE_DESIGN));
        }
Ejemplo n.º 5
0
        private void UpdateCommandStatus()
        {
            bool enabled = (activeHandler != null);

            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_EDIT_UNDO, enabled && activeHandler.CanUndo &&
                                            CanExecute(CommandHandlerNames.CMD_EDIT_UNDO));
            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_EDIT_REDO, enabled && activeHandler.CanRedo &&
                                            CanExecute(CommandHandlerNames.CMD_EDIT_REDO));
            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_EDIT_CUT, enabled && activeHandler.CanCut &&
                                            CanExecute(CommandHandlerNames.CMD_EDIT_CUT));
            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_EDIT_COPY, enabled && activeHandler.CanCopy &&
                                            CanExecute(CommandHandlerNames.CMD_EDIT_COPY));
            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_EDIT_PASTE, enabled && activeHandler.CanPaste &&
                                            CanExecute(CommandHandlerNames.CMD_EDIT_PASTE));
            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_EDIT_DELETE, enabled && activeHandler.CanDelete &&
                                            CanExecute(CommandHandlerNames.CMD_EDIT_DELETE));
            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_EDIT_SELECTALL, enabled && activeHandler.CanSelectAll &&
                                            CanExecute(CommandHandlerNames.CMD_EDIT_SELECTALL));
            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_EDIT_SEARCH, enabled && activeHandler.CanSearch &&
                                            CanExecute(CommandHandlerNames.CMD_EDIT_SEARCH));
            BuilderUtility.SetCommandStatus(WorkItem, CommandHandlerNames.CMD_EDIT_REPLACE, enabled && activeHandler.CanReplace &&
                                            CanExecute(CommandHandlerNames.CMD_EDIT_REPLACE));
        }