public static string ChooseFolder() { if (Platform.RunningOS == OS.Windows) { if (Win32.Win32PickFolder(null, out string result)) { return(result); } else { return(null); } } else if (Platform.RunningOS == OS.Linux) { if (kdialog) { return(KDialogChooseFolder()); } else if (parentWindow != IntPtr.Zero) { return(Gtk2.GtkFolder(parentWindow)); } else { return(Gtk3.GtkFolder()); } } else { //Mac throw new NotImplementedException(); } }
public static string ChooseFolder() { if (Platform.RunningOS == OS.Windows) { string result = null; using (var fbd = NewObj("System.Windows.Forms.FolderBrowserDialog")) { if (parentForm != null) { fbd.Parent = parentForm; } if (fbd.ShowDialog() == SwfOk() && !string.IsNullOrEmpty(fbd.SelectedPath)) { result = fbd.SelectedPath; } } return(result); } else if (Platform.RunningOS == OS.Linux) { if (kdialog) { throw new NotImplementedException(); } else if (parentWindow != IntPtr.Zero) { return(Gtk2.GtkFolder(parentWindow)); } else { return(Gtk3.GtkFolder()); } } else { //Mac throw new NotImplementedException(); } }