OpenFileAction.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System.IO;
  2. using System.Windows.Forms;
  3. namespace PaintDotNet.Actions
  4. {
  5. internal sealed class OpenFileAction : AppWorkspaceAction
  6. {
  7. public override void PerformAction(AppWorkspace appWorkspace)
  8. {
  9. string filePath;
  10. if (appWorkspace.ActiveDocumentWorkspace == null)
  11. {
  12. filePath = null;
  13. }
  14. else
  15. {
  16. string fileName;
  17. //FileType fileType;
  18. //SaveConfigToken saveConfigToken;
  19. appWorkspace.ActiveDocumentWorkspace.GetDocumentSaveOptions(out fileName/*, out fileType, out saveConfigToken*/);
  20. filePath = Path.GetDirectoryName(fileName);
  21. }
  22. string[] newFileNames;
  23. DialogResult result = DocumentWorkspace.ChooseFiles(appWorkspace, out newFileNames, true, filePath);
  24. if (result == DialogResult.OK)
  25. {
  26. appWorkspace.OpenFilesInNewWorkspace(newFileNames);
  27. }
  28. }
  29. public OpenFileAction()
  30. {
  31. }
  32. }
  33. }