Quantcast
Viewing all articles
Browse latest Browse all 18858

WPF Browser Close

 How can I stop the user to close the application closing the Browser,without notifying the changes in a Pagex?

         

App.xaml.cs

     publiceventNavigatedEventHandler UnloadPageWorkaround;

     privatevoid Application_Onexit(object sender,ExitEventArgs e)

      {

          UnloadPageWorkaround.Invoke(null, null);

      }

      

Pagex.xaml.cs

      void NavigationPage_Loaded(object sender,RoutedEventArgs e)

      {

           this.NavigationService.Navigating += newNavigatingCancelEventHandler(NavigationService_Navigating);

         

          ((App)Application.Current).UnloadPageWorkaround +=newNavigatedEventHandler(CheckExit);

            

          fillData();

      }

      void CheckExit(object sender,NavigationEventArgs e)

      {

          if (isChg)

          {           

              MessageBoxResult result = MessageBox.Show("Would you like to save the changes you've made? ","Changes made to your configuration!",MessageBoxButton.YesNo,MessageBoxImage.Question);

             

              if (result == MessageBoxResult.Yes)

              {

                  

                  // ?????????

              }                             

          }            

      }

Thanks!

Peter


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>