Esempio n. 1
0
        /// <summary>
        /// Executes login.
        /// </summary>
        private void LoginExecute()
        {
            this.BusyCount++;
            this.LoginCommand.RaiseCanExecuteChanged();

            #region prepare url
            string serverUrl = ServerPath;
            if (!ServerPath.StartsWith("http://") && !ServerPath.StartsWith("https://"))
            {
                serverUrl = string.Concat("http://", ServerPath);
            }
            if (!serverUrl.EndsWith("/"))
            {
                serverUrl = string.Concat(serverUrl, "/");
            }

            #endregion

            try
            {
                Membership.CheckUserData(Login, Password, serverUrl, LoginCallback);
            }
            catch
            {
                this.BusyCount--;
#if !UNIT_TEST
                MessageBox.Show((Application.Current.Resources["LanguageStrings"] as LanguageStrings).WRONG_SERVER_ADDRESS);
#else
                RaiseTestCompleted("cannot locate server");
#endif
            }
        }
Esempio n. 2
0
        public void TestInitialize()
        {
            if (Membership.CurrentUser == null)
            {
                UserRepository repository = new UserRepository();
                User           user       = new User();
                user = repository.TryGetCurrentUser();
                if (user == null)
                {
                    user          = new User();
                    user.Name     = LoginViewModelTest.LOGIN;
                    user.Password = LoginViewModelTest.PASSWORD;
                    Server server = new Server();
                    server.Address = LoginViewModelTest.SERVER_PATH;
                    user.ID        = 0;
                    user.Server    = server;
                    user.IsCurrent = true;
                    repository.AddNewUser(user);
                }

                Membership.CheckUserData(user.Name, user.Password, user.Server.Address, this.OnUserAuthenticated);
            }
        }