protected void OnEnviarClicked(object sender, EventArgs e) { try{ MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); mail.From = new MailAddress("*****@*****.**"); mail.To.Add(Para.Text); mail.Subject = Asunto.Text; mail.Body = Body.Text; SmtpServer.Port = 587; SmtpServer.Credentials = new System.Net.NetworkCredential("dgarciaverdin", "abcjpr_f4e"); SmtpServer.EnableSsl = true; ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; }; SmtpServer.Send(mail); MessageDialog md = new MessageDialog (null, DialogFlags.Modal, MessageType.Info, ButtonsType.None, "Mail enviado correctamente"); md.Show(); this.padre.tabla(); } catch(Exception Msg){ MessageDialog md = new MessageDialog (null, DialogFlags.Modal, MessageType.Error, ButtonsType.None, "Ouch"+ Msg.ToString() ); md.Show(); } }
static void MainWindow_DragDataReceived(object o, DragDataReceivedArgs args) { string data = System.Text.Encoding.UTF8.GetString(args.SelectionData.Data); data = data.Trim('\r', '\n', '\0'); if (Util.IsRunningOnMono()) { data = data.Replace("file://", ""); } else { data = data.Replace("file:///", ""); } data = data.Replace("%20", " "); // gtk inserts these for spaces? maybe? wtf. try { if (data.EndsWith(".gslice")) { GenerateGCodeForSliceFile(data); } else { LoadGCodeFile(data); } } catch (Exception e) { using (var dialog = new Gtk.MessageDialog(MainWindow, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, "Exception loading {0} : {1}", data, e.Message)) { dialog.Show(); } } }
void SetLabel() { Gtk.MessageDialog md = new Gtk.MessageDialog(null, 0, Gtk.MessageType.Question, Gtk.ButtonsType.None, "<b>" + Catalog.GetString("Set the timer's label to:") + "</b>"); md.Title = "Docky Timer"; md.Icon = DockServices.Drawing.LoadIcon("docky", 22); md.Modal = false; md.AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel); md.AddButton(Catalog.GetString("_Set Label"), Gtk.ResponseType.Ok); md.DefaultResponse = Gtk.ResponseType.Ok; Gtk.Entry labelEntry = new Gtk.Entry("" + label); labelEntry.Activated += delegate { Label = labelEntry.Text; md.Destroy(); }; labelEntry.Show(); md.VBox.PackEnd(labelEntry); md.Response += (o, args) => { if (args.ResponseId != Gtk.ResponseType.Cancel) { Label = labelEntry.Text; } md.Destroy(); }; md.Show(); }
// Pop up currently does nothing protected virtual void OnNewCollectionActivated(object sender, System.EventArgs e) { Window win = new Window("New Collection"); MessageDialog aboutMessage = new Gtk.MessageDialog(win, DialogFlags.DestroyWithParent, Gtk.MessageType.Question, ButtonsType.OkCancel, "Are you sure you want to create a new collection\nAny existing collection will be deleted."); aboutMessage.Show(); }
protected void OnBtnSaludarClicked(object sender, EventArgs e) { var msg = new Gtk.MessageDialog(this, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Close, "Hola {0}!, estamos aprendiendo a programar en Linux", txtNombre.Text); msg.Show(); }
public static void ShowErrorWindow( string errorMessage, Window parentWindow=null ) { var dialog = new MessageDialog( parentWindow, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, errorMessage ); dialog.WindowPosition = WindowPosition.Center; dialog.Show(); dialog.Run(); dialog.Hide(); }
public static MessageDialog Show(Window parent_window, string msg, MessageType messageType, Boolean showModal) { MessageDialog md = new MessageDialog (parent_window, DialogFlags.Modal, messageType, ButtonsType.Ok, msg); if (showModal) { md.Run (); } else { md.Show (); } return md; }
/* * this function show popup message came from server */ public void ShowPopup(string msg) { var Popup = new Gtk.MessageDialog(null, Gtk.DialogFlags.Modal, Gtk.MessageType.Question, Gtk.ButtonsType.Ok, msg); Popup.Show(); Popup.Run(); Popup.Destroy(); if (msg.CompareTo("로그인 성공") == 0) { GTK_Demo_Client.GameWindow GameWindow = new GTK_Demo_Client.GameWindow(); GameWindow.Show(); this.Destroy(); } }
public static void Info(string msg) { GLib.Idle.Add (new GLib.IdleHandler (delegate() { MessageDialog md = new MessageDialog(null, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.Ok, msg); md.DeleteEvent += delegate(object o, DeleteEventArgs args) { md.Destroy(); }; md.Response += delegate(object o, ResponseArgs args) { md.Hide(); md.Destroy(); }; md.Show (); return false; })); }
protected void OnButton2Clicked(object sender, EventArgs e) { //RegisterButton string ID = entry1.Text.Trim(); string Pass = entry2.Text.Trim(); if (!RegistRequest(ID, Pass)) { var request_fail = new Gtk.MessageDialog(null, Gtk.DialogFlags.Modal, Gtk.MessageType.Question, Gtk.ButtonsType.Ok, "Fail"); request_fail.Show(); request_fail.Run(); request_fail.Destroy(); return; } if (!PopupWorker.IsBusy) { PopupWorker.RunWorkerAsync(); } }
public static void ShowConfirmationDialog (string title, string text, string icon_name, System.Action action) { MessageDialog md = new MessageDialog (null, 0, MessageType.Question, ButtonsType.None, text); md.Title = title; md.Image = Image.NewFromIconName (icon_name, Gtk.IconSize.Dialog); md.Image.Visible = true; md.Image.Show (); md.AddButton (Stock.Cancel, ResponseType.Cancel); md.AddButton (title, ResponseType.Ok); md.DefaultResponse = ResponseType.Ok; md.Response += (o, args) => { if (args.ResponseId == ResponseType.Ok) action.Invoke (); md.Destroy (); }; md.Show (); }
/* * Not use */ private void ShowPopup() { string result_msg = GTK_Demo_Client.Popup.CPopupHandler.GetMessageFromServer(); var result = new Gtk.MessageDialog(null, Gtk.DialogFlags.Modal, Gtk.MessageType.Question, Gtk.ButtonsType.Ok, result_msg); result.Show(); result.Run(); result.Destroy(); if (result_msg.CompareTo("로그인 성공") == 0) { GTK_Demo_Client.GameWindow GameWindow = new GTK_Demo_Client.GameWindow(); GameWindow.Show(); this.Destroy(); return; } if (result_msg.CompareTo("서버와의 연결이 끊겼습니다") == 0) { Gtk.Main.Quit(); return; } }
public void Start(string[] args) { // Initialize IPC try { tracker = new SingleInstanceTracker <IPCConnectionWebSocket>(); tracker.MessageReceived += (sender, e) => { if (e.Message.Parameters.Length > 0 && e.Message.Parameters[0] == "newargs") { MainWindow.OnArgsReceived(e.Message.Parameters.Skip(1).ToArray()); } }; if (tracker.IsFirstInstance) { // Initialize GTK# Application.Init(); TrayIcon = CreateTray(new Pixbuf(System.IO.File.ReadAllBytes("icon.png"))); // Create a Window with title MainWindow = new MainWindow(); // Show the main window and start the application. MainWindow.ShowAll(); if (Array.IndexOf <string>(args, "/as") >= 0) { MainWindow.Visible = false; } MainWindow.Realized += (sender, ea) => { InitExtensions(); if (args.Length > 0) { ((MainWindow)MainWindow).OnArgsReceived(args); } }; MainWindow.DeleteEvent += (sender, ea) => { MainWindow.HideOnDelete(); }; MainWindow.Destroyed += (sender, eventArgs) => { Settings.Default.Save(); Application.Quit(); }; // persist settings and quit Application.Run(); } else { tracker.SendMessageToFirstInstance(args); } }catch (SingleInstancingException ex) { var dlg = new Gtk.MessageDialog(null, 0, MessageType.Error, ButtonsType.Ok, "Could not create a SingleInstanceTracker object:\n" + ex.Message + "\nInner Exception:\n" + ex.InnerException?.ToString() + "\nApplication will now terminate."); dlg.DeleteEvent += (o, ea) => { Application.Quit(); }; dlg.Show(); Application.Run(); }finally{ Dispose(); } }
protected void LaunchError (string format, params string[] args) { string message = String.Format (format, args); MessageDialog dlg = new MessageDialog (null, 0, MessageType.Error, ButtonsType.Ok, message); dlg.Response += OnErrorDialogResponse; dlg.Show (); }
private static void NotAdminErrorAndExit(bool isMicro) { MessageDialog md = new MessageDialog (null, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, String.Format ( "Для работы текущей версии программы необходимо провести{0} обновление базы, " + "но у вас нет для этого прав. Зайдите в программу под администратором.", isMicro ? " микро" : "" )); md.Show (); md.Run (); md.Destroy (); Environment.Exit(1); }
private void validaciones() { try{ }catch(Exception e){ MessageDialog md = new MessageDialog ( null, DialogFlags.Modal, MessageType.Error, ButtonsType.None, "Ocurrio un error: " + e.Message ); md.Show(); } }
void SetLabel () { Gtk.MessageDialog md = new Gtk.MessageDialog (null, 0, Gtk.MessageType.Question, Gtk.ButtonsType.None, "<b>" + Catalog.GetString ("Set the timer's label to:") + "</b>"); md.Title = "Docky Timer"; md.Icon = DockServices.Drawing.LoadIcon ("docky", 22); md.Modal = false; md.AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel); md.AddButton (Catalog.GetString ("_Set Label"), Gtk.ResponseType.Ok); md.DefaultResponse = Gtk.ResponseType.Ok; Gtk.Entry labelEntry = new Gtk.Entry ("" + label); labelEntry.Activated += delegate { Label = labelEntry.Text; md.Destroy (); }; labelEntry.Show (); md.VBox.PackEnd (labelEntry); md.Response += (o, args) => { if (args.ResponseId != Gtk.ResponseType.Cancel) Label = labelEntry.Text; md.Destroy (); }; md.Show (); }
public void on_contact_key_press(object o, KeyPressEventArgs args) { switch(args.Event.HardwareKeycode) { case 22: case 107: { TreeSelection tSelect = ContactTreeView.Selection; if(tSelect.CountSelectedRows() > 0) { MessageDialog dialog = new MessageDialog(CBApp, DialogFlags.Modal | DialogFlags.DestroyWithParent, MessageType.Question, ButtonsType.YesNo, "Do you want to delete the selected Contacts?"); dialog.Response += new ResponseHandler( DeleteContactResponse); dialog.Title = "Delete Contacts"; dialog.Show(); } break; } } }
private void insertarNuevo() { if (!this.validarNoVacio ()) { MessageDialog md = new MessageDialog ( null, DialogFlags.Modal, MessageType.Error, ButtonsType.None, "Ocurrio un error: " + "Campos vacios" ); md.Show (); } else { AccionesDeRegistros acciones = new AccionesDeRegistros (); Registros Persona = new Registros (); Persona.apellidoP = txtApellidoP.Text; Persona.apellidoM = txtApellidoM.Text; Persona.nombre = txtNombre.Text; Persona.domicilio = txtDomicilio.Text; Persona.cp = txtCp.Text; Persona.municipio = txtMun.Text; Persona.estado = txtEst.Text; Persona.pais = txtPais.ActiveText.ToString (); Persona.mapa = txtMail.Text; Persona.telefono = txtTel1.Text; Persona.celular = txtCelular.Text; Persona.radio = txtRadio.Text; Persona.observaciones = txtObs.Text; if (acciones.insertarRegistroNuevo (Persona, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))) { MessageDialog md = new MessageDialog (null, DialogFlags.Modal, MessageType.Info, ButtonsType.None, "Acción realizada con exito."); md.Show (); this.txtNombre.Text = ""; this.txtApellidoM.Text = ""; this.txtApellidoP.Text = ""; this.txtDomicilio.Text = ""; this.txtCp.Text = ""; this.txtMail.Text = ""; this.txtMun.Text= ""; this.txtEst.Text = ""; this.txtTel1.Text= ""; this.txtCelular.Text= ""; this.txtRadio.Text= ""; this.txtObs.Text= ""; this.padre.tabla (); } else { MessageDialog md = new MessageDialog ( null, DialogFlags.Modal, MessageType.Error, ButtonsType.None, "Ocurrio un error: " ); md.Show (); } } }
private void on_generateButton_clicked(object o, EventArgs e) { try { if (Directory.Exists(outputDirectoryEntry.Text) == false) { Gtk.MessageDialog dialog = new Gtk.MessageDialog(window, Gtk.DialogFlags.Modal, Gtk.MessageType.Question, Gtk.ButtonsType.YesNo, "The specified directory does not exist, would you like it to be created?"); if (dialog.Run() == (int)Gtk.ResponseType.Yes) { Directory.CreateDirectory(outputDirectoryEntry.Text); dialog.Destroy(); } else { dialog.Destroy(); return; } } DirectoryInfo dir = new DirectoryInfo(outputDirectoryEntry.Text); if (dir.GetFiles().Length > 0) { Gtk.MessageDialog dialog = new Gtk.MessageDialog(window, Gtk.DialogFlags.Modal, Gtk.MessageType.Question, Gtk.ButtonsType.YesNo, "The specified directory is not empty, any files with the same " + "names as your top-level widgets will be over-written. Do you want to continue?"); if (dialog.Run() != (int)Gtk.ResponseType.Yes) { dialog.Destroy(); return; } else { dialog.Destroy(); } } if (languageComboBox.Active == 0) codegen.GenerateCode(Language.CSharp, outputDirectoryEntry.Text); else if (languageComboBox.Active == 1) codegen.GenerateCode(Language.VisualBasic, outputDirectoryEntry.Text); else if (languageComboBox.Active == 2) codegen.GenerateCode(Language.Boo, outputDirectoryEntry.Text); else if (languageComboBox.Active == 3) codegen.GenerateCode(Language.Nemerle, outputDirectoryEntry.Text); else throw new Exception ("What is " + languageComboBox.Active + "??"); Gtk.MessageDialog msg = new Gtk.MessageDialog(window, Gtk.DialogFlags.Modal, Gtk.MessageType.Info, Gtk.ButtonsType.Ok, "Code generation completed!!"); msg.Show(); msg.Run(); msg.Destroy(); //TODO: This sucks! System.Diagnostics.Process.Start("gnome-open", outputDirectoryEntry.Text); } catch (Exception ex) { Console.WriteLine(ex); Gtk.MessageDialog errordialog = new Gtk.MessageDialog(window, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, ex.Message); errordialog.Run(); errordialog.Destroy(); } }
public static void FatalError(string errorMessage, string title) { MessageDialog errorDialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, errorMessage); errorDialog.Title = title; errorDialog.Response += (o, args) => errorDialog.Destroy(); errorDialog.Show(); Application.Quit(); Environment.Exit(1); }
/// <summary> /// Show Message Window /// </summary> public static void ShowMessage(string title, string message, MessageType mt) { // Gui Message MessageDialog mdl = new MessageDialog(null, DialogFlags.DestroyWithParent, mt, ButtonsType.Ok, true, message); mdl.Show(); mdl.Title = title; mdl.Icon = Gdk.Pixbuf.LoadFromResource("comex_256.png"); mdl.Run(); mdl.Destroy(); }
private void editarRegistro() { AccionesDeRegistros acciones = new AccionesDeRegistros(); this.Persona.nombre = this.txtNombre.Text.Trim(); this.Persona.apellidoM = this.txtApellidoM.Text.Trim(); this.Persona.apellidoP = this.txtApellidoP.Text.Trim (); this.Persona.domicilio = this.txtDomicilio.Text.Trim (); this.Persona.municipio = this.Entry.Text.Trim (); this.Persona.estado = this.txtEstado.Text.Trim (); this.Persona.pais = this.txtPais.ActiveText.ToString (); this.Persona.mapa = this.txtMail.Text.Trim (); this.Persona.telefono = this.txtTel.Text.Trim (); this.Persona.celular = this.txtCel.Text.Trim (); this.Persona.radio = this.txtRadio.Text.Trim (); this.Persona.observaciones = this.txtObs.Text.Trim (); bool editado = acciones.editarCodigoYNombreDeRegistro(Persona, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); if(editado){ MessageDialog md = new MessageDialog (null, DialogFlags.Modal, MessageType.Info, ButtonsType.None, "Acción realizada con exito." ); md.Show(); this.Persona.nombre = this.txtNombre.Text.Trim(); this.Persona.apellidoM = this.txtApellidoM.Text.Trim(); this.Persona.apellidoP = this.txtApellidoP.Text.Trim (); this.Persona.domicilio = this.txtDomicilio.Text.Trim (); this.Persona.municipio = this.Entry.Text.Trim (); this.Persona.estado = this.txtEstado.Text.Trim (); this.Persona.pais = this.txtPais.ActiveText.ToString (); this.Persona.mapa = this.txtMail.Text.Trim (); this.Persona.telefono = this.txtTel.Text.Trim (); this.Persona.celular = this.txtCel.Text.Trim (); this.Persona.radio = this.txtRadio.Text.Trim (); this.Persona.observaciones = this.txtObs.Text.Trim (); this.padre.tabla(); }else{ MessageDialog md = new MessageDialog (null, DialogFlags.Modal, MessageType.Error, ButtonsType.None, "Ocurrio un error al editar." ); md.Show(); } }
private void validaciones() { try{ if(!this.validarNoVacio()){ throw new Exception("Uno de los campos esta vacio."); } if(!this.validarTamano()){ throw new Exception("La longitd de los datos no es valida."); } }catch(Exception e){ MessageDialog md = new MessageDialog ( null, DialogFlags.Modal, MessageType.Error, ButtonsType.None, "Ocurrio un error: " + e.Message ); md.Show(); } }
private void PrintTicket(int id) { MessageDialog WinAsk = new MessageDialog(this, DialogFlags.Modal, MessageType.Question, ButtonsType.YesNo, "Распечатать квитанцию?"); WinAsk.Show (); if((ResponseType) WinAsk.Run () == ResponseType.Yes) { string param = "id=" + id.ToString (); ViewReportExt.Run ("PaymentTicket", param); } WinAsk.Destroy (); }
protected virtual void OnStopbuttonClicked(object sender, System.EventArgs e) { int res; if(capturer == null) return; MessageDialog md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal, MessageType.Question, ButtonsType.YesNo, Catalog.GetString("You are going to stop and finish the current capture."+"\n"+ "Do you want to proceed?")); res = md.Run(); md.Destroy(); if(res == (int)ResponseType.Yes) { md = new MessageDialog((Gtk.Window)this.Toplevel, DialogFlags.Modal, MessageType.Info, ButtonsType.None, Catalog.GetString("Finalizing file. This can take a while")); md.Show(); Stop(); md.Destroy(); recbutton.Visible = true; pausebutton.Visible = false; stopbutton.Visible = false; if(CaptureFinished != null) CaptureFinished(this, new EventArgs()); } }