public DialogResult ShowDialog(Window parent) { #if GTKCORE var adialog = new Gtk.AppChooserDialog( parent == null ? null : (parent.ControlObject as Gtk.Window), Gtk.DialogFlags.UseHeaderBar | Gtk.DialogFlags.DestroyWithParent, GLib.FileFactory.NewForPath(FilePath) ); #else var handle = parent == null ? IntPtr.Zero : (parent.ControlObject as Gtk.Window).Handle; var adialoghandle = NativeMethods.gtk_app_chooser_dialog_new(handle, 5, NativeMethods.g_file_new_for_path(FilePath)); var adialog = new Gtk.AppChooserDialog(adialoghandle); #endif if (adialog.Run() == (int)Gtk.ResponseType.Ok) { Process.Start(adialog.AppInfo.Executable, "\"" + FilePath + "\""); } #if GTKCORE adialog.Dispose(); #else adialog.Destroy(); #endif return(DialogResult.Ok); }
public DialogResult ShowDialog(Window parent) { var handle = parent == null ? IntPtr.Zero : (parent.ControlObject as Gtk.Window).Handle; var adialoghandle = NativeMethods.gtk_app_chooser_dialog_new(handle, 5, NativeMethods.g_file_new_for_path(FilePath)); var adialog = new Gtk.AppChooserDialog(adialoghandle); if (adialog.Run() == (int)Gtk.ResponseType.Ok) { Process.Start(adialog.AppInfo.Executable, "\"" + FilePath + "\""); } adialog.Destroy(); return(DialogResult.Ok); }