コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: OpenWithDialogHandler.cs プロジェクト: zzlvff/Eto
        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);
        }