public override HistoryMemento PerformAction(DocumentWorkspace documentWorkspace)
        {
            string[]       fileNames;
            string         startingDir = Path.GetDirectoryName(documentWorkspace.FilePath);
            DialogResult   result      = DocumentWorkspace.ChooseFiles(documentWorkspace, out fileNames, true, startingDir);
            HistoryMemento retHA       = null;

            if (result == DialogResult.OK)
            {
                Type oldToolType = documentWorkspace.GetToolType();
                documentWorkspace.SetTool(null);

                retHA = ImportMultipleFiles(documentWorkspace, fileNames);

                Type newToolType;
                if (retHA != null)
                {
                    CompoundHistoryMemento cha = new CompoundHistoryMemento(StaticName, StaticImage, new HistoryMemento[] { retHA });
                    retHA       = cha;
                    newToolType = typeof(Tools.MoveTool);
                }
                else
                {
                    newToolType = oldToolType;
                }

                documentWorkspace.SetToolFromType(newToolType);
            }

            return(retHA);
        }
        public override void PerformAction(AppWorkspace appWorkspace)
        {
            string filePath;

            if (appWorkspace.ActiveDocumentWorkspace == null)
            {
                filePath = null;
            }
            else
            {
                // Default to the directory the active document came from
                string          fileName;
                FileType        fileType;
                SaveConfigToken saveConfigToken;
                appWorkspace.ActiveDocumentWorkspace.GetDocumentSaveOptions(out fileName, out fileType, out saveConfigToken);
                filePath = Path.GetDirectoryName(fileName);
            }

            string[]     newFileNames;
            DialogResult result = DocumentWorkspace.ChooseFiles(appWorkspace, out newFileNames, true, filePath);

            if (result == DialogResult.OK)
            {
                appWorkspace.OpenFilesInNewWorkspace(newFileNames);
            }
        }
Beispiel #3
0
        public override HistoryMemento PerformAction(DocumentWorkspace documentWorkspace)
        {
            string[]       strArray;
            string         directoryName = Path.GetDirectoryName(documentWorkspace.FilePath);
            DialogResult   result        = DocumentWorkspace.ChooseFiles(documentWorkspace, out strArray, true, directoryName);
            HistoryMemento memento       = null;

            if (result == DialogResult.OK)
            {
                System.Type type2;
                System.Type toolType = documentWorkspace.GetToolType();
                documentWorkspace.ClearTool();
                memento = this.ImportMultipleFiles(documentWorkspace, strArray);
                if (memento != null)
                {
                    HistoryMemento[]       actions  = new HistoryMemento[] { memento };
                    CompoundHistoryMemento memento2 = new CompoundHistoryMemento(StaticName, StaticImage, actions);
                    memento = memento2;
                    type2   = typeof(MoveSelectedPixelsTool);
                }
                else
                {
                    type2 = toolType;
                }
                documentWorkspace.SetToolFromType(type2);
            }
            return(memento);
        }
Beispiel #4
0
 public override void PerformAction(AppWorkspace appWorkspace)
 {
     if (appWorkspace.CanSetActiveWorkspace)
     {
         string   directoryName;
         string[] strArray;
         if (appWorkspace.ActiveDocumentWorkspace == null)
         {
             directoryName = null;
         }
         else
         {
             string          str2;
             FileType        type;
             SaveConfigToken token;
             appWorkspace.ActiveDocumentWorkspace.GetDocumentSaveOptions(out str2, out type, out token);
             directoryName = Path.GetDirectoryName(str2);
         }
         if (DocumentWorkspace.ChooseFiles(appWorkspace, out strArray, true, directoryName) == DialogResult.OK)
         {
             appWorkspace.OpenFilesInNewWorkspace(strArray);
         }
     }
 }