Esempio n. 1
0
        private void Done()
        {
            SelectedItem.WordsRead = 0;
            _roamingSettings.Remove(SelectedItem.InternalId);
            ShowFinishedScreen = true;

            var milliseconds = MathsHelpers.DisplayTimePerWordGroup(SelectedItem.WordCount, _settingsService.WordsPerMin, _settingsService.WordsAtATime);
            var time         = MathsHelpers.TimeToReadArticle(milliseconds, SelectedItem.WordCount, _settingsService.WordsAtATime);

            var format = SelectedItem.WordCount > 1 ? _loader.GetString("FinishedReadingWordsText") : _loader.GetString("FinishedReadingWordText");

            FinishedText = SelectedItem.WordCount > 1 ? string.Format(format, SelectedItem.WordCount, time.ToFriendlyText()) : string.Format(format, time.ToFriendlyText());
        }
Esempio n. 2
0
        private async Task ConnectToServer()
        {
            RetryButtonIsVisible = false;
            ConnectionResult result = null;

            SetProgressBar(AppResources.SysTrayGettingServerDetails);

            if (_connectionDetails != null && !string.IsNullOrEmpty(_connectionDetails.ServerId))
            {
                result = await ConnectionManager.Connect(_connectionDetails.ServerAddress);

                var server = result.Servers.FirstOrDefault(x =>
                                                           string.Equals(x.Id, _connectionDetails.ServerId, StringComparison.CurrentCultureIgnoreCase));

                if (server != null)
                {
                    _serverInfo.SetServerInfo(server);
                    _applicationSettings.Set(Constants.Settings.DefaultServerConnection, server);

                    _savedServer = server;

                    _applicationSettings.Remove(Constants.Settings.ConnectionSettings);
                    _connectionDetails = null;
                }
            }

            if (_savedServer != null)
            {
                result = await ConnectionManager.Connect(_savedServer);
            }

            if (result != null && result.State == ConnectionState.Unavailable && _savedServer != null)
            {
                RetryButtonIsVisible = true;
                return;
            }

            // See if we can find and communicate with the server

            if (result == null || result.State == ConnectionState.Unavailable)
            {
                result = await ConnectionManager.Connect();
            }

            Deployment.Current.Dispatcher.BeginInvoke(async() =>
            {
                await Utils.HandleConnectedState(result, ApiClient, NavigationService, Log);

                SetProgressBar();
            });
        }
 public void ClearLoggedInUser()
 {
     LoggedInUser = null;
     _settingsService.Remove(Constants.Settings.SelectedUserSetting);
 }
Esempio n. 4
0
 private void DeleteFileAsync(string filename)
 {
     _roamingSettings.Remove(filename);
 }