Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the PushViewModel class.
        /// </summary>
        public SettingsViewModel(IExtendedApiClient apiClient, INavigationService navigationService, IApplicationSettingsService applicationSettings)
        {
            _apiClient           = apiClient;
            _navigationService   = navigationService;
            _applicationSettings = applicationSettings;

            if (IsInDesignMode)
            {
                IsRegistered          = UseNotifications = true;
                RegisteredText        = "Device registered";
                ServerPluginInstalled = false;

#if WP8
                FoundServers = new ObservableCollection <Server>
                {
                    new Server {
                        IpAddress = "192.168.0.2", PortNo = "8096"
                    },
                    new Server {
                        IpAddress = "192.168.0.4", PortNo = "8096"
                    }
                };
#endif
            }
            else
            {
                LoadingFromSettings   = true;
                SendTileUpdates       = SendToastUpdates = true;
                RegisteredText        = AppResources.DeviceNotRegistered;
                LoadingFromSettings   = false;
                ServerPluginInstalled = false;
            }
        }
        /// <summary>
        /// Initializes a new instance of the PushViewModel class.
        /// </summary>
        public SettingsViewModel(IExtendedApiClient apiClient, INavigationService navigationService, IApplicationSettingsService applicationSettings)
        {
            _apiClient = apiClient;
            _navigationService = navigationService;
            _applicationSettings = applicationSettings;

            if (IsInDesignMode)
            {
                IsRegistered = UseNotifications = true;
                RegisteredText = "Device registered";
                ServerPluginInstalled = false;

#if WP8
                FoundServers = new ObservableCollection<Server>
                {
                    new Server {IpAddress = "192.168.0.2", PortNo = "8096"},
                    new Server {IpAddress = "192.168.0.4", PortNo = "8096"}
                };
#endif
            }
            else
            {
                LoadingFromSettings = true;
                SendTileUpdates = SendToastUpdates = true;
                RegisteredText = AppResources.DeviceNotRegistered;
                LoadingFromSettings = false;
                ServerPluginInstalled = false;
            }
        }
 internal static void HandleHttpException(HttpException ex, string message, INavigationService navigationService, ILog log)
 {
     if (ex.StatusCode == HttpStatusCode.Forbidden)
     {
         MessageBox.Show("Sorry, it looks like this account has been disabled. We will now take you back to the login screen", "Unable to sign in", MessageBoxButton.OK);
         log.Error("UnauthorizedAccess for user [{0}]", AuthenticationService.Current.LoggedInUser.Name);
     }
     else
     {
         log.ErrorException(message, ex);
     }
 }
        internal static void CheckProfiles(INavigationService navigationService)
        {
            var clients   = App.Settings.ServerConfiguration.ManualLoginClients;
            var loginPage = clients.Contains(ManualLoginCategory.Mobile) ? Constants.Pages.ManualUsernameView : Constants.Pages.ChooseProfileView;

#if WP8
            if (AuthenticationService.Current.IsLoggedIn)
            {
                Services.LockScreenService.Current.Start();
            }
#endif
            // If one exists, then authenticate that user.
            navigationService.NavigateTo(AuthenticationService.Current.IsLoggedIn ? TileService.Current.PinnedPage() : loginPage);
        }