public static DialogResult ShowAsDialog(string title, string path, out string fileName) { AddRename dlg = new AddRename { ViewModel = {FileName = Path.GetFileName(path)}, Title = title }; bool? res = dlg.ShowDialog(); fileName = null; if (res.GetValueOrDefault()) { fileName = dlg.ViewModel.FileName; return System.Windows.Forms.DialogResult.OK; } return System.Windows.Forms.DialogResult.Cancel; }
public static DialogResult ShowAsDialog(string title, string path, out string fileName) { AddRename dlg = new AddRename { ViewModel = { FileName = Path.GetFileName(path) }, Title = title }; bool?res = dlg.ShowDialog(); fileName = null; if (res.GetValueOrDefault()) { fileName = dlg.ViewModel.FileName; return(System.Windows.Forms.DialogResult.OK); } return(System.Windows.Forms.DialogResult.Cancel); }