public BrowseResult Browse(BrowseParams browseParams) { if(browseParams==null) browseParams = new BrowseParams(); FileDialog dialog = new OpenFileDialog(); return OpenDialog(dialog, browseParams); }
public void Save(string text, BrowseParams browseParams) { var browseResult = browseFileService.Save(browseParams); if(browseResult.Cancel) return; File.WriteAllText(browseResult.FilePath, text, Encoding.UTF8); }
private BrowseResult OpenDialog(FileDialog dialog, BrowseParams browseParams) { using (new PreserveWorkingDirectory()) { browseParams.Apply(dialog); if (dialog.ShowDialog().GetValueOrDefault()) { return new BrowseResult(true, dialog.FileName); } return new BrowseResult(false, null); } }
public BrowseResult Save(BrowseParams browseParams) { var saveFileDialog = new SaveFileDialog(); return OpenDialog(saveFileDialog, browseParams); }