private void btnTestConnection_Click(object sender, EventArgs e) { mpDataWorker.Username = txtDBUserName.Text; mpDataWorker.Password = txtDBPassword.Text; mpDataWorker.Server = txtDBServer.Text; if (mpDataWorker.TestConnection()) { //Jippie MessageBox.Show("Connection succesfull"); connAvailable = true; Initialize(); } else { //Error MessageBox.Show("Connection failed"); connAvailable = false; Initialize(); } }
private void Initialize() { //Load MediaPortal Channels mpDataWorker = MPDataWorker.GetInstance(); //TODO: Ask for user/pass/server (in the beginning?) mpDataWorker.Username = txtDBUserName.Text; mpDataWorker.Password = txtDBPassword.Text; mpDataWorker.Server = txtDBServer.Text; if (mpDataWorker.TestConnection()) { connAvailable = true; btnAdd.Enabled = true; btnImportFromMediaportal.Enabled = true; btnExportToMediaPortal.Enabled = true; btnImportFromDreamBox.Enabled = true; //Two unique instances! //Load Channels //mpTVAllChannels = mpDataWorker.GetChannels(); //mpRadioAllChannels = mpDataWorker.GetChannels(false); //Map channels //mpChannelsSelection = mpDataWorker.GetChannels(activeTypeTV ? true : false); grdMPAllChannels.DataSource = mpChannelsSelection; } else { connAvailable = false; //btnAdd.Enabled = false; btnImportFromMediaportal.Enabled = false; // btnExportToMediaPortal.Enabled = false; //btnExportToMediaPortal.Enabled = false; //btnImportFromDreamBox.Enabled = false; //grdMPAllChannels.DataSource = null; } }