diff --git a/ShowEditorCommand.cs b/ShowEditorCommand.cs index 2a3678e..7c68b83 100644 --- a/ShowEditorCommand.cs +++ b/ShowEditorCommand.cs @@ -6,6 +6,7 @@ using System.Management.Automation.Runspaces; using System.Text; using Terminal.Gui; +using System.Collections.Generic; namespace psedit { @@ -68,11 +69,12 @@ protected override void ProcessRecord() new MenuBarItem ("_File", new MenuItem [] { new MenuItem ("_New", "", New), new MenuItem ("_Open", "", () => { - var dialog = new OpenDialog("Open file", "Open file"); + List allowedFileTypes = new List(); + allowedFileTypes.Add(".ps1"); + var dialog = new OpenDialog("Open file", "", allowedFileTypes); dialog.CanChooseDirectories = false; dialog.CanChooseFiles = true; dialog.AllowsMultipleSelection = false; - dialog.AllowedFileTypes = new [] {".ps1"}; Application.Run(dialog); @@ -381,8 +383,9 @@ private void Save(bool saveAs) { if (string.IsNullOrEmpty(Path) || saveAs) { - var dialog = new SaveDialog("Save file", "Save file"); - dialog.AllowedFileTypes = new string[] { ".ps1" }; + List allowedFileTypes = new List(); + allowedFileTypes.Add(".ps1"); + var dialog = new SaveDialog(saveAs ? "Save file as" : "Save file","", allowedFileTypes); Application.Run(dialog); if (dialog.FilePath.IsEmpty || dialog.Canceled == true || Directory.Exists(dialog.FilePath.ToString()))