/// <summary> /// Dismisses the message box. /// </summary> /// <param name="source"> /// The source that caused the dismission. /// </param> /// <param name="useTransition"> /// If true, the message box is dismissed after swiveling /// backward and out. /// </param> private void Dismiss(CustomMessageBoxResult source, bool useTransition) { // Ensure only a single Dismiss is being handled at a time if (_isBeingDismissed) { return; } _isBeingDismissed = true; // Handle the dismissing event. var handlerDismissing = Dismissing; if (handlerDismissing != null) { DismissingEventArgs args = new DismissingEventArgs(source); handlerDismissing(this, args); if (args.Cancel) { _isBeingDismissed = false; return; } } // Handle the dismissed event. var handlerDismissed = Dismissed; if (handlerDismissed != null) { DismissedEventArgs args = new DismissedEventArgs(source); handlerDismissed(this, args); } // Set the current instance to null. _currentInstance = null; // Cache this variable to avoid a race condition. bool restoreOriginalValues = _mustRestore; // Close popup. if (useTransition) { SwivelTransition backwardOut = new SwivelTransition { Mode = SwivelTransitionMode.BackwardOut }; ITransition swivelTransition = backwardOut.GetTransition(this); swivelTransition.Completed += (s, e) => { swivelTransition.Stop(); ClosePopup(restoreOriginalValues); }; swivelTransition.Begin(); } else { ClosePopup(restoreOriginalValues); } _isBeingDismissed = false; }
private void Box_Dismissing(object sender, DismissingEventArgs e) { if (e.Result == CustomMessageBoxResult.LeftButton) { //voeg toe if (txtNewCategory.Text.Length != 0) { int id = CategoriesViewModel.GetLastIndex(); Category c = new Category() { Name = txtNewCategory.Text, items = new ObservableCollection<Item>(), Id = ++id }; CategoriesViewModel.AddCategorie(c); } } box.Dismiss(); }
private void Box_Dismissing(object sender, DismissingEventArgs e) { if (e.Result == CustomMessageBoxResult.LeftButton) { //voeg toe if (txtNewItem.Text.Length != 0) { int id = category.GetLastIndex(); Item item = new Item() { Id = ++id, Count = 1, Done = false, Name = txtNewItem.Text }; Items.Add(item); } } box.Dismiss(); }
/// <summary> /// Dismisses the message box. /// </summary> /// <param name="source"> /// The source that caused the dismission. /// </param> /// <param name="useTransition"> /// If true, the message box is dismissed after swiveling /// backward and out. /// </param> private void Dismiss(CustomMessageBoxResult source, bool useTransition) { // Ensure only a single Dismiss is being handled at a time if (_isBeingDismissed) { return; } _isBeingDismissed = true; // Handle the dismissing event. var handlerDismissing = Dismissing; if (handlerDismissing != null) { DismissingEventArgs args = new DismissingEventArgs(source); handlerDismissing(this, args); if (args.Cancel) { _isBeingDismissed = false; return; } } // Set the current instance to null. _currentInstance = null; // Cache this variable to avoid a race condition. bool restoreOriginalValues = _mustRestore; // Close popup. if (useTransition) { SwivelTransition backwardOut = new SwivelTransition { Mode = SwivelTransitionMode.BackwardOut }; ITransition swivelTransition = backwardOut.GetTransition(this); swivelTransition.Completed += (s, e) => { swivelTransition.Stop(); ClosePopup(restoreOriginalValues, source); }; swivelTransition.Begin(); } else { ClosePopup(restoreOriginalValues, source); } _isBeingDismissed = false; }
void CortanaOverlay_Dismissing(object sender, DismissingEventArgs e) { if (noting) { switch (e.Result) { case CustomMessageBoxResult.LeftButton: note.Save(); UpdateLiveTile(note.note); break; case CustomMessageBoxResult.None: break; case CustomMessageBoxResult.RightButton: break; default: break; } NotesList.ItemsSource = note.GetAllNotes(); } noting = false; }