本文整理汇总了C#中Gtk.MessageDialog.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# MessageDialog.Dispose方法的具体用法?C# MessageDialog.Dispose怎么用?C# MessageDialog.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.MessageDialog
的用法示例。
在下文中一共展示了MessageDialog.Dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static int Main(string [] args)
{
Application.Init ();
Catalog.Init (Config.packageName, Config.prefix + "/share/locale");
try {
session = new Session ();
string filename = null;
if (args.Length == 1 && System.IO.File.Exists (args[0])) {
filename = args[0];
}
ChessWindow win = new ChessWindow (filename);
Application.Run ();
} catch (ApplicationException) {
return 1;
} catch (System.Exception e) {
try {
MessageDialog md =
new MessageDialog (null,
DialogFlags.
DestroyWithParent,
MessageType.Error,
ButtonsType.Close,
Catalog.GetString ("An unexpected exception occured:\n\n") +
e.ToString() + "\n" +
Catalog.GetString ("Please report about this exception to \n") +
"Nickolay V. Shmyrev <[email protected]>");
md.Run ();
md.Hide ();
md.Dispose ();
} catch (Exception ex) {
throw e;
}
}
return 0;
}
示例2: DoCancel
public void DoCancel()
{
Gtk.MessageDialog qdlg = new Gtk.MessageDialog (this, Gtk.DialogFlags.Modal, Gtk.MessageType.Warning,
Gtk.ButtonsType.YesNo, Catalog.GetString("Cancelling an export will result in an invalid GPX file.\nAre you sure?"));
if ((int) ResponseType.Yes == qdlg.Run())
{
qdlg.Hide();
qdlg.Dispose();
this.Hide();
this.Dispose();
m_writer.Cancel = true;
return;
}
qdlg.Hide();
this.ShowNow();
}
示例3: HandleExceptionManagerUnhandledException
void HandleExceptionManagerUnhandledException(UnhandledExceptionArgs args)
{
Exception ex = (Exception)args.ExceptionObject;
Console.WriteLine("Unhandled Exception: {0}", ex.GetType ().ToString ());
Console.WriteLine("\t{0}", ex.Message);
Console.WriteLine("\t{0}", ex.Source);
Console.WriteLine("\t{0}", ex.StackTrace);
MessageDialog d = new MessageDialog (null, DialogFlags.Modal, MessageType.Error,
ButtonsType.Close, true, "<b>{0}</b>: {1} at <i>{2}</i>",
ex.GetType ().ToString(),
ex.Message, ex.Source);
d.Run ();
d.Hide ();
d.Dispose ();
args.ExitApplication = true;
}
示例4: OnButtonPastebinLoginClicked
/// <summary>
/// Gets pastebin user key.
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="args">Event arguments.</param>
private void OnButtonPastebinLoginClicked(object sender, EventArgs e)
{
MessageDialog dialog;
if (this.pastebinUsername.Text.Length == 0 || this.labelPastebinPassword.Text.Length == 0)
{
dialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, false, Catalog.GetString("Username and password are required."));
dialog.Run();
dialog.Destroy();
dialog.Dispose();
}
else
{
this.buttonPastebinLogin.Sensitive = false;
ThreadPool.QueueUserWorkItem((state) =>
{
string key = Uploaders.Pastebin.GetUserKey(this.pastebinUsername.Text, this.pastebinPassword.Text);
Application.Invoke((s, ev) =>
{
if (key.StartsWith("Bad") || key.StartsWith(Catalog.GetString("Error: ")))
{
this.SetPastebinSensitivity(false);
dialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, false, Catalog.GetString("Invalid username or password."));
dialog.Run();
dialog.Destroy();
dialog.Dispose();
}
else
{
Core.Settings.Instance[SettingsKeys.PastebinUserKey] = key;
dialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, false, Catalog.GetString("Login successful. From now you can upload texts to your Pastebin account."));
dialog.Run();
dialog.Destroy();
dialog.Dispose();
this.SetPastebinSensitivity(true);
}
});
});
}
}
示例5: on_control_game_over
public void on_control_game_over(string reason)
{
statusbar.Push (gameStatusbarId, Catalog.GetString("Game Over"));
MessageDialog md = new MessageDialog (csboardWindow,
DialogFlags.
DestroyWithParent,
MessageType.
Info,
ButtonsType.
Close,
Catalog.GetString("Game Over") + "\n" +
reason);
md.Run ();
md.Hide ();
md.Dispose ();
return;
}
示例6: on_board_move
public void on_board_move(string move)
{
if (!control.MakeMove (move)) {
MessageDialog md =
new MessageDialog (csboardWindow,
DialogFlags.
DestroyWithParent,
MessageType.
Warning,
ButtonsType.Close,
Catalog.GetString("Illegal move"));
md.Run ();
md.Hide ();
md.Dispose ();
}
return;
}
示例7: on_book_activate
public void on_book_activate(System.Object b, EventArgs e)
{
ArrayList result = control.Book ();
if (result.Count == 0) {
MessageDialog md =
new MessageDialog (csboardWindow,
DialogFlags.
DestroyWithParent,
MessageType.Info,
ButtonsType.Close,
Catalog.GetString("There is no book move in this position"));
md.Run ();
md.Hide ();
md.Dispose ();
}
else {
BookDialog dialog = new BookDialog (result);
if (dialog.Run () == (int) ResponseType.Apply) {
dialog.Hide ();
string move;
move = dialog.GetMove ();
if (move != null) {
control.MakeMove (move);
}
dialog.Dispose ();
}
else {
dialog.Hide ();
dialog.Dispose ();
}
}
}
示例8: OnBtnGenerarClicked
protected void OnBtnGenerarClicked(object sender, EventArgs e)
{
try {
BarcodeLib.Barcode codeBar = new BarcodeLib.Barcode ();
codeBar.IncludeLabel = chkIncludeLabel.Active;
BarcodeLib.LabelPositions lblPos = (BarcodeLib.LabelPositions)Enum.Parse (typeof(BarcodeLib.LabelPositions), cmbTextPosition.ActiveText.ToString ());
codeBar.LabelPosition = lblPos;
BarcodeLib.TYPE bCodeType = (BarcodeLib.TYPE)Enum.Parse (typeof(BarcodeLib.TYPE), cmbBarCodeType.ActiveText.ToString ());
int width,height;
if (int.TryParse(txtWidth.Text.Trim(), out width)){
if (int.TryParse(txtHeight.Text.Trim(), out height)){
if (!string.IsNullOrEmpty(txtData.Text.Trim())){
System.Drawing.Image imgTmpCodeBar = codeBar.Encode (bCodeType, txtData.Text.Trim (), System.Drawing.Color.FromName(cmbColorText.ActiveText) , System.Drawing.Color.FromName(cmbColorBackground.ActiveText), int.Parse(txtWidth.Text.Trim()),int.Parse(txtHeight.Text.Trim()));
MemoryStream memoryStream = new MemoryStream();
imgTmpCodeBar.Save(memoryStream, ImageFormat.Png);
Gdk.Pixbuf pb = new Gdk.Pixbuf (memoryStream.ToArray());
imgCodeBar.Pixbuf = pb;
} else {
txtData.GrabFocus();
throw new Exception ("Falta indicar los datos a generar");
}
} else {
txtHeight.GrabFocus();
throw new Exception ("Altura incorrecta");
}
} else {
txtWidth.GrabFocus();
throw new Exception ("Anchura incorrecta");
}
} catch (Exception err) {
MessageDialog dlg = new MessageDialog (this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, string.Format ("Ocurrió un error \n {0}", err.Message));
dlg.Run ();
dlg.Destroy ();
dlg.Dispose ();
dlg = null;
}
}
示例9: on_window1_delete_event
protected void on_window1_delete_event(object o, DeleteEventArgs args)
{
MessageDialog d = new MessageDialog (this.window1, DialogFlags.DestroyWithParent,
MessageType.Question, ButtonsType.OkCancel,
true, "Are you sure you want to <b>quit</b>?");
ResponseType result = (ResponseType) d.Run ();
d.Hide ();
d.Dispose ();
args.RetVal = (result == ResponseType.Cancel);
if (result == ResponseType.Ok)
{
Gtk.Application.Quit ();
}
}
示例10: ChessWindow
public ChessWindow(string filename)
{
string engine = App.session.Engine;
/* try { */
if (engine.LastIndexOf ("crafty ") >= 0) {
control = new Crafty (engine);
} else
if (engine.LastIndexOf ("phalanx ") >= 0) {
control = new Phalanx (engine);
} else
if (engine.LastIndexOf ("gnuchess ") >= 0) {
control = new GnuChess (engine);
} else
if (engine.LastIndexOf ("ICS ") >= 0) {
control = new ICS (engine);
} else {
MessageDialog md =
new MessageDialog (csboardWindow,
DialogFlags.
DestroyWithParent,
MessageType.Error,
ButtonsType.Close,
Catalog.GetString(
"<b>Unknown engine</b>\n\nPlease check gconf keys of csboard"));
md.Run ();
md.Hide ();
md.Dispose ();
control = new GnuChess ("/usr/bin/gnuchess -x -e");
}
/*} catch {
MessageDialog md =
new MessageDialog (null, 0, MessageType.Error,
ButtonsType.Close,
String.Format(Catalog.GetString (
"<b>Failed to start engine</b>\n\nCheck that program '{0}' is available."),
engine));
md.Run ();
md.Hide ();
md.Dispose ();
return;
}*/
Glade.XML gXML =
Glade.XML.FromAssembly ("csboard.glade",
"csboardWindow", null);
gXML.Autoconnect (this);
gameStatusbarId = statusbar.GetContextId ("game");
gameStatusbarId = statusbar.GetContextId ("move");
// FIXME: Use libglade to create toolbar
App.session.SetupGeometry (csboardWindow);
csboardWindow.Show ();
control.WaitEvent +=
new ControlWaitHandler (on_control_wait);
control.BusyEvent +=
new ControlBusyHandler (on_control_busy);
control.PositionChangedEvent +=
new
ControlPositionChangedHandler
(on_position_changed);
control.GameOverEvent +=
new
ControlGameOverHandler (on_control_game_over);
control.SwitchSideEvent +=
new
ControlSwitchSideHandler (on_control_side);
control.HintEvent +=
new
ControlHintHandler (on_control_hint);
// Setup board widget
progressbar = new ProgressBar ();
status_frame.Add (progressbar);
boardWidget = new PlayerBoard (control.GetPosition ());
frame.Add (boardWidget);
boardWidget.Show ();
SetupLevel ();
boardWidget.showCoords = App.session.ShowCoords;
boardWidget.highLightMove = App.session.HighLightMove;
boardWidget.showAnimations = App.session.showAnimations;
show_coords.Active = App.session.ShowCoords;
last_move.Active = App.session.HighLightMove;
possible_moves.Active = App.session.PossibleMoves;
animate.Active = App.session.showAnimations;
//.........这里部分代码省略.........
示例11: doRemove
protected virtual void doRemove(object sender, System.EventArgs e)
{
Waypoint toDelete = GetSelectedWaypoint ();
MessageDialog md = new MessageDialog (null, DialogFlags.DestroyWithParent,
MessageType.Info, ButtonsType.YesNo,
"Are you sure you wish to delete " + toDelete.Name);
if ((int)ResponseType.Yes == md.Run ())
{
if (toDelete.Symbol == "Final Location")
m_Cache.HasFinal = false;
m_App.DeleteChildPoint(toDelete.Name);
}
md.Hide ();
md.Dispose ();
}
示例12: DeleteContactsSim
private void DeleteContactsSim()
{
MessageDialog mdlg = new MessageDialog(MainWindow,
DialogFlags.Modal,
MessageType.Question,
ButtonsType.YesNo,
GlobalObjUI.LMan.GetString("suredeletesim"));
mdlg.TransientFor = MainWindow;
mdlg.Title = MainClass.AppNameVer + " - " + GlobalObjUI.LMan.GetString("deletesimact");
ResponseType respType = (ResponseType)mdlg.Run();
if (respType == ResponseType.Yes)
{
// override
mdlg.Destroy();
mdlg.Dispose();
mdlg = null;
// Delete sim
ScanSimBefore();
// Reset status values
GlobalObjUI.SimADNStatus = 1;
GlobalObjUI.SimADNPosition = 0;
GlobalObjUI.SimADNError = "";
// Start thread for reading process
notify = new ThreadNotify(new ReadyEvent(WritingUpdate));
simThread = new System.Threading.Thread(new System.Threading.ThreadStart(GlobalObjUI.DeleteAllSimContactsList));
simThread.Start();
return;
}
mdlg.Destroy();
mdlg.Dispose();
mdlg = null;
}
示例13: UpdateDistanceFilter
private void UpdateDistanceFilter()
{
if (!String.IsNullOrEmpty(distanceEntry.Text))
{
try
{
double dist = double.Parse(distanceEntry.Text);
if (m_app.AppConfig.ImperialUnits)
dist = Utilities.MilesToKm(dist);
CacheStore.GlobalFilters.AddFilterCriteria(FilterList.KEY_DIST, dist);
clearDistanceButton.Sensitive = true;
}
catch
{
MessageDialog dlg = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok,
Catalog.GetString("Value is not a number"));
dlg.Run();
dlg.Hide();
dlg.Dispose();
distanceEntry.Changed -= OnChanged;
distanceEntry.Text = string.Empty;
distanceEntry.Changed += OnChanged;;
return;
}
}
else
{
CacheStore.GlobalFilters.RemoveCriteria(FilterList.KEY_DIST);
clearDistanceButton.Sensitive = false;
}
}
示例14: DeleteGPSProfile
public void DeleteGPSProfile()
{
DeleteItem dlg = new DeleteItem (m_app.Profiles);
if ((int)ResponseType.Ok == dlg.Run ()) {
if ((m_app.Profiles.GetActiveProfile () != null) && (dlg.ItemToDelete == m_app.Profiles.GetActiveProfile ().Name)) {
MessageDialog confirm = new MessageDialog (this, DialogFlags.Modal, MessageType.Warning, ButtonsType.YesNo, Catalog.GetString ("\"{0}\" is the active" + " GPS profile. Are you sure you wish to delete it?"), dlg.ItemToDelete);
if ((int)ResponseType.No == confirm.Run ()) {
confirm.Hide ();
confirm.Dispose ();
return;
}
confirm.Hide ();
confirm.Dispose ();
Config.GPSProf = null;
}
m_app.Profiles.DeleteProfile (dlg.ItemToDelete);
RebuildProfiles();
}
}
示例15: SendToGPS
public void SendToGPS()
{
if (m_app.Profiles.GetActiveProfile () == null) {
MessageDialog err = new MessageDialog (this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok,
Catalog.GetString ("There is no active GPS profile. Either select an"
+ " existing one from the GPS Menu or add a new profile ."));
err.Run ();
err.Hide ();
err.Dispose ();
return;
}
SendWaypointsDialog dlg = new SendWaypointsDialog ();
dlg.Parent = this;
dlg.Icon = this.Icon;
dlg.AutoClose = Config.AutoCloseWindows;
dlg.Start (CacheList.UnfilteredCaches, m_app.Profiles.GetActiveProfile (), m_app.CacheStore);
}