private async void SaveButton_Click(object sender, RoutedEventArgs e) { SaveButton.Focus(); string Errors = settings.Validate(); ErrorText.Text = Errors; if (Errors == null) { bool IsFirstRun = (Settings.SavedFile == null); Settings.SavedFile = settings; settings.Save(); SessionCore.Instance.Business.DownloadManager.Options = settings.Download; this.Close(); if (settings.MediaPlayerApp == MediaPlayerApplication.Mpc) { MpcConfigBusiness.ConfigureSettings(); SessionCore.Instance.Business.ConfigurePlayer(); } if (IsFirstRun || settings.MediaPlayerApp != currentPlayer) { SessionCore.Instance.Business.SetPlayer(SessionCore.Instance.GetNewPlayer()); } await EditPlaylistBusiness.AutoBindFilesAsync(); } }
private void UrlTextBox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { SaveButton.Focus(); } }
private void CartridgeCodeReaded(string code) { if (CodeBox.Focused) { CodeBox.Text = code; SaveButton.Focus(); } }
private void EditWindow_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { SaveButton.Focus(); var peer = new ButtonAutomationPeer(SaveButton); var invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider; invokeProv?.Invoke(); } }
private void PacketTextBox_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { SaveButton.Focus(); e.Handled = true; e.SuppressKeyPress = true; } }
private void OnLoaded(object sender, RoutedEventArgs routedEventArgs) { if (AllowNameEdit) { DocumentTextBox.Focus(); } else { SaveButton.Focus(); } }
private void SaveTaskDialog1_KeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.S && Keyboard.Modifiers == ModifierKeys.Control) { SaveButton.Focus(); var viewModel = (SaveTaskDialogViewModel)DataContext; if (viewModel.SaveTask.CanExecute(null)) { viewModel.SaveTask.Execute(null); } } }
private void CWCreateFolder_Loaded(object sender, RoutedEventArgs e) { Dispatcher.BeginInvoke(new System.Action(() => { if (string.IsNullOrWhiteSpace(txtFolder.Text)) { txtFolder.Focus(); } else { SaveButton.Focus(); } })); }
/// <summary> /// 説明文TextBoxのKeyDownイベント /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DescriptionTextBox_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { SaveButton.Focus(); } } catch (Exception ex) { throw Program.ThrowException(ex); } }
void CW_Loaded(object sender, RoutedEventArgs e) { Dispatcher.BeginInvoke(new Action(() => { if (string.IsNullOrWhiteSpace(txtBalance.Text)) { txtBalance.Focus(); } else { SaveButton.Focus(); } })); }
private void ColorClickHandler(object sender, EventArgs e) { var T = (TextBox)sender; using (var cd = new ColorDialog()) { cd.Color = T.BackColor; if (cd.ShowDialog() == DialogResult.OK) { T.BackColor = cd.Color; } } SaveButton.Focus(); }
public PrintJobView(PrintJobViewModel viewModel, IBannerManager bannerManager, IRegionManager regionManager) { _bannerManager = bannerManager; _regionManager = regionManager; DataContext = viewModel; ViewModel = viewModel; InitializeComponent(); TransposerHelper.Register(this, viewModel); // Using button.Focus() - see also https://stackoverflow.com/a/45139201 SaveButton.Click += delegate { SaveButton.Focus(); }; Loaded += async(sender, args) => await SetBanner(); }
private bool SaveChanges() { SaveButton.Focus(); video.Artist = video.Artist.Trim(); video.Album = video.Album.Trim(); video.Title = video.Title.Trim(); video.DownloadName = video.DownloadName.Trim(); video.DownloadUrl = video.DownloadUrl.Trim(); video.BuyUrl = video.BuyUrl.Trim(); ErrorText.Text = ""; if (TitleText.Text.Length == 0) { ErrorText.Text = "Title is required."; return(false); } if (business.IsTitleDuplicate(video)) { ErrorText.Text = "Artist and title already exist in the database."; return(false); } // Only update EditedOn when directly editing from the Edit window. if (!isPopup) { video.EditedOn = DateTime.UtcNow; } ratingBusiness.UpdateChanges(); business.Save(); isFormSaved = true; // Update grid when in popup mode. Otherwise Callback is called in Window_Closing. if (isPopup) { callback(video); } return(true); }
private bool SaveChanges() { SaveButton.Focus(); video.Artist = video.Artist.Trim(); video.Album = video.Album.Trim(); video.Title = video.Title.Trim(); video.DownloadName = video.DownloadName.Trim(); video.DownloadUrl = video.DownloadUrl.Trim(); video.BuyUrl = video.BuyUrl.Trim(); ErrorText.Text = ""; if (TitleText.Text.Length == 0) { ErrorText.Text = "Title is required."; return(false); } if (business.IsTitleDuplicate(video)) { ErrorText.Text = "Artist and title already exist in the database."; return(false); } if (!isUrlValid && StartDownloadCheckBox.IsChecked == true) { ErrorText.Text = "Please enter a valid URL"; return(false); } if (SessionCore.Instance.Business.DownloadManager.IsDownloadDuplicate(video.DownloadUrl)) { ErrorText.Text = "You are already downloading this video."; return(false); } video.EditedOn = DateTime.UtcNow; business.Save(); return(true); }
private void MainForm_Load(object sender, EventArgs e) { MinecraftFolderPath.Text = configFile.Read("MinecraftFolder", "UserConfig"); MinecraftExePath.Text = configFile.Read("MinecraftExe", "UserConfig"); SaveButton.Focus(); }
/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Form.Load"/> event. /// </summary> /// <param name="e">An <see cref="T:System.EventArgs"/> that contains the event data.</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); AnimateWindow(this.Handle, 200, AW_ACTIVATE | (_UseSlideAnimation ? AW_HOR_NEGATIVE | AW_SLIDE : AW_BLEND)); SaveButton.Focus(); }