本文整理汇总了C#中Gtk.MessageDialog.Run方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.MessageDialog.Run方法的具体用法?C# Gtk.MessageDialog.Run怎么用?C# Gtk.MessageDialog.Run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.MessageDialog
的用法示例。
在下文中一共展示了Gtk.MessageDialog.Run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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 ();
}
}
示例2: 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);
}
示例3: 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;
}
示例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();
}
}
示例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();
}
}
}
示例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 ();
}
示例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();
}
示例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;
}
示例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);
}
示例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();
}
}
}
示例11: 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 ();
}
}
示例12: 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;
}
示例13: 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(); }
}
}
示例14: 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);
}
示例15: OnRemoveButtonClicked
protected virtual void OnRemoveButtonClicked(object sender, System.EventArgs e)
{
Trace.Call(sender, e);
try {
Gtk.TreeIter iter;
if (!f_TreeView.Selection.GetSelected(out iter)) {
return;
}
Gtk.MessageDialog md = new Gtk.MessageDialog(
f_Parent,
Gtk.DialogFlags.Modal,
Gtk.MessageType.Warning,
Gtk.ButtonsType.YesNo,
_("Are you sure you want to delete the selected filter?")
);
int result = md.Run();
md.Destroy();
if (result != (int) Gtk.ResponseType.Yes) {
return;
}
f_ListStore.Remove(ref iter);
OnChanged(EventArgs.Empty);
} catch (Exception ex) {
Frontend.ShowException(ex);
}
}