示例#1
0
        public void ScanDroneMain(object sender, System.Timers.ElapsedEventArgs args)
        {
            try
            {
                log.Debug("====================Scan Start=======================");
                using (WCFAPI.WCFMacrosClient client = new WCFAPI.WCFMacrosClient())
                {
                    try
                    {
                        log.Debug("dorne waiting count : (" + client.Requests_Waiting() + ") Reset respose count = 0");
                        if (is_resarting)
                        {
                            is_resarting = false;
                            log.Debug("start Drone completed! mark is_resarting as false");
                        }
                        DroneResponseCount = 0;
                    }
                    catch
                    {
                        DroneResponseCount++;
                        log.Debug("increse Drone not Response Count to: (" + DroneResponseCount + ")");
                    }
                }

                if (DroneResponseCount >= 3 && !is_resarting)
                {
                    log.Debug("Server not response in 3 times starting resart it and send email to DEV team.");
                    using (var srv = new PortalService.CommonServiceClient())
                    {
                        srv.SendEmailByAddress("[email protected];[email protected];[email protected]", null,
                                               "Drone is not response  restarting it ",
                                               "Hi All,<br> <br> Drone on (" + System.Environment.MachineName + ") is not response the monitor program is restart it ! please notice !!");
                    }
                    ResartDrone();
                }
                log.Debug("====================Scan End=======================");
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
        }