Exemple #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);
            }
        }
Exemple #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Restart_Click(object sender, EventArgs e)
 {
     using (var client = new WCFAPI.WCFMacrosClient())
     {
     }
 }
Exemple #3
0
        public void SendToDrone(object sender, System.Timers.ElapsedEventArgs args)
        {
            log.Debug("======================start send bble to drone======================================");
            if (is_resarting)
            {
                log.Debug("server is restaring please check drone give up this time !");
                return;
            }
            try
            {
                if (NeedRunBBLEs == null)
                {
                    NeedRunBBLEs = GetNeedRunBBlEs();
                    if (NeedRunBBLEs == null)
                    {
                        log.Debug("can not find bbles in file BBlEs.json please check.");
                    }
                }



                //Loop
                using (var client = new WCFAPI.WCFMacrosClient())
                {
                    var waitingCount = -1;
                    try
                    {
                        waitingCount = client.Requests_Waiting();
                    }
                    catch
                    {
                        log.Debug("Some time error Requests_Waiting if want know detail please use break point!");
                        waitingCount = -1;
                    }

                    var needAdd = 20 - waitingCount;
                    if (needAdd > 0 && waitingCount >= 0)
                    {
                        int RanCount = Convert.ToInt32(ReadData("RanCount"));

                        for (var i = 0; i < needAdd; i++)
                        {
                            RanCount++;
                            if (RanCount < NeedRunBBLEs.Count())
                            {
                                int apiOrder = (new Random()).Next(1000, 2000);
                                var bble     = NeedRunBBLEs.ToList()[RanCount].ToString();
                                client.GetPropdata(bble, apiOrder, true, true, true, true, true, false);
                                client.Get_Servicer(apiOrder, bble);
                                log.Debug(String.Format("Request BBLE: {0} in ({1}/{2})  waiting request is ({3})", bble, RanCount, NeedRunBBLEs.Count, waitingCount));
                                SetData("RanCount", RanCount);
                            }
                            else
                            {
                                log.Debug("***********end of Send request loop***********");
                            }
                        }
                    }
                    else
                    {
                        log.Debug("Loop has (" + waitingCount.ToString() + ") waitingCount is busy now");
                    }
                }
            }
            catch (Exception ex)
            {
                log.Debug(ex);
            }
            log.Debug("======================end send bble to drone======================================");
        }