/// <summary> /// The method get triggered, when the "connect"button is clicked. I loads all relevant values from the textboxes and calls /// the FileOverview. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ConnectButtonClick(object sender, EventArgs e) { string server = serverBox.Text; if (!server.Equals("")) { //this.Enabled = false; if (saveBox.CheckState == CheckState.Checked) { try { RegistryKey key = Registry.LocalMachine.CreateSubKey(regDir); key.SetValue(regKeySrv, server); key.SetValue(regKeyLogin, loginBox.Text); key.Close(); } catch (Exception ex) { MessageBox.Show("You have to be logged in as Administrator or run the program as Administrator in order to save settings.", "Error while trying to save settings", MessageBoxButtons.OK, MessageBoxIcon.Information); } } //this.Visible = false; ConnectionMessage.Text = "Logging into the server. Please wait ..."; this.Update(); //fo = new FileOverview(server, loginBox.Text, passwordBox.Text, this); client = new Client(server, loginBox.Text, passwordBox.Text); if (client.isLogined) { this.Enabled = false; this.Visible = false; fo = new FileOverview(client, server, this); fo.SetVisible(); } else { try { if (!client.isConnected()) ConnectionMessage.Text = "Failed to connect to the server.\nPlease check your ip address."; else ConnectionMessage.Text = "Login failed. Please verify your user id and password."; } catch (System.NullReferenceException) { ConnectionMessage.Text = "Failed to connect to the server.\nPlease check your ip address."; } } } else { MessageBox.Show("Please enter serveraddress", "Address missing", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void dbOpenButton_Click(object sender, EventArgs e) { if (dbNameTextBox.Text != "") { this.Enabled = false; this.Visible = false; fo = new FileOverview(this, dbNameTextBox.Text); fo.SetVisible(); } else { MessageBox.Show("No data found...", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } }