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(); } }