示例#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();
     }
 }
示例#2
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)
     {
     }
 }
示例#3
0
 public Hyperlink(string GuiMap, string LogicalName, ControlAccess ControlAccess)
     : base(GuiMap, LogicalName)
 {
     myControlAccess = ControlAccess;
     myControlAccess.IntitializeControl<TestStack.White.UIItems.Hyperlink>(GuimapPath, LogicalName);
     Control = myControlAccess.UIControl;
 }
示例#4
0
 public DateTimePicker(string GuiMap, string LogicalName, ControlAccess ControlAccess)
     : base(GuiMap, LogicalName)
 {
     myControlAccess = ControlAccess;
     myControlAccess.IntitializeControl<TestStack.White.UIItems.DateTimePicker>(GuimapPath, LogicalName);
     Control = myControlAccess.UIControl;
 }
示例#5
0
        public void SetDefaultAccess()
        {
            this.DefaultContainerAccess = new ContainerAccess();


            //左边
            string containerName = this.GetType().Name;

            this.DefaultContainerAccess.ContainerName = containerName;
            this.DefaultContainerAccess.ContainerAccessDescription = "命令窗口";

            this.DefaultContainerAccess.ControlAccessList.Clear();
            this.DefaultContainerAccess.AddContainerOperator();
            //点 线 折线, 弧线 圆  蛇形线
            ControlAccess accessCommandEnable = new ControlAccess(containerName, "轨迹命令使能");

            accessCommandEnable.AddAccessTechnician(new List <string>()
            {
                this.btnEditDot.Name, this.btnEditLine.Name, this.btnEditPolyline.Name, this.btnEditArc.Name, this.btnEditCircle.Name, this.btnEditSnakeline.Name, this.btnEditPatternArray.Name, this.btnEditPatternsArray.Name, this.btnEditFinishShot.Name
            });
            this.DefaultContainerAccess.AddControlAccess(accessCommandEnable);
            //metroSetPanel1
            this.DefaultContainerAccess.AddControlAccess(new ControlAccess(containerName, "命令编辑局域", this.metroSetPanel1.Name, AccessEnums.RoleEnums.Operator));
            AccessControlMgr.Instance.AddContainerAccess(this.DefaultContainerAccess);
        }
示例#6
0
 public BaseControl(string GuiMap, string LogicalName, ControlAccess ControlAccess)
     :this(GuiMap,LogicalName)
 {
     myControlAccess = ControlAccess;
     myControlAccess.IntitializeControl<TestStack.White.UIItems.UIItem>(GuimapPath, LogicalName);
     Control = myControlAccess.UIControl;
 }
示例#7
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow item in this.dgvAccess.Rows)
     {
         if (item.Tag is ControlAccess)
         {
             ControlAccess access    = item.Tag as ControlAccess;
             RoleEnums     roleLevel = RoleEnums.Operator;
             if ((bool)item.Cells[1].Value)
             {
                 roleLevel = RoleEnums.Operator;
             }
             else if ((bool)item.Cells[2].Value)
             {
                 roleLevel = RoleEnums.Technician;
             }
             else if ((bool)item.Cells[3].Value)
             {
                 roleLevel = RoleEnums.Supervisor;
             }
             access.RoleLevel = roleLevel;
         }
     }
     MsgCenter.Broadcast(MsgConstants.MODIFY_ACCESS, this, null);
     AccessControlMgr.Instance.Save();
 }
示例#8
0
 public WebControl(Browser aBrowser, Locator aLocator)
 {
     myControlAccess             = new ControlAccess();
     myControlAccess.Browser     = aBrowser;
     myControlAccess.LocatorType = aLocator.LocatorType;
     myControlAccess.Locator     = aLocator.ControlLocator;
     myControlAccess.ControlType = ControlType.Custom;
     myControlAccess.IntializeControlAccess();
     //Control = myControlAccess.GetControl();
 }
示例#9
0
 public WebControl(Browser aBrowser, LocatorType aLocatorType, string aLocator, ControlType aControlType)
 {
     myControlAccess             = new ControlAccess();
     myControlAccess.Browser     = aBrowser;
     myControlAccess.LocatorType = aLocatorType;
     myControlAccess.Locator     = aLocator;
     myControlAccess.ControlType = aControlType;
     myControlAccess.IntializeControlAccess();
     //Control = myControlAccess.GetControl();
 }
示例#10
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);
        }
示例#11
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);
        }
示例#12
0
        public void UpdateExistAccess(ContainerAccess containerExist, ContainerAccess containerAdd)
        {
            if (containerExist == null)
            {
                this.ContainerAccessList.Add(containerAdd);
                return;
            }
            if (this.FindContainerAccessByName(containerExist.ContainerName) == null)
            {
                this.ContainerAccessList.Add(containerAdd);
            }
            else
            {
                if (containerExist.ContainerName == containerAdd.ContainerName)
                {
                    List <ControlAccess> controlAccessList = new List <ControlAccess>();
                    ControlAccess        accessTmp         = null;
                    foreach (ControlAccess item in containerAdd.ControlAccessList)
                    {
                        accessTmp = containerExist.ControlAccessList.Find(p => { return(p.AccessDesrciption == item.AccessDesrciption); });
                        //如果ControlAccess 已经存在
                        if (accessTmp != null)
                        {
                            //默认中有的权限项,accessTmp中可能不存在
                            List <AccessMap> maps = new List <AccessMap>();

                            AccessMap mapTemp = null;
                            //遍历默认的权限AccessMap
                            foreach (AccessMap map in item.Controls)
                            {
                                mapTemp = accessTmp.Controls.Find(p => p.ControlName == map.ControlName);
                                //accessTmp 存在AccessMap
                                if (mapTemp != null)
                                {
                                    maps.Add(mapTemp);
                                }
                                else
                                {
                                    maps.Add(map);
                                }
                            }
                            accessTmp.Controls = maps;
                            controlAccessList.Add(accessTmp);
                        }
                        else//如果不存在
                        {
                            controlAccessList.Add(item);
                        }
                    }
                    containerExist.ControlAccessList = controlAccessList;
                }
            }
        }
示例#13
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);
        }
示例#14
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();
     }
 }
示例#15
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;
        }
示例#16
0
        private void dgvAccess_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex > -1 && e.ColumnIndex > 0)
            {
                ControlAccess access = this.dgvAccess.Rows[e.RowIndex].Tag as ControlAccess;
                //bool value = (bool)this.dgvAccess.Rows[e.RowIndex].Cells
                //[e.ColumnIndex].Value;
                bool value = (bool)this.dgvAccess.Rows[e.RowIndex].Cells
                             [e.ColumnIndex].EditedFormattedValue;

                this.updateRow(e.RowIndex, e.ColumnIndex, value);
                #region
                //if (access.IsContanerAccess())
                //{
                //    //找到窗体权限
                //    int rowStart = e.RowIndex;
                //    int rowEnd = e.RowIndex;
                //    for (int i = rowStart + 1; i < this.dgvAccess.Rows.Count; i++)
                //    {
                //        ControlAccess conAccess = this.dgvAccess.Rows[i].Tag as ControlAccess;
                //        if (conAccess.ContainerName == access.ContainerName)
                //        {
                //            rowEnd = i;
                //        }
                //        else
                //        {
                //            break;
                //        }
                //    }
                //    for (int rowIndex = rowStart; rowIndex <= rowEnd; rowIndex++)
                //    {
                //        this.dgvAccess.Rows[rowIndex].Cells[e.ColumnIndex].Value = value;
                //        this.updateRow(rowIndex, e.ColumnIndex, value);
                //    }

                //}
                //else
                //{
                //    this.updateRow(e.RowIndex, e.ColumnIndex, value);
                //}
                #endregion
            }
        }
示例#17
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);
        }
示例#18
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);
            }
        }
示例#19
0
 internal TabPage(TestStack.White.UIItems.TabItems.TabPage control, ControlAccess ControlAccess)
 {
     Control = control;
     myControlAccess = ControlAccess;
 }
示例#20
0
        private void AddContainerAccess(ContainerAccess containerAccess)
        {
            DataGridViewRow dr = new DataGridViewRow();

            dr.HeaderCell.Value           = containerAccess.ContainerAccessDescription;
            dr.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleLeft;
            ControlAccess           container = containerAccess.GetContainerAccess();
            DataGridViewTextBoxCell txtCell   = new DataGridViewTextBoxCell();

            dr.Cells.Add(txtCell);
            if (container == null)
            {
                MessageBox.Show("缺少窗体控件权限");
                return;
            }
            dr.Tag = container;
            for (int i = 0; i < 3; i++)
            {
                DataGridViewCheckBoxCell ckbCell = new DataGridViewCheckBoxCell();
                dr.Cells.Add(ckbCell);
            }

            if (container == null)
            {
                dr.Cells[1].Value = true;
                dr.Cells[2].Value = true;
                dr.Cells[3].Value = true;
            }
            else
            {
                dr.Cells[1].Value = (RoleEnums.Operator - container.RoleLevel) >= 0 ? true : false;
                dr.Cells[2].Value = (RoleEnums.Technician - container.RoleLevel) >= 0 ? true : false;
                dr.Cells[3].Value = (RoleEnums.Supervisor - container.RoleLevel) >= 0 ? true : false;
            }

            this.dgvAccess.Rows.Add(dr);

            foreach (ControlAccess item in containerAccess.ControlAccessList)
            {
                if (item.AccessDesrciption == containerAccess.ContainerAccessDescription)
                {
                    continue;
                }
                dr = new DataGridViewRow();
                dr.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;
                dr.Tag = item;
                DataGridViewTextBoxCell txtCellChild = new DataGridViewTextBoxCell();
                txtCellChild.Style.Alignment = DataGridViewContentAlignment.MiddleLeft;
                dr.Cells.Add(txtCellChild);
                for (int i = 0; i < 3; i++)
                {
                    DataGridViewCheckBoxCell ckbCell = new DataGridViewCheckBoxCell();
                    dr.Cells.Add(ckbCell);
                }
                dr.Cells[0].Value = item.AccessDesrciption;
                dr.Cells[1].Value = (RoleEnums.Operator - item.RoleLevel) >= 0 ? true : false;
                dr.Cells[2].Value = (RoleEnums.Technician - item.RoleLevel) >= 0 ? true : false;
                dr.Cells[3].Value = (RoleEnums.Supervisor - item.RoleLevel) >= 0 ? true : false;
                this.dgvAccess.Rows.Add(dr);
            }
        }
示例#21
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());
            }
        }
示例#22
0
 public BaseControl(AutomationElement control, ControlAccess ControlAccess) 
 {
     myControlAccess = ControlAccess;
     AutomationElement = control;            
 }
示例#23
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);
        }
示例#24
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);
        }
示例#25
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);
                }
            }
        }
示例#26
0
 public Actions(ControlAccess controlAccess)
 {
     thisControlAccess = controlAccess;
 }
示例#27
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);
        }
示例#28
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;
                }
            }
        }
示例#29
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);
        }
        /// <summary>
        /// Verifies a control value.
        /// </summary>
        /// <param name="control">The control to verify.</param>
        /// <param name="modifiedValue">The new value to be verified.</param>
        /// <param name="existingValue">The previous value.</param>
        /// <param name="controlAccess">The control access.</param>
        /// <returns>The sanitised control value.</returns>
        private object VerifyValueControl(ValueControl control, object modifiedValue, object existingValue, ControlAccess controlAccess)
        {
            if (controlAccess.AccessLevel != AccessLevel.Write)
            {
                return existingValue ?? this.appInitialiser.GetInitialControlValue(control);
            }

            return modifiedValue;
        }
        /// <summary>
        /// Verifies a repeater value.
        /// </summary>
        /// <param name="modifiedValue">The new value to be verified.</param>
        /// <param name="existingValue">The previous value.</param>
        /// <param name="controlAccess">The control access.</param>
        /// <returns>The sanitised control value.</returns>
        private object VerifyRepeaterValue(object modifiedValue, object existingValue, ControlAccess controlAccess)
        {
            bool modifiedEmpty = true;
            bool existingEmpty = true;

            if (controlAccess.AccessLevel != AccessLevel.Write)
            {
                return existingValue ?? new Dictionary<string, object>[0];
            }

            if (modifiedValue != null)
            {
                modifiedEmpty = ((ICollection)modifiedValue).Count == 0;
            }

            if (existingValue != null)
            {
                existingEmpty = ((ICollection)existingValue).Count == 0;
            }

            Dictionary<string, object>[] repeaterItems = !modifiedEmpty ? (Dictionary<string, object>[])modifiedValue : new Dictionary<string, object>[0];
            Dictionary<string, object>[] cleanValue = new Dictionary<string, object>[repeaterItems.Length];
            Dictionary<string, object>[] existingRepeaterItems = existingValue == null ? new Dictionary<string, object>[0] : !existingEmpty ? (Dictionary<string, object>[])existingValue : new Dictionary<string, object>[0];

            for (int i = 0; i < repeaterItems.Length; i++)
            {
                Dictionary<string, object> existingRepeaterItem = existingRepeaterItems.Length > i ? existingRepeaterItems[i] : null;
                cleanValue[i] = this.VerifyContainer(repeaterItems[i], existingRepeaterItem);
            }

            return cleanValue;
        }