private void OpenedEventHandler(object sender, DialogOpenedEventArgs eventargs) { if(UserEmail.Text.Trim() != String.Empty && UserPassword.Password.Trim() != String.Empty && UserPasswordConfirm.Password.Trim() != String.Empty) { if(IsNewPasswordMatch()) { if (!UserExists()) { _focusUser.UserEmail = UserEmail.Text.Trim(); _focusUser.LastUpdate = _focusUser.DateCreated = StringManipulation.GetStringFromDate(DateTime.Now.Date); _focusUser.UserId = NextUserId(); _userAccess.Insert(_focusUser); eventargs.Session.UpdateContent(new MessageDialog("Alright Sparky,","Your account has been created, login?")); } else { eventargs.Session.UpdateContent(new MessageDialog("Too litle too late", "The email you entered has already been taken...")); } } else { eventargs.Session.UpdateContent(new MessageDialog("Are we randomly pressing keys", "The passwords you provided do not match")); } } else { eventargs.Session.UpdateContent(new MessageDialog("Forgeting Something?", "All fields were not filled")); } }
private void OpenedEventHandler(object sender, DialogOpenedEventArgs eventargs) { if(NameTextBox.Text.Trim() != String.Empty && PasswordBox.Password.Trim() != String.Empty) { if(!UserIsValid(NameTextBox.Text.Trim(), PasswordBox.Password.Trim())) { if(!_passwordWasChanged) { _isProceed = false; eventargs.Session.UpdateContent(new MessageDialog("He is a Ghost!", "No user found with the\nemail and password you provided")); } else { _isProceed = false; eventargs.Session.UpdateContent(new MessageDialog("When the cat is away..", "Your password was changed " + _daysAgo + " days ago.\nIf this was not you you should know that you data\n was probably compromised")); } } else { _isProceed = true; eventargs.Session.Close(); } } else { eventargs.Session.UpdateContent(new MessageDialog("Ahoy mate, Forgeting something", "You must enter both an Email Address and a Password!")); } }
private static void IsOpenPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs) { var dialogHost = (DialogHost)dependencyObject; if (dialogHost._popupContentControl != null) { ValidationAssist.SetSuppress(dialogHost._popupContentControl, !dialogHost.IsOpen); } VisualStateManager.GoToState(dialogHost, dialogHost.SelectState(), !TransitionAssist.GetDisableTransitions(dialogHost)); if (dialogHost.IsOpen) { WatchWindowActivation(dialogHost); dialogHost._currentSnackbarMessageQueueUnPauseAction = dialogHost.SnackbarMessageQueue?.Pause(); } else { dialogHost._asyncShowWaitHandle.Set(); dialogHost._attachedDialogClosingEventHandler = null; if (dialogHost._currentSnackbarMessageQueueUnPauseAction != null) { dialogHost._currentSnackbarMessageQueueUnPauseAction(); dialogHost._currentSnackbarMessageQueueUnPauseAction = null; } dialogHost._session.IsEnded = true; dialogHost._session = null; dialogHost._closeCleanUp(); dialogHost.Dispatcher.InvokeAsync(() => dialogHost._restoreFocusDialogClose.Focus(), DispatcherPriority.Input); return; } dialogHost._asyncShowWaitHandle.Reset(); dialogHost._session = new DialogSession(dialogHost); var window = Window.GetWindow(dialogHost); dialogHost._restoreFocusDialogClose = window != null?FocusManager.GetFocusedElement(window) : null; //multiple ways of calling back that the dialog has opened: // * routed event // * the attached property (which should be applied to the button which opened the dialog // * straight forward dependency property // * handler provided to the async show method var dialogOpenedEventArgs = new DialogOpenedEventArgs(dialogHost._session, DialogOpenedEvent); dialogHost.OnDialogOpened(dialogOpenedEventArgs); dialogHost._attachedDialogOpenedEventHandler?.Invoke(dialogHost, dialogOpenedEventArgs); dialogHost.DialogOpenedCallback?.Invoke(dialogHost, dialogOpenedEventArgs); dialogHost._asyncShowOpenedEventHandler?.Invoke(dialogHost, dialogOpenedEventArgs); dialogHost.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { var child = dialogHost.FocusPopup(); //https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/issues/187 //totally not happy about this, but on immediate validation we can get some weird looking stuff...give WPF a kick to refresh... Task.Delay(300).ContinueWith(t => child.Dispatcher.BeginInvoke(new Action(() => child.InvalidateVisual()))); })); }
private static async void ExtendedOpenedEventHandler(object sender, MaterialDesignThemes.Wpf.DialogOpenedEventArgs eventArgs) { try { await Task.Delay(1200); eventArgs.Session.Close(); } catch { /*cancelled by user...tidy up and dont close as will have already closed */ } }
private void DialogHost_DialogOpened(object sender, MaterialDesignThemes.Wpf.DialogOpenedEventArgs eventArgs) { IndexTextBox.Text = null; ActiveBorder.Visibility = Visibility.Visible; this.ComponentName.Text = _selectedProxy.FullName; System.Drawing.Bitmap bitmap = CanvasRenderEngine.GetObjectBitmap(_selectedProxy.CreateObejct(), this._isInput, out _); ShowcaseImage.Source = CanvasRenderEngine.BitmapToBitmapImage(bitmap); this.DialogCancelButton.Content = LanguagableComponent.GetTransLation(new string[] { "CANCEL", "取消" }); this.DialogFinishButton.Content = LanguagableComponent.GetTransLation(new string[] { "ACCEPT", "接受" }); HintAssist.SetHint(this.IndexTextBox, _isInput ? LanguagableComponent.GetTransLation(new string[] { "Output Index", "输出端索引" }) : LanguagableComponent.GetTransLation(new string[] { "Input Index", "输入端索引" })); }
private static async void ExtendedOpenedEventHandlerLocal(object sender, MaterialDesignThemes.Wpf.DialogOpenedEventArgs eventArgs) { do { await Task.Delay(100); }while (Dialogs.Register.close == false); try { Dialogs.Register.close = false; eventArgs.Session.Close(); } catch { } }
private void DialogHost_DialogOpened(object sender, MaterialDesignThemes.Wpf.DialogOpenedEventArgs eventArgs) { ActiveBorder.Visibility = Visibility.Visible; HintAssist.SetHint(DialogSelect, new Label() { Content = LanguagableComponent.GetTransLation(new string[] { "Select Mode", "选择模式" }), HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }); ColorMode.Content = LanguagableComponent.GetTransLation(new string[] { "Wire Color", "连线颜色" }); InputMode.Content = LanguagableComponent.GetTransLation(new string[] { "Input Control", "输入控制项" }); OutputMode.Content = LanguagableComponent.GetTransLation(new string[] { "Output Control", "输出控制项" }); DialogAccept.Content = LanguagableComponent.GetTransLation(new string[] { "ACCEPT", "接受" }); }
private void OpenedEventHandler(object sender, DialogOpenedEventArgs eventargs) { if(UserEmail.Text.Trim() != String.Empty && OldPassword.Password.Trim() != String.Empty && NewPassword.Password.Trim() != String.Empty && ConfirmPassword.Password.Trim() != String.Empty) { if(VerifyUserExists(UserEmail.Text.Trim())) { if(IsForgotenPassword(OldPassword.Password.Trim())) { if(IsNewPasswordMatch()) { UpdateUser(); eventargs.Session.UpdateContent(new MessageDialog("Good to go", "Your password has been updated")); } else { eventargs.Session.UpdateContent(new MessageDialog("Banging your head on the keyboard", "We had to assume because the passwords\nyou've entered don't match")); } } else { if(OldPasswordChecksOut()) { if(IsNewPasswordMatch()) { UpdateUser(); eventargs.Session.UpdateContent(new MessageDialog("Good to go", "Your password has been updated")); } else { eventargs.Session.UpdateContent(new MessageDialog("Banging your head on the keyboard", "We had to assume because the passwords\nyou've entered don't match")); } } else { MessageBox.Show("The Email and Password entered do not match our records", "No User Found"); } } } else { eventargs.Session.UpdateContent(new MessageDialog("He is a Ghost!", "No user found with the\nemail and password you provided")); } } else { eventargs.Session.UpdateContent(new MessageDialog("Ahoy mate, Forgeting something", "You must enter both an Email Address and a Password!")); } }
private static void IsOpenPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs) { var dialogHost = (DialogHost)dependencyObject; ValidationAssist.SetSuppress(dialogHost._popupContentControl, !dialogHost.IsOpen); VisualStateManager.GoToState(dialogHost, dialogHost.SelectState(), !TransitionAssist.GetDisableTransitions(dialogHost)); if (!dialogHost.IsOpen) { dialogHost._asyncShowWaitHandle.Set(); dialogHost._attachedDialogClosingEventHandler = null; dialogHost._session.IsEnded = true; dialogHost._session = null; return; } dialogHost._asyncShowWaitHandle.Reset(); dialogHost._session = new DialogSession(dialogHost); //multiple ways of calling back that the dialog has opened: // * routed event // * the attached property (which should be applied to the button which opened the dialog // * straight forward dependency property // * handler provided to the async show method var dialogOpenedEventArgs = new DialogOpenedEventArgs(dialogHost._session, DialogOpenedEvent); dialogHost.OnDialogOpened(dialogOpenedEventArgs); dialogHost._attachedDialogOpenedEventHandler?.Invoke(dialogHost, dialogOpenedEventArgs); dialogHost.DialogOpenedCallback?.Invoke(dialogHost, dialogOpenedEventArgs); dialogHost._asyncShowOpenedEventHandler?.Invoke(dialogHost, dialogOpenedEventArgs); dialogHost.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { var child = dialogHost._popup?.Child; if (child == null) { return; } child.Focus(); child.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next)); //https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/issues/187 //totally not happy about this, but on immediate validation we can get some wierd looking stuff...give WPF a kick to refresh... Task.Delay(300).ContinueWith(t => child.Dispatcher.BeginInvoke(new Action(() => child.InvalidateVisual()))); })); }
private static async void erroropenEvent(object sender, MaterialDesignThemes.Wpf.DialogOpenedEventArgs eventArgs) { try { await Task.Delay(2000); eventArgs.Session.Close(); } catch (TaskCanceledException) { /*cancelled by user...tidy up and dont close as will have already closed */ } catch { } }
private async void RootDialogOpened(object sender, MaterialDesignThemes.Wpf.DialogOpenedEventArgs eventArgs) { try { DialogHost host = sender as DialogHost; if (host.DialogContent.GetType() == typeof(Loading)) { UserHelper helper = new UserHelper(); User user = await helper.GetUserFromSystem(); if (user != null) { bool connected = await helper.CheckUser(user); if (connected) { (DataContext as MainWindowViewModel).User = user; await((mainContentControl.Content as ItemGrid).DataContext as ItemGridViewModel).FillCollection(user); DialogHost.CloseDialogCommand.Execute(null, rootDialog); } else { DialogHost.OpenDialogCommand.Execute(new SignIn(), rootDialog); } } else { DialogHost.OpenDialogCommand.Execute(new SignIn(), rootDialog); } } } catch (Exception ex) { DialogHost.CloseDialogCommand.Execute(this, null); Message msg = new Message(ex.ToString()); await DialogHost.Show(msg, "RootDialog", gridDialogHost_DialogOpened, gridDialogHost_DialogClosing); } }
private static void IsOpenPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs) { var dialogHost = (DialogHost)dependencyObject; VisualStateManager.GoToState(dialogHost, dialogHost.SelectState(), true); if (!dialogHost.IsOpen) { dialogHost._asyncShowWaitHandle.Set(); dialogHost._attachedDialogClosingEventHandler = null; dialogHost._session.IsEnded = true; dialogHost._session = null; return; } dialogHost._asyncShowWaitHandle.Reset(); dialogHost._session = new DialogSession(dialogHost); //multiple ways of calling back that the dialog has opened: // * routed event // * the attached property (which should be applied to the button which opened the dialog // * straight forward dependency property // * handler provided to the async show method var dialogOpenedEventArgs = new DialogOpenedEventArgs(dialogHost._session, DialogOpenedEvent); dialogHost.OnDialogOpened(dialogOpenedEventArgs); dialogHost._attachedDialogOpenedEventHandler?.Invoke(dialogHost, dialogOpenedEventArgs); dialogHost.DialogOpenedCallback?.Invoke(dialogHost, dialogOpenedEventArgs); dialogHost._asyncShowOpenedEventHandler?.Invoke(dialogHost, dialogOpenedEventArgs); dialogHost.Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new Action(() => { dialogHost._popup?.Child?.Focus(); dialogHost._popup?.Child?.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next)); })); }
private async void SignInDialogOpened(object sender, MaterialDesignThemes.Wpf.DialogOpenedEventArgs eventArgs) { User user = new User(); user.Name = NameText.Text; user.Email = Email.Text; user.Password = Password.Password; UserHelper helper = new UserHelper(); if (await helper.CheckUser(user)) { if (await helper.WriteUserToSystem(user)) { DialogHost sign = eventArgs.Source as DialogHost; DialogHost.CloseDialogCommand.Execute(null, sign); DialogHost.CloseDialogCommand.Execute(sender, null); } } else { DialogHost.CloseDialogCommand.Execute(null, eventArgs.Source as DialogHost); } }
private static void IsOpenPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs) { var dialogHost = (DialogHost)dependencyObject; if (dialogHost._popupContentControl != null) { ValidationAssist.SetSuppress(dialogHost._popupContentControl, !dialogHost.IsOpen); } VisualStateManager.GoToState(dialogHost, dialogHost.SelectState(), !TransitionAssist.GetDisableTransitions(dialogHost)); if (dialogHost.IsOpen) { WatchWindowActivation(dialogHost); dialogHost._currentSnackbarMessageQueueUnPauseAction = dialogHost.SnackbarMessageQueue?.Pause(); } else { dialogHost._attachedDialogClosingEventHandler = null; if (dialogHost._currentSnackbarMessageQueueUnPauseAction != null) { dialogHost._currentSnackbarMessageQueueUnPauseAction(); dialogHost._currentSnackbarMessageQueueUnPauseAction = null; } dialogHost.CurrentSession.IsEnded = true; dialogHost.CurrentSession = null; dialogHost._closeCleanUp(); //NB: _dialogTaskCompletionSource is only set in the case where the dialog is shown with Show //To get into this case you need to display the dialog with Show and then hide it by setting IsOpen to false //Setting this here ensures the other dialogHost._dialogTaskCompletionSource?.TrySetResult(null); // Don't attempt to Invoke if _restoreFocusDialogClose hasn't been assigned yet. Can occur // if the MainWindow has started up minimized. Even when Show() has been called, this doesn't // seem to have been set. dialogHost.Dispatcher.InvokeAsync(() => dialogHost._restoreFocusDialogClose?.Focus(), DispatcherPriority.Input); return; } dialogHost.CurrentSession = new DialogSession(dialogHost); var window = Window.GetWindow(dialogHost); dialogHost._restoreFocusDialogClose = window != null?FocusManager.GetFocusedElement(window) : null; //multiple ways of calling back that the dialog has opened: // * routed event // * the attached property (which should be applied to the button which opened the dialog // * straight forward dependency property // * handler provided to the async show method var dialogOpenedEventArgs = new DialogOpenedEventArgs(dialogHost.CurrentSession, DialogOpenedEvent); dialogHost.OnDialogOpened(dialogOpenedEventArgs); dialogHost._attachedDialogOpenedEventHandler?.Invoke(dialogHost, dialogOpenedEventArgs); dialogHost.DialogOpenedCallback?.Invoke(dialogHost, dialogOpenedEventArgs); dialogHost._asyncShowOpenedEventHandler?.Invoke(dialogHost, dialogOpenedEventArgs); dialogHost.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { CommandManager.InvalidateRequerySuggested(); UIElement child = dialogHost.FocusPopup(); if (child != null) { //https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/issues/187 //totally not happy about this, but on immediate validation we can get some weird looking stuff...give WPF a kick to refresh... Task.Delay(300).ContinueWith(t => child.Dispatcher.BeginInvoke(new Action(() => child.InvalidateVisual()))); } })); }
protected void OnDialogOpened(DialogOpenedEventArgs eventArgs) { RaiseEvent(eventArgs); }
private void SaveIncome(DialogOpenedEventArgs eventargs) { var accId = GetAccountId(); if(accId != null && accId != 0) { if(_isDateSelected && TransDate.SelectedDate != null) { var income = new Income { InId = Int64.Parse(TransId.Text), AccId = accId, InTypeId = _transactionTypeId, InText = TransMemo.Text, InDetails = TransDetails.Text, InSubTypeId = _transactionSubTypeId, InAmount = _transactionAmount, InDate = StringManipulation.GetStringFromDate(TransDate.SelectedDate.Value.Date), LastUpdate = StringManipulation.GetStringFromDate(DateTime.Now.Date) }; _incomeAccess.Insert(income); _focusAccount = income.Account(); _focusAccount.AccBalance += Math.Round(_transactionAmount, 2); _focusAccount.LastUpdate = StringManipulation.GetStringFromDate(DateTime.Now.Date); _accountAccess.Update(_focusAccount); eventargs.Session.UpdateContent(new MessageDialog("Awesome dude!","A new income has been saved")); Reset(); } else { eventargs.Session.UpdateContent(new MessageDialog("No date, No save","You must select a valid date")); } } else { eventargs.Session.UpdateContent(new MessageDialog("Missing Accounts","We could not associate the transaction with any account")); } }
private static void IsOpenPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs) { var dialogHost = (DialogHost)dependencyObject; ValidationAssist.SetSuppress(dialogHost._popupContentControl, !dialogHost.IsOpen); VisualStateManager.GoToState(dialogHost, dialogHost.SelectState(), !TransitionAssist.GetDisableTransitions(dialogHost)); if (dialogHost.IsOpen) { WatchWindowActivation(dialogHost); } else { dialogHost._asyncShowWaitHandle.Set(); dialogHost._attachedDialogClosingEventHandler = null; dialogHost._session.IsEnded = true; dialogHost._session = null; dialogHost._closeCleanUp(); return; } dialogHost._asyncShowWaitHandle.Reset(); dialogHost._session = new DialogSession(dialogHost); //multiple ways of calling back that the dialog has opened: // * routed event // * the attached property (which should be applied to the button which opened the dialog // * straight forward dependency property // * handler provided to the async show method var dialogOpenedEventArgs = new DialogOpenedEventArgs(dialogHost._session, DialogOpenedEvent); dialogHost.OnDialogOpened(dialogOpenedEventArgs); dialogHost._attachedDialogOpenedEventHandler?.Invoke(dialogHost, dialogOpenedEventArgs); dialogHost.DialogOpenedCallback?.Invoke(dialogHost, dialogOpenedEventArgs); dialogHost._asyncShowOpenedEventHandler?.Invoke(dialogHost, dialogOpenedEventArgs); dialogHost.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { var child = dialogHost._popup?.Child; if (child == null) return; child.Focus(); child.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next)); //https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/issues/187 //totally not happy about this, but on immediate validation we can get some wierd looking stuff...give WPF a kick to refresh... Task.Delay(300).ContinueWith(t => child.Dispatcher.BeginInvoke(new Action(() => child.InvalidateVisual()))); })); }
private void OpenedEventHandler(object sender, DialogOpenedEventArgs eventargs) { var transType = GetTransactionType(); if(transType != TransactionType.None) { if(IsAmountDouble()) { switch(transType) { case TransactionType.Expense: SaveExpediture(eventargs); break; case TransactionType.Income: SaveIncome(eventargs); break; } } else { eventargs.Session.UpdateContent(new MessageDialog( "Those are some alien numbers", "Transaction amount must be in numeric form (0-9)")); } } else { eventargs.Session.UpdateContent(new MessageDialog("Can't decide?","You must select a valid transaction type")); } }
private void SaveExpediture(DialogOpenedEventArgs eventargs) { var accId = GetAccountId(); if(accId != null && accId != 0) { if(_isDateSelected && TransDate.SelectedDate != null) { var expense = new Expediture { ExId = Int64.Parse(TransId.Text), AccId = accId, ExTypeId = _transactionTypeId, ExText = TransMemo.Text, ExDetails = TransDetails.Text, ExSubTypeId = _transactionSubTypeId, ExAmount = _transactionAmount, ExDate = StringManipulation.GetStringFromDate(TransDate.SelectedDate.Value.Date), LastUpdate = StringManipulation.GetStringFromDate(DateTime.Now.Date) }; _expeditureAccess.Insert(expense); _focusAccount = expense.Account(); _focusAccount.AccBalance -= Math.Round(_transactionAmount, 2); _focusAccount.LastUpdate = StringManipulation.GetStringFromDate(DateTime.Now.Date); _accountAccess.Update(_focusAccount); eventargs.Session.UpdateContent(new MessageDialog("Alright sparky","A new expense has been saved")); Reset(); } else { eventargs.Session.UpdateContent(new MessageDialog("No date, No Save","You must select a valid date")); } } else { eventargs.Session.UpdateContent(new MessageDialog("Missing Accounts","We could not associate the transaction with any account")); } }
private void ExtendedOpenedEventHandler(object sender, DialogOpenedEventArgs eventargs) { Console.WriteLine("You could intercept the open and affect the dialog using eventArgs.Session."); }
public void ClockDialogOpenedEventHandler(object sender, DialogOpenedEventArgs eventArgs) { Clock.Time = ((PickersViewModel) DataContext).Time; }
public void CalendarDialogOpenedEventHandler(object sender, DialogOpenedEventArgs eventArgs) { Calendar.SelectedDate = ((PickersViewModel)DataContext).Date; }
private static void IsOpenPropertyChangedCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs) { var dialogHost = (DialogHost)dependencyObject; if (dialogHost._popupContentControl != null) ValidationAssist.SetSuppress(dialogHost._popupContentControl, !dialogHost.IsOpen); VisualStateManager.GoToState(dialogHost, dialogHost.SelectState(), !TransitionAssist.GetDisableTransitions(dialogHost)); if (dialogHost.IsOpen) { WatchWindowActivation(dialogHost); dialogHost._currentSnackbarMessageQueueUnPauseAction = dialogHost.SnackbarMessageQueue?.Pause(); } else { dialogHost._asyncShowWaitHandle.Set(); dialogHost._attachedDialogClosingEventHandler = null; if (dialogHost._currentSnackbarMessageQueueUnPauseAction != null) { dialogHost._currentSnackbarMessageQueueUnPauseAction(); dialogHost._currentSnackbarMessageQueueUnPauseAction = null; } dialogHost._session.IsEnded = true; dialogHost._session = null; dialogHost._closeCleanUp(); // Don't attempt to Invoke if _restoreFocusDialogClose hasn't been assigned yet. Can occur // if the MainWindow has started up minimized. Even when Show() has been called, this doesn't // seem to have been set. dialogHost.Dispatcher.InvokeAsync(() => dialogHost._restoreFocusDialogClose?.Focus(), DispatcherPriority.Input); return; } dialogHost._asyncShowWaitHandle.Reset(); dialogHost._session = new DialogSession(dialogHost); var window = Window.GetWindow(dialogHost); dialogHost._restoreFocusDialogClose = window != null ? FocusManager.GetFocusedElement(window) : null; //multiple ways of calling back that the dialog has opened: // * routed event // * the attached property (which should be applied to the button which opened the dialog // * straight forward dependency property // * handler provided to the async show method var dialogOpenedEventArgs = new DialogOpenedEventArgs(dialogHost._session, DialogOpenedEvent); dialogHost.OnDialogOpened(dialogOpenedEventArgs); dialogHost._attachedDialogOpenedEventHandler?.Invoke(dialogHost, dialogOpenedEventArgs); dialogHost.DialogOpenedCallback?.Invoke(dialogHost, dialogOpenedEventArgs); dialogHost._asyncShowOpenedEventHandler?.Invoke(dialogHost, dialogOpenedEventArgs); dialogHost.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { CommandManager.InvalidateRequerySuggested(); var child = dialogHost.FocusPopup(); //https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/issues/187 //totally not happy about this, but on immediate validation we can get some weird looking stuff...give WPF a kick to refresh... Task.Delay(300).ContinueWith(t => child.Dispatcher.BeginInvoke(new Action(() => child.InvalidateVisual()))); })); }
private void DialogHost_DialogOpened(object sender, MaterialDesignThemes.Wpf.DialogOpenedEventArgs eventArgs) { ActiveBorder.Visibility = Visibility.Visible; }