Ejemplo n.º 1
0
 void cmb_Dismissing(object sender, DismissingEventArgs e)
 {
     if (e.Result == CustomMessageBoxResult.RightButton)
     {
         this.ID.Text = "";
     }
     if (e.Result == CustomMessageBoxResult.LeftButton)
     {
         this.ID.Text = ((ListPickerItem)lp.SelectedItem).Content.ToString();
     }
 }
        /// <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;
        }
Ejemplo n.º 3
0
        /// <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)
        {
            // Handle the dismissing event.
            var handlerDismissing = Dismissing;

            if (handlerDismissing != null)
            {
                DismissingEventArgs args = new DismissingEventArgs(source);
                handlerDismissing(this, args);

                if (args.Cancel)
                {
                    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);
                };
                Deployment.Current.Dispatcher.BeginInvoke(swivelTransition.Begin);
            }
            else
            {
                ClosePopup(restoreOriginalValues);
            }
        }
Ejemplo n.º 4
0
        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;
        }
        private void ProcessButtonClick(CustomMessageBoxResult c)
        {
            if (this.Dismissing != null)
            {
                var dea = new DismissingEventArgs(c);
                this.Dismissing(this, dea);
                if (dea.Cancel == true)
                {
                    return;
                }
            }

#if NETFX_CORE
            this.Dismiss();
#else 
            this.Close();
#endif

            if (this.Dismissed != null)
            {
                this.Dismissed(this, new DismissedEventArgs(c));
            }
        }