Exemplo n.º 1
0
 private void CustomMessageBoxDismissed(object sender, DismissedEventArgs e)
 {
     try
     {
         if (e.Result.Equals(CustomMessageBoxResult.LeftButton))
         {
             //check if the internet is working, go to Login page. Else display message and load main page
             if (NetworkInterface.GetIsNetworkAvailable())
             {
                 NavigationService.Navigate(new Uri("/FacebookLogin.xaml?" + UriParameter.IsSyncScneario + "=No", UriKind.Relative));
             }
             else
             {
                 MessageBox.Show(AppResources.WarnInternetMsg, AppResources.WarnNwTitle, MessageBoxButton.OK);
                 NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
             }
         }
         else
         {
             NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, AppResources.ErrOnNavigation, MessageBoxButton.OK);
         NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
     }
 }
Exemplo n.º 2
0
 void deleteMessageBox_Dismissed(object sender, DismissedEventArgs e)
 {
     if (e.Result == CustomMessageBoxResult.LeftButton)
     {
         File.Delete((Application.Current as App).path);
     }
 }
Exemplo n.º 3
0
        private static async void MessageBoxOnDismissed(object sender, DismissedEventArgs e)
        {
            switch (e.Result)
            {
            case CustomMessageBoxResult.LeftButton:
                // Add the following task here which you wish to perform on speak button
                var region = SettingsHelper.GetRegion();
                await BugTreckerReporter.SendException(_exception, new[] { region });

                break;

            case CustomMessageBoxResult.RightButton:
                // Do something.

                break;

            case CustomMessageBoxResult.None:
                // Do something.

                break;

            default:
                break;
            }
        }
Exemplo n.º 4
0
        private void OnCustomMessageBoxDismissed(object sender, DismissedEventArgs e)
        {
            CustomMessageBox cmb = (CustomMessageBox)sender;

            // Unregisters events.
            UnregisterEventHandlers(cmb);

            // Removes this message box if it is registered.
            bool hasValue     = false;
            bool hasMoreBoxes = false;

            lock (_syncRoot)
            {
                if (hasValue = _otherMessageBoxes.Contains(cmb))
                {
                    _otherMessageBoxes.Remove(cmb);
                }

                hasMoreBoxes = HasMessageBox;
            }

            // Sends an event if it was registered.
            if (hasValue && !hasMoreBoxes)
            {
                // If no more message box is managed, send an event.
                BeginRaiseHasMessageBoxChanged();
            }
        }
Exemplo n.º 5
0
 private async void Notification_Dismissed(object sender, DismissedEventArgs e)
 {
     if (!(sender is SfCardView notification))
     {
         return;
     }
     await RemoveNotification(notification);
 }
Exemplo n.º 6
0
        private void SfCardView_Dismissed(object sender, DismissedEventArgs e)
        {
            var item = (sender as SfCardView)?.BindingContext as CardModel;

            if (items != null && item != null && items.Contains(item))
            {
                items.Remove(item);
            }
        }
        /// <summary>
        /// Closes the pop up.
        /// </summary>
        private void ClosePopup(bool restoreOriginalValues, CustomMessageBoxResult source)
        {
            // Remove the popup.
            if (_popup != null)
            {
                _popup.IsOpen = false;
                _popup        = null;
            }

            // If there is no other message box displayed.
            if (restoreOriginalValues)
            {
                // Set the system tray back to its original
                // color nad opacity if necessary.
                if (SystemTray.IsVisible)
                {
                    SystemTray.BackgroundColor = _systemTrayColor;
                    SystemTray.Opacity         = _systemTrayOpacity;
                }

                // Bring the application bar if necessary.
                if (_hasApplicationBar)
                {
                    _hasApplicationBar = false;

                    // Application bar can be nulled during the Dismissed event
                    // so a null check needs to be performed here.
                    if (_page.ApplicationBar != null)
                    {
                        _page.ApplicationBar.IsVisible = true;
                    }
                }
            }

            // Dettach event handlers.
            if (_page != null)
            {
                _page.BackKeyPress       -= OnBackKeyPress;
                _page.OrientationChanged -= OnOrientationChanged;
                _page = null;
            }

            if (_frame != null)
            {
                _frame.Navigating -= OnNavigating;
                _frame             = null;
            }

            // Handle the dismissed event.
            var handlerDismissed = Dismissed;

            if (handlerDismissed != null)
            {
                DismissedEventArgs args = new DismissedEventArgs(source);
                handlerDismissed(this, args);
            }
        }
Exemplo n.º 8
0
        private void OnWigCustomMessageBoxDismissed(object sender, DismissedEventArgs e)
        {
            CustomMessageBox cmb = (CustomMessageBox)sender;

            // Unregisters events.
            UnregisterEventHandlers(cmb);

            // Looks the corresponding wherigo message box up in the dictionary, and
            // gives it a result depending on the custom message box result.
            WF.Player.Core.MessageBox wmb;
            bool hasValue = false;

            lock (_syncRoot)
            {
                hasValue = _wherigoMessageBoxes.TryGetValue(cmb, out wmb);
            }
            if (hasValue)
            {
                // Gives result to the Wherigo message box.
                switch (e.Result)
                {
                case CustomMessageBoxResult.LeftButton:
                    wmb.GiveResult(WF.Player.Core.MessageBoxResult.FirstButton);
                    break;

                case CustomMessageBoxResult.RightButton:
                    wmb.GiveResult(WF.Player.Core.MessageBoxResult.SecondButton);
                    break;

                case CustomMessageBoxResult.None:
                    // TODO: Keep track of lost message boxes.
                    System.Diagnostics.Debug.WriteLine("Dismissed message box with no result: " + wmb.Text);

                    wmb.GiveResult(WF.Player.Core.MessageBoxResult.Cancel);
                    break;

                default:
                    throw new InvalidOperationException("Unknown value of CustomMessageBoxResult cannot be processed: " + e.Result.ToString());
                }

                // Bye bye box.
                bool hasMoreBoxes = false;
                lock (_syncRoot)
                {
                    _wherigoMessageBoxes.Remove(cmb);
                    hasMoreBoxes = HasMessageBox;
                }

                // If no more message box is managed, send an event.
                if (!hasMoreBoxes)
                {
                    BeginRaiseHasMessageBoxChanged();
                }
            }
        }
        private void BuyAppMessageBoxDismissed(object sender, DismissedEventArgs e)
        {
            if (!e.Result.Equals(CustomMessageBoxResult.LeftButton))
            {
                return;
            }

            var buyAppTask = new MarketplaceDetailTask();

            buyAppTask.Show();
        }
Exemplo n.º 10
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);
            }
        }
Exemplo n.º 11
0
        private static void ShowUserDislikesDialog_Dismissed(object sender, DismissedEventArgs e)
        {
            FSLog.Info();

            SettingsManager.AppRaterDoYouLikeQuestionShown = true;

            if (e.Result == CustomMessageBoxResult.LeftButton)
            {
                ShowUserLikesRateDialog();
            }
            else
            {
                ShowUserDislikesDialog();
            }
        }
Exemplo n.º 12
0
        void cmb_Dismissed(object sender, DismissedEventArgs e)
        {
            switch (e.Result)
            {
            case CustomMessageBoxResult.LeftButton:
            {
                if (string.IsNullOrEmpty(_currentAccountData.Login.Text))
                {
                    return;
                }
                if (string.IsNullOrEmpty(_currentAccountData.Name.Text))
                {
                    return;
                }
                if (string.IsNullOrEmpty(_currentAccountData.Password.Text))
                {
                    return;
                }
                if (_currentAccountData.IsEdit)
                {
                    Account editAccount = PassHoslder.SelectedItem as Account;
                    editAccount.Name     = _currentAccountData.Name.Text;
                    editAccount.Login    = _currentAccountData.Login.Text;
                    editAccount.Password = _currentAccountData.Password.Text;
                }
                else
                {
                    Account a = new Account();
                    a.Login    = _currentAccountData.Login.Text;
                    a.Name     = _currentAccountData.Name.Text;
                    a.Password = _currentAccountData.Password.Text;
                    _accounts.Add(a);
                }
                SaveAccounts();
                HandleOneDriveBehaviour();
            }
            break;

            case CustomMessageBoxResult.RightButton:
                break;

            default:
                break;
            }

            PassHoslder.SelectedItem = null;
            _dialogIsShow            = false;
        }
Exemplo n.º 13
0
 public void LuaDialog_Dismissed(object sender, DismissedEventArgs e)
 {
     if (e.Result == CustomMessageBoxResult.LeftButton) //Positive
     {
         if (OnPositiveButton != null)
         {
             OnPositiveButton.CallIn(this);
         }
     }
     else if (e.Result == CustomMessageBoxResult.RightButton || //Cancel
              e.Result == CustomMessageBoxResult.None)
     {
         if (OnNegativeButton != null)
         {
             OnNegativeButton.CallIn(this);
         }
     }
 }
Exemplo n.º 14
0
        // 提示框返回结果 处理方法
        void messageBox_Dismissed(object sender, DismissedEventArgs e)
        {
            if (effectInstance != null)
            {
                // 暂停提示音
                effectInstance.Stop();
            }

            if (vibrationThread != null)
            {
                // 关闭振动线程
                vibrationThread.Abort();
                // 暂停振动
                vibrationDevice.Cancel();
            }

            loopPlay = false;

            // 处理用户点击选择的按钮
            switch (e.Result)
            {
            case CustomMessageBoxResult.LeftButton:
                var szoozeSeconds = SzoozeTimes.GetSeconds(selectedSzoozeTime);
                var newSzoozeTime = DateTime.Parse("00:00:00").AddSeconds(szoozeSeconds);
                new Thread(() =>
                {
                    Thread.Sleep(500);
                    this.Dispatcher.BeginInvoke(() =>
                    {
                        NavigateToTimingPage(newSzoozeTime, TextBoxName.Text);
                    });
                }).Start();
                break;

            default:
                break;
            }
        }
        private void OnSavegameCustomMessageBoxDismissed(object sender, DismissedEventArgs e)
        {
            CustomMessageBox cmb = (CustomMessageBox)sender;

            // Unregisters events.
            cmb.Dismissed -= new EventHandler <DismissedEventArgs>(OnSavegameCustomMessageBoxDismissed);

            // Only moves on if OK has been pushed.
            if (e.Result != CustomMessageBoxResult.LeftButton)
            {
                return;
            }

            // Gets the associated savegame.
            Controls.SavegameMessageBoxContentControl content = cmb.Content as Controls.SavegameMessageBoxContentControl;
            if (content == null)
            {
                throw new InvalidOperationException("Message box has no SavegameMessageBoxContentControl.");
            }
            CartridgeSavegame cs = content.Savegame;

            if (cs == null)
            {
                throw new InvalidOperationException("SavegameMessageBoxContentControl has no CartridgeSavegame.");
            }

            // If the name already exists, asks if the old savegame should be replaced.
            CartridgeTag      tag = GetCurrentTag();
            CartridgeSavegame oldCSWithSameName = GetSavegameByName(content.Name);

            if (oldCSWithSameName != null)
            {
                // Asks for replacing the savegame.
                if (MessageBox.Show(
                        String.Format("A savegame named {0} already exists for this cartridge. Do you want to override it?", content.Name),
                        "Replace savegame?",
                        MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    // Go: deletes the old savegame and continues.
                    tag.RemoveSavegame(oldCSWithSameName);
                }
                else
                {
                    // No-go: prompt for another name.
                    ShowNewSavegameMessageBox(cs);

                    // Don't go further
                    return;
                }
            }

            // Edits the savegame.
            cs.Name      = content.Name;
            cs.HashColor = content.HashColor;

            // Commit.
            cs.ExportToIsoStore();

            // Adds an history entry for this savegame.
            _appViewModel.Model.History.AddSavedGame(tag, cs);

            // Adds the savegame to the tag.
            tag.AddSavegame(cs);
        }
Exemplo n.º 16
0
 void messageBox_Dismissed(object sender, DismissedEventArgs e)
 {
     Messenger.Default.Send(true, "TaskBarVisibility");
 }