Exemplo n.º 1
0
        protected override bool Execute(object parameter)
        {
            ErrorHandler(() =>
            {
                if (_pageMgr.ActiveDocument != null)
                {
                    if (String.IsNullOrEmpty(_pageMgr.ActiveDocument.DocumentFilePath))
                    {
                        var fm = new FileFilterManager();
                        fm.AddCommandLineGuiFilter();
                        fm.AddAllFilesFilter();

                        var sfd = ControlFactory.CreateSaveFileDialog("Select a Gui Command Line file name", fm.ToString());

                        if (sfd.ShowDialog(new Win32Window(App.Current.MainWindow)) == System.Windows.Forms.DialogResult.OK)
                        {
                            _pageMgr.ActiveDocument.DocumentFilePath = sfd.FileName;

                            _pageMgr.SaveActive();
                        }
                    }
                    else
                    {
                        _pageMgr.SaveActive();
                    }
                }
            });

            return(base.Execute(parameter));
        }
Exemplo n.º 2
0
        protected override bool Execute(object parameter)
        {
            ErrorHandler(() =>
            {
                var fm = new FileFilterManager();
                fm.AddCommandLineGuiFilter();
                fm.AddAllFilesFilter();

                var ofd = ControlFactory.CreateOpenFileDialog("Select a Command Line Gui file", fm.ToString());

                if (ofd.ShowDialog(new Win32Window(App.Current.MainWindow)) == System.Windows.Forms.DialogResult.OK)
                {
                    var guiDocument = _pageMgr.Open(ofd.FileName);

                    if (guiDocument != null)
                    {
                        // activate loaded doc.
                        _pageMgr.ActiveDocument = guiDocument;
                    }
                }
            });

            return(base.Execute(parameter));
        }