private void btn_Manager_Start_Click(object sender, EventArgs e) { //assumes the manager is not started...otherwise start button would be disabled. btn_Manager_Start.Enabled = false; btn_Manager_Stop.Enabled = false; btn_Manager_Reset.Enabled = false; inspect_Manager.ValuesSecondary.Description = "Starting Manager..."; PBar.Value = 0; PBar.Show(); if (CurrentSelectedManagerWrapper._container == null) { //this is also done in the constructor of the wrapper CurrentSelectedManagerWrapper._container = new Alchemi.Manager.ManagerContainer(); CurrentSelectedManagerWrapper._container.RemotingConfigFile = "eduGRID_ManagerApp.exe.config"; CurrentSelectedManagerWrapper._container.ReadConfig(false, AppDomain.CurrentDomain.BaseDirectory, "eduGRIDManager.config.xml"); CurrentSelectedManagerWrapper.Config = CurrentSelectedManagerWrapper._container.Config; } { //note that dbtype is not being displayed...its type is retained as default CurrentSelectedManagerWrapper.Config.DbServer = txDbServer.Text; CurrentSelectedManagerWrapper.Config.DbUsername = txDbUsername.Text; CurrentSelectedManagerWrapper.Config.DbPassword = txDbPassword.Text; CurrentSelectedManagerWrapper.Config.DbName = txDbName.Text; CurrentSelectedManagerWrapper.Config.OwnPort = int.Parse(txOwnPort.Text); //todo: more to be added for intermediate level manager CurrentSelectedManagerWrapper.ManagerName = txtInstanceName.Text; } CurrentSelectedManagerWrapper._container.Config = CurrentSelectedManagerWrapper.Config; try { CurrentSelectedManagerWrapper._container.Start(); inspect_Manager.ValuesSecondary.Description = "Manager Started"; btn_Manager_Stop.Enabled = true; txDbServer.Enabled = false; txDbUsername.Enabled = false; txDbPassword.Enabled = false; txDbName.Enabled = false; txOwnPort.Enabled = false; PBar.Visible = false; } catch (Exception ex) { btn_Manager_Start.Enabled = true; btn_Manager_Reset.Enabled = true; Msgbox.ShowMsgbox("Could not start Manager!", ex.ToString(), "", "", "OK"); inspect_Manager.ValuesSecondary.Description = "Could not start manager!"; } }
private void btn_Manager_Stop_Click(object sender, EventArgs e) { btn_Manager_Stop.Enabled = false; try { CurrentSelectedManagerWrapper._container.Stop(); CurrentSelectedManagerWrapper._container = null; btn_Manager_Start.Enabled = true; btn_Manager_Reset.Enabled = true; txDbServer.Enabled = true; txDbUsername.Enabled = true; txDbPassword.Enabled = true; txDbName.Enabled = true; txOwnPort.Enabled = true; } catch (Exception ex) { btn_Manager_Stop.Enabled = true; Msgbox.ShowMsgbox("Error stopping manager", ex.ToString(), "", "", "OK :("); } }
private void DisplayManager() { //function assumes that currentselectedmanagerwrapper is set properly if (CurrentSelectedManagerWrapper != null) { if ((CurrentSelectedManagerWrapper._container != null) && (CurrentSelectedManagerWrapper._container.Started)) { inspect_Manager.ValuesSecondary.Description = "Manager Started"; btn_Manager_Start.Enabled = false; btn_Manager_Reset.Enabled = false; btn_Manager_Stop.Enabled = true; txDbServer.Enabled = false; txDbServer.Text = CurrentSelectedManagerWrapper.Config.DbServer; txDbUsername.Enabled = false; txDbUsername.Text = CurrentSelectedManagerWrapper.Config.DbUsername; txDbPassword.Enabled = false; txDbPassword.Text = CurrentSelectedManagerWrapper.Config.DbPassword; txDbName.Enabled = false; txDbName.Text = CurrentSelectedManagerWrapper.Config.DbName; txOwnPort.Enabled = false; txOwnPort.Text = CurrentSelectedManagerWrapper.Config.OwnPort.ToString(); PBar.Visible = false; } else { btn_Manager_Start.Enabled = true; btn_Manager_Stop.Enabled = false; btn_Manager_Reset.Enabled = true; txDbServer.Enabled = true; txDbServer.Text = CurrentSelectedManagerWrapper.Config.DbServer; txDbUsername.Enabled = true; txDbUsername.Text = CurrentSelectedManagerWrapper.Config.DbUsername; txDbPassword.Enabled = true; txDbPassword.Text = CurrentSelectedManagerWrapper.Config.DbPassword; txDbName.Enabled = true; txDbName.Text = CurrentSelectedManagerWrapper.Config.DbName; txOwnPort.Enabled = true; txOwnPort.Text = CurrentSelectedManagerWrapper.Config.OwnPort.ToString(); PBar.Visible = false; } inspect_Manager.BringToFront(); inspect_Manager.Visible = true; } else { Msgbox.ShowMsgbox("Uninitialized!", "This Manager Instance is not initialized, or was closed for an unknown reason. Would you like to start the instance?", "", "", "&OK"); } }