public void Run() { dlgAbout.Icon = new Gdk.Pixbuf(null, "lPhant.png"); dlgAbout.Run(); dlgAbout.Hide(); dlgAbout.Dispose(); }
void EditPlayer(Text text) { playerText = text; if (playerDialog == null) { Gtk.Dialog d = new Gtk.Dialog(Catalog.GetString("Select player"), this, DialogFlags.Modal | DialogFlags.DestroyWithParent, Stock.Cancel, ResponseType.Cancel); d.WidthRequest = 600; d.HeightRequest = 400; DrawingArea da = new DrawingArea(); TeamTagger tagger = new TeamTagger(new WidgetWrapper(da)); tagger.ShowSubstitutionButtons = false; tagger.LoadTeams(project.LocalTeamTemplate, project.VisitorTeamTemplate, project.Dashboard.FieldBackground); tagger.PlayersSelectionChangedEvent += players => { if (players.Count == 1) { Player p = players [0]; playerText.Value = p.ToString(); d.Respond(ResponseType.Ok); } tagger.ResetSelection(); }; d.VBox.PackStart(da, true, true, 0); d.ShowAll(); playerDialog = d; } if (playerDialog.Run() != (int)ResponseType.Ok) { text.Value = null; } playerDialog.Hide(); }
private void HandleOkClicked(object sender, EventArgs args) { this.Hide(); dialog.Hide(); System.Threading.Thread command_thread = new System.Threading.Thread(new System.Threading.ThreadStart(doSharpening)); command_thread.Name = "Sharpening"; progressDialog = new ThreadProgressDialog(command_thread, 1); progressDialog.Start(); }
void HandleOkClicked(object sender, EventArgs args) { Hide(); dialog.Hide(); var command_thread = new System.Threading.Thread(new System.Threading.ThreadStart(doSharpening)) { Name = "Sharpening" }; progressDialog = new ThreadProgressDialog(command_thread, 1); progressDialog.Start(); }
public void OnAddPls() { Hyena.Log.Information("add playlist"); Gtk.Dialog dlg = new Gtk.Dialog(); dlg.Title = "Add Playlist"; Gtk.Entry pls = new Gtk.Entry(); pls.WidthChars = 40; Gtk.Label lbl = new Gtk.Label("Playlist name:"); Gtk.HBox hb = new Gtk.HBox(); hb.PackStart(lbl, false, false, 1); hb.PackEnd(pls); dlg.VBox.PackStart(hb); dlg.AddButton(Gtk.Stock.Cancel, 0); dlg.AddButton(Gtk.Stock.Ok, 1); dlg.VBox.ShowAll(); string plsname = ""; while (plsname == "") { int response = dlg.Run(); if (response == 0) { dlg.Hide(); dlg.Destroy(); return; } else { plsname = pls.Text.Trim(); } } dlg.Hide(); dlg.Destroy(); _pls = _col.NewPlayList(plsname); _model.Reload(); _pls_model.SetPlayList(_pls); }
private void on_NewPhoneBookDialog_delete_event(object o, DeleteEventArgs args) { NewPhoneBookDialog.Hide(); NewPhoneBookDialog.Dispose(); args.RetVal = true; }
public string GetTextResponse (string question, string caption, string initialValue, bool isPassword) { string returnValue = null; Dialog md = new Dialog (caption, rootWindow, DialogFlags.Modal | DialogFlags.DestroyWithParent); try { // add a label with the question Label questionLabel = new Label(question); questionLabel.UseMarkup = true; questionLabel.Xalign = 0.0F; md.VBox.PackStart(questionLabel, true, false, 6); // add an entry with initialValue Entry responseEntry = (initialValue != null) ? new Entry(initialValue) : new Entry(); md.VBox.PackStart(responseEntry, false, true, 6); responseEntry.Visibility = !isPassword; // add action widgets md.AddActionWidget(new Button(Gtk.Stock.Cancel), ResponseType.Cancel); md.AddActionWidget(new Button(Gtk.Stock.Ok), ResponseType.Ok); md.VBox.ShowAll(); md.ActionArea.ShowAll(); md.HasSeparator = false; md.BorderWidth = 6; PlaceDialog (md, rootWindow); int response = md.Run (); md.Hide (); if ((ResponseType) response == ResponseType.Ok) { returnValue = responseEntry.Text; } return returnValue; } finally { md.Destroy (); } }
protected void OnRemapDialogCancel(object o, EventArgs e) { RemapDialog.Hide(); }
public void OnAddPls() { Hyena.Log.Information ("add playlist"); Gtk.Dialog dlg=new Gtk.Dialog(); dlg.Title="Add Playlist"; Gtk.Entry pls=new Gtk.Entry(); pls.WidthChars=40; Gtk.Label lbl=new Gtk.Label("Playlist name:"); Gtk.HBox hb=new Gtk.HBox(); hb.PackStart (lbl,false,false,1); hb.PackEnd (pls); dlg.VBox.PackStart (hb); dlg.AddButton (Gtk.Stock.Cancel,0); dlg.AddButton (Gtk.Stock.Ok,1); dlg.VBox.ShowAll (); string plsname=""; while (plsname=="") { int response=dlg.Run (); if (response==0) { dlg.Hide (); dlg.Destroy (); return; } else { plsname=pls.Text.Trim (); } } dlg.Hide (); dlg.Destroy (); _pls=_col.NewPlayList(plsname); _model.Reload (); _pls_model.SetPlayList (_pls); }
// call this method to show a dialog and get a response value // returns null if cancel is selected public string GetTextResponse(string question, string caption, string initialValue) { string returnValue = null; using (Gtk.Dialog md = new Gtk.Dialog (caption, (Gtk.Window) WorkbenchSingleton.Workbench, Gtk.DialogFlags.Modal | Gtk.DialogFlags.DestroyWithParent)) { // add a label with the question Gtk.Label questionLabel = new Gtk.Label(question); questionLabel.UseMarkup = true; questionLabel.Xalign = 0.0F; md.VBox.PackStart(questionLabel, true, false, 6); // add an entry with initialValue Gtk.Entry responseEntry = (initialValue != null) ? new Gtk.Entry(initialValue) : new Gtk.Entry(); md.VBox.PackStart(responseEntry, false, true, 6); // add action widgets md.AddActionWidget(new Gtk.Button(Gtk.Stock.Cancel), Gtk.ResponseType.Cancel); md.AddActionWidget(new Gtk.Button(Gtk.Stock.Ok), Gtk.ResponseType.Ok); md.VBox.ShowAll(); md.ActionArea.ShowAll(); md.HasSeparator = false; md.BorderWidth = 6; int response = md.Run (); md.Hide (); if ((Gtk.ResponseType) response == Gtk.ResponseType.Ok) { returnValue = responseEntry.Text; } } return returnValue; }
private void on_cancelbutton_clicked(object o, EventArgs args) { cancel = true; PasswordDialog.Hide(); }
void HandleGeneratebuttonClicked(object sender, EventArgs e) { Dialog d = new Dialog ("Generate Seed", this.window, DialogFlags.DestroyWithParent, Stock.Ok, ResponseType.Ok, Stock.Cancel, ResponseType.Cancel); HBox hbox1 = new HBox (false, 0); Image icon = new Image (); icon.SetFromStock (Stock.DialogQuestion, IconSize.Dialog); Label l1 = new Label (); l1.Text = "<span weight=\"bold\" size=\"x-large\">Enter in a seed for the random name generator below.</span>"; l1.UseMarkup = true; hbox1.PackStart (icon, false, true, 0); hbox1.PackEnd (l1, false, true, 0); HBox hbox2 = new HBox (false, 0); Random r = new Random (DateTime.Now.Millisecond); Entry entry = new Entry (r.Next ().ToString ()); hbox2.PackStart (new Label ("Enter seed integer:"), false, true, 0); hbox2.PackEnd (entry); d.VBox.PackStart (hbox1, false, true, 0); d.VBox.PackEnd (hbox2, true, true, 0); d.ShowAll (); int result = d.Run (); if ((ResponseType)result == ResponseType.Ok) { try { int seed = Convert.ToInt32 (entry.Text); this.HandleGenerateName (seed); } catch (ArgumentNullException ex) { this.ReportError (ex); } catch (FormatException ex) { this.ReportError (ex); } catch (OverflowException ex) { this.ReportError (ex); } } d.Hide (); d.Destroy (); }
public void ReportError(Exception ex) { Dialog d = new Dialog (ex.GetType ().ToString (), this.window, DialogFlags.DestroyWithParent, Stock.Ok, ResponseType.Ok); Image icon = new Image (); icon.SetFromStock (Stock.DialogError, IconSize.Dialog); Label l1 = new Label (); l1.Text = "<span weight=\"bold\" size=\"x-large\">" + ex.GetType ().ToString () + "</span>"; l1.UseMarkup = true; HBox hbox = new HBox (false, 0); hbox.PackStart (icon, false, true, 0); hbox.PackEnd (l1, true, true, 0); d.VBox.PackStart (hbox, false, true, 0); d.VBox.PackStart (new Label (ex.Message), false, true, 0); d.VBox.PackStart (new Label (ex.Source), false, true, 0); ScrolledWindow sw = new ScrolledWindow (); TextView tv = new TextView (); tv.Editable = false; tv.Buffer.Text = ex.StackTrace; sw.Add (tv); d.VBox.PackEnd (sw, true, true, 0); d.ShowAll (); d.Run (); d.Hide (); d.Destroy (); }
private static Gtk.ResponseType showErrDialog(Exception e, bool canContinue) { Gtk.Table pnlError; Gtk.Image pctError; Gtk.Label lblError; Gtk.ScrolledWindow scrError; Gtk.TextView txtError; Gtk.Button cmdReport; Gtk.Button cmdIgnore; Gtk.Button cmdExit; pnlError = new Gtk.Table(2, 2, false); pnlError.Name = "pnlError"; pnlError.RowSpacing = 6; pnlError.ColumnSpacing = 6; pctError = new Gtk.Image(); pctError.Name = "pctError"; pctError.Xpad = 8; pctError.Ypad = 8; if (CurrentOS.IsMac) { pctError.Pixbuf = Gdk.Pixbuf.LoadFromResource("RestrictionTrackerGTK.Resources.config.os_x.advanced_nettest_error.png"); } else { pctError.Pixbuf = Gdk.Pixbuf.LoadFromResource("RestrictionTrackerGTK.Resources.config.linux.advanced_nettest_error.png"); } pnlError.Attach(pctError, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0); lblError = new Gtk.Label(); lblError.Name = "lblError"; lblError.Xalign = 0F; lblError.Yalign = 0.5F; if (e.TargetSite == null) { lblError.LabelProp = "<span size=\"12000\" weight=\"bold\">" + modFunctions.ProductName + " has Encountered an Error</span>"; } else { lblError.LabelProp = "<span size=\"12000\" weight=\"bold\">" + modFunctions.ProductName + " has Encountered an Error in " + e.TargetSite.Name + "</span>"; } var signal = GLib.Signal.Lookup(lblError, "size-allocate", typeof(SizeAllocatedArgs)); signal.AddDelegate(new EventHandler <SizeAllocatedArgs>(SizeAllocateLabel)); lblError.LineWrap = true; lblError.UseMarkup = true; pnlError.Attach(lblError, 1, 2, 0, 1, AttachOptions.Shrink | AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 0, 0); scrError = new Gtk.ScrolledWindow(); scrError.Name = "scrError"; scrError.VscrollbarPolicy = PolicyType.Automatic; scrError.HscrollbarPolicy = PolicyType.Never; scrError.ShadowType = ShadowType.In; txtError = new Gtk.TextView(); txtError.CanFocus = true; txtError.Name = "txtError"; txtError.Editable = false; txtError.AcceptsTab = false; txtError.WrapMode = WrapMode.Word; scrError.Add(txtError); pnlError.Attach(scrError, 1, 2, 1, 2, AttachOptions.Shrink | AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink | AttachOptions.Fill | AttachOptions.Expand, 0, 0); txtError.Buffer.Text = "Error: " + e.Message; if (!string.IsNullOrEmpty(e.StackTrace)) { if (e.StackTrace.Contains("\n")) { txtError.Buffer.Text += "\n" + e.StackTrace.Substring(0, e.StackTrace.IndexOf("\n")); } else { txtError.Buffer.Text += "\n" + e.StackTrace; } } else { if (!string.IsNullOrEmpty(e.Source)) { txtError.Buffer.Text += "\n @ " + e.Source; if (e.TargetSite != null) { txtError.Buffer.Text += "." + e.TargetSite.Name; } } else { if (e.TargetSite != null) { txtError.Buffer.Text += "\n @ " + e.TargetSite.Name; } } } cmdReport = new Gtk.Button(); cmdReport.CanDefault = true; cmdReport.CanFocus = true; cmdReport.Name = "cmdReport"; cmdReport.UseUnderline = false; cmdReport.Label = "Report Error"; if (canContinue) { cmdIgnore = new Gtk.Button(); cmdIgnore.CanDefault = true; cmdIgnore.CanFocus = true; cmdIgnore.Name = "cmdIgnore"; cmdIgnore.UseUnderline = false; cmdIgnore.Label = "Ignore and Continue"; } else { cmdIgnore = null; } cmdExit = new global::Gtk.Button(); cmdExit.CanFocus = true; cmdExit.Name = "cmdExit"; cmdExit.UseUnderline = true; cmdExit.Label = global::Mono.Unix.Catalog.GetString("Exit Application"); Gtk.Dialog dlgErr = new Gtk.Dialog("Error in " + modFunctions.ProductName, null, DialogFlags.Modal | DialogFlags.DestroyWithParent, cmdReport); dlgErr.TypeHint = Gdk.WindowTypeHint.Dialog; dlgErr.WindowPosition = WindowPosition.CenterAlways; dlgErr.SkipPagerHint = true; dlgErr.SkipTaskbarHint = true; dlgErr.AllowShrink = true; dlgErr.AllowGrow = true; VBox pnlErrorDialog = dlgErr.VBox; pnlErrorDialog.Name = "pnlErrorDialog"; pnlErrorDialog.BorderWidth = 2; pnlErrorDialog.Add(pnlError); Box.BoxChild pnlError_BC = (Box.BoxChild)pnlErrorDialog[pnlError]; pnlError_BC.Position = 0; Gtk.HButtonBox dlgErrorAction = dlgErr.ActionArea; dlgErrorAction.Name = "dlgErrorAction"; dlgErrorAction.Spacing = 10; dlgErrorAction.BorderWidth = 5; dlgErrorAction.LayoutStyle = ButtonBoxStyle.End; dlgErr.AddActionWidget(cmdReport, ResponseType.Ok); if (canContinue) { dlgErr.AddActionWidget(cmdIgnore, ResponseType.No); } dlgErr.AddActionWidget(cmdExit, ResponseType.Reject); dlgErr.ShowAll(); Gdk.Geometry minGeo = new Gdk.Geometry(); minGeo.MinWidth = dlgErr.Allocation.Width; minGeo.MinHeight = dlgErr.Allocation.Height; if (minGeo.MinWidth > 1 & minGeo.MinHeight > 1) { dlgErr.SetGeometryHints(null, minGeo, Gdk.WindowHints.MinSize); } Gtk.ResponseType dRet; do { dRet = (Gtk.ResponseType)dlgErr.Run(); } while (dRet == ResponseType.None); dlgErr.Hide(); dlgErr.Destroy(); dlgErr = null; return(dRet); }