示例#1
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            if (_isNewInstance)
            {
                _isNewInstance = false;
                IDictionary <string, object> state = PhoneApplicationService.Current.State;
                if (state.ContainsKey(_operationsStateKey))
                {
                    _operationsState = (OperationsStates)state[(_operationsStateKey)];
                    switch (_operationsState)
                    {
                    case OperationsStates.FactoryReseting:
                    case OperationsStates.RemovingUsers:
                    case OperationsStates.LoggingOut:
                        if (App.Engine.LoggedUser == null)
                        {
                            try
                            {
                                state.Remove(_operationsStateKey);
                                NavigationService.GoBack();
                            }
                            catch (InvalidOperationException) { }
                        }
                        break;

                    default:
                        break;
                    }
                }
            }

            base.OnNavigatedTo(e);
        }
示例#2
0
        private void OnFactoryResetButtonClicked(object sender, RoutedEventArgs e)
        {
            _operationsState = OperationsStates.FactoryReseting;
            MessageBoxResult result = MessageBox.Show(FileLanguage.SettingsPage_FactoryResetInfoMessage, FileLanguage.ARE_YOU_SURE, MessageBoxButton.OKCancel);

            if (result == MessageBoxResult.OK)
            {
                ProgressBarOverlay.Show(FileLanguage.SettingsPage_ClearingData);
                App.Engine.FactoryReset()
                .Finally(() => { try { NavigationService.GoBack(); } catch (InvalidOperationException) { } })
                .Finally(ProgressBarOverlay.Close)
                .Subscribe();
            }
        }
示例#3
0
        private void OnLogoutButtonClicked(object sender, RoutedEventArgs e)
        {
            _operationsState = OperationsStates.LoggingOut;
            MessageBoxResult result = MessageBox.Show(FileLanguage.QUESTION_LOGOUT_USER, FileLanguage.ARE_YOU_SURE, MessageBoxButton.OKCancel);

            if (result == MessageBoxResult.OK)
            {
                ProgressBarOverlay.Show(FileLanguage.SettingsPage_LoggingOut);
                App.Engine.Logout()
                .Finally(() => { try { NavigationService.GoBack(); } catch (InvalidOperationException) { } })
                .Finally(ProgressBarOverlay.Close)
                .Subscribe();
            }
        }
示例#4
0
        private void OnRemoveUserButtonClicked(object sender, RoutedEventArgs e)
        {
            _operationsState = OperationsStates.RemovingUsers;
            MessageBoxResult result = MessageBox.Show(FileLanguage.SettingsPage_UsersRemovedInfoMessage, FileLanguage.ARE_YOU_SURE, MessageBoxButton.OKCancel);

            if (result == MessageBoxResult.OK)
            {
                ProgressBarOverlay.Show(FileLanguage.SettingsPage_RemovingUser);
                User removedUser = App.Engine.LoggedUser;
                App.Engine.Logout()
                .Finally(
                    () =>
                {
                    App.Engine.RemoveUsers(removedUser);
                    ProgressBarOverlay.Close();
                    try
                    {
                        NavigationService.GoBack();
                    }
                    catch (InvalidOperationException) { }
                })
                .Subscribe();
            }
        }
 private void OnSelectLanguageClicked( object sender, RoutedEventArgs e )
 {
     _operationsState = OperationsStates.SelectingLanguages;
     NavigationService.Navigate( new Uri( "/LanguagePage.xaml", UriKind.Relative ) );
 }
 private void OnRemoveUserButtonClicked( object sender, RoutedEventArgs e )
 {
     _operationsState = OperationsStates.RemovingUsers;
     MessageBoxResult result = MessageBox.Show( FileLanguage.SettingsPage_UsersRemovedInfoMessage, FileLanguage.ARE_YOU_SURE, MessageBoxButton.OKCancel );
     if( result == MessageBoxResult.OK )
     {
         ProgressBarOverlay.Show( FileLanguage.SettingsPage_RemovingUser );
         User removedUser = App.Engine.LoggedUser;
         App.Engine.Logout()
                   .Finally(
                     () =>
                     {
                         App.Engine.RemoveUsers( removedUser );
                         ProgressBarOverlay.Close();
                         try
                         {
                             NavigationService.GoBack();
                         }
                         catch( InvalidOperationException ) { }
                     } )
                   .Subscribe();
     }
 }
 private void OnLogoutButtonClicked( object sender, RoutedEventArgs e )
 {
     _operationsState = OperationsStates.LoggingOut;
     MessageBoxResult result = MessageBox.Show( FileLanguage.QUESTION_LOGOUT_USER, FileLanguage.ARE_YOU_SURE, MessageBoxButton.OKCancel );
     if( result == MessageBoxResult.OK )
     {
         ProgressBarOverlay.Show( FileLanguage.SettingsPage_LoggingOut );
         App.Engine.Logout()
             .Finally( () => { try { NavigationService.GoBack(); } catch( InvalidOperationException ) { } } )
             .Finally( ProgressBarOverlay.Close )
             .Subscribe();
     }
 }
 private void OnFactoryResetButtonClicked( object sender, RoutedEventArgs e )
 {
     _operationsState = OperationsStates.FactoryReseting;
     MessageBoxResult result = MessageBox.Show( FileLanguage.SettingsPage_FactoryResetInfoMessage, FileLanguage.ARE_YOU_SURE, MessageBoxButton.OKCancel );
     if( result == MessageBoxResult.OK )
     {
         ProgressBarOverlay.Show( FileLanguage.SettingsPage_ClearingData );
         App.Engine.FactoryReset()
             .Finally( () => { try { NavigationService.GoBack(); } catch( InvalidOperationException ) { } } )
             .Finally( ProgressBarOverlay.Close )
             .Subscribe();
     }
 }
        protected override void OnNavigatedTo( System.Windows.Navigation.NavigationEventArgs e )
        {
            if( _isNewInstance )
            {
                _isNewInstance = false;
                IDictionary<string, object> state = PhoneApplicationService.Current.State;
                if( state.ContainsKey( _operationsStateKey ) )
                {
                    _operationsState = (OperationsStates)state[( _operationsStateKey )];
                    switch( _operationsState )
                    {
                        case OperationsStates.FactoryReseting:
                        case OperationsStates.RemovingUsers:
                        case OperationsStates.LoggingOut:
                            if( App.Engine.LoggedUser == null )
                            {
                                try
                                {
                                    state.Remove( _operationsStateKey );
                                    NavigationService.GoBack();
                                }
                                catch( InvalidOperationException ) { }
                            }
                            break;
                        default:
                            break;
                    }
                }
            }

            base.OnNavigatedTo( e );
        }
示例#10
0
 private void OnSelectLanguageClicked(object sender, RoutedEventArgs e)
 {
     _operationsState = OperationsStates.SelectingLanguages;
     NavigationService.Navigate(new Uri("/LanguagePage.xaml", UriKind.Relative));
 }