Exemplo n.º 1
0
 private void initPage(object obj)
 {
     try
     {
         System.Threading.Thread.Sleep(500);
         System.TimeSpan timeout = System.TimeSpan.FromMilliseconds(30000.0);
         try
         {
             ServiceController serviceController = new ServiceController(EcoGlobalVar.gl_ServiceName);
             serviceController.Start();
             serviceController.WaitForStatus(ServiceControllerStatus.Running, timeout);
         }
         catch (System.Exception)
         {
             EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.srvFail, new string[0]));
         }
         ControlAccess.ConfigControl config = delegate(Control control, object param)
         {
             this.enableclose = 1;
             base.Close();
         };
         ControlAccess controlAccess = new ControlAccess(this, config);
         controlAccess.Access(this, null);
     }
     catch (System.Exception)
     {
     }
 }
Exemplo n.º 2
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();
     }
 }
Exemplo n.º 3
0
        private void setbar(int v)
        {
            ControlAccess.ConfigControl config = delegate(Control control, object param)
            {
                this.progressBar1.Value = v;
            };
            ControlAccess controlAccess = new ControlAccess(this, config);

            controlAccess.Access(this, null);
        }
Exemplo n.º 4
0
        private void setbarString(string str)
        {
            ControlAccess.ConfigControl config = delegate(Control control, object param)
            {
                this.lbMsg.Text = str;
            };
            ControlAccess controlAccess = new ControlAccess(this, config);

            controlAccess.Access(this, null);
        }
Exemplo n.º 5
0
        private void showbar()
        {
            ControlAccess.ConfigControl config = delegate(Control control, object param)
            {
                this.m_pbVal++;
                if (this.m_pbVal >= 100)
                {
                    this.m_pbVal = 1;
                }
                this.progressBar1.Value = this.m_pbVal;
            };
            ControlAccess controlAccess = new ControlAccess(this, config);

            controlAccess.Access(this, null);
        }
Exemplo n.º 6
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();
     }
 }
Exemplo n.º 7
0
        private void ThreadFwUpgrade(object obj)
        {
            this.m_isUpgradeFlg = 1;
            Program.IdleTimer_Pause(1);
            System.Collections.Generic.List <FirmwareUpgrade> list = obj as System.Collections.Generic.List <FirmwareUpgrade>;
            for (int i = 0; i < list.Count; i++)
            {
                FirmwareUpgrade firmwareUpgrade = list[i];
                firmwareUpgrade.Upgrade(new FirmwareUpgrade.Upgrading(this.Upgrade));
            }
            ControlAccess.ConfigControl config = delegate(Control control, object param)
            {
                this.cbMainFw.Enabled  = true;
                this.butBrowse.Enabled = true;
                this.butSearch.Enabled = true;
                this.butUpdate.Enabled = true;
                this.cbsel.Enabled     = true;
                for (int j = 0; j < this.dgvFwDevice.Rows.Count; j++)
                {
                    DataGridViewRow dataGridViewRow = this.dgvFwDevice.Rows[j];
                    int             num             = System.Convert.ToInt32(dataGridViewRow.Cells["dgvtdevID"].Value.ToString());
                    string          text            = dataGridViewRow.Cells[4].Value.ToString();
                    foreach (string[] current in this.m_allRows)
                    {
                        int num2 = System.Convert.ToInt32(current[6]);
                        if (num == num2)
                        {
                            current[4] = text;
                            current[5] = dataGridViewRow.Cells[5].Value.ToString();
                            break;
                        }
                    }
                    DataGridViewDisableCheckBoxCell dataGridViewDisableCheckBoxCell = dataGridViewRow.Cells[0] as DataGridViewDisableCheckBoxCell;
                    dataGridViewDisableCheckBoxCell.Enabled  = true;
                    dataGridViewDisableCheckBoxCell.ReadOnly = false;
                }
                this.dgvFwDevice.Update();
                this.dgvFwDevice.Focus();
            };
            ControlAccess controlAccess = new ControlAccess(this, config);

            controlAccess.Access(this.dgvFwDevice, null);
            Program.IdleTimer_Run(1);
            this.m_isUpgradeFlg = 2;
        }
Exemplo n.º 8
0
 public void Access(Control control, object obj)
 {
     if (!control.InvokeRequired)
     {
         this.config(control, obj);
         return;
     }
     if (this.form == null)
     {
         return;
     }
     ControlAccess.ConfigControl method = new ControlAccess.ConfigControl(this.Access);
     this.form.Invoke(method, new object[]
     {
         control,
         obj
     });
 }
Exemplo n.º 9
0
        private void addDeviceProc(object obj)
        {
            ControlAccess.ConfigControl config = delegate(Control control, object param)
            {
                PictureBox pictureBox = control as PictureBox;
                pictureBox.Show();
            };
            ControlAccess controlAccess = new ControlAccess(this, config);

            controlAccess.Access(this.pictureBoxLoading, null);
            System.Collections.Generic.List <System.Collections.Hashtable> list = obj as System.Collections.Generic.List <System.Collections.Hashtable>;
            this.otherDevSave(list);
            config = delegate(Control control, object param)
            {
                OtherDeviceAddDevDlg otherDeviceAddDevDlg = control as OtherDeviceAddDevDlg;
                otherDeviceAddDevDlg.butCancel.Enabled = true;
                otherDeviceAddDevDlg.DialogResult      = DialogResult.OK;
                otherDeviceAddDevDlg.Close();
            };
            controlAccess = new ControlAccess(this, config);
            controlAccess.Access(this, null);
        }
Exemplo n.º 10
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;
                }
            }
        }
Exemplo n.º 11
0
 public ControlAccess(ContainerControl form, ControlAccess.ConfigControl config)
 {
     this.form   = form;
     this.config = config;
 }
Exemplo n.º 12
0
        private void startThread(object obj)
        {
            try
            {
                switch (EcoLanguage.getLang())
                {
                case 0:
                    System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("en");
                    break;

                case 1:
                    System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("de");
                    break;

                case 2:
                    System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("es");
                    break;

                case 3:
                    System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("fr");
                    break;

                case 4:
                    System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("it");
                    break;

                case 5:
                    System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("ja");
                    break;

                case 6:
                    System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("ko");
                    break;

                case 7:
                    System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("pt");
                    break;

                case 8:
                    System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("ru");
                    break;

                case 9:
                    System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("zh-CHS");
                    break;

                case 10:
                    System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("zh-CHT");
                    break;

                default:
                    System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("en");
                    break;
                }
                System.Threading.Thread.Sleep(50);
                if (this.theProcess != null)
                {
                    this.m_retv = this.theProcess(this.m_param);
                }
                if (this.setbarTimer != null)
                {
                    try
                    {
                        this.setbarTimer.Stop();
                        this.setbarTimer.Dispose();
                    }
                    catch
                    {
                    }
                }
                this.setbar(100);
                if (this.m_opt == 0)
                {
                    ControlAccess.ConfigControl config = delegate(Control control, object param)
                    {
                        progressPopup progressPopup = control as progressPopup;
                        progressPopup.Close();
                    };
                    ControlAccess controlAccess = new ControlAccess(this, config);
                    controlAccess.Access(this, null);
                }
            }
            catch (System.Exception)
            {
                this.m_retv = null;
                ControlAccess.ConfigControl config2 = delegate(Control control, object param)
                {
                    progressPopup progressPopup = control as progressPopup;
                    progressPopup.Close();
                };
                ControlAccess controlAccess2 = new ControlAccess(this, config2);
                controlAccess2.Access(this, null);
            }
        }
Exemplo n.º 13
0
        private void Upgrade(UpgradeStatus us, int devID, string parameter)
        {
            string status = "";

            if (us == UpgradeStatus.UpgradeFailed)
            {
                ControlAccess.ConfigControl config = delegate(Control control, object param)
                {
                    DataGridView grid   = control as DataGridView;
                    string       value  = param as string;
                    int          devID2 = System.Convert.ToInt32(value);
                    status = EcoLanguage.getMsg(LangRes.FrwUpgradeST_upgradefail, new string[0]);
                    this.changeUpgradeStatus(grid, devID2, status);
                };
                ControlAccess controlAccess = new ControlAccess(this, config);
                controlAccess.Access(this.dgvFwDevice, devID.ToString());
                return;
            }
            if (us == UpgradeStatus.UpgradeSucceed)
            {
                ControlAccess.ConfigControl config2 = delegate(Control control, object param)
                {
                    DataGridView grid  = control as DataGridView;
                    string       value = param as string;
                    int          num   = System.Convert.ToInt32(value);
                    status = EcoLanguage.getMsg(LangRes.FrwUpgradeST_upgradesucc, new string[0]);
                    string parameter2 = parameter;
                    this.changeUpgradeStatus(grid, num, status, parameter2);
                    DeviceInfo deviceByID = DeviceOperation.getDeviceByID(num);
                    deviceByID.FWVersion = parameter2;
                    deviceByID.Update();
                };
                ControlAccess controlAccess2 = new ControlAccess(this, config2);
                controlAccess2.Access(this.dgvFwDevice, devID.ToString());
                return;
            }
            if (us == UpgradeStatus.ServerUnconnected)
            {
                ControlAccess.ConfigControl config3 = delegate(Control control, object param)
                {
                    DataGridView grid   = control as DataGridView;
                    string       value  = param as string;
                    int          devID2 = System.Convert.ToInt32(value);
                    status = EcoLanguage.getMsg(LangRes.FrwUpgradeST_serverunconnected, new string[0]);
                    this.changeUpgradeStatus(grid, devID2, status);
                };
                ControlAccess controlAccess3 = new ControlAccess(this, config3);
                controlAccess3.Access(this.dgvFwDevice, devID.ToString());
                return;
            }
            if (us == UpgradeStatus.Uploading)
            {
                ControlAccess.ConfigControl config4 = delegate(Control control, object param)
                {
                    DataGridView grid   = control as DataGridView;
                    string       value  = param as string;
                    int          devID2 = System.Convert.ToInt32(value);
                    status = EcoLanguage.getMsg(LangRes.FrwUpgradeST_uploading, new string[0]) + " " + parameter;
                    this.changeUpgradeStatus(grid, devID2, status);
                };
                ControlAccess controlAccess4 = new ControlAccess(this, config4);
                controlAccess4.Access(this.dgvFwDevice, devID.ToString());
                return;
            }
            if (us == UpgradeStatus.Upgrading)
            {
                ControlAccess.ConfigControl config5 = delegate(Control control, object param)
                {
                    DataGridView grid   = control as DataGridView;
                    string       value  = param as string;
                    int          devID2 = System.Convert.ToInt32(value);
                    status = EcoLanguage.getMsg(LangRes.FrwUpgradeST_upgrading, new string[0]) + " " + parameter;
                    this.changeUpgradeStatus(grid, devID2, status);
                };
                ControlAccess controlAccess5 = new ControlAccess(this, config5);
                controlAccess5.Access(this.dgvFwDevice, devID.ToString());
                return;
            }
            if (us == UpgradeStatus.WrongFile)
            {
                ControlAccess.ConfigControl config6 = delegate(Control control, object param)
                {
                    DataGridView grid   = control as DataGridView;
                    string       value  = param as string;
                    int          devID2 = System.Convert.ToInt32(value);
                    status = EcoLanguage.getMsg(LangRes.FrwUpgradeST_wrongfile, new string[0]);
                    this.changeUpgradeStatus(grid, devID2, status);
                };
                ControlAccess controlAccess6 = new ControlAccess(this, config6);
                controlAccess6.Access(this.dgvFwDevice, devID.ToString());
                return;
            }
            if (us == UpgradeStatus.NoNeedToUpgrade)
            {
                ControlAccess.ConfigControl config7 = delegate(Control control, object param)
                {
                    DataGridView grid   = control as DataGridView;
                    string       value  = param as string;
                    int          devID2 = System.Convert.ToInt32(value);
                    status = EcoLanguage.getMsg(LangRes.FrwUpgradeST_noneedupgrade, new string[0]);
                    this.changeUpgradeStatus(grid, devID2, status);
                };
                ControlAccess controlAccess7 = new ControlAccess(this, config7);
                controlAccess7.Access(this.dgvFwDevice, devID.ToString());
                return;
            }
            if (us == UpgradeStatus.ServerBusy)
            {
                ControlAccess.ConfigControl config8 = delegate(Control control, object param)
                {
                    DataGridView grid   = control as DataGridView;
                    string       value  = param as string;
                    int          devID2 = System.Convert.ToInt32(value);
                    status = EcoLanguage.getMsg(LangRes.FrwUpgradeST_serverbusy, new string[0]);
                    this.changeUpgradeStatus(grid, devID2, status);
                };
                ControlAccess controlAccess8 = new ControlAccess(this, config8);
                controlAccess8.Access(this.dgvFwDevice, devID.ToString());
                return;
            }
            if (us == UpgradeStatus.Starting)
            {
                ControlAccess.ConfigControl config9 = delegate(Control control, object param)
                {
                    DataGridView grid   = control as DataGridView;
                    string       value  = param as string;
                    int          devID2 = System.Convert.ToInt32(value);
                    status = EcoLanguage.getMsg(LangRes.FrwUpgradeST_starting, new string[0]);
                    this.changeUpgradeStatus(grid, devID2, status);
                };
                ControlAccess controlAccess9 = new ControlAccess(this, config9);
                controlAccess9.Access(this.dgvFwDevice, devID.ToString());
            }
        }
Exemplo n.º 14
0
        private void filteronlinedev()
        {
            this.dgvFwDevice.Rows.Clear();
            this.cbsel.Checked = true;
            string text  = null;
            string strB  = null;
            string text2 = null;
            string text3 = "";
            string text4 = "";

            if (this.tbFileNm.Text.Length > 0)
            {
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(this.tbFileNm.Text);
                text  = fileInfo.Name.ToUpper();
                text2 = fileInfo.Extension;
                if (text2 != null)
                {
                    text2 = text2.ToUpper();
                }
                strB = this.getDevFWflg(this.tbFileNm.Text, ref text3, ref text4);
            }
            DevAccessCfg instance = DevAccessCfg.GetInstance();

            if (text4.Length == 0)
            {
                using (System.Collections.Generic.List <string[]> .Enumerator enumerator = this.m_allRows.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        string[] current = enumerator.Current;
                        string   text5   = current[6];
                        string   text6   = current[7];
                        string   text7   = current[4];
                        if (text != null)
                        {
                            DevModelConfig deviceModelConfig = instance.getDeviceModelConfig(current[3], text7);
                            if (deviceModelConfig.FWvalidate != 0)
                            {
                                if ((deviceModelConfig.FWnms.Length > 0 && !text.StartsWith(deviceModelConfig.FWnms)) || (deviceModelConfig.FWext.Length > 0 && (text2 == null || !text2.Equals(deviceModelConfig.FWext))))
                                {
                                    continue;
                                }
                                switch (deviceModelConfig.FWvalidate)
                                {
                                case 1:
                                    if (!text3.Equals("ATEN") || (this.cbMainFw.Checked && text7.CompareTo(strB) >= 0))
                                    {
                                        continue;
                                    }
                                    break;
                                }
                            }
                        }
                        string[] obj = new string[]
                        {
                            "1",
                            current[1],
                            current[2],
                            current[3],
                            text7,
                            current[5],
                            text5,
                            text6
                        };
                        ControlAccess.ConfigControl config = delegate(Control control, object param)
                        {
                            DataGridView dataGridView = control as DataGridView;
                            string[]     array2       = param as string[];
                            dataGridView.Rows.Add(new object[]
                            {
                                true,
                                array2[1],
                                array2[2],
                                array2[3],
                                array2[4],
                                array2[5],
                                array2[6],
                                array2[7]
                            });
                        };
                        ControlAccess controlAccess = new ControlAccess(this, config);
                        controlAccess.Access(this.dgvFwDevice, obj);
                    }
                    goto IL_37E;
                }
            }
            string[] array = text4.Split(new char[]
            {
                '/'
            });
            foreach (string[] current2 in this.m_allRows)
            {
                string text5 = current2[6];
                string text6 = current2[7];
                string text7 = current2[4];
                if (text != null)
                {
                    bool flag = false;
                    for (int i = 0; i < array.Length; i++)
                    {
                        string text8 = array[i];
                        int    num   = text8.IndexOf("*");
                        if (num >= 0)
                        {
                            text8 = text8.Substring(0, num);
                            if (current2[3].IndexOf(text8) >= 0)
                            {
                                flag = true;
                                break;
                            }
                        }
                        else
                        {
                            if (current2[3].Equals(array[i]))
                            {
                                flag = true;
                                break;
                            }
                        }
                    }
                    if (!flag || (this.cbMainFw.Checked && text7.CompareTo(strB) >= 0))
                    {
                        continue;
                    }
                }
                string[] obj2 = new string[]
                {
                    "1",
                    current2[1],
                    current2[2],
                    current2[3],
                    text7,
                    current2[5],
                    text5,
                    text6
                };
                ControlAccess.ConfigControl config2 = delegate(Control control, object param)
                {
                    DataGridView dataGridView = control as DataGridView;
                    string[]     array2       = param as string[];
                    dataGridView.Rows.Add(new object[]
                    {
                        true,
                        array2[1],
                        array2[2],
                        array2[3],
                        array2[4],
                        array2[5],
                        array2[6],
                        array2[7]
                    });
                };
                ControlAccess controlAccess2 = new ControlAccess(this, config2);
                controlAccess2.Access(this.dgvFwDevice, obj2);
            }
            IL_37E :
            ControlAccess.ConfigControl config3 = delegate(Control control, object param)
            {
                this.cbMainFw.Enabled  = true;
                this.butBrowse.Enabled = true;
                this.butUpdate.Enabled = true;
                this.cbsel.Enabled     = true;
            };
            ControlAccess controlAccess3 = new ControlAccess(this, config3);

            controlAccess3.Access(this.dgvFwDevice, null);
        }
Exemplo n.º 15
0
        private object initFWDevProc(object aaa)
        {
            System.Collections.Generic.List <DeviceInfo> allDevice = DeviceOperation.GetAllDevice();
            DevAccessCfg.GetInstance();
            foreach (DeviceInfo current in allDevice)
            {
                if (ClientAPI.IsDeviceOnline(current.DeviceID))
                {
                    string         text              = current.DeviceID.ToString();
                    string         modelNm           = current.ModelNm;
                    DevModelConfig deviceModelConfig = DevAccessCfg.GetInstance().getDeviceModelConfig(modelNm, current.FWVersion);
                    if (deviceModelConfig.commonThresholdFlag != Constant.EatonPDU_M2 && deviceModelConfig.commonThresholdFlag != Constant.EatonPDUThreshold && deviceModelConfig.commonThresholdFlag != Constant.APC_PDU)
                    {
                        DevSnmpConfig  sNMPpara       = commUtil.getSNMPpara(current);
                        string         mac            = current.Mac;
                        DevAccessAPI   devAccessAPI   = new DevAccessAPI(sNMPpara);
                        DevServiceInfo devServiceInfo = devAccessAPI.GetDevServiceInfo(mac);
                        int            httpPort       = devServiceInfo.httpPort;
                        if (httpPort != 0)
                        {
                            string[] obj = new string[]
                            {
                                "1",
                                current.DeviceName,
                                current.DeviceIP,
                                current.ModelNm,
                                devServiceInfo.fwVersion,
                                "",
                                text,
                                httpPort.ToString()
                            };
                            ControlAccess.ConfigControl config = delegate(Control control, object param)
                            {
                                DataGridView dataGridView = control as DataGridView;
                                string[]     array        = param as string[];
                                dataGridView.Rows.Add(new object[]
                                {
                                    true,
                                    array[1],
                                    array[2],
                                    array[3],
                                    array[4],
                                    array[5],
                                    array[6],
                                    array[7]
                                });
                                this.m_allRows.Add(array);
                            };
                            ControlAccess controlAccess = new ControlAccess(this, config);
                            controlAccess.Access(this.dgvFwDevice, obj);
                        }
                    }
                }
            }
            ControlAccess.ConfigControl config2 = delegate(Control control, object param)
            {
                this.cbMainFw.Enabled  = true;
                this.butBrowse.Enabled = true;
                this.butUpdate.Enabled = true;
                this.cbsel.Enabled     = true;
            };
            ControlAccess controlAccess2 = new ControlAccess(this, config2);

            controlAccess2.Access(this.dgvFwDevice, null);
            return(0);
        }
Exemplo n.º 16
0
        private void startDBchange()
        {
            try
            {
                System.Threading.Thread.Sleep(500);
                EcoGlobalVar.ECOAppRunStatus = 2;
                Program.StopService(EcoGlobalVar.gl_ServiceName, 30000);
                System.Threading.Thread.Sleep(500);
                if (DBUrl.DB_CURRENT_TYPE.ToUpper().Equals("MYSQL") && this.m_usemysql)
                {
                    this.m_retv = DBUrl.updatesetting(this.m_port, this.m_usrnm, this.m_psw);
                }
                else
                {
                    this.m_retv = this.updatesetting(this.m_usemysql, this.m_dbIP, this.m_port, this.m_usrnm, this.m_psw);
                }
                string valuePair = ValuePairs.getValuePair("Username");
                if (!string.IsNullOrEmpty(valuePair))
                {
                    LogAPI.writeEventLog("0130020", new string[]
                    {
                        valuePair
                    });
                }
                else
                {
                    LogAPI.writeEventLog("0130020", new string[0]);
                }
                InterProcessShared <System.Collections.Generic.Dictionary <string, string> > .setInterProcessKeyValue("ServiceStDBMaintain", "DBMaintainFinish");

                if (!this.b_cancel)
                {
                    Program.StartService(null);
                }
                ControlAccess.ConfigControl config = delegate(Control control, object param)
                {
                    if (!this.b_cancel)
                    {
                        if (this.m_retv != DebugCenter.ST_Success)
                        {
                            EcoMessageBox.ShowError(this, EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
                        }
                        else
                        {
                            EcoMessageBox.ShowInfo(this, EcoLanguage.getMsg(LangRes.OPsucc, new string[0]));
                        }
                        this.m_normalclose = 2;
                    }
                    base.Close();
                };
                ControlAccess controlAccess = new ControlAccess(this, config);
                controlAccess.Access(this, null);
            }
            catch (System.Exception)
            {
                if (this.m_normalclose == 1)
                {
                    ControlAccess.ConfigControl config2 = delegate(Control control, object param)
                    {
                        EcoMessageBox.ShowError(this, EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
                        this.m_normalclose = 2;
                        base.Close();
                    };
                    ControlAccess controlAccess2 = new ControlAccess(this, config2);
                    controlAccess2.Access(this, null);
                }
            }
        }
Exemplo n.º 17
0
        private int updatesetting(bool b_mysqlenable, string str_dbip, int i_port, string str_usr, string str_pwd)
        {
            this.setbar(1);
            string arg_11_0 = System.AppDomain.CurrentDomain.BaseDirectory;

            if (!b_mysqlenable)
            {
                this.setbar(1);
                AccessDBUpdate.showOnDBChg = new AccessDBUpdate.Delegateshowbar(this.setbar2);
                if (this.m_opt == 2)
                {
                    ControlAccess.ConfigControl config = delegate(Control control, object param)
                    {
                        dbchangeDlg dbchangeDlg = control as dbchangeDlg;
                        dbchangeDlg.butCancel.Enabled = true;
                    };
                    ControlAccess controlAccess = new ControlAccess(this, config);
                    controlAccess.Access(this, null);
                    this.b_timer_start = true;
                    AccessDBUpdate.InitAccessDataDB();
                    ExpiryCheck.SyncExpiredDate();
                    DebugCenter.GetInstance().appendToFile("DBChange History MySQL->Access start...");
                    System.DateTime now      = System.DateTime.Now;
                    int             num      = AccessDBUpdate.ExportDataDB2Access();
                    System.DateTime now2     = System.DateTime.Now;
                    System.TimeSpan timeSpan = now2 - now;
                    DebugCenter.GetInstance().appendToFile("DBChange History MySQL->Access spend:" + timeSpan.TotalMilliseconds);
                    this.b_timer_start = false;
                    try
                    {
                        this.setbarTimer.Stop();
                        this.setbarTimer.Dispose();
                    }
                    catch
                    {
                    }
                    config = delegate(Control control, object param)
                    {
                        dbchangeDlg dbchangeDlg = control as dbchangeDlg;
                        dbchangeDlg.butCancel.Enabled = false;
                    };
                    controlAccess = new ControlAccess(this, config);
                    controlAccess.Access(this, null);
                    if (num < 0)
                    {
                        return(-4);
                    }
                }
                else
                {
                    AccessDBUpdate.InitAccessDataDB();
                    if (DBUrl.DB_CURRENT_TYPE.ToUpper().Equals("MYSQL"))
                    {
                        DBTools.DropMySQLDatabase(DBUrl.DB_CURRENT_NAME, DBUrl.CURRENT_HOST_PATH, DBUrl.CURRENT_PORT, DBUrl.CURRENT_USER_NAME, DBUrl.CURRENT_PWD);
                    }
                }
                string       connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + System.AppDomain.CurrentDomain.BaseDirectory + "sysdb.mdb;Jet OLEDB:Database Password=^tenec0Sensor";
                OleDbCommand oleDbCommand     = new OleDbCommand();
                using (OleDbConnection oleDbConnection = new OleDbConnection(connectionString))
                {
                    try
                    {
                        oleDbConnection.Open();
                        oleDbCommand.Connection  = oleDbConnection;
                        oleDbCommand.CommandType = CommandType.Text;
                        oleDbCommand.CommandText = "update dbsource set db_type='ACCESS',db_name='datadb',host_path='datadb.mdb',port= 0,user_name = 'root',pwd='root' where active_flag = 2 ";
                        int num2 = oleDbCommand.ExecuteNonQuery();
                        if (num2 < 0)
                        {
                            int result = -5;
                            return(result);
                        }
                    }
                    catch (System.Exception)
                    {
                        int result = -5;
                        return(result);
                    }
                    finally
                    {
                        oleDbCommand.Dispose();
                    }
                }
                DBUrl.initconfig();
                this.setbar(100);
                return(DebugCenter.ST_Success);
            }
            int num3 = DBTools.InitMySQLDatabase("127.0.0.1", i_port, str_usr, str_pwd);

            if (num3 < 0)
            {
                return(-2);
            }
            if (this.m_opt == 2)
            {
                ControlAccess.ConfigControl config2 = delegate(Control control, object param)
                {
                    dbchangeDlg dbchangeDlg = control as dbchangeDlg;
                    dbchangeDlg.butCancel.Enabled = true;
                };
                ControlAccess controlAccess2 = new ControlAccess(this, config2);
                controlAccess2.Access(this, null);
                this.b_timer_start = true;
                ExpiryCheck.SyncExpiredDate();
                DebugCenter.GetInstance().appendToFile("DBChange History Access->MySQL start...");
                System.DateTime now3      = System.DateTime.Now;
                int             num4      = AccessDBUpdate.ExportDataDB2MySQL("eco", "127.0.0.1", i_port, str_usr, str_pwd);
                System.DateTime now4      = System.DateTime.Now;
                System.TimeSpan timeSpan2 = now4 - now3;
                DebugCenter.GetInstance().appendToFile("DBChange History Access->MySQL spend:" + timeSpan2.TotalMilliseconds);
                this.b_timer_start = false;
                try
                {
                    this.setbarTimer.Stop();
                    this.setbarTimer.Dispose();
                }
                catch
                {
                }
                config2 = delegate(Control control, object param)
                {
                    dbchangeDlg dbchangeDlg = control as dbchangeDlg;
                    dbchangeDlg.butCancel.Enabled = false;
                };
                controlAccess2 = new ControlAccess(this, config2);
                controlAccess2.Access(this, null);
                if (num4 < 0)
                {
                    return(-4);
                }
            }
            string       connectionString2 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + System.AppDomain.CurrentDomain.BaseDirectory + "sysdb.mdb;Jet OLEDB:Database Password=^tenec0Sensor";
            OleDbCommand oleDbCommand2     = new OleDbCommand();

            using (OleDbConnection oleDbConnection2 = new OleDbConnection(connectionString2))
            {
                try
                {
                    oleDbConnection2.Open();
                    oleDbCommand2.Connection  = oleDbConnection2;
                    oleDbCommand2.CommandType = CommandType.Text;
                    oleDbCommand2.CommandText = string.Concat(new object[]
                    {
                        "update dbsource set db_type='MYSQL',db_name='eco',host_path='127.0.0.1',port= ",
                        i_port,
                        ",user_name = '",
                        str_usr,
                        "',pwd='",
                        str_pwd,
                        "' where active_flag = 2 "
                    });
                    int num5 = oleDbCommand2.ExecuteNonQuery();
                    if (num5 < 0)
                    {
                        int result = -5;
                        return(result);
                    }
                }
                catch (System.Exception)
                {
                    int result = -5;
                    return(result);
                }
                finally
                {
                    oleDbCommand2.Dispose();
                }
            }
            DBUrl.initconfig();
            this.setbar(100);
            return(DebugCenter.ST_Success);
        }
Exemplo n.º 18
0
        private static void showpro(bool showinTaskBar)
        {
            switch (EcoLanguage.getLang())
            {
            case 0:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("en");
                break;

            case 1:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("de");
                break;

            case 2:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("es");
                break;

            case 3:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("fr");
                break;

            case 4:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("it");
                break;

            case 5:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("ja");
                break;

            case 6:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("ko");
                break;

            case 7:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("pt");
                break;

            case 8:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("ru");
                break;

            case 9:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("zh-CHS");
                break;

            case 10:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("zh-CHT");
                break;

            default:
                System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("en");
                break;
            }
            progressPopup dlg = new progressPopup("eco Sensors", 1, EcoLanguage.getMsg(LangRes.PopProgressMsg_loading, new string[0]), Resources.login_background, new progressPopup.ProcessInThread(EcoGlobalVar.waitstopshowPro), null, 0);

            dlg.StartPosition = FormStartPosition.CenterScreen;
            if (showinTaskBar)
            {
                Form form = new Form();
                form.Size          = new Size(1, 1);
                form.StartPosition = FormStartPosition.Manual;
                Rectangle virtualScreen = SystemInformation.VirtualScreen;
                form.Location = new Point(virtualScreen.Bottom + 10, virtualScreen.Right + 10);
                form.Icon     = Resources.altusen_32x32;


                form.Show();
                form.Focus();
                form.BringToFront();
                form.TopMost = true;
                dlg.Owner    = form;
            }
            ControlAccess.ConfigControl config = delegate(Control control, object obj)
            {
                dlg.ShowDialog();
            };
            ControlAccess controlAccess = new ControlAccess(dlg, config);

            controlAccess.Access(dlg, null);
        }