private void ShowUpdateResult(PublishVersion newVersion, bool forceNotify) { if (newVersion == null) { if (forceNotify) { MessageBox.Show(strings.messageLatest, strings.actPanelTitle, MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { // Check if ignored if (forceNotify || !Version.TryParse(_plugin.Settings.VersionIgnored, out var v) || v < newVersion.ParsedVersion) { // Show notify var message = string.Format(newVersion.IsPreRelease ? strings.messageNewPrerelease : strings.messageNewStable, newVersion.ParsedVersion); MessageBoxManager.Yes = strings.buttonUpdateNow; MessageBoxManager.No = strings.buttonIgnoreVersion; MessageBoxManager.Cancel = strings.buttonUpdateLater; MessageBoxManager.Register(); var res = MessageBox.Show(message, strings.actPanelTitle, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); MessageBoxManager.Unregister(); if (res == DialogResult.No) { _controller.NotifyNewVersionIgnored(true, newVersion.ParsedVersion.ToString()); } else if (res == DialogResult.Yes) { System.Diagnostics.Process.Start(newVersion.PublishPage); } } } }
protected override async void Delete(object sender, RoutedEventArgs e) { try { // Gets the product to be deleted ProductOverviewItem ToBeDeleted = ((FrameworkElement)sender).DataContext as ProductOverviewItem; string messageboxTitle = String.Format(LangResource.MBTitleDeleteObj, ToBeDeleted.ProductName); string messageboxContent = String.Format(LangResource.MBContentDeleteObj, LangResource.TheProduct.ToLower(), ToBeDeleted.ProductName); MessageBoxManager.Yes = LangResource.Yes; MessageBoxManager.No = LangResource.No; MessageBoxManager.Register(); // Shows a messagebox with localized content to propmpt if the user is sure he wants to delete the product if (MessageBox.Show(messageboxContent, messageboxTitle, MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { MessageBoxManager.Unregister(); // Delete the product from the database and the ProductList _prodRepo.Delete(ToBeDeleted.ID); ProductList.Remove(ToBeDeleted); await _prodRepo.SaveChangesAsync(); // Refreshes the grid BindData(); } else { MessageBoxManager.Unregister(); } } catch (Exception) { MessageBoxManager.Unregister(); MessageBox.Show(LangResource.ErrUpdateOverviewFailed); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MessageBoxManager.Register(); AppDomain.CurrentDomain.AssemblyResolve += (Object sender, ResolveEventArgs args) => { String thisExe = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name; System.Reflection.AssemblyName embeddedAssembly = new System.Reflection.AssemblyName(args.Name); String resourceName = "Siege_Account_Switcher.AeroWizard.dll"; using (var stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)) { Byte[] assemblyData = new Byte[stream.Length]; stream.Read(assemblyData, 0, assemblyData.Length); return(System.Reflection.Assembly.Load(assemblyData)); } }; Application.Run(new Form1()); }
private void simpleButtonSupprimer_Click(object sender, EventArgs e) { if (dataGridView1.CurrentRow != null) { MessageBoxManager.Yes = "نعم"; MessageBoxManager.No = "لا"; MessageBoxManager.Register(); DialogResult dr = MessageBox.Show("هل أنت متأكد من الحذف ؟؟", "تنبيه", MessageBoxButtons.YesNo); MessageBoxManager.Unregister(); if (dr == DialogResult.Yes) { op.deletePlainte(dataGridView1.SelectedRows[0].Cells[0].Value.ToString()); history.AddHistory(" جدول الشكايات ", "الحدف", dataGridView1.SelectedRows[0].Cells[0].Value.ToString()); getDataTable(); } else { } } }
private DirectoryInfo GetFallbackDirectory() { bool folder = false; MessageBoxManager.Yes = "Browse exe"; MessageBoxManager.No = "Browse dir"; MessageBoxManager.Register(); var result = MessageBox.Show("We couldn't seem to find your Serious Sam Fusion installation, please show us where it is located.", "Error", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Error); MessageBoxManager.Unregister(); if (result == DialogResult.Cancel) { Application.Exit(); } else if (result == DialogResult.No) { folder = true; } return(NotFoundHandler(folder)); }
public Form1() { InitializeComponent(); timer.Enabled = true; MessageBoxManager.Yes = "Có"; MessageBoxManager.No = "Không"; MessageBoxManager.Cancel = "Hủy"; MessageBoxManager.Register(); input = new InputInformation( tb_somay, tb_tensv, tb_msv, tb_sdt, tb_tenmay, tb_nd, tb_ghichu, bt_them, bt_capnhat, bt_xoa, bt_excel, timer, gvdata, saveFileDialog1, cms_menu); this.timer.Tick += new System.EventHandler(this.timer_Tick); input.changeData(); }
//File menu private void exitToolStripMenuItem_Click(object sender, EventArgs e) { if (isSaved == false) { MessageBoxManager.Yes = "Thoát"; MessageBoxManager.No = "Lưu lại"; MessageBoxManager.Cancel = "Trở lại"; MessageBoxManager.Register(); DialogResult dR = MessageBox.Show("Dữ liệu chưa được lưu sẽ bị mất\r\nBạn có chắc muốn thoát?", "Cảnh báo", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning); if (dR == DialogResult.Yes) { this.Close(); } else if (dR == DialogResult.No) { this.saveFile(false, "Save Document Files"); } MessageBoxManager.Unregister(); } }
private void DeleteStudentCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { MessageBoxManager.OK = "Ta bort"; MessageBoxManager.Cancel = "Avbryt"; MessageBoxManager.Register(); var items = dataGrid.SelectedCells.Select(x => x.Item as Student).Where(x => x != null).ToHashSet(); var text = items.Count > 1 ? "Är du säker att du vill ta bort markerade elever?" : "Är du säker att du vill ta bort markerad elev?"; var caption = items.Count > 1 ? "Ta bort elever" : "Ta bort elev"; History.NewStep(); if (MessageBox.Show(text, caption, MessageBoxButton.OKCancel) == MessageBoxResult.OK) { foreach (var student in items) { CurrentClass.Students.Remove(student); History.AddToHistory(new Commands.RemoveStudent(CurrentClass, student)); } } MessageBoxManager.Unregister(); }
private void pbExitWithDelete_Click(object sender, EventArgs e) { MessageBoxManager.Unregister(); MessageBoxManager.Yes = "Yes"; MessageBoxManager.No = "No"; MessageBoxManager.Register(); DialogResult choose = MessageBox.Show("Are You Sure To Exit With Delete Text And Image Files?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (choose == DialogResult.Yes) { File.Delete(OriginalUrl); File.Delete(KeyGenerateUrl); File.Delete(EncryptUrl); File.Delete(DecryptUrl); File.Delete(DecryptedImageUrl); File.Delete(EncryptedImageUrl); File.Delete(OriginalImageUrl); Application.Exit(); } }
private void Form1_Load(object sender, EventArgs e) { MessageBoxManager.Yes = "Sql server"; MessageBoxManager.No = "File system"; MessageBoxManager.Register(); var result = MessageBox.Show("Do you want to use sql server or file system?", "Inform", MessageBoxButtons.YesNo, MessageBoxIcon.Information); MessageBoxManager.Unregister(); if (result == DialogResult.Yes) { _dataOptions = DataOptions.SqlServer; ShowData(); } else if (result == DialogResult.No) { _dataOptions = DataOptions.FileSystem; ShowData(); } }
int MsgBox(string act, string text) { IntPtr ptr = IntPtr.Zero; int msgbox_id = 0; switch (act) { case "close": msgbox_id = User32.MessageBox(Handle, "Действительно хотите выйти?\nВсе несохраненные данные будут потеряны.", "Выход", User32.settings.MB_ICONQUESTION | User32.settings.MB_YESNO); return(msgbox_id); case "test": MessageBoxManager.Yes = "Ok"; MessageBoxManager.No = "Retry"; MessageBoxManager.Cancel = "Cancel"; MessageBoxManager.Register(); msgbox_id = User32.MessageBox(Handle, text, "Дескрипторы", User32.settings.MB_ICONWARNING | User32.settings.MB_YESNOCANCEL); switch (User32.Msgbox_rtrn(msgbox_id)) { case "IDYES": MessageBox.Show("ОК нажато"); break; case "IDNO": MessageBox.Show("Retry нажато"); break; case "IDCANCEL": MessageBox.Show("Cancel нажато"); break; } MessageBoxManager.Unregister(); break; } return(msgbox_id); }
/// <summary> /// ////// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmRPTAccount_Load(object sender, EventArgs e) { this.BackColor = Properties.Settings.Default.colorBackGround; try { comboBox2.AutoCompleteMode = AutoCompleteMode.SuggestAppend; comboBox2.AutoCompleteSource = AutoCompleteSource.ListItems; comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend; comboBox1.AutoCompleteSource = AutoCompleteSource.ListItems; comboBox3.AutoCompleteMode = AutoCompleteMode.SuggestAppend; comboBox3.AutoCompleteSource = AutoCompleteSource.ListItems; GetData1(); MessageBoxManager.Yes = "نعم"; MessageBoxManager.No = "الغاء"; MessageBoxManager.Register(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void simpleButton1_Click_1(object sender, EventArgs e) { // co = new Cause_Operations(); MessageBoxManager.Yes = "نعم"; MessageBoxManager.No = "لا"; MessageBoxManager.Register(); DialogResult dr = MessageBox.Show("هل أنت متأكد من الحذف ؟؟", "تنبيه", MessageBoxButtons.YesNo); MessageBoxManager.Unregister(); if (dr == DialogResult.Yes) { co.deletePieceJointe_cause(int.Parse(dataGridView1.SelectedRows[0].Cells[4].Value.ToString())); history.AddHistory("وثائق القضية", "الحذف", cb_num_cause.Text); getdata(); textBox1.Clear(); } else { } //MessageBox.Show(dataGridView1.SelectedRows[0].Cells[4].Value.ToString()); }
private void çıkışToolStripMenuItem_Click(object sender, EventArgs e) { if (lbl_cins.Text == "Cinsiyet :") { if (MessageBox.Show("Çıkmak istediğinizden emin misiniz?", "Onay", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Environment.Exit(0); } } else if (lbl_cins.Text == "Gender :") { MessageBoxManager.Yes = "Yes"; MessageBoxManager.No = "No"; MessageBoxManager.Register(); if (MessageBox.Show("Are you sure that you want to exit ?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Environment.Exit(0); } MessageBoxManager.Unregister(); } }
private void simpleButton2_Click(object sender, EventArgs e) { MessageBoxManager.Yes = "نعم"; MessageBoxManager.No = "لا"; MessageBoxManager.Register(); DialogResult dr = MessageBox.Show("هل أنت متأكد من الحذف ؟؟", "تنبيه", MessageBoxButtons.YesNo); MessageBoxManager.Unregister(); if (dr == DialogResult.Yes) { string id = dataGridView1.SelectedRows[0].Cells[1].Value.ToString(); co.deleteCause(id); dataGridView1.DataSource = GetData().Tables["causes"]; testdata(); history.AddHistory("القضية", "الحدف", txt_search.Text); cn.Close(); } else { } }
private void btnÜrünEkle_Click(object sender, EventArgs e) { if (Ayarlar.dil == "English") { UrunEkle(); FalseYap(); MessageBoxManager.Unregister(); MessageBoxManager.OK = "OK"; MessageBoxManager.Register(); MessageBox.Show("Added Product To Warehouse.", "Succesfull", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (Ayarlar.dil == "Türkçe") { UrunEkle(); FalseYap(); MessageBoxManager.Unregister(); MessageBoxManager.OK = "Tamam"; MessageBoxManager.Register(); MessageBox.Show("Depoya Ürün Eklenmiştir.", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void newToolStripMenuItem_Click(object sender, EventArgs e) { if (isSaved == false) { MessageBoxManager.Yes = "Tiếp tục"; MessageBoxManager.No = "Lưu lại"; MessageBoxManager.Cancel = "Hủy bỏ"; MessageBoxManager.Register(); DialogResult dR = MessageBox.Show("Dữ liệu chưa được lưu sẽ bị mất\r\nBạn có muốn tiếp tục?", "Cảnh báo", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning); if (dR == DialogResult.Yes) { rtxtWordPad.Clear(); } else if (dR == DialogResult.No) { this.saveFile(false, "Save Document Files"); } MessageBoxManager.Unregister(); } }
private void frmWordPad_FormClosing(object sender, FormClosingEventArgs e) { if (isSaved == false) { MessageBoxManager.Yes = "Thoát"; MessageBoxManager.No = "Lưu lại"; MessageBoxManager.Cancel = "Trở lại"; MessageBoxManager.Register(); DialogResult dR = MessageBox.Show("Dữ liệu chưa được lưu sẽ bị mất\r\nBạn có chắc muốn thoát?", "Cảnh báo", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning); if (dR == DialogResult.Cancel) { e.Cancel = true; } else if (dR == DialogResult.No) { this.saveFile(false, "Save Document Files"); e.Cancel = true; } MessageBoxManager.Unregister(); } }
private void Verify(object sender, RoutedEventArgs e) { try { SetLanguageDictionary(); var user = ((FrameworkElement)sender).DataContext as DesktopUser; string messageboxContent = String.Format(LangResource.MBContentVerifyUser, user.FullName); string messageboxTitle = String.Format(LangResource.MBTitleVerifyUser, user.FullName); MessageBoxManager.Yes = LangResource.Yes; MessageBoxManager.No = LangResource.No; MessageBoxManager.Register(); if (MessageBox.Show(messageboxContent, messageboxTitle, MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { MessageBoxManager.Unregister(); user.VerifiedByAdmin = true; _userRepo.Update(user); _userRepo.SaveChangesAsync(); BindData(); } else { MessageBoxManager.Unregister(); } } catch (Exception) { MessageBox.Show(LangResource.ErrUpdateOverviewFailed); MessageBoxManager.Unregister(); } }
private void btn_ajouter_Click(object sender, EventArgs e) { if (cnx.State == ConnectionState.Closed) { cnx.Open(); } //!string.IsNullOrEmpty(imagLocation) if ((!string.IsNullOrEmpty(imagLocation) && txtAdvMawdoua.Text != "" && txtClientMawdoua.Text != "" && txtMontantMawdoua.Text != "" && txtNumCheckMawdoua.Text != "")) { byte[] imageCause = null; FileStream stream = new FileStream(imagLocation, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(stream); imageCause = br.ReadBytes((int)stream.Length); SqlCommand cmdAjoutCause = new SqlCommand(); cmd.Connection = cnx; cmdAjoutCause.Connection = cnx; cmd.CommandText = "SELECT cc.id_client_cause, cc.nom , ac.id_adversaire_cause ,ac.nom_adv from dbo.cause c, dbo.client_cause cc, dbo.adversaire_cause ac WHERE c.id_cause='" + cmbNumMawdoua.SelectedItem + "' AND c.id_client=cc.id_client_cause AND c.id_adv=ac.id_adversaire_cause "; dr = cmd.ExecuteReader(); //MessageBox.Show(dr[0].ToString()); while (dr.Read()) { cmdAjoutCause.Parameters.Add(new SqlParameter("@logo", imageCause)); cmdAjoutCause.CommandText = "insert into depot_cause values('" + cmbNumMawdoua.Text + "'," + dr[0].ToString() + "," + int.Parse(dr[2].ToString()) + ", " + txtNumCheckMawdoua.Text + "," + float.Parse(txtMontantMawdoua.Text) + ",@logo)"; } dr.Close(); cmdAjoutCause.ExecuteNonQuery(); MessageBox.Show("لقد ثمت الاضافة بنجاح ... "); getData1(); history.AddHistory(" الوديعة", "الاضافة", cmbNumMawdoua.Text); cnx.Close(); } else { MessageBoxManager.OK = "حسنا"; MessageBoxManager.Register(); MessageBox.Show("يجب ملئ الخانات ", "تنبيه", MessageBoxButtons.OK); } }
private void lbl2Top1_Click(object sender, EventArgs e) { Label[] camp = { lbl8Top1, lbl8Top2, lbl8Top3, lbl8Top4, lbl8Top5, lbl8Top6, lbl8Top7, lbl8Top8, lbl4Top1, lbl4Top2, lbl4Top3, lbl4Top4, lbl2Top1, lbl2Top1 }; Label myLabel = sender as Label; int index = Array.IndexOf(camp, myLabel); MessageBoxManager.Yes = "Sim"; MessageBoxManager.No = "Não"; MessageBoxManager.Register(); var confirmResult = MessageBox.Show("Você está preste a selecionar o ganhador do campeonato, essa mudança não podera ser desfeita. Você selecionou o certo?", "Selecionar Vencedor", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { conex.conn.Open(); string sql2 = "update partida set id_vencedor ='" + IDJog[index] + "' where num_partida ='" + NumPart[index] + "'and id_torneio ='" + ID + "'; "; MySqlCommand cmd = new MySqlCommand(sql2, conex.conn); cmd.ExecuteNonQuery(); conex.conn.Close(); } }
private void simpleButton3_Click(object sender, EventArgs e) { MessageBoxManager.Yes = "نعم"; MessageBoxManager.No = "لا"; MessageBoxManager.Register(); DialogResult dr = MessageBox.Show("هل أنت متأكد من الحذف ؟؟", "تنبيه", MessageBoxButtons.YesNo); MessageBoxManager.Unregister(); if (dr == DialogResult.Yes) { String id = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); op.deleteParPlaignant(id); MessageBox.Show("تم الحذف بنجاح"); getDataTable(); chikaya.getDataTableParPlaignant(); history.AddHistory("المشتكون بهم", "الحدف", txb_cin.Text); } else { } }
DialogResult MessageBoxFromThread(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, bool tweak) { if (InvokeRequired) { return((DialogResult)Invoke(new MessageBoxFromThreadDelegate(MessageBoxFromThread), new object[] { owner, text, caption, buttons, icon, defaultButton, tweak })); } TaskbarProgress.SetState(this, TaskbarProgress.TaskbarStates.Paused); if (tweak) { MessageBoxManager.Register(); // Tweak button names } var result = MessageBox.Show(owner, text, caption, buttons, icon, defaultButton); if (tweak) { MessageBoxManager.Unregister(); } TaskbarProgress.SetState(this, TaskbarProgress.TaskbarStates.Normal); return(result); }
/// <summary> /// Checks if a file has been changed outside /// </summary> private static void CheckFileChange(ITabbedDocument document) { TabbedDocument casted = document as TabbedDocument; if (casted.IsEditable && casted.CheckFileChange()) { if (Globals.Settings.AutoReloadModifiedFiles) { casted.RefreshFileInfo(); casted.Reload(false); } else { if (YesToAll) { casted.RefreshFileInfo(); casted.Reload(false); return; } String dlgTitle = TextHelper.GetString("Title.InfoDialog"); String dlgMessage = TextHelper.GetString("Info.FileIsModifiedOutside"); String formatted = String.Format(dlgMessage, "\n", casted.FileName); MessageBoxManager.Cancel = TextHelper.GetString("Label.YesToAll"); MessageBoxManager.Register(); // Use custom labels... DialogResult result = MessageBox.Show(Globals.MainForm, formatted, " " + dlgTitle, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information); casted.RefreshFileInfo(); // User may have waited before responding, save info now if (result == DialogResult.Yes) { casted.Reload(false); } else if (result == DialogResult.Cancel) { casted.Reload(false); YesToAll = true; } MessageBoxManager.Unregister(); } } }
private void simpleButton3_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 0) { MessageBox.Show("please select a row to delete"); } else { string word = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); MessageBoxManager.Yes = "نعم"; MessageBoxManager.No = "لا"; MessageBoxManager.Register(); DialogResult dr = MessageBox.Show("هل أنت متأكد من الحدف ؟", "تنبيه", MessageBoxButtons.YesNo); MessageBoxManager.Unregister(); if (dr == DialogResult.Yes) { notification.delete(word); history.AddHistory("تبليغ", "حذف", word); refresh(); } } }
//delete adversaire public void deleteAdversaire_cause(int id_Adversaire_cause) { try { if (cn.State == ConnectionState.Closed) { cn.Open(); } SqlCommand cmd = new SqlCommand("DELETE FROM adversaire_cause WHERE id_adversaire_cause = " + id_Adversaire_cause, cn); cmd.ExecuteNonQuery(); MessageBoxManager.OK = "حسنا"; MessageBoxManager.Register(); DialogResult dr = MessageBox.Show("تم الحدف بنجاح", "", MessageBoxButtons.OK); MessageBoxManager.Unregister(); //MessageBox.Show("تم الحدف بنجاح "); cn.Close(); } catch (SystemException ex) { MessageBox.Show(string.Format("An error occurred: {0}", ex.Message)); } }
private void InitLocalization() { MessageBoxManager.Unregister(); MessageBoxManager.Yes = International.GetText("Global_Yes"); MessageBoxManager.No = International.GetText("Global_No"); MessageBoxManager.OK = International.GetText("Global_OK"); MessageBoxManager.Cancel = International.GetText("Global_Cancel"); MessageBoxManager.Retry = International.GetText("Global_Retry"); MessageBoxManager.Register(); labelServiceLocation.Text = International.GetText("Service_Location") + ":"; { int i = 0; foreach (string loc in Globals.MiningLocation) { comboBoxLocation.Items[i++] = International.GetText("LocationName_" + loc); } } labelBitcoinAddress.Text = International.GetText("BitcoinAddress") + ":"; labelWorkerName.Text = International.GetText("WorkerName") + ":"; linkLabelCheckStats.Text = International.GetText("Form_Main_check_stats"); linkLabelChooseBTCWallet.Text = International.GetText("Form_Main_choose_bitcoin_wallet"); toolStripStatusLabelGlobalRateText.Text = International.GetText("Form_Main_global_rate") + ":"; toolStripStatusLabelBTCDayText.Text = "BTC/" + International.GetText(ConfigManager.GeneralConfig.TimeUnit.ToString()); toolStripStatusLabelBalanceText.Text = (ExchangeRateAPI.ActiveDisplayCurrency + "/") + International.GetText(ConfigManager.GeneralConfig.TimeUnit.ToString()); devicesListViewEnableControl1.InitLocale(); buttonBenchmark.Text = International.GetText("Form_Main_benchmark"); buttonSettings.Text = International.GetText("Form_Main_settings"); buttonStartMining.Text = International.GetText("Form_Main_start"); buttonStopMining.Text = International.GetText("Form_Main_stop"); buttonHelp.Text = International.GetText("Form_Main_help"); label_NotProfitable.Text = International.GetText("Form_Main_MINING_NOT_PROFITABLE"); groupBox1.Text = International.GetText("Form_Main_Group_Device_Rates"); }
private void btnNew_Click(object sender, EventArgs e) { MessageBoxManager.OK = "ADD"; MessageBoxManager.Cancel = "UPDATE"; MessageBoxManager.Register(); DialogResult dialogResult = MessageBox.Show("Do you wanna ADD or UPDATE", "", MessageBoxButtons.OKCancel); if (dialogResult == DialogResult.OK) { txtUsername.ReadOnly = false; btnUpdateAccount.Enabled = false; btnAddAccount.Enabled = true; MessageBoxManager.Unregister(); } else { txtUsername.ReadOnly = true; btnAddAccount.Enabled = false; btnUpdateAccount.Enabled = true; MessageBoxManager.Unregister(); } }
public static void UpdateCulture() { if (String.IsNullOrEmpty(Culture)) { return; } //Copy all MergedDictionarys into a auxiliar list. var dictionaryList = Application.Current.Resources.MergedDictionaries.ToList(); //Search for the specified culture. string requestedCulture = string.Format(@"ResourceDictionary/Lang/{0}.xaml", Culture); var resourceDictionary = dictionaryList. FirstOrDefault(d => d.Source.OriginalString == requestedCulture); if (resourceDictionary == null) { //If not found, select our default language. requestedCulture = @"ResourceDictionary/Lang/en-US.xaml"; resourceDictionary = dictionaryList. FirstOrDefault(d => d.Source.OriginalString == requestedCulture); } //If we have the requested resource, remove it from the list and place at the end. //Then this language will be our string table to use. if (resourceDictionary != null) { Application.Current.Resources.MergedDictionaries.Remove(resourceDictionary); Application.Current.Resources.MergedDictionaries.Add(resourceDictionary); } //Inform the threads of the new culture. Thread.CurrentThread.CurrentCulture = new CultureInfo(Culture); Thread.CurrentThread.CurrentUICulture = new CultureInfo(Culture); MessageBoxManager.Unregister(); //MessageBoxManager.OK = Application.Current.TryFindResource("BtnOK").ToString(); MessageBoxManager.Register(); }
protected async override void Delete(object sender, RoutedEventArgs e) { try { Language ToBeDeleted = ((FrameworkElement)sender).DataContext as Language; string messageboxTitle = String.Format(LangResource.MBTitleDeleteObj, ToBeDeleted.LocalName); string messageboxContent = String.Format(LangResource.MBContentDeleteObj, LangResource.TheLanguage.ToLower(), ToBeDeleted.LocalName); MessageBoxManager.Yes = LangResource.Yes; MessageBoxManager.No = LangResource.No; MessageBoxManager.Register(); if (MessageBox.Show(messageboxContent, messageboxTitle, MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) { MessageBoxManager.Unregister(); _langRepo.Delete(ToBeDeleted); LanguageList.Remove(ToBeDeleted); await _langRepo.SaveChangesAsync(); BindData(); } else { MessageBoxManager.Unregister(); } } catch (Exception) { throw; } }