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 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; }