Пример #1
0
        Xwt.Command ShowDialogWithParent(AddPackageSourceDialog dialog)
        {
            Xwt.WindowFrame parent = Xwt.Toolkit.CurrentEngine.WrapWindow(Toplevel);
            Xwt.Command     result = dialog.Run(parent);

            // Ensure dialog has focus after browsing for a folder.
            IdeServices.DesktopService.FocusWindow(parent);

            return(result);
        }
Пример #2
0
 public static bool ShowBreakpointProperties(ref BreakEvent bp, BreakpointType breakpointType = BreakpointType.Location)
 {
     using (var dlg = new BreakpointPropertiesDialog(bp, breakpointType)) {
         Xwt.Command response = dlg.Run();
         if (bp == null)
         {
             bp = dlg.GetBreakEvent();
         }
         return(response == Xwt.Command.Ok);
     }
 }
Пример #3
0
 public static Gtk.ResponseType ToResponseType(this Xwt.Command command)
 {
     if (command.Id == Command.Ok.Id)
     {
         return(Gtk.ResponseType.Ok);
     }
     if (command.Id == Command.Cancel.Id)
     {
         return(Gtk.ResponseType.Cancel);
     }
     if (command.Id == Command.Yes.Id)
     {
         return(Gtk.ResponseType.Yes);
     }
     if (command.Id == Command.No.Id)
     {
         return(Gtk.ResponseType.No);
     }
     if (command.Id == Command.Close.Id)
     {
         return(Gtk.ResponseType.Close);
     }
     if (command.Id == Command.Delete.Id)
     {
         return(Gtk.ResponseType.DeleteEvent);
     }
     if (command.Id == Command.Apply.Id)
     {
         return(Gtk.ResponseType.Accept);
     }
     if (command.Id == Command.Stop.Id)
     {
         return(Gtk.ResponseType.Reject);
     }
     return(Gtk.ResponseType.None);
 }
Пример #4
0
        /// <summary>Shows dialog</summary>
        /// <returns><value>True</value> if user want to proceed current operation, and <value>False</value> if user don't.</returns>
        public bool ShowDialog(Xwt.WindowFrame parent = null)
        {
            Build();
            Xwt.Command DialogResult = null;
            if (parent == null)
            {
                DialogResult = this.Run();
            }
            else
            {
                DialogResult = this.Run(parent);
            }
            //4beginners: xwtdialog.Run() == winform.ShowDialog() == vb6form.Show(vbModal);

            if (DialogResult == null)
            {
                return(false);
            }
            switch (DialogResult.Id)             //hack due to C# limitation (it's unable to do switch(){} on custon types)
            {
            case "Add":
            case "Apply":
            case "Clear":
            case "Copy":
            case "Cut":
            case "Delete":
            case "Ok":
            case "Paste":
            case "Remove":
            case "Save":
            case "SaveAs":
            case "Yes":
                return(true);
            }
            return(false);
        }