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
 }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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;
            }
        }
예제 #5
0
        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);
        }
예제 #6
0
        //-----------------------------------------------------------------------------------------------
        private void ManagerMainForm_Load(object sender, EventArgs e)
        {
            //normal startup. not a service
            _container = new  ManagerContainer();
            _container.ReadConfig();

            RefreshUIControls(_container.Config);
            uiStartButton.Focus();
        }
예제 #7
0
        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);
        }
예제 #8
0
 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;
 }
예제 #9
0
        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();
        }
예제 #10
0
        //-----------------------------------------------------------------------------------------------
        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();
        }
예제 #11
0
        public bool Stop()
        {
            try
            {
                _container.Stop();
                _container = null;
                return true;
            }
            catch (Exception ex)
            {
                logger.Error("Error stopping manager", ex);
                return false;
            }

            //Refresh ui controlls
        }