Example #1
0
        static StoredSettings()
        {
            TranslationManager.Instance.LanguageChanged += OnLanguageChanged;
            IVtsWebService client = Infrastructure.Container.GetInstance <IVtsWebService>();

            try
            {
                if (client.CheckConnection() == "ok")
                {
                    string login        = AgentIsolatedStorageHelper.Login;
                    string passwordHash = AgentIsolatedStorageHelper.PasswordHash;
                    if (String.IsNullOrEmpty(login) || String.IsNullOrEmpty(passwordHash))
                    {
                        return;
                    }
                    UserDto userDto = client.AuthenticateUser(login, passwordHash);
                    if (userDto != null)
                    {
                        storedUser = UserAssembler.FromDtoToDomainObject(userDto);
                    }
                    else
                    {
                        Log.Warn("Could not log on with stored credentials!");
                    }
                    TranslationManager.Instance.CurrentLanguageEnum =
                        AgentIsolatedStorageHelper.Language;
                }
            }
            catch (Exception p)
            {
                Log.Error(p.Message);
            }
        }
Example #2
0
        private void CheckConnectionInBackground(object sender, DoWorkEventArgs doWorkEventArgs)
        {
            IVtsWebService service = Infrastructure.Container.GetInstance <IVtsWebService>();

            try
            {
                string connectionResult = service.CheckConnection();
                if (String.Equals(connectionResult, "ok",
                                  StringComparison.InvariantCultureIgnoreCase))
                {
                    connectionIsOk = true;
                }
            }
            catch (Exception)
            {
                connectionIsOk = false;
            }
        }