Esempio n. 1
0
 private static void theIdleTimeout(object source, ElapsedEventArgs e)
 {
     if (Program.m_IdleTimerStopFlg == Program.IDLETIMER_PAUSE)
     {
         return;
     }
     if (Program.m_IdleTimeSet <= 0)
     {
         return;
     }
     Program.m_IdleCounter++;
     if (Program.m_IdleCounter >= Program.m_IdleTimeSet)
     {
         Program.m_IdleTimer.Stop();
         string para = "0230003\nAAA";
         ClientAPI.RemoteCall(100, 1, para, 10000);
         ClientAPI.Logout();
         ClientAPI.StopBroadcastChannel();
         EcoGlobalVar.stopalltimer(true);
         ControlAccess.ConfigControl config = delegate(Control control, object obj)
         {
             TopMostMessageBox.Show(EcoLanguage.getMsginThread("ThreadPopMsg_IdleTimeout", new string[0]), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         };
         ControlAccess controlAccess = new ControlAccess(EcoGlobalVar.gl_mainForm, config);
         controlAccess.Access(EcoGlobalVar.gl_mainForm, null);
         Program.ExitApp();
     }
 }
Esempio n. 2
0
 public static void ServerClosedProc(int reason)
 {
     if (EcoGlobalVar.ECOAppRunStatus == 2)
     {
         return;
     }
     if (reason != -1)
     {
         if (reason != -2)
         {
             return;
         }
     }
     try
     {
         ClientAPI.StopBroadcastChannel();
     }
     catch (System.Exception)
     {
     }
     try
     {
         EcoGlobalVar.stopalltimer(true);
     }
     catch (System.Exception)
     {
     }
     if (!EcoGlobalVar.isinExit)
     {
         EcoGlobalVar.isinExit = true;
         ControlAccess.ConfigControl config = delegate(Control control, object param)
         {
             int?num = param as int?;
             if (!num.HasValue || num == -1)
             {
                 TopMostMessageBox.Show(EcoLanguage.getMsginThread("srvConnectFail", new string[0]), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                 return;
             }
             TopMostMessageBox.Show(EcoLanguage.getMsginThread("srvEndSession", new string[0]), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         };
         ControlAccess controlAccess = new ControlAccess(EcoGlobalVar.gl_mainForm, config);
         controlAccess.Access(EcoGlobalVar.gl_mainForm, reason);
         Program.ExitApp();
     }
 }
Esempio n. 3
0
        public static void receiveDashBoardFlgProc(int infoType, object info, object carried)
        {
            string text = (string)carried;
            int    num  = 0;

            try
            {
                if ((infoType & 8) != 0 && EcoGlobalVar.gl_LoginUser != null && (EcoGlobalVar.gl_LoginUser.UserType == 1 || EcoGlobalVar.gl_LoginUser.UserType == 2))
                {
                    if (EcoGlobalVar.gl_LoginUser.UserType == 1)
                    {
                        EcoGlobalVar.gl_LoginUserUACDev2Port = (System.Collections.Generic.Dictionary <long, System.Collections.Generic.List <long> >)ClientAPI.RemoteCall(8, 1, "", 10000);
                        EcoGlobalVar.gl_LoginUser.UserDevice = ValuePairs.getValuePair("UserDevice");
                        EcoGlobalVar.gl_LoginUser.UserGroup  = ValuePairs.getValuePair("UserGroup");
                    }
                    if (EcoGlobalVar.gl_EnegManPage != null)
                    {
                        if (EcoGlobalVar.gl_LoginUser.UserType != 0 && (EcoGlobalVar.gl_LoginUser.UserDevice == null || EcoGlobalVar.gl_LoginUser.UserDevice.Length == 0))
                        {
                            EcoGlobalVar.gl_EnegManPage.showPowerControlButton(false);
                        }
                        else
                        {
                            EcoGlobalVar.gl_EnegManPage.showPowerControlButton(true);
                        }
                        if (EcoGlobalVar.gl_LoginUser.UserType != 0 && (EcoGlobalVar.gl_LoginUser.UserGroup == null || EcoGlobalVar.gl_LoginUser.UserGroup.Length == 0))
                        {
                            EcoGlobalVar.gl_EnegManPage.showGpControlButton(false);
                        }
                        else
                        {
                            EcoGlobalVar.gl_EnegManPage.showGpControlButton(true);
                        }
                    }
                    if (EcoGlobalVar.gl_DashBoardUserCtrl != null)
                    {
                        EcoGlobalVar.gl_DashBoardUserCtrl.FreshFlg_DashBoard = 1;
                        EcoGlobalVar.gl_DashBoardUserCtrl.resetTimer();
                    }
                    if (EcoGlobalVar.gl_DataGpOPAll != null && EcoGlobalVar.gl_DataGpOPAll.GroupTreeOpFlg != 64)
                    {
                        EcoGlobalVar.gl_DataGpOPAll.GroupTreeOpFlg = 64;
                    }
                }
                if ((infoType & 8192) != 0)
                {
                    try
                    {
                        string text2 = (string)info;
                        string text3 = (string)carried;
                        if (text2.Equals("RestartListener", System.StringComparison.InvariantCultureIgnoreCase))
                        {
                            string[] array = text3.Split(new char[]
                            {
                                ','
                            });
                            if (array.Length >= 2)
                            {
                                array[0].Trim();
                                array[1].Trim();
                                ClientAPI.StopBroadcastChannel();
                                EcoGlobalVar.stopalltimer(true);
                                if (!EcoGlobalVar.isinExit)
                                {
                                    EcoGlobalVar.isinExit = true;
                                    ControlAccess.ConfigControl config = delegate(Control control, object obj)
                                    {
                                        TopMostMessageBox.Show(EcoLanguage.getMsginThread("ThreadPopMsgneedRelogin", new string[0]), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                                    };
                                    ControlAccess controlAccess = new ControlAccess(EcoGlobalVar.gl_mainForm, config);
                                    controlAccess.Access(EcoGlobalVar.gl_mainForm, null);
                                    Program.ExitApp();
                                }
                            }
                        }
                    }
                    catch (System.Exception)
                    {
                    }
                }
                if (text.Length != 0)
                {
                    num = System.Convert.ToInt32(text);
                }
            }
            catch (System.Exception)
            {
            }
            if ((infoType & 4) != 0)
            {
                EcoGlobalVar.DCLayoutType = ClientAPI.getRackLayout();
            }
            if ((num & 32) != 0 || (infoType & 32) != 0)
            {
                System.Collections.Generic.Dictionary <string, string> sysValuePairs = ClientAPI.getSysValuePairs();
                if (sysValuePairs.ContainsKey("TempUnit"))
                {
                    EcoGlobalVar.TempUnit = CultureTransfer.ToInt32(sysValuePairs["TempUnit"]);
                }
                if (sysValuePairs.ContainsKey("CurCurrency"))
                {
                    EcoGlobalVar.CurCurrency = sysValuePairs["CurCurrency"];
                }
                if (sysValuePairs.ContainsKey("co2kg"))
                {
                    EcoGlobalVar.co2kg = CultureTransfer.ToSingle(sysValuePairs["co2kg"]);
                }
                if (sysValuePairs.ContainsKey("ENABLE_POWER_OP"))
                {
                    EcoGlobalVar.flgEnablePower = AppData.getDB_flgEnablePower();
                }
                if (sysValuePairs.ContainsKey("RackFullNameFlag"))
                {
                    EcoGlobalVar.RackFullNameFlag = CultureTransfer.ToInt32(sysValuePairs["RackFullNameFlag"]);
                }
                EcoGlobalVar.gl_maxZoneNum = CultureTransfer.ToInt32(ClientAPI.getKeyValue("MaxZoneNum"));
                EcoGlobalVar.gl_maxRackNum = CultureTransfer.ToInt32(ClientAPI.getKeyValue("MaxRackNum"));
                EcoGlobalVar.gl_maxDevNum  = CultureTransfer.ToInt32(ClientAPI.getKeyValue("MaxDevNum"));
                EcoGlobalVar.gl_supportISG = (CultureTransfer.ToInt32(ClientAPI.getKeyValue("SupportISG")) > 0);
                EcoGlobalVar.gl_supportBP  = (CultureTransfer.ToInt32(ClientAPI.getKeyValue("SupportBP")) > 0);
            }
            if ((num & 64) != 0 && EcoGlobalVar.gl_LoginUser != null && EcoGlobalVar.gl_LoginUser.UserType != 1 && EcoGlobalVar.gl_DataGpOPAll != null && EcoGlobalVar.gl_DataGpOPAll.GroupTreeOpFlg != 64)
            {
                EcoGlobalVar.gl_DataGpOPAll.GroupTreeOpFlg = 64;
            }
            if ((num & 128) != 0 && EcoGlobalVar.ECOAppRunMode == 2)
            {
                ClientAPI.StopBroadcastChannel();
                EcoGlobalVar.stopalltimer(true);
                if (!EcoGlobalVar.isinExit)
                {
                    EcoGlobalVar.isinExit = true;
                    ControlAccess.ConfigControl config2 = delegate(Control control, object obj)
                    {
                        TopMostMessageBox.Show(EcoLanguage.getMsginThread("ThreadPopMsgneedRelogin", new string[0]), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    };
                    ControlAccess controlAccess2 = new ControlAccess(EcoGlobalVar.gl_mainForm, config2);
                    controlAccess2.Access(EcoGlobalVar.gl_mainForm, null);
                    Program.ExitApp();
                }
            }
            if ((num & 1) != 0)
            {
                if (EcoGlobalVar.gl_DashBoardCtrl != null)
                {
                    EcoGlobalVar.gl_DashBoardCtrl.FreshFlg_DashBoard = 1;
                    EcoGlobalVar.gl_DashBoardCtrl.resetTimer();
                }
                if (EcoGlobalVar.gl_DashBoardUserCtrl != null)
                {
                    EcoGlobalVar.gl_DashBoardUserCtrl.FreshFlg_DashBoard = 1;
                    EcoGlobalVar.gl_DashBoardUserCtrl.resetTimer();
                }
                if (EcoGlobalVar.gl_monitorCtrl != null)
                {
                    EcoGlobalVar.gl_monitorCtrl.FreshFlg_DashBoard = 1;
                    EcoGlobalVar.gl_monitorCtrl.resetTimer();
                }
            }
            if ((num & 2) != 0 || (infoType & 2) != 0)
            {
                if (EcoGlobalVar.gl_DashBoardCtrl != null && EcoGlobalVar.gl_DashBoardCtrl.FreshFlg_DashBoard != 1)
                {
                    EcoGlobalVar.gl_DashBoardCtrl.FreshFlg_DashBoard = 2;
                }
                if (EcoGlobalVar.gl_DashBoardUserCtrl != null && EcoGlobalVar.gl_DashBoardUserCtrl.FreshFlg_DashBoard != 1)
                {
                    EcoGlobalVar.gl_DashBoardUserCtrl.FreshFlg_DashBoard = 2;
                }
                if (EcoGlobalVar.gl_monitorCtrl != null && EcoGlobalVar.gl_monitorCtrl.FreshFlg_DashBoard != 1)
                {
                    EcoGlobalVar.gl_monitorCtrl.FreshFlg_DashBoard = 2;
                }
            }
        }