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


C# Gtk.MessageDialog.Destroy方法代码示例

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


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

示例1: on_okButton_clicked

        void on_okButton_clicked(object o, EventArgs args)
        {
            if (Core.Settings.KeyEncrypted && !Core.Settings.CheckKeyPassword(oldPasswordEntry.Text)) {
                Gui.ShowErrorDialog("Old password incorrect");
                oldPasswordEntry.GrabFocus();
                return;
            }

            if (newPasswordEntry.Text != confirmPasswordEntry.Text) {
                Gui.ShowErrorDialog("New passwords do not match");
                newPasswordEntry.GrabFocus();
                return;
            }

            if (newPasswordEntry.Text == String.Empty) {
                var dialog = new Gtk.MessageDialog(base.Window, Gtk.DialogFlags.Modal, Gtk.MessageType.Question, Gtk.ButtonsType.YesNo, "Are you sure you don't want to set a password?");
                dialog.Show();
                int r = dialog.Run();
                dialog.Destroy();
                if (r != (int)Gtk.ResponseType.Yes) {
                    return;
                }
            }

            Core.Settings.ChangeKeyPassword(newPasswordEntry.Text);

            if (!Core.Settings.FirstRun)
                Gui.ShowMessageDialog("Your password has been changed.");

            Dialog.Respond(Gtk.ResponseType.Ok);
        }
开发者ID:codebutler,项目名称:meshwork,代码行数:31,代码来源:ChangeKeyPasswordDialog.cs

示例2: CreateUmlElement

 // uses reflection to call the corresponding method in the "Create" class.
 public static UML.Element CreateUmlElement(string elementType)
 {
     Type create = typeof(UML.Create);
     object newElement = create.InvokeMember(
         elementType,
         BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Static,
         null,
         null,
         null);
     UML.NamedElement ne = newElement as UML.NamedElement;
     if(ne != null)
     {
         _dialog = new Gtk.MessageDialog(
             null, Gtk.DialogFlags.Modal, Gtk.MessageType.Question,
             Gtk.ButtonsType.Ok, GettextCatalog.GetString ("New element name:"));
         Gtk.Entry elementName = new Gtk.Entry();
         elementName.Activated += new EventHandler(CloseNewElementNameModal);
         _dialog.VBox.Add(elementName);
         elementName.Show();
         _dialog.Run();
         ne.Name = String.Format(elementName.Text, elementType);
         _dialog.Destroy();
         _dialog = null;
     }
     return (UML.Element)newElement;
 }
开发者ID:MonoBrasil,项目名称:historico,代码行数:27,代码来源:Helper.cs

示例3: MainClass

        public MainClass(bool debug, string appName)
        {
            GLibLogging.Enabled = true;

            Assembly exe = typeof (MainClass).Assembly;

            string configDir = Path.GetFullPath (Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), appName));
            string lockFile = Path.Combine (configDir, "pid.lock");

            bool instanceRunning = DetectInstances (lockFile, appName);
            if (instanceRunning) {
                Gtk.Application.Init ();

                Gtk.MessageDialog md = new Gtk.MessageDialog (null, Gtk.DialogFlags.Modal, Gtk.MessageType.Warning, Gtk.ButtonsType.Close,
                    GettextCatalog.GetString ("An instance of StrongMonkey with configuration profile '{0}' is already running.{1}If you really want to run 2 seperate instances, use the \"--appName=StrongMonkeyXXX\" command line parameter",
                        appName, Environment.NewLine));
                md.Run ();
                md.Destroy ();
                md.Dispose ();

                md.Close += delegate(object sender, EventArgs e) {
                    Gtk.Application.Quit ();
                };

                Gtk.Application.Run ();
            } else {
                CoreUtility.Initialize (exe, appName, debug);
                WriteInstancePid (lockFile);

                AddinUtility.Initialize ();
            }
        }
开发者ID:titobrasolin,项目名称:StrongMonkey,代码行数:32,代码来源:Main.cs

示例4: OnButtonOkClicked

 protected void OnButtonOkClicked(object sender, EventArgs e)
 {
     try
     {
         if (cat != null)
         {
             int id = GetId(cat, idEntry.Text);
             string name = GetName(nameEntry.Text);
             doc = new Document(cat, id, name, dateCalendar.Date);
             cat.Add(doc);
             this.Respond(Gtk.ResponseType.Ok);
         }
         else
         {
             throw new Exception("You must select a category");
         }
     }
     catch (Exception ex)
     {
         Gtk.MessageDialog msg = new Gtk.MessageDialog(this, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Close, true, String.Format(ex.Message.ToString()));
         if ((Gtk.ResponseType)msg.Run() == Gtk.ResponseType.Close)
         {
             msg.Destroy();
         }
     }
 }
开发者ID:rafael1193,项目名称:secretaria-electrial,代码行数:26,代码来源:AddDocument.cs

示例5: ShowErrorMessage

 void ShowErrorMessage(string msg)
 {
     Gtk.MessageDialog md = new Gtk.MessageDialog (null ,
                                                   Gtk.DialogFlags.DestroyWithParent,
                                                   Gtk.MessageType.Error,
                                                   Gtk.ButtonsType.Close, msg,
                                                   new object [] {});
     md.Run ();
     md.Destroy ();
 }
开发者ID:jrudolph,项目名称:do-plugins,代码行数:10,代码来源:Configuration.cs

示例6: ShowWarningMessage

 public static void ShowWarningMessage(Gtk.Window parentWin, string format, params object[] args)
 {
     Gtk.MessageDialog md = new Gtk.MessageDialog(parentWin,
                                                  Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal,
                                                  Gtk.MessageType.Warning,
                                                  Gtk.ButtonsType.Ok,
                                                  format,
                                                  args);
     md.Title = Catalog.GetString("Warning");
     md.Run();
     md.Destroy();
 }
开发者ID:sciaopin,项目名称:bang-sharp,代码行数:12,代码来源:ErrorManager.cs

示例7: HandleOverrideConfirmation

        bool HandleOverrideConfirmation (String name)
        {
            Gtk.MessageDialog dialog = new Gtk.MessageDialog(this.Toplevel as Gtk.Window,
                Gtk.DialogFlags.DestroyWithParent,
                Gtk.MessageType.Question,
                Gtk.ButtonsType.YesNo,
                name + Mono.Unix.Catalog.GetString(" already exists.\n Do you want to override it?"));
            dialog.Modal = true;
            Gtk.ResponseType result = (Gtk.ResponseType)dialog.Run();
            dialog.Destroy ();

            return result == Gtk.ResponseType.Yes;
        }
开发者ID:monsterlabs,项目名称:HumanRightsTracker,代码行数:13,代码来源:CaseReportWindow.cs

示例8: ShowDialog

		public DialogResult ShowDialog(Control parent)
		{
			Gtk.Widget c = (parent == null) ? null : (Gtk.Widget)parent.ControlObject;
			while (!(c is Gtk.Window) && c != null)
			{
				c = c.Parent;
			}
			control = new Gtk.MessageDialog((Gtk.Window)c, Gtk.DialogFlags.Modal, Convert (Type), Gtk.ButtonsType.Ok, false, Text);
			control.TypeHint = Gdk.WindowTypeHint.Dialog;
            var caption = Caption ?? ((parent != null && parent.ParentWindow != null) ? parent.ParentWindow.Title : null);
            if (!string.IsNullOrEmpty(caption)) control.Title = caption;
			int ret = control.Run();
			control.Destroy();
			return Generator.Convert((Gtk.ResponseType)ret);
		}
开发者ID:hultqvist,项目名称:Eto,代码行数:15,代码来源:MessageBoxHandler.cs

示例9: OnButtonCloseClicked

 protected void OnButtonCloseClicked(object sender, EventArgs e)
 {
     //Check if preferences are valid
     if (pathFileChooserButton.Filename != null)
     {
         this.Respond(Gtk.ResponseType.Close);
     }
     else
     {
         Gtk.MessageDialog mes = new Gtk.MessageDialog(this, Gtk.DialogFlags.Modal, Gtk.MessageType.Info, Gtk.ButtonsType.Ok, Mono.Unix.Catalog.GetString("You must choose a valid path for registry files."));
         if ((Gtk.ResponseType)mes.Run() == Gtk.ResponseType.Ok)
         {
             mes.Destroy();
         }
     }
 }
开发者ID:rafael1193,项目名称:secretaria-electrial,代码行数:16,代码来源:Preferences.cs

示例10: Run

		public void Run ()
		{
			string text = TextEditorApp.MainWindow.View.Buffer.Text;
			XmlDocument doc = new XmlDocument ();
			try {
				doc.LoadXml (text);
				StringWriter sw = new StringWriter ();
				XmlTextWriter tw = new XmlTextWriter (sw);
				tw.Formatting = Formatting.Indented;
				doc.Save (tw);
				TextEditorApp.MainWindow.View.Buffer.Text = sw.ToString ();
			}
			catch {
				Gtk.MessageDialog dlg = new Gtk.MessageDialog (TextEditorApp.MainWindow, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Close, "Error parsing XML.");
				dlg.Run ();
				dlg.Destroy ();
			}
		}
开发者ID:wanglehui,项目名称:mono-addins,代码行数:18,代码来源:FormatXmlCommand.cs

示例11: ShowSaveCheckDialog

        public SaveCheckDialogResult ShowSaveCheckDialog()
        {
            Gtk.MessageDialog saveCheckDialog = new Gtk.MessageDialog(null, Gtk.DialogFlags.Modal, Gtk.MessageType.Question, Gtk.ButtonsType.YesNo, false, "The current document has unsaved changes. Do you wish to save those now?");
            saveCheckDialog.AddButton("Cancel", Gtk.ResponseType.Cancel);

            SaveCheckDialogResult result = SaveCheckDialogResult.Cancel;

            int dialogResult = saveCheckDialog.Run();
            if ((int)Gtk.ResponseType.Yes == dialogResult)
            {
                result = SaveCheckDialogResult.Save;
            }
            else if ((int)Gtk.ResponseType.No == dialogResult)
            {
                result = SaveCheckDialogResult.NoSave;
            }

            saveCheckDialog.Destroy();

            return result;
        }
开发者ID:alfar,项目名称:WordBuilder,代码行数:21,代码来源:FileDialogHelper.cs

示例12: Load

        public static void Load()
        {
            try
            {
                SetDefaultValues();

                using (FileStream stream = new FileStream(SettingsPath, FileMode.Open))
                {
                    BinaryFormatter bin = new BinaryFormatter();
                    HelperClass hc = (HelperClass)bin.Deserialize(stream);
                    hc.PushValues();
                }
            }
            catch (Exception ex)
            {
                Gtk.MessageDialog md = new Gtk.MessageDialog(null, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, "Couldn´t read Settings!" + Environment.NewLine + ex.Message);
                md.Title = "Error";
                md.AddButton("Restore Settings?", Gtk.ResponseType.Yes);
                Gtk.ResponseType result = (Gtk.ResponseType)md.Run();
                md.Destroy();

                if (result == Gtk.ResponseType.Yes) { Recreate(); }
            }
        }
开发者ID:TimeScience,项目名称:desert-deflicker,代码行数:24,代码来源:MySettings.cs

示例13: Run

		public static void Run (string file)
		{
			ICompiler[] compilers = (ICompiler[]) AddinManager.GetExtensionObjects (typeof(ICompiler));
			
			ICompiler compiler = null;
			foreach (ICompiler comp in compilers) {
				if (comp.CanCompile (file)) {
					compiler = comp;
					break;
				}
			}
			if (compiler == null) {
				string msg = "No compiler available for this kind of file.";
				Gtk.MessageDialog dlg = new Gtk.MessageDialog (TextEditorApp.MainWindow, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Close, msg);
				dlg.Run ();
				dlg.Destroy ();
				return;
			}

			string messages = compiler.Compile (file, file + ".exe");
			
			TextEditorApp.MainWindow.ConsoleWrite ("Compilation finished.\n");
			TextEditorApp.MainWindow.ConsoleWrite (messages);
		}
开发者ID:wanglehui,项目名称:mono-addins,代码行数:24,代码来源:CompilerManager.cs

示例14: ShowException

        public static void ShowException(Gtk.Window parent, Exception ex)
        {
            Trace.Call(parent, ex != null ? ex.GetType() : null);

            if (parent == null) {
                parent = _MainWindow;
            }

            if (!IsGuiThread()) {
                Gtk.Application.Invoke(delegate {
                    ShowException(parent, ex);
                });
                return;
            }

            if (ex is NotImplementedException) {
                // don't quit on NotImplementedException
                ShowError(parent, ex);
                return;
            }

            #if LOG4NET
            _Logger.Error("ShowException(): Exception:", ex);
            #endif

            // HACK: ugly MS .NET throws underlaying SocketException instead of
            // wrapping those into a nice RemotingException, see:
            // http://projects.qnetp.net/issues/show/232
            if (ex is System.Runtime.Remoting.RemotingException ||
                ex is System.Net.Sockets.SocketException) {
                if (_InReconnectHandler || _InCrashHandler) {
                    // one reconnect is good enough and a crash we won't survive
                    return;
                }

                Frontend.ReconnectEngineToGUI();
                return;
            }

            if (_InCrashHandler) {
                // only show not more than one crash dialog, else the user
                // will not be able to copy/paste the stack trace and stuff
                return;
            }
            _InCrashHandler = true;

            // we are using a remote engine, we are not running on Mono and an
            // IConvertible issue happened
            if (!Frontend.IsLocalEngine &&
                Type.GetType("Mono.Runtime") == null &&
                ex is InvalidCastException &&
                ex.Message.Contains("IConvertible")) {
                var msg = _(
                    "A fatal error has been detected because of a protocol incompatibility with the smuxi-server!\n\n" +
                    "Please install Mono on the frontend side so it matches the smuxi-server.\n\n" +
                    "More details about this issue can be found here:\n" +
                    "https://smuxi.im/issues/show/589"
                );
                var dialog = new Gtk.MessageDialog(
                    parent,
                    Gtk.DialogFlags.Modal,
                    Gtk.MessageType.Error,
                    Gtk.ButtonsType.Close,
                    true,
                    msg
                );
                dialog.Run();
                dialog.Destroy();
                Quit();
                return;
            }

            CrashDialog cd = new CrashDialog(parent, ex);
            cd.Run();
            cd.Destroy();

            if (SysDiag.Debugger.IsAttached) {
                // allow the debugger to examine the situation
                //SysDiag.Debugger.Break();
                // HACK: Break() would be nicer but crashes the runtime
                throw ex;
            }

            Quit();
        }
开发者ID:knocte,项目名称:smuxi,代码行数:85,代码来源:Frontend.cs

示例15: ShowError

        public static void ShowError(Gtk.Window parent, string msg, Exception ex)
        {
            Trace.Call(parent, msg, ex != null ? ex.GetType() : null);

            if (!IsGuiThread()) {
                Gtk.Application.Invoke(delegate {
                    ShowError(parent, msg, ex);
                });
                return;
            }

            if (ex != null) {
            #if LOG4NET
                _Logger.Error("ShowError(): Exception: ", ex);
            #endif
                msg += "\n" + String.Format(_("Cause: {0}"), ex.Message);
            }
            if (parent == null) {
                parent = _MainWindow;
            }

            Gtk.MessageDialog md = new Gtk.MessageDialog(
                parent,
                Gtk.DialogFlags.Modal,
                Gtk.MessageType.Error,
                Gtk.ButtonsType.Ok,
                false,
                msg
            );
            md.Run();
            md.Destroy();
        }
开发者ID:knocte,项目名称:smuxi,代码行数:32,代码来源:Frontend.cs


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