Esempio n. 1
0
 public static void StartRefreshThread(bool b_runasservice)
 {
     if (DBCacheEventProcess.dbcep_instance == null)
     {
         InterProcessEvent.getGlobalEvent("DBSyncEventName_Service_Device", false);
         InterProcessEvent.getGlobalEvent("DBSyncEventName_AP_Device", false);
         InterProcessEvent.getGlobalEvent("DBSyncEventName_Service_Rack", false);
         InterProcessEvent.getGlobalEvent("DBSyncEventName_AP_Rack", false);
         InterProcessEvent.getGlobalEvent("DBSyncEventName_Service_ZONE", false);
         InterProcessEvent.getGlobalEvent("DBSyncEventName_AP_ZONE", false);
         InterProcessEvent.getGlobalEvent("DBSyncEventName_Service_BackupTask", false);
         InterProcessEvent.getGlobalEvent("DBSyncEventName_AP_BackupTask", false);
         InterProcessEvent.getGlobalEvent("DBSyncEventName_Service_User", false);
         InterProcessEvent.getGlobalEvent("DBSyncEventName_AP_User", false);
         InterProcessEvent.getGlobalEvent("DBSyncEventName_Service_GroupTask", false);
         InterProcessEvent.getGlobalEvent("DBSyncEventName_AP_GroupTask", false);
         InterProcessEvent.getGlobalEvent("DBSyncEventName_Service_Group", false);
         InterProcessEvent.getGlobalEvent("DBSyncEventName_AP_Group", false);
         InterProcessEvent.getGlobalEvent("DBSyncEventName_Service_Event", false);
         InterProcessEvent.getGlobalEvent("DBSyncEventName_AP_Event", false);
         InterProcessEvent.getGlobalEvent("DBSyncEventName_Service_Smtp", false);
         InterProcessEvent.getGlobalEvent("DBSyncEventName_AP_Smtp", false);
         InterProcessEvent.getGlobalEvent("DBSyncEventName_Service_SystemParameter", false);
         InterProcessEvent.getGlobalEvent("DBSyncEventName_AP_SystemParameter", false);
         InterProcessEvent.getGlobalEvent("DBSyncEventName_Service_DeviceVoltage", false);
         InterProcessEvent.getGlobalEvent("DBSyncEventName_AP_DeviceVoltage", false);
         DBCacheEventProcess.dbcep_instance = new DBCacheEventProcess();
         DBCacheEventProcess.dbcep_instance.run_as_service = b_runasservice;
         DBCacheEventProcess.dbcep_instance.Start();
     }
 }
Esempio n. 2
0
 public static void DBSyncEventSet(bool bValue, params string[] subEventNames)
 {
     for (int i = 0; i < subEventNames.Length; i++)
     {
         string name = subEventNames[i];
         InterProcessEvent.setGlobalEvent(name, bValue);
     }
     if (DBCacheStatus._dbSyncEvent != null)
     {
         DBCacheStatus._dbSyncEvent.Set();
     }
 }
Esempio n. 3
0
 public static void SetDBStatus(int i_st)
 {
     lock (TaskStatus.thisLock)
     {
         TaskStatus.i_dbstatus = i_st;
         try
         {
             if (i_st == 1)
             {
                 InterProcessEvent.setGlobalEvent("Database_Maintaining", false);
             }
         }
         catch (Exception ex)
         {
             DebugCenter.GetInstance().appendToFile("DBERROR~~~~~~~~~~~DBERROR : " + ex.Message + "\n" + ex.StackTrace);
         }
     }
 }
Esempio n. 4
0
 private void WorkThread(object state)
 {
     while (this._stopping == 0)
     {
         int num = WaitHandle.WaitAny(this._waitHandles, 500);
         if (num == 0)
         {
             break;
         }
         if (num == 1)
         {
             bool flag = false;
             if (this.run_as_service)
             {
                 if (InterProcessEvent.getGlobalEvent("DBSyncEventName_Service_BackupTask", false))
                 {
                     flag = true;
                     DBCacheStatus.BackupTask = true;
                     InterProcessEvent.setGlobalEvent("DBSyncEventName_Service_BackupTask", false);
                 }
                 if (InterProcessEvent.getGlobalEvent("DBSyncEventName_Service_Device", false))
                 {
                     flag = true;
                     DBCacheStatus.Device             = true;
                     DBCacheStatus.Group              = true;
                     DBCacheStatus.ServiceRefreshFlag = true;
                     InterProcessEvent.setGlobalEvent("DBSyncEventName_Service_Device", false);
                 }
                 if (InterProcessEvent.getGlobalEvent("DBSyncEventName_Service_DeviceVoltage", false))
                 {
                     flag = true;
                     DBCacheStatus.DeviceVoltage = true;
                     InterProcessEvent.setGlobalEvent("DBSyncEventName_Service_DeviceVoltage", false);
                 }
                 if (InterProcessEvent.getGlobalEvent("DBSyncEventName_Service_Event", false))
                 {
                     flag = true;
                     DBCacheStatus.Event = true;
                     InterProcessEvent.setGlobalEvent("DBSyncEventName_Service_Event", false);
                 }
                 if (InterProcessEvent.getGlobalEvent("DBSyncEventName_Service_Group", false))
                 {
                     flag = true;
                     DBCacheStatus.Group = true;
                     InterProcessEvent.setGlobalEvent("DBSyncEventName_Service_Group", false);
                 }
                 if (InterProcessEvent.getGlobalEvent("DBSyncEventName_Service_GroupTask", false))
                 {
                     flag = true;
                     DBCacheStatus.GroupTask = true;
                     InterProcessEvent.setGlobalEvent("DBSyncEventName_Service_GroupTask", false);
                 }
                 if (InterProcessEvent.getGlobalEvent("DBSyncEventName_Service_Rack", false))
                 {
                     flag = true;
                     DBCacheStatus.Rack  = true;
                     DBCacheStatus.Group = true;
                     InterProcessEvent.setGlobalEvent("DBSyncEventName_Service_Rack", false);
                 }
                 if (InterProcessEvent.getGlobalEvent("DBSyncEventName_Service_Smtp", false))
                 {
                     flag = true;
                     DBCacheStatus.Smtp = true;
                     InterProcessEvent.setGlobalEvent("DBSyncEventName_Service_Smtp", false);
                 }
                 if (InterProcessEvent.getGlobalEvent("DBSyncEventName_Service_SystemParameter", false))
                 {
                     flag = true;
                     DBCacheStatus.SystemParameter = true;
                     InterProcessEvent.setGlobalEvent("DBSyncEventName_Service_SystemParameter", false);
                 }
                 if (InterProcessEvent.getGlobalEvent("DBSyncEventName_Service_User", false))
                 {
                     flag = true;
                     DBCacheStatus.User = true;
                     InterProcessEvent.setGlobalEvent("DBSyncEventName_Service_User", false);
                 }
                 if (InterProcessEvent.getGlobalEvent("DBSyncEventName_Service_ZONE", false))
                 {
                     flag = true;
                     DBCacheStatus.ZONE  = true;
                     DBCacheStatus.Group = true;
                     InterProcessEvent.setGlobalEvent("DBSyncEventName_Service_ZONE", false);
                 }
             }
             else
             {
                 if (InterProcessEvent.getGlobalEvent("DBSyncEventName_AP_BackupTask", false))
                 {
                     flag = true;
                     DBCacheStatus.BackupTask = true;
                     InterProcessEvent.setGlobalEvent("DBSyncEventName_AP_BackupTask", false);
                 }
                 if (InterProcessEvent.getGlobalEvent("DBSyncEventName_AP_Device", false))
                 {
                     flag = true;
                     DBCacheStatus.Device = true;
                     DBCacheStatus.Group  = true;
                     InterProcessEvent.setGlobalEvent("DBSyncEventName_AP_Device", false);
                     DeviceInfo.SetRefreshFlag(1);
                 }
                 if (InterProcessEvent.getGlobalEvent("DBSyncEventName_AP_DeviceVoltage", false))
                 {
                     flag = true;
                     DBCacheStatus.DeviceVoltage = true;
                     InterProcessEvent.setGlobalEvent("DBSyncEventName_AP_DeviceVoltage", false);
                 }
                 if (InterProcessEvent.getGlobalEvent("DBSyncEventName_AP_Event", false))
                 {
                     flag = true;
                     DBCacheStatus.Event = true;
                     InterProcessEvent.setGlobalEvent("DBSyncEventName_AP_Event", false);
                 }
                 if (InterProcessEvent.getGlobalEvent("DBSyncEventName_AP_Group", false))
                 {
                     flag = true;
                     DBCacheStatus.Group = true;
                     InterProcessEvent.setGlobalEvent("DBSyncEventName_AP_Group", false);
                 }
                 if (InterProcessEvent.getGlobalEvent("DBSyncEventName_AP_GroupTask", false))
                 {
                     flag = true;
                     DBCacheStatus.GroupTask = true;
                     InterProcessEvent.setGlobalEvent("DBSyncEventName_AP_GroupTask", false);
                 }
                 if (InterProcessEvent.getGlobalEvent("DBSyncEventName_AP_Rack", false))
                 {
                     flag = true;
                     DBCacheStatus.Rack  = true;
                     DBCacheStatus.Group = true;
                     InterProcessEvent.setGlobalEvent("DBSyncEventName_AP_Rack", false);
                 }
                 if (InterProcessEvent.getGlobalEvent("DBSyncEventName_AP_Smtp", false))
                 {
                     flag = true;
                     DBCacheStatus.Smtp = true;
                     InterProcessEvent.setGlobalEvent("DBSyncEventName_AP_Smtp", false);
                 }
                 if (InterProcessEvent.getGlobalEvent("DBSyncEventName_AP_SystemParameter", false))
                 {
                     flag = true;
                     DBCacheStatus.SystemParameter = true;
                     InterProcessEvent.setGlobalEvent("DBSyncEventName_AP_SystemParameter", false);
                 }
                 if (InterProcessEvent.getGlobalEvent("DBSyncEventName_AP_User", false))
                 {
                     flag = true;
                     DBCacheStatus.User = true;
                     InterProcessEvent.setGlobalEvent("DBSyncEventName_AP_User", false);
                 }
                 if (InterProcessEvent.getGlobalEvent("DBSyncEventName_AP_ZONE", false))
                 {
                     flag = true;
                     DBCacheStatus.ZONE  = true;
                     DBCacheStatus.Group = true;
                     InterProcessEvent.setGlobalEvent("DBSyncEventName_AP_ZONE", false);
                 }
             }
             if (flag)
             {
                 DBCacheStatus._dbSyncEvent.Reset();
             }
             else
             {
                 Thread.Sleep(500);
             }
         }
     }
     DebugCenter.GetInstance().appendToFile("[" + this._threadName + "] thread end");
     this._stoppedEvent.Set();
 }