public void UpdateListMeasTask()
        {
            ClassConvertTasks ts   = new ClassConvertTasks();
            ClassesDBGetTasks cl   = new ClassesDBGetTasks();
            List <MeasTask>   mts_ = ts.ConvertTo_MEAS_TASKObjects(cl.ReadlAllSTasksFromDB()).ToList();

            foreach (MeasTask FND in mts_.ToArray())
            {
                // Удаляем данные об объекте с глобального списка
                if (GlobalInit.LIST_MEAS_TASK.Find(j => j.Id.Value == FND.Id.Value) == null)
                {
                    GlobalInit.LIST_MEAS_TASK.Add(FND);
                }
                else
                {
                    //lock (GlobalInit.LIST_MEAS_TASK)
                    if ((FND.Status != null) && (FND.Status != "N"))
                    {
                        MeasTask fnd = GlobalInit.LIST_MEAS_TASK.Find(j => j.Id.Value == FND.Id.Value);
                        if (fnd != null)
                        {
                            GlobalInit.LIST_MEAS_TASK.ReplaceAll <MeasTask>(fnd, FND);
                        }
                        else
                        {
                            GlobalInit.LIST_MEAS_TASK.Add(FND);
                        }
                    }
                }
            }
            ts.Dispose();
            cl.Dispose();
        }
Exemplo n.º 2
0
        void IAppServerComponent.Activate()
        {
            BaseXMLConfiguration xml_conf = new BaseXMLConfiguration();

            GlobalInit.Initialization();
            ClassesDBGetResult       DbGetRes = new ClassesDBGetResult();
            ClassConvertToSDRResults conv     = new ClassConvertToSDRResults();
            ///
            // Начальная инициализация (загрузка конфигурационных данных)

            /*
             * Task tt = new Task(() => {
             *  System.Threading.Thread.CurrentThread.Priority = System.Threading.ThreadPriority.Normal;
             *      if (GlobalInit.LST_MeasurementResults.Count == 0) {
             *          MeasurementResults[] msResltConv = conv.ConvertTo_SDRObjects(DbGetRes.ReadlAllResultFromDB());
             *          if (msResltConv != null) {
             *              foreach (MeasurementResults inb in msResltConv.ToArray()) {
             *                  GlobalInit.LST_MeasurementResults.Add(inb);
             *              }
             *          }
             *      }
             * });
             * tt.Start();
             * tt.Wait();
             */

            Task tsg = new Task(() => {
                ClassesDBGetTasks cl = new ClassesDBGetTasks();
                ClassConvertTasks ts = new ClassConvertTasks();
                List <MeasTask> mts_ = ts.ConvertTo_MEAS_TASKObjects(cl.ReadlAllSTasksFromDB()).ToList();
                foreach (MeasTask mtsd in mts_.ToArray())
                {
                    if (((GlobalInit.LIST_MEAS_TASK.Find(j => j.Id.Value == mtsd.Id.Value) == null)))
                    {
                        MeasTask fnd = GlobalInit.LIST_MEAS_TASK.Find(j => j.Id.Value == mtsd.Id.Value);
                        if (fnd != null)
                        {
                            GlobalInit.LIST_MEAS_TASK.ReplaceAll <MeasTask>(fnd, mtsd);
                        }
                        else
                        {
                            GlobalInit.LIST_MEAS_TASK.Add(mtsd);
                        }
                    }
                }
                cl.Dispose();
                ts.Dispose();
            });

            tsg.Start();



            Sheduler_Up_Meas_SDR_Results Sc_Up_Meas_SDR = new Sheduler_Up_Meas_SDR_Results(); Sc_Up_Meas_SDR.ShedulerRepeatStart(BaseXMLConfiguration.xml_conf._TimeUpdateMeasResult);

            ShedulerReceiveStatusMeastaskSDR sc = new ShedulerReceiveStatusMeastaskSDR();

            sc.ShedulerRepeatStart(BaseXMLConfiguration.xml_conf._TimeUpdateMeasTaskStatus);


            ShedulerCheckActivitySensor CheckActivitySensor = new ShedulerCheckActivitySensor();

            CheckActivitySensor.ShedulerRepeatStart(BaseXMLConfiguration.xml_conf._RescanActivitySensor);

            ShedulerGetMeasTask getMeasTask = new ShedulerGetMeasTask(); getMeasTask.ShedulerRepeatStart(20);


            //Sheduler_ArchiveSDRResults arch_sdrRes = new Sheduler_ArchiveSDRResults(); arch_sdrRes.ShedulerRepeatStart(BaseXMLConfiguration.xml_conf._TimeArchiveResult);

            ShedulerCheckStart Quartz = new ShedulerCheckStart();

            Quartz.ShedulerRepeatStart(BaseXMLConfiguration.xml_conf._ReloadStart);
        }