/// <summary> /// Launching client window /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void App_OnStartup(object sender, StartupEventArgs e) { var connectForm = new ConnectForm(); if (connectForm.ShowDialog() != true) return; var chatClient = new ChatClient(connectForm.PortNumber, connectForm.IpAddress, connectForm.UserName); if (!chatClient.IsConnected) { Current.Shutdown(); return; } RegistryHelper.Read(chatClient); var clientForm = new ClientWindow(chatClient); clientForm.Show(); }
private void connectButton_Click(object sender, EventArgs e) { using (var cf = new ConnectForm()) { if (_connectionInfo != null) { cf.Server = _connectionInfo.DataSource; cf.SQLAuth = !_connectionInfo.IntegratedSecurity; if (cf.SQLAuth) { cf.UserName = _connectionInfo.UserID; cf.Password = _connectionInfo.Password; } } if (cf.ShowDialog() == DialogResult.Cancel) { return; } _connectionInfo = new SqlConnectionStringBuilder { DataSource = cf.Server, IntegratedSecurity = !cf.SQLAuth }; if (cf.SQLAuth) { _connectionInfo.UserID = cf.UserName; _connectionInfo.Password = "******"; } connectionLabel.Text = _connectionInfo.ConnectionString; if (cf.SQLAuth) { _connectionInfo.Password = cf.Password; } if (_connection != null && _connection.State == ConnectionState.Open) { _connection.Close(); } _connection = new SqlConnection(_connectionInfo.ConnectionString); _connection.Open(); autoRefreshCheckBox.Enabled = secNumericUpDown.Enabled = true; } }
/// <summary> /// Launching client window /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void App_OnStartup(object sender, StartupEventArgs e) { var connectForm = new ConnectForm(); if (connectForm.ShowDialog() != true) { return; } var chatClient = new ChatClient(connectForm.PortNumber, connectForm.IpAddress, connectForm.UserName); if (!chatClient.IsConnected) { Current.Shutdown(); return; } RegistryHelper.Read(chatClient); var clientForm = new ClientWindow(chatClient); clientForm.Show(); }
private void btnPartFind_Click(object sender, EventArgs e) { client = Common.Util.Service; draw = Common.Util.Drawing; if (draw != null) { ConnectForm f = new ConnectForm(Common.Util.paramsEntity(draw), CommonUntils.RelationType.ALL); f.ShowDialog(); } else { MessageBox.Show("图纸对象为空!"); } }