public bool Start(Configuration ConfigFromUI) { _container.Config = ConfigFromUI; try { _container.Start(); Msgbox.ShowMsgbox("Manager started","Manager is Running!", "", "", "OK"); //for heirarchical stuff // if (Config.Intermediate) // { // //Config.Id = Manager.Id; // //Config.Dedicated = Manager.Dedicated; // } return true; } catch (Exception ex) { _container = null; string errorMsg = string.Format("Could not start Manager. Reason: {0}{1}", Environment.NewLine, ex.Message); if (ex.InnerException != null) { errorMsg += string.Format("{0}", ex.InnerException.Message); } //Log(errorMsg); logger.Error(errorMsg, ex); return false; } //Application should refresh UI controls now }
public ManagerContainerWrapper() { ManagerContainer.ManagerStartEvent += new ManagerStartStatusEventHandler(this.Manager_StartStatusEvent); _container = new ManagerContainer(); _container.RemotingConfigFile = "eduGRID_ManagerApp.exe.config"; _container.ReadConfig(false, AppDomain.CurrentDomain.BaseDirectory, "eduGRIDManager.config.xml"); Config = _container.Config; //After this is initialized, Application should read Config and fill up ui with default values }
public ManagerService() { // This call is required by the Windows.Forms Component Designer. InitializeComponent(); try { _container = new ManagerContainer(); _container.RemotingConfigFile = "Alchemi.ManagerService.exe.config"; Logger.LogHandler += new LogEventHandler(this.Log); } catch (Exception ex) { HandleAllUnknownErrors(null,ex); } }
private void StopContainer() { try { if (_container!=null) _container.Stop(); logger.Info("Stopped Alchemi Manager Service."); } catch (Exception ex) { logger.Error("Error stopping manager container",ex); } finally { _container = null; } }
protected override void StartManager() { if (Started && _container!=null) { RefreshUIControls(_container.Config); return; } //to avoid people from clicking this again uiStartButton.Enabled = false; uiResetButton.Enabled = false; uiStopButton.Enabled = false; ucEndPoints.Enabled = false; uiStatusBar.Text = "Starting Manager..."; Log("Attempting to start Manager..."); uiProgressBar.Value = 0; uiProgressBar.Show(); if (_container == null) _container = new ManagerContainer(); _container.Config = GetConfigFromUI(); _container.RemotingConfigFile = Assembly.GetExecutingAssembly().Location + ".config"; try { _container.Start(); Log("Manager started"); //for heirarchical stuff // if (Config.Intermediate) // { // //Config.Id = Manager.Id; // //Config.Dedicated = Manager.Dedicated; // } } catch (Exception ex) { string errorMsg = string.Format("Could not start Manager. Reason: {0}{1}", Environment.NewLine, ex.Message); if (ex.InnerException != null) { errorMsg += string.Format("{0}", ex.InnerException.Message); } Log(errorMsg); logger.Error(errorMsg,ex); } RefreshUIControls(_container.Config); }
//----------------------------------------------------------------------------------------------- private void ManagerMainForm_Load(object sender, EventArgs e) { //normal startup. not a service _container = new ManagerContainer(); _container.ReadConfig(); RefreshUIControls(_container.Config); uiStartButton.Focus(); }
protected override void StopManager() { if (Started) { uiProgressBar.Value = 0; uiProgressBar.Show(); uiProgressBar.Value = uiProgressBar.Maximum / 2; uiStatusBar.Text = "Stopping Manager..."; Log("Stopping Manager..."); uiStopButton.Enabled = false; uiStartButton.Enabled = false; ucEndPoints.Enabled = true; try { _container.Stop(); _container = null; } catch (Exception ex) { logger.Error("Error stopping manager",ex); } uiProgressBar.Value = uiProgressBar.Maximum; Log("Manager stopped."); } if (_container == null) _container = new ManagerContainer(); _container.Config = GetConfigFromUI(); RefreshUIControls(_container.Config); }
private Configuration ReadManagerConfig(bool useDefault) { //in case it is a service, the container would be null since we dont need it really. //but we still need to get the config from it, so create a new one and read the config. ManagerContainer mc = new ManagerContainer(); mc.ReadConfig(); return mc.Config; }
protected override void StartManager() { if (Started) { RefreshUIControls(); return; } //to avoid people from clicking this again btStart.Enabled = false; btReset.Enabled = false; btStop.Enabled = false; statusBar.Text = "Starting Manager..."; Log("Attempting to start Manager..."); pbar.Value = 0; pbar.Show(); Config = GetConfigFromUI(); if (_container == null) _container = new ManagerContainer(); _container.Config = Config; _container.RemotingConfigFile = "Alchemi.ManagerExec.exe.config"; Log("app name == " + System.IO.Path.GetFileName(Application.ExecutablePath)); try { _container.Start(); Log("Manager started"); //for heirarchical stuff // if (Config.Intermediate) // { // //Config.Id = Manager.Id; // //Config.Dedicated = Manager.Dedicated; // } } catch (Exception ex) { _container = null; string errorMsg = string.Format("Could not start Manager. Reason: {0}{1}", Environment.NewLine, ex.Message); if (ex.InnerException != null) { errorMsg += string.Format("{0}", ex.InnerException.Message); } Log(errorMsg); logger.Error(errorMsg,ex); } RefreshUIControls(); }
//----------------------------------------------------------------------------------------------- private void ManagerMainForm_Load(object sender, EventArgs e) { //normal startup. not a service _container = new ManagerContainer(); _container.ReadConfig(false); Config = _container.Config; RefreshUIControls(); btStart.Focus(); }
public bool Stop() { try { _container.Stop(); _container = null; return true; } catch (Exception ex) { logger.Error("Error stopping manager", ex); return false; } //Refresh ui controlls }