当前位置: 首页>>代码示例>>C#>>正文


C# Dialog.Hide方法代码示例

本文整理汇总了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 ();
				}
			}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:40,代码来源:MessageService.cs

示例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);
 }
开发者ID:nailyk,项目名称:banshee-community-extensions,代码行数:32,代码来源:CS_PlayListAdmin.cs

示例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 ();
 }
开发者ID:sgtnasty,项目名称:battle,代码行数:44,代码来源:Program.cs

示例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;
        }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:36,代码来源:MessageService.cs

示例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 ();
 }
开发者ID:sgtnasty,项目名称:battle,代码行数:26,代码来源:Program.cs


注:本文中的Gtk.Dialog.Hide方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。