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 Open(FileDialogFilters filters = null) { if (Platform.RunningOS == OS.Windows) { if (Win32.Win32OpenDialog(Win32.ConvertFilters(filters), null, out string result)) { return(result); } else { return(null); } } else if (Platform.RunningOS == OS.Linux) { if (kdialog) { return(KDialogOpen(filters)); } else if (parentWindow != IntPtr.Zero) { return(Gtk2.GtkOpen(parentWindow, filters)); } else { return(Gtk3.GtkOpen(filters)); } } else { //Mac throw new NotImplementedException(); } }
public static string Open(FileDialogFilters filters = null) { if (Platform.RunningOS == OS.Windows) { string result = null; using (var ofd = NewObj("System.Windows.Forms.OpenFileDialog")) { if (parentForm != null) { ofd.Parent = parentForm; } if (filters != null) { ofd.Filter = SwfFilter(filters); } if (ofd.ShowDialog() == SwfOk()) { result = ofd.FileName; } } WinformsDoEvents(); return(result); } else if (Platform.RunningOS == OS.Linux) { if (kdialog) { return(KDialogOpen()); } else if (parentWindow != IntPtr.Zero) { return(Gtk2.GtkOpen(parentWindow, filters)); } else { return(Gtk3.GtkOpen(filters)); } } 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(); } }