本文整理汇总了C#中Gtk.Dialog.Hide方法的典型用法代码示例。如果您正苦于以下问题:C# Dialog.Hide方法的具体用法?C# Dialog.Hide怎么用?C# Dialog.Hide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Dialog
的用法示例。
在下文中一共展示了Dialog.Hide方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTextResponse
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 ();
}
}
示例2: OnAddPls
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);
}
示例3: HandleGeneratebuttonClicked
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 ();
}
示例4: GetTextResponse
// 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;
}
示例5: ReportError
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 ();
}