示例#1
0
        protected override bool Execute(object parameter)
        {
            ErrorHandler(() =>
            {
                if (_pageMgr.ActiveDocument != null)
                {
                    var pm = new PersistenceManager();
                    pm.FileTypeProviders.Add(new CommandLineGuiFileTypeProvider());
                    pm.FileTypeProviders.Add(new BatchFileTypeProvider());

                    var sfd = ControlFactory.CreateSaveFileDialog("Select a Command Line Gui file name", pm.GetFileFilter(false));

                    if (sfd.ShowDialog(new Win32Window(App.Current.MainWindow)) == System.Windows.Forms.DialogResult.OK)
                    {
                        // SaveFileDialog uses a 1-based index for FilterIndex.
                        var provider = pm.FileTypeProviders[sfd.FilterIndex - 1];

                        if (sfd.FilterIndex == 1)
                        {
                            _pageMgr.ActiveDocument.DocumentFilePath = sfd.FileName;
                            _pageMgr.ActiveDocument.IsChanged        = false;
                        }

                        GuiDocumentManager.SaveAs(_pageMgr.ActiveDocument, sfd.FileName, provider);
                    }
                }
            });

            return(base.Execute(parameter));
        }
示例#2
0
        public FileSaveHandler(GuiDocumentManager pageMgr)
        {
            _pageMgr = pageMgr;

            Command = AppCommands.FileSave;
        }
示例#3
0
        public ToolExecuteHandler(GuiDocumentManager pageMgr)
        {
            _pageMgr = pageMgr;

            Command = AppCommands.ExecuteCommandLine;
        }
示例#4
0
        public EditCopyHandler(GuiDocumentManager pageMgr)
        {
            _pageMgr = pageMgr;

            Command = AppCommands.EditCopy;
        }
示例#5
0
        public FileOpenHandler(GuiDocumentManager pageMgr)
        {
            _pageMgr = pageMgr;

            Command = AppCommands.FileOpen;
        }
示例#6
0
        public ToolHelpHandler(GuiDocumentManager pageMgr)
        {
            _pageMgr = pageMgr;

            Command = AppCommands.ToolHelp;
        }
示例#7
0
        public NavigateUrlHandler(GuiDocumentManager pageMgr)
        {
            _pageMgr = pageMgr;

            Command = AppCommands.NavigateUrl;
        }
示例#8
0
        public EditModifiedHandler(GuiDocumentManager pageMgr)
        {
            _pageMgr = pageMgr;

            Command = AppCommands.Modified;
        }