using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Windows.Forms; using DarkWynter.Engine.Networking.Database; namespace DarkWynter.App { public partial class DataBaseControl : UserControl { /// /// Connection to DarkWynter server database /// DataBaseConnection dbConnection; public DataBaseControl() { InitializeComponent(); this.Dock = DockStyle.Fill; } private void btnConnect_Click(object sender, EventArgs e) { dbConnection = new DataBaseConnection( txtIP.Text, txtPort.Text, txtDatabase.Text, txtUsername.Text, txtPassword.Text ); txtLog.AppendText("Openning connection...\r\n"); if (dbConnection.Connect()) { txtLog.AppendText("Connection opened\r\n"); } else { txtLog.AppendText( "Could not access the database.\r\n" + "Please make sure you completed the fields with the correct information and try again.\r\n"); } btnListTables.Enabled = true; } private void btnListTables_Click(object sender, EventArgs e) { txtLog.AppendText(dbConnection.ListTables()); } private void btnDisconnect_Click(object sender, EventArgs e) { dbConnection.Disconnect(); } private void mnuExit_Click(object sender, EventArgs e) { Application.Exit(); } } }