本文整理汇总了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);
}
示例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;
}
示例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 ();
}
}
示例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();
}
}
}
示例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 ();
}
示例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();
}
示例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;
}
示例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);
}
示例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();
}
}
}
示例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 ();
}
}
示例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;
}
示例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(); }
}
}
示例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);
}
示例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();
}
示例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();
}