Exemple #1
0
        public JsonResult AddPingData(string pingData, int?pingQuantity = 1, bool?reset = false, bool?worker = false, string type = "")
        {
            var xtype = typeof(PingWorker);

            if (!string.IsNullOrEmpty(type))
            {
                xtype = EngineeCommandWorkerQueue.GetType(type);
            }
            if (worker == true)
            {
                for (int i = 0; i < pingQuantity; i++)
                {
                    EngineeCommandWorkerQueue.AddAndStartWorker(xtype);
                }
            }
            else
            {
                if (reset == true)
                {
                    EngineeCommandWorkerQueue.ResetToOneWorker(xtype);
                }
                else
                {
                    for (int i = 0; i < pingQuantity; i++)
                    {
                        EngineeCommandWorkerQueue.Push(new PingWorker($"{i + 1}. {pingData}"));
                    }
                }
            }

            return(Json(new { Ok = true, Data = new { }, Message = "Success" }, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public JsonResult GetStatistic(string type)
        {
            var xtype = typeof(PingWorker);

            if (!string.IsNullOrEmpty(type))
            {
                xtype = EngineeCommandWorkerQueue.GetType(type);
            }
            int workerCount;
            int dataCount;

            EngineeCommandWorkerQueue.CountStatistic(xtype, out dataCount, out workerCount);
            return(Json(new { Ok = true, Data = new { dataCount, workerCount }, Message = "Success" }, JsonRequestBehavior.AllowGet));
        }