private void ItemClickEventHandler_Delete2(object sender, ItemClickEventArgs e) { if (gridViewRowClick == true) { gridViewRowClick = false; XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.AutoCloseOptions.Delay = 3000; args.AutoCloseOptions.ShowTimerOnDefaultButton = true; args.DefaultButtonIndex = 0; args.Caption = "Thông báo "; args.Text = "Xóa thành công. Thông báo này sẽ tự đóng sau 3 giây."; args.Buttons = new DialogResult[] { DialogResult.OK }; XtraMessageBox.Show(args).ToString(); } else { XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.AutoCloseOptions.Delay = 3000; args.AutoCloseOptions.ShowTimerOnDefaultButton = true; args.DefaultButtonIndex = 0; args.Caption = "Thông báo "; args.Text = "Vui lòng click vào đầu dòng cần xóa. Thông báo này sẽ tự đóng sau 3 giây."; args.Buttons = new DialogResult[] { DialogResult.OK }; XtraMessageBox.Show(args).ToString(); } ////throw new NotImplementedException(); }
private void ItemClickEventHandler_Save(object sender, ItemClickEventArgs e) { try { Set4Object_Header(); BUS_PTUH.PTU_Header_INSERT(OBJ_PTUH); //BUS_PTUH.Update_SoPO(OBJ_PTUH.SoPTU); layoutControlGroup4.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.AutoCloseOptions.Delay = 2000; args.AutoCloseOptions.ShowTimerOnDefaultButton = true; args.DefaultButtonIndex = 0; args.Caption = "Thông báo "; args.Text = "Lưu thành công . Thông báo này sẽ tự đóng sau 1 giây."; args.Buttons = new DialogResult[] { DialogResult.OK }; XtraMessageBox.Show(args).ToString(); //Is_close = true; } catch (Exception ex) { throw new NotImplementedException(); } }
private void ItemClickEventHandler_Delete2(object sender, ItemClickEventArgs e) { if (gridViewRowClick == true) { BUS2.KHMau_CTXN_LABDAO_DELETE(KHMAUCTXNOBJ.ID); gridViewRowClick = false; //XtraMessageBox.Show("Xóa thành công "); XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.AutoCloseOptions.Delay = 3000; args.AutoCloseOptions.ShowTimerOnDefaultButton = true; args.DefaultButtonIndex = 0; args.Caption = "Thông báo "; args.Text = "Xóa thành công. Thông báo này sẽ tự đóng sau 3 giây."; args.Buttons = new DialogResult[] { DialogResult.OK }; XtraMessageBox.Show(args).ToString(); gridControl1.DataSource = this.tbl_KHMau_CTXN_LABTableAdapter.FillBy(this.sYNC_NUTRICIELDataSet.tbl_KHMau_CTXN_LAB, txtKHMau.Text); } else { XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.AutoCloseOptions.Delay = 3000; args.AutoCloseOptions.ShowTimerOnDefaultButton = true; args.DefaultButtonIndex = 0; args.Caption = "Thông báo "; args.Text = "Vui lòng click vào đầu dòng cần xóa. Thông báo này sẽ tự đóng sau 3 giây."; args.Buttons = new DialogResult[] { DialogResult.OK }; XtraMessageBox.Show(args).ToString(); } //throw new NotImplementedException(); }
private void btnOkParam_Click(object sender, EventArgs e) { bool valorSelect = true; foreach (LookUpEdit cComprobar in pagParametrizacion.Controls.OfType <LookUpEdit>()) { if (cComprobar.Text == "[Elegir]" | string.IsNullOrWhiteSpace(cComprobar.Text)) { valorSelect = false; } } if (valorSelect == true) { XtraMessageBoxArgs args = new XtraMessageBoxArgs(); if (ActualizarConfigConexion(true) == true) { args.AutoCloseOptions.Delay = 5000; args.Caption = "Cerrar en 5 segundos"; args.Text = "Se guardó la configuración con éxito. Abrir nuevamente la aplicación"; args.DefaultButtonIndex = 0; args.AutoCloseOptions.ShowTimerOnDefaultButton = true; args.Buttons = new DialogResult[] { DialogResult.OK }; XtraMessageBox.Show(args).ToString(); Application.Exit(); } else { XtraMessageBox.Show("Error al guardar los parámetros de conexión, falta permisos", "Ejecutar como administrador", MessageBoxButtons.OK); } } else { XtraMessageBox.Show("Falta elegir algunos parámetros", "Seleccionar", MessageBoxButtons.OK); } }
private void timer1_Tick(object sender, EventArgs e) { if (ss() == false && testcn() == false) { XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.AutoCloseOptions.Delay = 2000; args.Caption = "Auto-close message"; args.Text = "access internet connection deny"; args.Buttons = new DialogResult[] { DialogResult.OK, DialogResult.Cancel }; // MessageBox.Show(ex.Message); XtraMessageBox.Show(args).ToString(); } else { foreach (var item in LoadEvents(service, "*****@*****.**", CancellationToken.None)) { //CalendarService service = new CalendarService(); string calendarId = "*****@*****.**"; service.Events.Delete(calendarId, item.Id).Execute(); // MessageBox.Show(item.Id); //rest of the fields } this.appointmentsTableAdapter.Fill(this.dossierMarcherDataSet.Appointments); this.gcSyncComponent.CalendarId = "*****@*****.**"; this.gcSyncComponent.Synchronize(); } }
private void ItemClickEventHandler_Update2(object sender, ItemClickEventArgs e) { if (gridViewRowClick == true) { isAction = "Edit"; state = MenuState.Insert; this.Enabled = false; F_PO_Lines_Added_Row FRM = new F_PO_Lines_Added_Row(); FRM.isAction = this.isAction; FRM.ngaynhanmau = this.ngaynhanmau; Set4Object_Details(); FRM.OBJ_POH = this.OBJ_POH; FRM.OBJ_POL = this.OBJ_POL; FRM.myFinished += this.finished; FRM.Show(); } else { XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.AutoCloseOptions.Delay = 3000; args.AutoCloseOptions.ShowTimerOnDefaultButton = true; args.DefaultButtonIndex = 0; args.Caption = "Thông báo tự đóng "; args.Text = "Vui lòng click chọn dòng cần cập nhật. Thông báo này sẽ tự đóng sau 3 giây."; args.Buttons = new DialogResult[] { DialogResult.OK }; XtraMessageBox.Show(args).ToString(); } }
private static DialogResult DoShowModalDialog(XtraMessageBoxForm dlg, XtraMessageBoxArgs args) { var result = dlg.ShowMessageBoxDialog(args); FormHelper.TopMost = false; return(result); }
public FromGroupRoll() { InitializeComponent(); void AddGroupRoll(object sender, EventArgs e) { if (textName.Text != "") { Cursor = Cursors.WaitCursor; string name = Regex.Replace(textName.Text.Trim(), " {2,}", " "); name = name[0].ToString().ToUpper() + name.Substring(1); bool result = DaoGroupRoll.Instance.InsertGroupRoll(name) == 1; Cursor = Cursors.Default; if (result) { Global.isExecute = true; textName.Text = ""; } else { XtraMessageBoxArgs argsLoginMessageBox = new XtraMessageBoxArgs(null, null, "Nhóm chức vụ đã tồn tại", "Thông báo", new DialogResult[] { DialogResult.OK }); argsLoginMessageBox.Showing += Global.MessageBoxOK; XtraMessageBox.Show(argsLoginMessageBox); } } else { XtraMessageBoxArgs argsLoginMessageBox = new XtraMessageBoxArgs(null, null, "Vui lòng điền đầy đủ thông tin", "Thông báo", new DialogResult[] { DialogResult.OK }); argsLoginMessageBox.Showing += Global.MessageBoxOK; XtraMessageBox.Show(argsLoginMessageBox); } } buttonSubmit.Click += AddGroupRoll; }
public DialogResult ShowMessageOK(string text, string caption, Bitmap bitmap) { XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.Caption = caption; IntPtr icH = bitmap.GetHicon(); Icon ico = Icon.FromHandle(icH); args.Icon = ico; args.AllowHtmlText = DevExpress.Utils.DefaultBoolean.True; args.Text = text; args.Buttons = new DialogResult[] { DialogResult.OK }; args.Showing += (s, e) => { foreach (var control in e.Form.Controls) { SimpleButton button = control as SimpleButton; if (button != null) { button.ImageOptions.SvgImageSize = new Size(16, 16); switch (button.DialogResult.ToString()) { case ("OK"): button.ImageOptions.Image = Form1.Default.imageCollectionSmall.Images[1]; button.Text = "Đóng"; button.AllowFocus = true; break; } } } }; args.AutoCloseOptions.ShowTimerOnDefaultButton = true; return(XtraMessageBox.Show(args)); }
public LoginForm() { InitializeComponent(); //连接Sqlite数据库 if (!SQLiteControl.ConnectToDatabase(@"./DataBase/database.sqlite")) { XtraMessageBoxArgs args = ControlHelper.XtraMessageBoxArgs("消息", "连接数据库失败", new DialogResult[] { DialogResult.Yes }); XtraMessageBox.Show(args); Application.Exit(); } account_textEdit.Focus(); //每次登录前Copy一份DB FileInfo file = new FileInfo(@"./DataBase/database.sqlite"); if (!File.Exists(@"./DataBase/" + DateTime.Today.ToString("yyyy-MM-dd") + ".sqlite")) { file = file.CopyTo(@"./DataBase/" + DateTime.Today.ToString("yyyy-MM-dd") + ".sqlite"); } //解密文件 //else //{ // file = new FileInfo(@"./DataBase/" + DateTime.Today.ToString("yyyy-MM-dd") + ".sqlite"); // file.Decrypt(); //} PreLoad(); login_simpleButton.Focus(); }
private void ItemClickEventHandler_Save(object sender, ItemClickEventArgs e) { if (isAction == "Add") { if (lkeSoPO.Text.Length > 0 && lkeSoPO.Text != "...") { Set4Object_Details(); //XtraMessageBox.Show("Set object xong"); BUS_PTUL.PTU_Lines_INSERT(OBJ_PTUL); //XtraMessageBox.Show("INSERT xong"); XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.AutoCloseOptions.Delay = 1000; args.AutoCloseOptions.ShowTimerOnDefaultButton = true; args.DefaultButtonIndex = 0; args.Caption = "Thông tin "; args.Text = "Lưu thành công . Thông báo này sẽ tự đóng ."; args.Buttons = new DialogResult[] { DialogResult.OK }; XtraMessageBox.Show(args).ToString(); Is_close = true; } } else if (isAction == "Edit") { Set4Object_Details(); XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.AutoCloseOptions.Delay = 3000; args.AutoCloseOptions.ShowTimerOnDefaultButton = true; args.DefaultButtonIndex = 0; args.Caption = "Thông báo "; args.Text = "Cập nhật thành công . Thông báo này sẽ tự đóng sau 3 giây."; args.Buttons = new DialogResult[] { DialogResult.OK }; XtraMessageBox.Show(args).ToString(); Is_close = true; } }
private void ButtonSubmit_Click(object sender, EventArgs e) { if (textOldPassword.Text != "" && textNewPassword.Text != "" && textRePassword.Text != "") { if (textNewPassword.Text == textRePassword.Text) { Cursor = Cursors.WaitCursor; if (DaoAccount.Instance.ChangePassword((int)Tag, textOldPassword.Text, textNewPassword.Text) == 1) { Close(); } else { Cursor = Cursors.Default; XtraMessageBoxArgs argsLoginMessageBox = new XtraMessageBoxArgs(null, null, "Mật khẩu không đúng", "Thông báo", new DialogResult[] { DialogResult.OK }); argsLoginMessageBox.Showing += Global.MessageBoxOK; XtraMessageBox.Show(argsLoginMessageBox); } } else { XtraMessageBoxArgs argsLoginMessageBox = new XtraMessageBoxArgs(null, null, "Mật khẩu nhập lại không khớp", "Thông báo", new DialogResult[] { DialogResult.OK }); argsLoginMessageBox.Showing += Global.MessageBoxOK; XtraMessageBox.Show(argsLoginMessageBox); } } else { XtraMessageBoxArgs argsLoginMessageBox = new XtraMessageBoxArgs(null, null, "Vui lòng điền đầy đủ thông tin", "Thông báo", new DialogResult[] { DialogResult.OK }); argsLoginMessageBox.Showing += Global.MessageBoxOK; XtraMessageBox.Show(argsLoginMessageBox); } }
private void bunifuButton2_Click(object sender, EventArgs e) // Move to next Form { XtraMessageBoxArgs mess = new XtraMessageBoxArgs(); if (textEdit1.Text == GetCode()) { string sname = name.Text; string smail = Mailsbox.Text; string spass = passbox.Text; if (InsertUser(sname, smail, spass)) { Info StepForm = new Info(); StepForm.Show(); StepForm.SetName.Text = name.Text; this.Hide(); } } else { mess.Caption = "Error"; mess.Icon = new Icon(@"D:\Lesson\RIT\C #\WinForm\RavenWedding\Pic\Icon\error-7-xl.png"); mess.Text = "The code you just type has wrong\nPlease recheck your emails and ensure that it same with the code which you has receive."; mess.Buttons = new DialogResult[] { DialogResult.Yes, DialogResult.No }; var x = XtraMessageBox.Show(mess); } }
private void ItemClickEventHandler_Edit(object sender, EventArgs e) { // 25 isEditting gan bang true //isEditting = true; isAction = "Edit"; state = MenuState.Update; if (gridViewRowClick == true) { Set4Object(); //Disable this.Enabled = false; // // Truyen object LOC to DELEGATE F_CUSTOMER_Details F_CUS_Dtl = new Class.F_CUSTOMER_Details(); F_CUS_Dtl.CUS = this.CUS; F_CUS_Dtl.isAction = this.isAction; F_CUS_Dtl.myFinished += this.finished; F_CUS_Dtl.Show(); } else { XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.AutoCloseOptions.Delay = 3000; args.AutoCloseOptions.ShowTimerOnDefaultButton = true; args.DefaultButtonIndex = 0; args.Caption = "Lưu ý "; args.Text = "Vui lòng click vào dòng cần chỉnh sửa . Thông báo này sẽ tự đóng sau 3 giây."; args.Buttons = new DialogResult[] { DialogResult.OK }; XtraMessageBox.Show(args).ToString(); } }
public FormTask() { InitializeComponent(); void AddTask(object sender, EventArgs e) { object employeeId = lookupObject.EditValue; object time = dateDateTime.EditValue; string location = Regex.Replace(textLocation.Text.Trim(), " {2,}", " "); if (location != "") { location = location[0].ToString().ToUpper() + location.Substring(1); } string content = Regex.Replace(textContent.Text.Trim(), " {2,}", " "); if (content != "") { content = content[0].ToString().ToUpper() + content.Substring(1); } string note = Regex.Replace(textNote.Text.Trim(), " {2,}", " "); if (note != "") { note = note[0].ToString().ToUpper() + note.Substring(1); } if (employeeId != null && time != null) { if (DateTime.Compare((DateTime)dateDateTime.EditValue, DateTime.Now.StartOfWeek(DayOfWeek.Monday)) < 0) { XtraMessageBoxArgs argsLoginMessageBox = new XtraMessageBoxArgs(null, null, "Bạn có chắc muốn thêm lịch trình cho tuần đã qua", "Thông báo", new DialogResult[] { DialogResult.Yes, DialogResult.No }); argsLoginMessageBox.Showing += Global.MessageBoxYesNo; if (XtraMessageBox.Show(argsLoginMessageBox) == DialogResult.No) { return; } } Cursor = Cursors.WaitCursor; DaoTask.Instance.InsertTask((int)employeeId, (DateTime)time, location, content, note); Global.isExecute = true; lookupObject.EditValue = null; dateDateTime.EditValue = null; textLocation.Text = ""; textContent.Text = ""; textNote.Text = ""; Cursor = Cursors.Default; } else { XtraMessageBoxArgs argsLoginMessageBox = new XtraMessageBoxArgs(null, null, "Vui lòng điền đầy đủ thông tin", "Thông báo", new DialogResult[] { DialogResult.OK }); argsLoginMessageBox.Showing += Global.MessageBoxOK; XtraMessageBox.Show(argsLoginMessageBox); } } Load += LoadEmployee; buttonSubmit.Click += AddTask; }
private void ConnectionIsError() { XtraMessageBoxArgs argsLoginMessageBox = new XtraMessageBoxArgs(null, null, "Lỗi kết nối cơ sở dữ liệu", "Thông báo", new DialogResult[] { DialogResult.OK }); argsLoginMessageBox.Showing += Global.MessageBoxOK; XtraMessageBox.Show(argsLoginMessageBox); Environment.Exit(0); }
protected override void ShowMessage(string text) { var msg = new XtraMessageBoxArgs(); msg.MessageBeepSound = MessageBeepSound.Error; msg.Text = text; XtraMessageBox.Show(msg); }
private void ItemClickEventHandler_Update2(object sender, ItemClickEventArgs e) { if (gridViewRowClick == true) { isAction = "Edit"; state = MenuState.Insert; //Update : DELEGATE //Gọi form Details //Disable this.Enabled = false; // F_KHMau_CTXN_Details FRM = new F_KHMau_CTXN_Details(); FRM.isAction = this.isAction; FRM.ngaynhanmau = this.ngaynhanmau; Set4Object_Details(); FRM.KHMAUOBJ = this.KHMAUOBJ; FRM.KHMAUCTXNOBJ = this.KHMAUCTXNOBJ; FRM.myFinished += this.finished; FRM.Show(); } else { XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.AutoCloseOptions.Delay = 3000; args.AutoCloseOptions.ShowTimerOnDefaultButton = true; args.DefaultButtonIndex = 0; args.Caption = "Thông báo tự đóng "; args.Text = "Vui lòng click chọn dòng cần cập nhật. Thông báo này sẽ tự đóng sau 3 giây."; args.Buttons = new DialogResult[] { DialogResult.OK }; XtraMessageBox.Show(args).ToString(); } //if(lkeCTXN.Text.Length > 0 && lkeCTXN.Text != "...") //{ // if (txtSoLuong.Text == null) // XtraMessageBox.Show("Vui lòng nhập số lượng mẫu đã nhận","Lưu ý"); // else // { // if (txtSoLuongXN.Text == null) // txtSoLuongXN.Text = txtSoLuong.Text; // if (KHMAUCTXNOBJ.DonGia != 0) // KHMAUCTXNOBJ.ThanhTien = (KHMAUCTXNOBJ.DonGia * float.Parse(txtSoLuongXN.Text) * (100 + KHMAUCTXNOBJ.VAT) / 100); // else // KHMAUCTXNOBJ.ThanhTien = 0; // KHMAUCTXNOBJ.KHMau = txtKHMau.Text; // KHMAUCTXNOBJ.CTXNID = int.Parse(lkeCTXN.EditValue.ToString()); // KHMAUCTXNOBJ.SoLuongXN = txtSoLuongXN.Text; // BUS2.KHMau_CTXN_LABBUS_INSERT(KHMAUCTXNOBJ); // } //} //this.tbl_KHMau_CTXN_LABTableAdapter.ClearBeforeFill = true; //gridControl1.DataSource = this.tbl_KHMau_CTXN_LABTableAdapter.FillBy(this.sYNC_NUTRICIELDataSet.tbl_KHMau_CTXN_LAB, txtKHMau.Text); //throw new NotImplementedException(); }
/** * XtraMessageBox dialog for Global usage. * */ public static void ShowMessageBox(string caption, string content) { XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.Caption = caption; args.Text = content; args.Buttons = new DialogResult[] { DialogResult.OK }; XtraMessageBox.Show(args).ToString(); }
private void message_popup_ok(string messsage) { XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.Caption = "Notification!"; args.Text = messsage; args.Buttons = new DialogResult[] { DialogResult.OK }; XtraMessageBox.Show(args).ToString(); }
public void Error_Message(string msg) { XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.Caption = "경고"; args.Text = msg; args.Buttons = new DialogResult[] { DialogResult.OK }; args.Showing += Args_Showing; XtraMessageBox.Show(args).ToString(); }
/** * 一定時間でメッセージのdialogを表示 * during: ミリ秒 * */ public static void ShowFloatTips(string message, int during) { XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.AutoCloseOptions.Delay = during; args.Caption = "情報"; args.Text = message; args.Buttons = new DialogResult[] { DialogResult.OK }; XtraMessageBox.Show(args).ToString(); }
private static DialogResult ShowInternal(Control owner, string message, string caption, Icon messageIcon, params DialogResult[] dialogResults) { MessageBoxForm form = new MessageBoxForm(); form.Icon = MessageBoxIcon; XtraMessageBoxArgs args = new XtraMessageBoxArgs(owner, message, caption, dialogResults, messageIcon, 0); args.Showing += Args_Showing; return(form.ShowMessageBoxDialog(args)); }
public static void AutoMsg(string caption, string msg, int sec) { XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.AutoCloseOptions.Delay = sec * 1000; args.Caption = caption; args.Text = msg; //args.Buttons = new DialogResult[] { DialogResult.OK, DialogResult.Cancel }; XtraMessageBox.Show(args).ToString(); }
public static void ShowSplashPanelMessage(string pMessage) { XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.AutoCloseOptions.Delay = 1000; args.Caption = "Thông báo!"; args.Text = pMessage; //args.Buttons = new DialogResult[] { DialogResult.OK, DialogResult.Cancel }; XtraMessageBox.Show(args).ToString(); }
private void comboBoxAoo_SelectionChangeCommitted(object sender, EventArgs e) { string s = "1"; if (Program.sql_con.State == ConnectionState.Closed) { Program.sql_con.Open(); } if (comboBoxAoo.SelectedIndex > -1) { SqlCommand cmd = Program.sql_con.CreateCommand(); cmd.CommandType = CommandType.Text; s = comboBoxAoo.SelectedValue.ToString(); cmd.CommandText = "select e.[délai_dexecution] as délai_dexecution , p.date_op from etude e inner join fk f on e.id1 = f.id1 inner join publication p on p.id2 = f.id2 where p.id2 = '" + s + "'"; DataTable table = new DataTable(); cmd.ExecuteNonQuery(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(table); foreach (DataRow row in table.Rows) { délai_dexecution.EditValue = row["délai_dexecution"].ToString(); DateTime dt = Convert.ToDateTime(row["date_op"].ToString()); dt = dt.AddDays(+75); dateEditdate_approbation.EditValue = dt; } if (dateEditdate_approbation.DateTime < DateTime.Now) { XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.AutoCloseOptions.Delay = 6000; args.Caption = "Auto-close message"; args.Text = "Date approbation a expiré"; args.Buttons = new DialogResult[] { DialogResult.OK, DialogResult.Cancel }; XtraMessageBox.Show(args).ToString(); } else if (dateEditdate_approbation.DateTime > DateTime.Now) { if (dateEditdate_approbation.DateTime < DateTime.Now.AddDays(+15)) { TimeSpan difference = DateTime.Now - dateEditdate_approbation.DateTime; //create TimeSpan object XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.AutoCloseOptions.Delay = 6000; args.Caption = "Auto-close message"; args.Text = "Il reste " + difference.Days + " jour d'expiration de la date d'approbation"; args.Buttons = new DialogResult[] { DialogResult.OK, DialogResult.Cancel }; XtraMessageBox.Show(args).ToString(); } } } }
/// <summary> /// 显示自定义消息框,最多支持8个按钮 /// </summary> /// <param name="textStr">消息框文本</param> /// <param name="btnTextStrs">按钮对应的文本数组</param> public int ShowMessageBox(string textStr, string[] btnTextStrs) { btnTextArray = btnTextStrs; dialogResultArray = new DialogResult[btnTextStrs.Length]; for (int i = 0; i < btnTextStrs.Length; i++) { switch (i) { case 0: dialogResultArray[0] = DialogResult.Yes; break; case 1: dialogResultArray[1] = DialogResult.No; break; case 2: dialogResultArray[2] = DialogResult.Abort; break; case 3: dialogResultArray[3] = DialogResult.Ignore; break; case 4: dialogResultArray[4] = DialogResult.Retry; break; case 5: dialogResultArray[5] = DialogResult.OK; break; case 6: dialogResultArray[6] = DialogResult.Cancel; break; case 7: dialogResultArray[7] = DialogResult.None; break; } } XtraMessageBoxArgs msgBoxArgs = new XtraMessageBoxArgs(this, textStr, "提示", dialogResultArray, System.Drawing.Icon.FromHandle(System.Drawing.SystemIcons.Exclamation.Handle), 0); DialogResult result = ShowMessageBoxDialog(msgBoxArgs); for (int i = 0; i < dialogResultArray.Length; i++) { if (dialogResultArray[i] == result) { return(i); } } return(-1); }
private void DescargarPlantilla() { try { using (var dialogoParaGuardar = new XtraSaveFileDialog()) { dialogoParaGuardar.Title = "Guardar en..."; dialogoParaGuardar.Filter = @"Archivos de excel (*.xlsx)|*.xlsx"; dialogoParaGuardar.FilterIndex = 2; dialogoParaGuardar.RestoreDirectory = true; if (dialogoParaGuardar.ShowDialog() != DialogResult.OK) { return; } var libroDeTrabajo = new XLWorkbook(); var WorkSheetNombre = "Familia"; var parametroUseSubFamily = Parametros.FirstOrDefault(p => p.PARAMETER_ID == Enums.GetStringValue(IdParametro.UseMaterialSubFamily) && p.GROUP_ID == Enums.GetStringValue(GrupoParametro.MaterialSubFamily)); if (parametroUseSubFamily != null && int.Parse(parametroUseSubFamily.VALUE) == (int)SiNo.Si) { WorkSheetNombre = "Sub-familia"; } var hoja = libroDeTrabajo.Worksheets.Add(WorkSheetNombre); GenerarHojaDeClase(hoja, 1, 1, 5); if (File.Exists(dialogoParaGuardar.FileName)) { File.Delete(dialogoParaGuardar.FileName); } libroDeTrabajo.SaveAs(dialogoParaGuardar.FileName); XtraMessageBoxArgs args = new XtraMessageBoxArgs(); args.AutoCloseOptions.Delay = 3000; args.Caption = "Operación exitosa"; args.Text = "Archivo generado exitósamente, ¿Desea abrir el archivo?"; args.Buttons = new[] { DialogResult.Yes, DialogResult.No }; args.Icon = System.Drawing.SystemIcons.Question; args.DefaultButtonIndex = 0; args.AutoCloseOptions.ShowTimerOnDefaultButton = true; if (XtraMessageBox.Show(args) == DialogResult.Yes) { Process.Start(dialogoParaGuardar.FileName); } } } catch (Exception e) { InteraccionConUsuarioServicio.Alerta($"Error al descargar la plantilla: {e.Message}"); } }
private void close_simpleButton_Click(object sender, EventArgs e) { XtraMessageBoxArgs args = ControlHelper.XtraMessageBoxArgs("是否关闭当前窗口?", "消息", new DialogResult[] { DialogResult.Yes, DialogResult.No }); if (XtraMessageBox.Show(args) == DialogResult.No) { return; } this.Close(); }
/// <summary> /// 退出button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void exit_simpleButton_Click(object sender, EventArgs e) { XtraMessageBoxArgs args = ControlHelper.XtraMessageBoxArgs("消息", "是否退出程序", new DialogResult[] { DialogResult.Yes, DialogResult.No }, 5000); if (XtraMessageBox.Show(args) == DialogResult.No) { return; } Application.Exit(); }