本文整理汇总了C#中Gtk.MessageDialog类的典型用法代码示例。如果您正苦于以下问题:C# Gtk.MessageDialog类的具体用法?C# Gtk.MessageDialog怎么用?C# Gtk.MessageDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Gtk.MessageDialog类属于命名空间,在下文中一共展示了Gtk.MessageDialog类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: Close
public override void Close()
{
Trace.Call();
// show warning if there are open chats (besides protocol chat)
var ownedChats = 0;
foreach (var chatView in Frontend.MainWindow.ChatViewManager.Chats) {
if (chatView.ProtocolManager == ProtocolManager) {
ownedChats++;
}
}
if (ownedChats > 1) {
Gtk.MessageDialog md = new Gtk.MessageDialog(
Frontend.MainWindow,
Gtk.DialogFlags.Modal,
Gtk.MessageType.Warning,
Gtk.ButtonsType.YesNo,
_("Closing the protocol chat will also close all open chats connected to it!\n"+
"Are you sure you want to do this?"));
int result = md.Run();
md.Destroy();
if ((Gtk.ResponseType) result != Gtk.ResponseType.Yes) {
return;
}
}
ThreadPool.QueueUserWorkItem(delegate {
try {
// no need to call base.Close() as CommandNetwork() will
// deal with it
Frontend.Session.CommandNetwork(
new CommandModel(
Frontend.FrontendManager,
ChatModel,
"close"
)
);
} catch (Exception ex) {
Frontend.ShowException(ex);
}
});
}
开发者ID:pacificIT,项目名称:smuxi,代码行数:42,代码来源:ProtocolChatView.cs
示例17: ShowReconnectDialog
public static bool ShowReconnectDialog(Gtk.Window parent)
{
Trace.Call(parent);
Gtk.MessageDialog md = new Gtk.MessageDialog(parent,
Gtk.DialogFlags.Modal, Gtk.MessageType.Error,
Gtk.ButtonsType.OkCancel, _("The frontend has lost the connection to the server.\nDo you want to reconnect now?"));
Gtk.ResponseType res = (Gtk.ResponseType) md.Run();
md.Destroy();
if (res != Gtk.ResponseType.Ok) {
Quit();
return false;
}
while (true) {
try {
Frontend.ReconnectEngineToGUI();
// yay, we made it
_InReconnectHandler = false;
break;
} catch (Exception e) {
#if LOG4NET
_Logger.Error("ShowReconnectDialog(): Reconnect failed, exception:", e);
#endif
var msg = _("Reconnecting to the server has failed.\nDo you want to try again?");
// the parent window is hidden (MainWindow) at this
// point thus modal doesn't make sense here
md = new Gtk.MessageDialog(parent,
Gtk.DialogFlags.DestroyWithParent,
Gtk.MessageType.Error,
Gtk.ButtonsType.OkCancel, msg);
md.SetPosition(Gtk.WindowPosition.CenterAlways);
res = (Gtk.ResponseType) md.Run();
md.Destroy();
if (res != Gtk.ResponseType.Ok) {
// give up
Quit();
return false;
}
}
}
return true;
}
开发者ID:knocte,项目名称:smuxi,代码行数:45,代码来源:Frontend.cs
示例18: 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
示例19: 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
示例20: CheckFrontendManagerStatus
private static bool CheckFrontendManagerStatus()
{
Trace.Call();
if (_FrontendManager == null) {
// we lost the frontend manager, nothing to check
return false;
}
if (_FrontendManager.IsAlive) {
// everything is fine
return true;
}
#if LOG4NET
_Logger.Error("CheckFrontendManagerStatus(): frontend manager is not alive anymore!");
#endif
Gtk.Application.Invoke(delegate {
Gtk.MessageDialog md = new Gtk.MessageDialog(_MainWindow,
Gtk.DialogFlags.Modal, Gtk.MessageType.Error,
Gtk.ButtonsType.OkCancel, _("The server has lost the connection to the frontend.\nDo you want to reconnect now?"));
Gtk.ResponseType res = (Gtk.ResponseType) md.Run();
md.Destroy();
if (res != Gtk.ResponseType.Ok) {
// the frontend is unusable in this state -> say good bye
Frontend.Quit();
return;
}
Frontend.ReconnectEngineToGUI();
});
return false;
}
开发者ID:knocte,项目名称:smuxi,代码行数:35,代码来源:Frontend.cs
注:本文中的Gtk.MessageDialog类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论