Esempio n. 1
0
        /// <summary>
        /// Tries to establish a connection to the wordclock
        /// </summary>
        /// <returns></returns>
        async Task ConnectToWordclock()
        {
            bool isInputValid = await ValidateUserInput();

            if (isInputValid)
            {
                IsBusy = true;
                Connect.ChangeCanExecute();

                var isConnectionEstablished = false;

                try
                {
                    EndpointConfigurationFactory.Initialize(_server, _port);
                    isConnectionEstablished = await Task.Run(() => _connectionService.IsConnectionEstablished());
                }
                catch (Exception ex)
                {
                    await _dialogService.ShowError(ex);
                }
                finally
                {
                    IsBusy = false;
                    Connect.ChangeCanExecute();
                }

                if (isConnectionEstablished)
                {
                    SaveConnectionInformation();

                    //Use absolute Uri to reset the navigation stack. So it is not possible to navigate to the ConnectPage anymore
                    await _navigationService.NavigateAsync(new Uri("/MenuPage", UriKind.Absolute));
                }
            }
        }
Esempio n. 2
0
 private void Save()
 {
     try
     {
         _powerService.SavePowerTimeSlots(PowerTimeSlots);
     }catch (Exception ex)
     {
         _dialogService.ShowError(ex);
     }
 }
Esempio n. 3
0
 private void SetShowPrefix(bool value)
 {
     try
     {
         _clockService.SetShowPrefix(value);
     }catch (Exception ex)
     {
         _dialogService.ShowError(ex);
     }
 }
Esempio n. 4
0
        private bool UpdateRequired()
        {
            try
            {
                var appVersion = "";                //_versionService.Version;

                return(_updateService.IsUpdateRequired(appVersion));
            }
            catch (Exception ex)
            {
                _dialogService.ShowError(ex);
            }

            return(false);
        }