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


C# Dialog.Destroy方法代码示例

本文整理汇总了C#中Gtk.Dialog.Destroy方法的典型用法代码示例。如果您正苦于以下问题:C# Dialog.Destroy方法的具体用法?C# Dialog.Destroy怎么用?C# Dialog.Destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk.Dialog的用法示例。


在下文中一共展示了Dialog.Destroy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: onClick

 private void onClick(object Sender, EventArgs e)
 {
     Dialog d = new Dialog ("Test", this, DialogFlags.DestroyWithParent);
     d.Modal = true;
     d.AddButton ("Close", ResponseType.Close);
     d.Run ();
     d.Destroy ();
 }
开发者ID:MASGAU,项目名称:gtk-sharp-ribbon,代码行数:8,代码来源:DropdownGroupTest.cs

示例2: RunDialog

		private bool RunDialog (Dialog dlg)
		{
			bool result = false;
			try {	
				if (dlg.Run () == (int)ResponseType.Ok)
					result = true;
			} finally {
				dlg.Destroy ();
			}
			return result;
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:10,代码来源:SqlServerGuiProvider.cs

示例3: TakePwd

        internal static string TakePwd (Window parentWindow, string challengePwd, string experimentPwd)
        {              
            var passwordPickerDialog = new InsertPassword ();       
            string passwordFromUser = null;
            if (passwordPickerDialog.Run () == (int)Gtk.ResponseType.Ok) {
                //check pwds here
                passwordFromUser = passwordPickerDialog.userEnteredPassword;
                if (string.IsNullOrEmpty (passwordFromUser)) {
                    //show alert dialog
                    Dialog dialog = new Dialog (
                        "Warning",
                        parentWindow,
                        DialogFlags.Modal,
                        "Close", ResponseType.Ok
                        );

                    dialog.VBox.Add (new Label ("Please insert a valid password")); 
                    dialog.ShowAll ();
                    dialog.Run ();
                    dialog.Destroy ();

                    return null;

                } else if (!checkPasswords (passwordFromUser, challengePwd, experimentPwd)) {
                    //show alert
                    Dialog dialog = new Dialog (
                        "Warning",
                        parentWindow,
                        DialogFlags.Modal,
                        "Close", ResponseType.Ok
                        );

                    dialog.VBox.Add (new Label ("Entered password is not valid")); 
                    dialog.ShowAll ();
                    dialog.Run ();
                    dialog.Destroy ();

                    return null;
                }

                return passwordFromUser;
            } 

            passwordPickerDialog.Destroy ();
            return null;  
        }
开发者ID:CoEST,项目名称:TraceLab,代码行数:46,代码来源:PasswordDialog.cs

示例4: RunDialog

        private bool RunDialog(Dialog dlg)
        {
            bool result = false;
            // If the Preview Dialog is canceled, don't execute and don't close the Editor Dialog.
            try {
                int resp;
                    do {
                        resp = dlg.Run ();
                         } while (resp != (int)ResponseType.Cancel && resp != (int)ResponseType.Ok &&
                         resp != (int)ResponseType.DeleteEvent);

                if (resp == (int)ResponseType.Ok)
                    result = true;
                else
                    result = false;
            } finally {
                dlg.Destroy ();
            }
            return result;
        }
开发者ID:schamane,项目名称:monodevelop-mongodb-provider,代码行数:20,代码来源:MongoDbGuiProvider.cs

示例5: DeadlineButton_Clicked

 void DeadlineButton_Clicked(object sender, EventArgs e)
 {
     var dialog = new Dialog ("Sample", null, DialogFlags.DestroyWithParent);
     dialog.Modal = true;
     dialog.AddButton ("Cancel", ResponseType.Cancel);
     dialog.AddButton ("OK", ResponseType.Ok);
     dialog.ContentArea.Add (calendar);
     calendar.Show ();
     if (dialog.Run () == (int)ResponseType.Ok) {
         deadlineButton.Label = calendar.Date.ToShortDateString ();
     }
     dialog.Destroy ();
 }
开发者ID:loganek,项目名称:loganek-planer,代码行数:13,代码来源:TaskEditor.cs

示例6: OnCellBeginEdit

 /// <summary>
 /// User is about to edit a cell.
 /// </summary>
 /// <param name="sender">The sender of the event</param>
 /// <param name="e">The event arguments</param>
 private void OnCellBeginEdit(object sender, EditingStartedArgs e)
 {
     this.userEditingCell = true;
     IGridCell where = GetCurrentCell;
     if (where.RowIndex >= DataSource.Rows.Count)
     {
         for (int i = DataSource.Rows.Count; i <= where.RowIndex; i++)
         {
             DataRow row = DataSource.NewRow();
             DataSource.Rows.Add(row);
         }
     }
     this.valueBeforeEdit = this.DataSource.Rows[where.RowIndex][where.ColumnIndex];
     Type dataType = this.valueBeforeEdit.GetType();
     if (dataType == typeof(DateTime))
     {
         Dialog dialog = new Dialog("Select date", gridview.Toplevel as Window, DialogFlags.DestroyWithParent);
         dialog.SetPosition(WindowPosition.None);
         VBox topArea = dialog.VBox;
         topArea.PackStart(new HBox());
         Calendar calendar = new Calendar();
         calendar.DisplayOptions = CalendarDisplayOptions.ShowHeading |
                              CalendarDisplayOptions.ShowDayNames |
                              CalendarDisplayOptions.ShowWeekNumbers;
         calendar.Date = (DateTime)this.valueBeforeEdit;
         topArea.PackStart(calendar, true, true, 0);
         dialog.ShowAll();
         dialog.Run();
         // What SHOULD we do here? For now, assume that if the user modified the date in the calendar dialog,
         // the resulting date is what they want. Otherwise, keep the text-editing (Entry) widget active, and
         // let the user enter a value manually.
         if (calendar.Date != (DateTime)this.valueBeforeEdit)
         {
             DateTime date = calendar.GetDate();
             this.DataSource.Rows[where.RowIndex][where.ColumnIndex] = date;
             CellRendererText render = sender as CellRendererText;
             if (render != null)
             {
                 render.Text = String.Format("{0:d}", date);
                 if (e.Editable is Entry)
                 {
                     (e.Editable as Entry).Text = render.Text;
                     (e.Editable as Entry).Destroy();
                     this.userEditingCell = false;
                     if (this.CellsChanged != null)
                     {
                         GridCellsChangedArgs args = new GridCellsChangedArgs();
                         args.ChangedCells = new List<IGridCell>();
                         args.ChangedCells.Add(this.GetCell(where.ColumnIndex, where.RowIndex));
                         this.CellsChanged(this, args);
                     }
                 }
             }
         }
         dialog.Destroy();
     }
 }
开发者ID:hol353,项目名称:ApsimX,代码行数:62,代码来源:GridView.cs

示例7: RunChangeLogDlg

        public static void RunChangeLogDlg(Gtk.Window parent)
        {
            Dialog HistoryDialog = new Dialog ("История версий программы", parent, Gtk.DialogFlags.DestroyWithParent);
            HistoryDialog.Modal = true;
            HistoryDialog.AddButton ("Закрыть", ResponseType.Close);

            System.IO.StreamReader HistoryFile = new System.IO.StreamReader ("changes.txt");
            TextView HistoryTextView = new TextView ();
            HistoryTextView.WidthRequest = 700;
            HistoryTextView.WrapMode = WrapMode.Word;
            HistoryTextView.Sensitive = false;
            HistoryTextView.Buffer.Text = HistoryFile.ReadToEnd ();
            Gtk.ScrolledWindow ScrollW = new ScrolledWindow ();
            ScrollW.HeightRequest = 500;
            ScrollW.Add (HistoryTextView);
            HistoryDialog.VBox.Add (ScrollW);

            HistoryDialog.ShowAll ();
            HistoryDialog.Run ();
            HistoryDialog.Destroy ();
        }
开发者ID:QualitySolution,项目名称:QSProjects,代码行数:21,代码来源:QSMain.cs

示例8: buttonOKClickedHandler

        protected void buttonOKClickedHandler (object sender, EventArgs e)
        {
           
            string fileName = tbx_fileName.Text.Trim ();
            string fileNameAndPath;
            if (!fileName.EndsWith (s_fileExtension)) {
                fileName += s_fileExtension;
            }
            fileNameAndPath = tbx_dirPath.Text + System.IO.Path.DirectorySeparatorChar + fileName;

            //warn the user if the file already exists
            if (System.IO.File.Exists (fileNameAndPath)) {
                //show message dialog
                Dialog dialog = null;
                ResponseType response = ResponseType.None;

                try {
                    dialog = new Dialog (
                        "Warning",
                        this,
                        DialogFlags.DestroyWithParent | DialogFlags.Modal,
                        "Ok", ResponseType.Yes,
                        "No", ResponseType.No
                    );
                    dialog.VBox.Add (new Label ("\n\n" + OVERWIRTE_WARNING_MESSAGE + "  \n"));
                    dialog.ShowAll ();

                    response = (ResponseType)dialog.Run ();
      
                    dialog.Destroy ();
                    if (response == ResponseType.No)
                        Results = false;
                    else 
                        Results = true;
                
                } catch (Exception ex) {
                    Console.WriteLine (ex.ToString ());
                }            
            } else {
                Results = true;
            } 

                _experiment.ExperimentInfo.Name = tbx_experimentName.Text;
                //_experiment.ExperimentInfo.FilePath= flw_choseFile.CurrentFolder +"/"+ fileName;
                _experiment.ExperimentInfo.FilePath = fileNameAndPath;//tbx_dirPath.Text +"/"+ fileName;
                _experiment.ExperimentInfo.Author = tbx_author.Text;
                _experiment.ExperimentInfo.Description = tbx_description.Buffer.Text;

                this.Destroy ();
      
        }
开发者ID:CoEST,项目名称:TraceLab,代码行数:51,代码来源:NewExperimentDialog.cs

示例9: 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

示例10: OnConfigureButtonClicked

        /// <summary>
        /// Activated when the user clicks the "Configure" button. Opens a new dialog containing the configuration
        /// widget of the selected plugin
        /// </summary>
        /// <param name="sender">
        /// A <see cref="System.Object"/> -- not used
        /// </param>
        /// <param name="e">
        /// A <see cref="EventArgs"/> -- not used
        /// </param>
        void OnConfigureButtonClicked(object sender, EventArgs e)
        {
            LiveRadioPluginListModel model = plugin_view.Model as LiveRadioPluginListModel;
            ILiveRadioPlugin plugin = model[plugin_view.Model.Selection.FocusedIndex];

            Dialog dialog = new Dialog ();
            dialog.Title = String.Format ("LiveRadio Plugin {0} configuration", plugin.Name);
            dialog.IconName = "gtk-preferences";
            dialog.Resizable = false;
            dialog.BorderWidth = 6;
            dialog.ContentArea.Spacing = 12;

            dialog.ContentArea.PackStart (plugin.ConfigurationWidget, false, false, 0);

            Button save_button = new Button (Stock.Save);
            Button cancel_button = new Button (Stock.Cancel);

            dialog.AddActionWidget (cancel_button, 0);
            dialog.AddActionWidget (save_button, 0);

            cancel_button.Clicked += delegate { dialog.Destroy (); };
            save_button.Clicked += delegate {
                plugin.SaveConfiguration ();
                dialog.Destroy ();
            };

            dialog.ShowAll ();
        }
开发者ID:nailyk,项目名称:banshee-community-extensions,代码行数:38,代码来源:LiveRadioSourceContents.cs

示例11: OnAddActionActivated

        protected virtual void OnAddActionActivated(object sender, System.EventArgs e)
        {
            ResponseType result;
            if(SimpleMode)
            {
                NewNode = true;
                editNode = new Dialog("Новый " + nameNode, this, Gtk.DialogFlags.DestroyWithParent);
                BuildSimpleEditorDialog ();
                editNode.ShowAll();
                result = (ResponseType) editNode.Run ();
                inputNameEntry.Destroy();
                editNode.Destroy ();
            }
            else
            {
                //Вызываем событие в основном приложении для запуска диалога элемента справочника
                result = OnRunReferenceItemDlg (TableRef, true, -1, ParentId);
            }

            if (result == ResponseType.Ok)
            {
                UpdateList();
                RefChanged = true;
            }
        }
开发者ID:QualitySolution,项目名称:QSProjects,代码行数:25,代码来源:Reference.cs

示例12: ShowLog

        void ShowLog(string text)
        {
            Dialog HistoryDialog = new Dialog("Лог работы модуля распознования.", this, Gtk.DialogFlags.DestroyWithParent);
            HistoryDialog.Modal = true;
            HistoryDialog.AddButton ("Закрыть", ResponseType.Close);

            TextView HistoryTextView = new TextView();
            HistoryTextView.WidthRequest = 700;
            HistoryTextView.WrapMode = WrapMode.Word;
            HistoryTextView.Sensitive = false;
            HistoryTextView.Buffer.Text = text;
            Gtk.ScrolledWindow ScrollW = new ScrolledWindow();
            ScrollW.HeightRequest = 500;
            ScrollW.Add (HistoryTextView);
            HistoryDialog.VBox.Add (ScrollW);

            HistoryDialog.ShowAll ();
            HistoryDialog.Run ();
            HistoryDialog.Destroy ();
        }
开发者ID:Badou03080,项目名称:earchive,代码行数:20,代码来源:InputDocs.cs

示例13: OnAdvancedSyncConfigButton

		private void OnAdvancedSyncConfigButton (object sender, EventArgs args)
		{
			// Get saved behavior
			SyncTitleConflictResolution savedBehavior = SyncTitleConflictResolution.Cancel;
			object dlgBehaviorPref = Preferences.Get (Preferences.SYNC_CONFIGURED_CONFLICT_BEHAVIOR);
			if (dlgBehaviorPref != null && dlgBehaviorPref is int) // TODO: Check range of this int
				savedBehavior = (SyncTitleConflictResolution)dlgBehaviorPref;

			// Create dialog
			Gtk.Dialog advancedDlg =
			        new Gtk.Dialog (Catalog.GetString ("Other Synchronization Options"),
			                        this,
			                        Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal | Gtk.DialogFlags.NoSeparator,
			                        Gtk.Stock.Close, Gtk.ResponseType.Close);
			// Populate dialog
			Gtk.Label label =
			        new Gtk.Label (Catalog.GetString ("When a conflict is detected between " +
			                                          "a local note and a note on the configured " +
			                                          "synchronization server:"));
			label.Wrap = true;
			label.Xalign = 0;

			promptOnConflictRadio =
			        new Gtk.RadioButton (Catalog.GetString ("Always ask me what to do."));
			promptOnConflictRadio.Toggled += OnConflictOptionToggle;

			renameOnConflictRadio =
			        new Gtk.RadioButton (promptOnConflictRadio, Catalog.GetString ("Rename my local note."));
			renameOnConflictRadio.Toggled += OnConflictOptionToggle;

			overwriteOnConflictRadio =
			        new Gtk.RadioButton (promptOnConflictRadio, Catalog.GetString ("Replace my local note with the server's update."));
			overwriteOnConflictRadio.Toggled += OnConflictOptionToggle;

			switch (savedBehavior) {
			case SyncTitleConflictResolution.RenameExistingNoUpdate:
				renameOnConflictRadio.Active = true;
				break;
			case SyncTitleConflictResolution.OverwriteExisting:
				overwriteOnConflictRadio.Active = true;
				break;
			default:
				promptOnConflictRadio.Active = true;
				break;
			}

			Gtk.VBox vbox = new Gtk.VBox ();
			vbox.BorderWidth = 18;

			vbox.PackStart (promptOnConflictRadio);
			vbox.PackStart (renameOnConflictRadio);
			vbox.PackStart (overwriteOnConflictRadio);

			advancedDlg.VBox.PackStart (label, false, false, 6);
			advancedDlg.VBox.PackStart (vbox, false, false, 0);

			advancedDlg.ShowAll ();

			// Run dialog
			advancedDlg.Run ();
			advancedDlg.Destroy ();
		}
开发者ID:rashoodkhan,项目名称:tomboy,代码行数:62,代码来源:PreferencesDialog.cs

示例14: HandleSharpen

	void HandleSharpen (object sender, EventArgs args)
	{
		Gtk.Dialog dialog = new Gtk.Dialog (Catalog.GetString ("Unsharp Mask"), main_window, Gtk.DialogFlags.Modal);

		dialog.VBox.Spacing = 6;
		dialog.VBox.BorderWidth = 12;
		
		Gtk.Table table = new Gtk.Table (3, 2, false);
		table.ColumnSpacing = 6;
		table.RowSpacing = 6;
		
		table.Attach (new Gtk.Label (Catalog.GetString ("Amount:")), 0, 1, 0, 1);
		table.Attach (new Gtk.Label (Catalog.GetString ("Radius:")), 0, 1, 1, 2);
		table.Attach (new Gtk.Label (Catalog.GetString ("Threshold:")), 0, 1, 2, 3);

		Gtk.SpinButton amount_spin = new Gtk.SpinButton (0.5, 100.0, .01);
		Gtk.SpinButton radius_spin = new Gtk.SpinButton (5.0, 50.0, .01);
		Gtk.SpinButton threshold_spin = new Gtk.SpinButton (0.0, 50.0, .01);

		table.Attach (amount_spin, 1, 2, 0, 1);
		table.Attach (radius_spin, 1, 2, 1, 2);
		table.Attach (threshold_spin, 1, 2, 2, 3);
		
		dialog.VBox.PackStart (table);

		dialog.AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel);
		dialog.AddButton (Gtk.Stock.Ok, Gtk.ResponseType.Ok);

		dialog.ShowAll ();

		Gtk.ResponseType response = (Gtk.ResponseType) dialog.Run ();

		if (response == Gtk.ResponseType.Ok) {
			foreach (int id in SelectedIds ()) {
				Photo photo = query.Photos [id];
				try {
					Gdk.Pixbuf orig = FSpot.PhotoLoader.Load (query, id);
					Gdk.Pixbuf final = PixbufUtils.UnsharpMask (orig, radius_spin.Value, amount_spin.Value, threshold_spin.Value);
					
					bool create_version = photo.DefaultVersionId == Photo.OriginalVersionId;

					photo.SaveVersion (final, create_version);
					query.Commit (id);
				} catch (System.Exception e) {
					string msg = Catalog.GetString ("Error saving sharpened photo");
					string desc = String.Format (Catalog.GetString ("Received exception \"{0}\". Unable to save photo {1}"),
								     e.Message, photo.Name.Replace ("_", "__"));
					
					HigMessageDialog md = new HigMessageDialog (main_window, DialogFlags.DestroyWithParent, 
										    Gtk.MessageType.Error, ButtonsType.Ok, 
										    msg,
										    desc);
					md.Run ();
					md.Destroy ();
				}
			
			}
		}

		dialog.Destroy ();
	}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:61,代码来源:MainWindow.cs

示例15: RunManager

        public void RunManager()
        {
            if (master == null)
                return;

            Widget container = ConstructUI ();
            if (container == null)
                return;

            Widget parent = master.Controller;
            if (parent != null)
                parent = parent.Toplevel;

            Dialog dialog = new Dialog ();
            dialog.Title = "Layout management";
            dialog.TransientFor = parent as Window;
            dialog.AddButton (Gtk.Stock.Close, Gtk.ResponseType.Close);
            dialog.SetDefaultSize (-1, 300);
            dialog.VBox.Add (container);
            dialog.Run ();
            dialog.Destroy ();
        }
开发者ID:Karkus476,项目名称:supertux-editor,代码行数:22,代码来源:DockLayout.cs


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