private void sql_DisconnectionEvent(object sender, SQLConnectionEventArgs args) { this.cbDatabases.InvokeIfRequired(() => { this.lbTables.Items.Clear(); this.cbDatabases.Items.Clear(); this.cbDatabases.Text = ""; //TODO: ... this.statusBarLabel.Text = ""; }); }
private void sql_ConnectionEvent(object sender, SQLConnectionEventArgs args) { Console.WriteLine("Poszło3"); this.bSQLConnect.InvokeIfRequired(() => { this.bSQLConnect.Enabled = true; this.pbConnecting.Hide(); this.statusBarLabel.Text = ""; }); if (args.IsSuccess) { Console.WriteLine("Poszło4"); this.pDBData.InvokeIfRequired(() => { this.pDBData.Show(); this.pDBConnection.Hide(); }); /* * Check if key is alrady in connection strings dicionary... */ if (this.settings.SqlConnectionStrings.ContainsKey(this.sql.ConnectionString.Server)) { /* * ... if so, then update it */ this.settings.SqlConnectionStrings[this.sql.ConnectionString.Server] = this.sql.ConnectionString.ConnectionString; } else { /* * ... if not, then create it */ this.settings.SqlConnectionStrings.Add( this.sql.ConnectionString.Server, this.sql.ConnectionString.ConnectionString ); } this.settings.Save(); this.statusBarLabel.Text = "Szukam baz danych..."; this.sql.StartScanDatabases(); } else { this.pDBData.InvokeIfRequired(() => { this.pDBConnection.Show(); this.pDBData.Hide(); }); /* * Check if key is alrady in connection strings dicionary... */ if (this.settings.SqlConnectionStrings.ContainsKey(this.sql.ConnectionString.Server)) { /* * ... if so, then remove it, because it is not working correctly */ this.settings.SqlConnectionStrings.Remove(this.sql.ConnectionString.Server); } Console.WriteLine("Poszło5"); MessageBox.Show("Wystapił błąd podczas połączenia z bazą.", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Warning); Console.WriteLine("Poszło6"); } }