Example #1
0
        public AuthViewModel(API.IClient client)
        {
            _client = client;


            #region Command definitions
            // All of the commands are defined in the constructor because this way we can
            // make them a bit less messy. TODO: can this be done better?

            _goCommand = new DelegateCommand(() =>
            {
                bool isValidToken = _client.ValidateToken(AuthToken).Result;
                if (isValidToken)
                {
                    DialogResult = true;
                    OnClosingRequest();
                    return;
                }
                else
                {
                    ShowMessage(this, PluginResources.UI_TokenNotValid);
                }
            });

            _logoutCommand = new DelegateCommand(() =>
            {
                AuthToken    = null;
                DialogResult = true;
                OnClosingRequest();
            });

            #endregion
        }
Example #2
0
 public TranslationProviderLanguageDirection(LanguagePair languageDirection, API.IClient client, ITranslationProvider parent)
 {
     _languageDirection  = languageDirection;
     _client             = client;
     TranslationProvider = parent; // It isn't (and probably shouldn't be) used internally. We hold on to the provider just because the API asks us to.
 }
Example #3
0
 public TranslationProvider(Uri providerUri, API.IClient client)
 {
     _client = client;
     Uri     = providerUri;
 }