protected override void OnStart(string[] args)
        {
            try
            {
                //Thread.Sleep(15000);
                var displayName = GetServiceName();
                string configFile = AppDomain.CurrentDomain.BaseDirectory + "\\" + displayName + ".exe.config";
                if (File.Exists(configFile))
                {
                    AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", configFile);
                }
                webClient = new CPServiceClient();
                string systemProcess = string.Empty;
                if (ConfigurationManager.AppSettings["SystemProcess"] != null) systemProcess = ConfigurationManager.AppSettings["SystemProcess"].ToString();

                //ServiceLogManager.GetLogger(this.GetType().Name).Info(string.Format("Started {0} Background Service", systemProcess));
                processor = new TaskProcessorCore(webClient.GetSystemProcessByName(systemProcess));
                processor.OnGetSystemProcessThread += new TaskProcessorCore.GetSystemProcessThreadEventHandler(processor_OnGetSystemProcessThread);
                processor.OnUpdateSystemProcess += new TaskProcessorCore.UpdateSystemProcessThreadEventHandler(processor_OnUpdateSystemProcess);
                processor.StartEngines();

                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            }
            catch (Exception e)
            {
                throw;
            }
        }
        protected override void OnStart(string[] args)
        {
            try
            {
                //Thread.Sleep(15000);
                var    displayName = GetServiceName();
                string configFile  = AppDomain.CurrentDomain.BaseDirectory + "\\" + displayName + ".exe.config";
                if (File.Exists(configFile))
                {
                    AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", configFile);
                }
                webClient = new CPServiceClient();
                string systemProcess = string.Empty;
                if (ConfigurationManager.AppSettings["SystemProcess"] != null)
                {
                    systemProcess = ConfigurationManager.AppSettings["SystemProcess"].ToString();
                }

                //ServiceLogManager.GetLogger(this.GetType().Name).Info(string.Format("Started {0} Background Service", systemProcess));
                processor = new TaskProcessorCore(webClient.GetSystemProcessByName(systemProcess));
                processor.OnGetSystemProcessThread += new TaskProcessorCore.GetSystemProcessThreadEventHandler(processor_OnGetSystemProcessThread);
                processor.OnUpdateSystemProcess    += new TaskProcessorCore.UpdateSystemProcessThreadEventHandler(processor_OnUpdateSystemProcess);
                processor.StartEngines();

                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            }
            catch (Exception e)
            {
                throw;
            }
        }