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


C# Gtk.MessageDialog类代码示例

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


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

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

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

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

示例4: BattleSession

        public BattleSession()
        {
            this.coreAbilities = new List<AbilityDefinition>(8);
            this.coreAbilities.Add(AbilityDefinition.Charisma);
            this.coreAbilities.Add(AbilityDefinition.Logic);
            this.coreAbilities.Add(AbilityDefinition.Perception);
            this.coreAbilities.Add(AbilityDefinition.Power);
            this.coreAbilities.Add(AbilityDefinition.Speed);
            this.coreAbilities.Add(AbilityDefinition.Stamina);
            this.coreAbilities.Add(AbilityDefinition.Strength);
            this.coreAbilities.Add(AbilityDefinition.Willpower);

            try {
                this.origins = new List<OriginDefinition>();
                this.origins = Battle.Data.Storage.LoadOrigins("Data/origins.xml");
                this.species = new List<SpeciesDefinition>();
                this.species = Battle.Data.Storage.LoadSpecies("Data/species.xml");
                this.skills = new List<SkillDefinition>();
                this.skills = Battle.Data.Storage.LoadSkills("Data/skills.xml");
                this.powerSources = new List<PowerSource>();
                this.powerSources = Battle.Data.Storage.LoadPowerSources("Data/powersources.xml");
                this.powers = new List<PowerDefinition>();
                this.powers = Battle.Data.Storage.LoadPowers("Data/powers.xml");
            }
            catch (Exception exp)
            {
                Gtk.MessageDialog dlg = new Gtk.MessageDialog(null, Gtk.DialogFlags.Modal, Gtk.MessageType.Error,
                                                              Gtk.ButtonsType.Close, "{0}: {1}",
                                                              exp.GetType().ToString(), exp.Message);
                dlg.Run();
            }
        }
开发者ID:sgtnasty,项目名称:battle,代码行数:32,代码来源:BattleSession.cs

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

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

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

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

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

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

示例11: Ask

        /// <summary>
        /// Asks for confirmation through a dialog on the screen. 
        /// </summary>
        /// <param name="main">
        /// A <see cref="Window"/> that will be the parent of the dialog.
        /// </param>
        /// <param name="title">
        /// A <see cref="System.String"/> containing the title of the dialog.
        /// </param>
        /// <param name="msg">
        /// A <see cref="System.String"/> containing the question to show.
        /// </param>
        /// <returns>
        /// A <see cref="System.Boolean"/> containing true if the user chose yes, false otherwise
        /// </returns>
        public static bool Ask(Gtk.Window main, string title, string msg)
        {
            var dlg = new Gtk.MessageDialog(
                          		main,
                                Gtk.DialogFlags.Modal,
                                Gtk.MessageType.Question,
                                Gtk.ButtonsType.YesNo,
                                title
             );

            dlg.Text = msg;
            dlg.Title = title + " Question";

            Gtk.ResponseType res = (Gtk.ResponseType) dlg.Run();
            dlg.Destroy();

            return ( res == Gtk.ResponseType.Yes );
        }
开发者ID:Baltasarq,项目名称:GtkUtil,代码行数:33,代码来源:GtkUtil.cs

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

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

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

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


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