/// <summary> /// User wants to accept the changes /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnButtonOk(object sender, RoutedEventArgs e) { // take the focus off whatever field may have it which will force commit of edit and binding of the // new value back to editingAccount object ButtonOk.Focus(); HandleOk(5); }
private async void pickContactsBt_Click(object sender, RoutedEventArgs e) { try { cp = new ContactPicker(); cp.SelectionMode = ContactSelectionMode.Fields; cp.DesiredFieldsWithContactFieldType.Add(ContactFieldType.PhoneNumber); var contact = await cp.PickContactAsync(); Country selectedCountry = ((WithdrawalViewModel)DataContext).SelectedCountry; bool validationResult; if (contact == null) { validationResult = Helper.ValidateContactInfo("", "", out ((WithdrawalViewModel)DataContext).contactNumberWellFormatted, ref selectedCountry, ref ((WithdrawalViewModel)DataContext).isToResetCountry, ref ((WithdrawalViewModel)DataContext).validateContactInfoAgain); ((WithdrawalViewModel)DataContext).SelectedCountry = selectedCountry; ((WithdrawalViewModel)DataContext).updateUserInterfaceBasedOnBasedOnValidationResult("", "", validationResult); } else { validationResult = Helper.ValidateContactInfo(contact.DisplayName, contact.Phones.FirstOrDefault().Number, out ((WithdrawalViewModel)DataContext).contactNumberWellFormatted, ref selectedCountry, ref ((WithdrawalViewModel)DataContext).isToResetCountry, ref ((WithdrawalViewModel)DataContext).validateContactInfoAgain); ((WithdrawalViewModel)DataContext).SelectedCountry = selectedCountry; ((WithdrawalViewModel)DataContext).updateUserInterfaceBasedOnBasedOnValidationResult(contact.DisplayName, contact.Phones.FirstOrDefault().Number, validationResult); contactNumberBackup = contact.Phones.FirstOrDefault().Number; ButtonOk.Focus(FocusState.Programmatic); } } catch (Exception) { } HelperWindows.LoseFocus(sender); }
private void TxtPassword_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { ButtonOk.Focus(); } }
private void passwordBox_KeyDown(object sender, KeyRoutedEventArgs e) { if (e.Key != VirtualKey.Enter) { return; } ButtonOk.Focus(FocusState.Programmatic); }
private void metroWindow_Loaded(object sender, RoutedEventArgs e) { if (soundSw) { General.PlaySound(General.soundNotice); } ButtonOk.Focus(); imagePic.Source = new BitmapImage(new Uri("Resources/Pic/" + PicName, UriKind.Relative)); }
private void metroWindow_Loaded(object sender, RoutedEventArgs e) { General.PlaySound(General.soundNotice); ButtonOk.Focus(); var rootPath = "Resources/Pic出力回路/"; switch (mode) { case TEST_出力回路.MODE.OUTP_ON: imagePic.Source = new BitmapImage(new Uri(rootPath + "汎用出力12点灯_.jpg", UriKind.Relative)); labelMessage.Content = "チェッカーのLEDが点灯していますか?"; break; case TEST_出力回路.MODE.OUTP_OFF1: imagePic.Source = new BitmapImage(new Uri(rootPath + "その他点灯_.jpg", UriKind.Relative)); labelMessage.Content = "チェッカーのLEDが点灯していますか?"; break; case TEST_出力回路.MODE.OUTP_OFF2: imagePic.Source = new BitmapImage(new Uri(rootPath + "基板LED点灯_.jpg", UriKind.Relative)); labelMessage.Content = "基板のLEDが点灯していますか?"; break; case TEST_出力回路.MODE.INTERLOCK1: imagePic.Source = new BitmapImage(new Uri(rootPath + "Interlock1.jpg", UriKind.Relative)); labelMessage.Content = "外部非常停止SWを上向きにすると、\r\nインターロックLEDが点灯しますか?"; break; case TEST_出力回路.MODE.INTERLOCK2: imagePic.Source = new BitmapImage(new Uri(rootPath + "Interlock2.jpg", UriKind.Relative)); labelMessage.Content = "インバータ過昇温SWを上向きにすると、\r\nインターロックLEDが消灯しますか?"; break; case TEST_出力回路.MODE.INTERLOCK3: if (State.TestItem == ITEM._30167671) { imagePic.Source = new BitmapImage(new Uri(rootPath + "Interlock30167671.jpg", UriKind.Relative)); labelMessage.Content = "インバータ過昇温SWを下向きにしても、\r\nインターロックLEDが消灯したままですか?"; } else { imagePic.Source = new BitmapImage(new Uri(rootPath + "Interlock30221500.jpg", UriKind.Relative)); labelMessage.Content = "インバータ過昇温SWを下向きにすると、\r\nインターロックLEDが点灯しますか?"; } break; } }
private void Window_Loaded(object sender, RoutedEventArgs e) { Main MainWindowApp = null; foreach (Window Value in App.Current.Windows) { if (Value.Title == "نرم افزار آب و فاضلاب طرقرود") { MainWindowApp = (Main)Value; } } if (ButtonYes.Visibility == System.Windows.Visibility.Visible) { ButtonYes.Focus(); } else { ButtonOk.Focus(); } }
private void metroWindow_Loaded(object sender, RoutedEventArgs e) { General.PlaySoundLoop(General.soundAlarm); ButtonOk.Focus(); imagePic.Source = new BitmapImage(new Uri("Resources/Pic/non2.PNG", UriKind.Relative)); }
private void metroWindow_Loaded(object sender, RoutedEventArgs e) { TmTimeOut.Interval = 700; TmTimeOut.Start(); ButtonOk.Focus(); }
private void ContactTb_OnKeyUp(object sender, KeyRoutedEventArgs e) { TextBox txt = (TextBox)sender; // Deny the use of "." "," "-" if (e.Key != VirtualKey.Back) { // code 190 = . if (e.Key.ToString().Equals("190")) { txt.Text = txt.Text.Replace(".", ""); txt.SelectionStart = txt.Text.Length; } else // code 188 = , if (e.Key.ToString().Equals("188")) { txt.Text = txt.Text.Replace(",", ""); txt.SelectionStart = txt.Text.Length; } else // code 189 = - if (e.Key.ToString().Equals("189")) { txt.Text = txt.Text.Replace("-", ""); txt.SelectionStart = txt.Text.Length; } if (!AppDefConstants.INTERNACIONAL_NUMBER_ON) { if (ContactTb.Text.Length < 9) { contactNumberBackup = txt.Text.ToString(); } else if (ContactTb.Text.Length == 9) { contactNumberBackup = txt.Text.ToString(); ButtonOk.Focus(FocusState.Programmatic); } else { txt.Text = contactNumberBackup; ButtonOk.Focus(FocusState.Programmatic); } } else { if (ContactTb.Text.Length < 11) { contactNumberBackup = txt.Text.ToString(); } else if (ContactTb.Text.Length == 11) { contactNumberBackup = txt.Text.ToString(); } else { txt.Text = contactNumberBackup; } } } }
private void WithdrawalToOther_Click(object sender, RoutedEventArgs e) { ((WithdrawalViewModel)DataContext).toggleShowContactFields(); ButtonOk.Focus(FocusState.Programmatic); }
public DialogWindow(Window parent, string message, string title, MessageBoxButton messageBoxButton, MessageBoxImage messageBoxImage) : base() { InitializeComponent(); Closing += new CancelEventHandler(DialogWindow_Closing); Owner = parent; Title = title; LabelContent.Text = message; if (Owner == null) { WindowStartupLocation = WindowStartupLocation.CenterScreen; } if (messageBoxButton == MessageBoxButton.OK || messageBoxButton == MessageBoxButton.OKCancel) { ButtonOk.Visibility = Visibility.Visible; ButtonOk.Click += new RoutedEventHandler(ButtonOk_Click); ButtonOk.Focus(); } if (messageBoxButton == MessageBoxButton.YesNo || messageBoxButton == MessageBoxButton.YesNoCancel) { ButtonYes.Visibility = Visibility.Visible; ButtonNo.Visibility = Visibility.Visible; ButtonNo.Focus(); ButtonYes.Click += new RoutedEventHandler(ButtonYes_Click); ButtonNo.Click += new RoutedEventHandler(ButtonNo_Click); } if (messageBoxButton == MessageBoxButton.OKCancel || messageBoxButton == MessageBoxButton.YesNoCancel) { ButtonCancel.Visibility = Visibility.Visible; ButtonCancel.Focus(); ButtonCancel.Click += new RoutedEventHandler(ButtonCancel_Click); } if (messageBoxImage != MessageBoxImage.None) { Image.Visibility = Visibility.Visible; switch (messageBoxImage) { case MessageBoxImage.Information: Image.Source = Imaging.CreateBitmapSourceFromHIcon(System.Drawing.SystemIcons.Information.Handle, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); System.Media.SystemSounds.Asterisk.Play(); break; case MessageBoxImage.Question: Image.Source = Imaging.CreateBitmapSourceFromHIcon(System.Drawing.SystemIcons.Question.Handle, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); System.Media.SystemSounds.Question.Play(); break; case MessageBoxImage.Exclamation: Image.Source = Imaging.CreateBitmapSourceFromHIcon(System.Drawing.SystemIcons.Exclamation.Handle, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); System.Media.SystemSounds.Exclamation.Play(); break; case MessageBoxImage.Error: Image.Source = Imaging.CreateBitmapSourceFromHIcon(System.Drawing.SystemIcons.Error.Handle, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); System.Media.SystemSounds.Hand.Play(); break; } } ShowDialog(); }
/******************************/ /* Menu Events */ /******************************/ #region Menu Events #endregion /******************************/ /* Other Events */ /******************************/ #region Other Events /// <summary> /// MetroWindow_Loaded /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MetroWindow_Loaded(object sender, RoutedEventArgs e) { ButtonOk.Focus(); LoadFileList(); }