Esempio n. 1
0
        } // end of ControllerSetUp method

        /// <summary>
        /// will disable controller which will be passed inside of the method
        /// </summary>
        /// <returns></returns>
        static public void DisableController()
        {
            try
            {
                Cntr.Dispose();
                Cntr = null;
                monitoringRunning = false;
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Problem with Dispose method inside of ControllerPresenter class");
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Will check before connecting to the controller if controller is active and if it's active it will AbbELog off from this controller and will dispose that controller.
 /// </summary>
 /// <returns></returns>
 static public void EnableController()
 {
     if (Cntr != null) //if selecting a new controller
     {
         try
         {
             using (Cntr)
             {
                 Cntr.Logoff();
                 Cntr.Dispose();
                 Cntr = null;
             }
         }
         catch (Exception e)
         {
             logger.Error($"Inside of ControllerPresenter {e}");
         }
     }
 } // end of EnableController method
Esempio n. 3
0
        /// <summary>
        /// scanning network and setting up the controller
        /// </summary>
        static public bool ControllerSetUp()
        {
            try
            {
                // checking if ReadConfigXmlFileSetList returns an empty list or not
                if (Utilities.ReadConfigXmlFileSetList() != null)
                {
                    SetConfigSuccessful = true;
                }
            }
            catch (Exception)
            {
                logger.Error(Utilities.errorMsExcep);
            }

            foreach (var t in Utilities.cd)
            {
                controllerId = t.Controller_ID;
            }
            int i = 0;

            if (SetConfigSuccessful == true)
            {
                try
                {
                    // scanning the network for a controller availability
                    Scanner.Scan();
                    for (i = 0; i < Scanner.Controllers.Count; i++)
                    {
                        if (Scanner.Controllers[i].Name.Equals(controllerId))
                        {
                            ContrInfo = Scanner.Controllers[i];
                            if (ContrInfo.Availability == Availability.Available)
                            {
                                if (Cntr != null)
                                {
                                    Cntr.Logoff();
                                    Cntr = null;
                                }

                                //DisableController();
                            }
                            Cntr = ControllerFactory.CreateFrom(ContrInfo);
                            Cntr.Logon(UserInfo.DefaultUser);
                            AbbELog    = Cntr.EventLog;
                            Successful = true;
                        }
                    }
                }
                catch (Exception excp)
                {
                    logger.Error($"Problem to set up a controller: {excp.Message}");
                    Successful = false;
                }

                if (Scanner.Controllers.Count == 0)
                {
                    Successful = false;
                    logger.Info($"Scanner did not found controllers on the network.");
                }
            }
            else
            {
                Successful = false;
            }
            return(Successful);
        } // end of ControllerSetUp method
Esempio n. 4
0
        } // end of ControllerSetUp method

        /// <summary>
        /// will disable controller which will be passed inside of the method
        /// </summary>
        /// <returns></returns>
        static public void DisableController()
        {
            Cntr.Dispose();
            Cntr = null;
        }