示例#1
0
        private void OnBackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                return;
            }

            // Navigate back if possible, and if the event has not
            // already been handled .
            if (rootFrame.CanGoBack && e.Handled == false)
            {
                e.Handled = true;
                rootFrame.GoBack();
            }
        }
示例#2
0
        private void CreateTweetPage_BackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
        {
            e.Handled = true;

            if (DateTime.Now - TmpUserData.PreviousBackRequest < new TimeSpan(0, 0, 1))
            {
                return;
            }
            else
            {
                TmpUserData.PreviousBackRequest = DateTime.Now;
            }

            if (Frame.CanGoBack)
            {
                Frame.GoBack();
            }
        }
示例#3
0
        private async void EasyMode_BackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
        {
            e.Handled = true;
            disTimer.Stop();
            disTimer = null;

            var msg = new MessageDialog("App will be closed do you wish to continue?");
            var yes = new UICommand("Yes");
            var no  = new UICommand("No");

            msg.Commands.Add(yes);
            msg.Commands.Add(no);
            IUICommand result = await msg.ShowAsync();

            if (result != null && result.Label.Equals("Yes"))
            {
                Frame.Navigate(typeof(GameOver), Score.ToString());
            }//if
        }
示例#4
0
#pragma warning disable CC0057  // Unused parameters
#pragma warning disable IDE0060 // Remove unused parameter
        public static void OnBackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
#pragma warning restore IDE0060 // Remove unused parameter
#pragma warning restore CC0057  // Unused parameters
        {
            var popupNavigationInstance = Rg.Plugins.Popup.Services.PopupNavigation.Instance;

            //e.Handled = false;
            if (popupNavigationInstance.PopupStack.Count > 0)
            {
                var lastPage = popupNavigationInstance.PopupStack.Last();

                var isPreventClose = // lastPage.IsBeingDismissed ||
                                     lastPage.SendBackButtonPressed();

                if (!isPreventClose)
                {
                    Xamarin.Forms.Device.BeginInvokeOnMainThread(async() =>
                    {
                        await popupNavigationInstance.PopAsync();
                    });
                }

                e.Handled = true;

                /*
                 * //Windows.UI.Core.SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
                 * var b = Windows.UI.Core.SystemNavigationManager.GetForCurrentView();
                 * var fields = typeof(Windows.UI.Core.SystemNavigationManager).GetFields();
                 * var events = typeof(Windows.UI.Core.SystemNavigationManager).GetRuntimeEvents();
                 * //EventInfo f1 = typeof(Windows.UI.Core.SystemNavigationManager).GetEvent("BackRequested", BindingFlags.Static | BindingFlags.NonPublic);
                 * EventInfo f1 = null;
                 * foreach (var evnt in events)
                 *  if (evnt.Name == "BackRequested")
                 *      f1 = evnt;
                 * var remove = f1.GetRemoveMethod();
                 * var methods = f1.GetOtherMethods();
                 *
                 * //foreach (var method in methods)
                 * //    f1.RemoveEventHandler(b, method);
                 */
            }
        }
示例#5
0
        private async void PlaySingle_BackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
        {
            e.Handled = true;
            dispatcherTimer.Stop();
            dispatcherTimer = null;

            var msg      = new MessageDialog("Are you handsome?");
            var okBtn    = new UICommand("Yes");
            var kindaBtn = new UICommand("Kinda");

            msg.Commands.Add(okBtn);
            msg.Commands.Add(kindaBtn);
            IUICommand result = await msg.ShowAsync();

            if (result != null && result.Label.Equals("Yes"))
            {
                //Application.Current.Exit();
                Frame.Navigate(typeof(GameOver), Score.ToString()); // Navigate to game over screen and send score
            }
        }
示例#6
0
        private void MainPage_BackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
        {
            if (frameEventList.CanGoBack && frameEventDetails.IsEnabled == false)
            {
                frameEventList.GoBack();
                e.Handled = true;
            }
            else if (frameEventDetails.IsEnabled == true &&
                     frameEventDetails.Visibility == Visibility.Visible)
            {
                frameEventDetails.Content    = null;
                frameEventDetails.Visibility = Visibility.Collapsed;
                frameEventDetails.IsEnabled  = false;
            }

            if (!frameEventList.CanGoBack && frameEventDetails.IsEnabled == false)
            {
                Windows.UI.Core.SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
                    Windows.UI.Core.AppViewBackButtonVisibility.Collapsed;
            }
        }
示例#7
0
        /// <summary>
        /// Handles the back button press and navigates through the history of the root frame.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">Details about the back button press.</param>
        private void App_BackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
        {
            Frame frame = Window.Current.Content as Frame;

            if (frame == null)
            {
                return;
            }

            var handler = this.BackPressed;

            if (handler != null)
            {
                handler(sender, e);
            }

            if (frame.CanGoBack && !e.Handled)
            {
                frame.GoBack();
                e.Handled = true;
            }
        }
 private void PC_BackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
 {
     FirstPage.firstpage.Second_Page_Back();
     Windows.UI.Core.SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = Windows.UI.Core.AppViewBackButtonVisibility.Collapsed;
 }
示例#9
0
 private void ShellPage_BackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
 {
 }
示例#10
0
 private void BackupProgress_BackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
 {
     e.Handled = true;
 }
示例#11
0
 private void App_BackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
 {
     e.Handled = On_BackRequested();
 }
示例#12
0
 private void BackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e) => Frame.GoBack();
示例#13
0
 private void View_BackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
 {
     //if (contentFrame.CanGoBack)
 }
示例#14
0
 private void BackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
 {
     view.rssVisibility = Visibility.Collapsed;
 }
 private void PersonPage_BackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
 {
     this.Frame.Navigate(typeof(MainPage));
 }
示例#16
0
 private void OnBackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
 {
     e.Handled = true;
     this.Hide();
 }
示例#17
0
 private void App_BackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
 {
     throw new NotImplementedException();
 }
 private void BlockBack(object sender, Windows.UI.Core.BackRequestedEventArgs e)
 {
     e.Handled = true;
 }
示例#19
0
 private void MainPage_BackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
 {
     e.Handled = true;
     AppCore.ModerateBack();
 }