예제 #1
0
        private void ExecuteLogin()
        {
            ASMRestSettingsInstance.Instance.HostAndPort = _textHostAndPort.Text;
            ASMRestSettingsInstance.Instance.UserName    = _textUserName.Text;
            ASMRestSettingsInstance.Instance.Password    = _textPassword.Text;

            try
            {
                BaseRestHttpClient client = new BaseRestHttpClient(ASMRestSettingsInstance.Instance);
                client.Login();
                this.DialogResult = DialogResult.OK;
                this.Hide();

                if (_checkRemember.Checked)
                {
                    ASMLoginOptions options = new ASMLoginOptions();
                    options.Url      = _textHostAndPort.Text;
                    options.UserName = _textUserName.Text;
                    options.Password = Encryptor.EncryptToString(_textPassword.Text);
                    options.FullName = ASMRestSettingsInstance.Instance.FullName;
                    options.Save();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #2
0
        public void TestLogin()
        {
            InitSettings();

            BaseRestHttpClient loginManager = new BaseRestHttpClient(ASMRestSettingsInstance.Instance);

            Assert.IsTrue(loginManager.Login());
        }