ConnectAsync() public method

public ConnectAsync ( string name, string host, string password ) : Task
name string
host string
password string
return Task
コード例 #1
0
        private async void button1_Click(object sender, EventArgs e)
        {
            button1.Enabled = false;

            bool storeAsDefault = checkBox1.Checked;

            string host     = textBox1.Text;
            string userName = textBox2.Text;
            string password = ServerConnection.EncryptString(ServerConnection.ToSecureString(textBox3.Text));

            if (storeAsDefault)
            {
                Properties.Settings.Default.UserName = userName;
                Properties.Settings.Default.Host     = host;
                Properties.Settings.Default.Password = password;
                Properties.Settings.Default.Save();
            }

            bool result = await CoondornatorParentForm.ConnectAsync(userName, host, password);

            if (!result)
            {
                button1.Enabled = true;
            }
            else
            {
                Close();
            }
        }