예제 #1
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            if (item.ItemId == global::Android.Resource.Id.Home)
            {
                BackPressed?.Invoke(this, EventArgs.Empty);
            }

            return(base.OnOptionsItemSelected(item));
        }
        private void _navigationManager_BackRequested(object sender, global::Windows.UI.Core.BackRequestedEventArgs e)
        {
            var cancelEventArgs = new CancelEventArgs();

            BackPressed?.Invoke(sender, cancelEventArgs);
            if (cancelEventArgs.Cancel)
            {
                e.Handled = true;
            }
        }
        public Game1(BackPressed backPressed)
        {
            this.backPressed      = backPressed;
            graphics              = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            graphics.IsFullScreen              = true;
            graphics.PreferredBackBufferWidth  = 800;
            graphics.PreferredBackBufferHeight = 480;
            graphics.SupportedOrientations     = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;
        }
예제 #4
0
        public override void OnBackPressed()
        {
            CancelEventArgs args = new CancelEventArgs();

            BackPressed?.Invoke(this, args);

            if (!args.Cancel)
            {
                base.OnBackPressed();
            }
        }
예제 #5
0
        public override void BeforeDispose()
        {
            if (BackPressed != null)
            {
                //Remove all Events associated to this control (That haven't been unsubscribed !)
                foreach (Delegate d in BackPressed.GetInvocationList())
                {
                    BackPressed -= (EventHandler)d;
                }
            }

            _engine.ScreenSize_Updated -= UpdateLayoutInternal;
        }
예제 #6
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>
        void App_BackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
        {
            if (!(Window.Current.Content is Frame frame))
            {
                return;
            }

            BackPressed?.Invoke(sender, e);

            if (frame.CanGoBack && !e.Handled)
            {
                frame.GoBack();
                e.Handled = true;
            }
        }
예제 #7
0
 // To support using the Fragment Backstack with back press
 // Override OnBackPress and have it call this utility method
 public void OnBackPressWithFragmentManagement()
 {
     BackPressed?.Invoke(this, EventArgs.Empty);
     if (SupportFragmentManager.BackStackEntryCount > 1)
     {
         // get the fragment to be popped
         SupportFragmentManager.PopBackStackImmediate();
         var entry = SupportFragmentManager.GetBackStackEntryAt(SupportFragmentManager.BackStackEntryCount - 1);
         var frag  = SupportFragmentManager.FindFragmentByTag(entry.Name);
         FragmentPoppedOnBack?.Invoke(null, frag);
     }
     else
     {
         if (SupportFragmentManager.BackStackEntryCount == 1)
         {
             SupportFragmentManager.PopBackStackImmediate();
         }
         base.OnBackPressed();
     }
 }
        private async void NativeAppWindow_BackPressed(object sender, System.ComponentModel.CancelEventArgs e)
        {
            BackPressed?.Invoke(this, e);

            if (e.Cancel)
            {
                return;
            }

            var currentContent = ViewModel?.GetFinalContent();

            if (currentContent != null)
            {
                // We assume going back succeeded
                bool wentBack = true;

                var task = ViewModel.HandleUserInteractionAsync("GoBack", delegate
                {
                    // Sometimes this might happen asynchronously if there was another pending UI action,
                    // but in those cases we would want to cancel the back press anyways. And for the case
                    // of exiting the app, as long as no other pending UI action was occurring, this would
                    // happen synchronously, and return false, and not cancel the back press
                    wentBack = currentContent.GoBack();
                });

                e.Cancel = wentBack;

                try
                {
                    await task;
                }
                catch (Exception ex)
                {
                    ExceptionHelper.ReportHandledException(ex);
                }
            }
        }
예제 #9
0
 private void OnBackPressed()
 {
     BackPressed?.Invoke();
 }
 public void BackButtonPressed()
 {
     BackPressed?.Invoke();
 }
예제 #11
0
 public override void OnBackPressed()
 {
     BackPressed?.Invoke(this, EventArgs.Empty);
     base.OnBackPressed();
 }
 private void backButton_Click(object sender, EventArgs e)
 {
     BackPressed.Invoke(this, e);
 }
예제 #13
0
 private void RaiseBackPressed()
 {
     BackPressed?.Invoke(this, new EventArgs());
 }
 private void Activity_BackPressed(object sender, System.ComponentModel.CancelEventArgs e)
 {
     BackPressed?.Invoke(this, e);
 }
예제 #15
0
        public ScoreScreen()
        {
            BuildUI();

            Back.Click += (sender, e) => BackPressed?.Invoke(sender, e);
        }
예제 #16
0
 private void Back_Click(object sender, EventArgs e)
 => BackPressed?.Invoke(this, null);