Example #1
0
        public void pageInit(OtherDevices pParent, string gatewayID, string devName)
        {
            this.m_pParent   = pParent;
            this.m_gatewayID = gatewayID;
            InSnergyGateway gateWaybyGID = InSnergyGateway.GetGateWaybyGID(gatewayID);

            if (gateWaybyGID == null)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DevInfo_nofind, new string[]
                {
                    devName
                }));
                return;
            }
            this.tbDevName.Text  = gateWaybyGID.GatewayName;
            this.labDevIp.Text   = InSnergyService.getGatewayIP(gateWaybyGID.GatewayID);
            this.labDevType.Text = gateWaybyGID.GatewayType;
            this.dgvBranchPanels.Rows.Clear();
            int num = 1;

            foreach (Branch current in gateWaybyGID.BranchList)
            {
                string[] values = new string[]
                {
                    num.ToString(),
                            current.BranchName,
                            current.Location,
                            current.SubMeterList.Count.ToString(),
                            current.GatewayID,
                            current.BranchID
                };
                this.dgvBranchPanels.Rows.Add(values);
                num++;
            }
        }
Example #2
0
 public void pageInit(OtherDevices pParent, TreeNode rootNode)
 {
     this.m_pParent = pParent;
     if (Sys_Para.GetISGFlag() == 0)
     {
         this.cbEnableISGateway.Checked = false;
         this.tbISGServicePort.Enabled  = false;
         this.cbAtenPDU.Enabled         = false;
     }
     else
     {
         this.cbEnableISGateway.Checked = true;
         this.tbISGServicePort.Enabled  = true;
         this.cbAtenPDU.Enabled         = true;
     }
     this.tbISGServicePort.Text = System.Convert.ToString(Sys_Para.GetISGPort());
     if (Sys_Para.GetITPowerFlag() == 0)
     {
         this.cbAtenPDU.Checked = false;
     }
     else
     {
         this.cbAtenPDU.Checked = true;
     }
     this.dgvAllOtherDevices.Rows.Clear();
     System.Collections.Generic.List <InSnergyGateway> allGateWay = InSnergyGateway.GetAllGateWay();
     foreach (TreeNode treeNode in rootNode.Nodes)
     {
         string          text            = treeNode.Text;
         string          name            = treeNode.Name;
         bool            flag            = false;
         InSnergyGateway inSnergyGateway = null;
         for (int i = 0; i < allGateWay.Count; i++)
         {
             inSnergyGateway = allGateWay[i];
             if (inSnergyGateway.GatewayID == name)
             {
                 flag = true;
                 break;
             }
         }
         if (flag)
         {
             string gatewayIP = InSnergyService.getGatewayIP(inSnergyGateway.GatewayID);
             string msg       = EcoLanguage.getMsg(LangRes.ISGST_offline, new string[0]);
             if (InSnergyService.IsGatewayOnline(name))
             {
                 msg = EcoLanguage.getMsg(LangRes.ISGST_online, new string[0]);
             }
             string[] values = new string[]
             {
                 text,
                 inSnergyGateway.GatewayType,
                 gatewayIP,
                 msg,
                 inSnergyGateway.GatewayID
             };
             this.dgvAllOtherDevices.Rows.Add(values);
         }
     }
     if (this.dgvAllOtherDevices.Rows.Count == 0)
     {
         this.butOthDevicesDel.Enabled  = false;
         this.butOthDeviceSetup.Enabled = false;
         return;
     }
     this.butOthDevicesDel.Enabled  = true;
     this.butOthDeviceSetup.Enabled = true;
 }
        public void pageInit(OtherDevices pParent, string gatewayID, string BranchID)
        {
            this.m_pParent = pParent;
            InSnergyGateway gateWaybyBID = InSnergyGateway.GetGateWaybyBID(BranchID);

            if (gateWaybyBID == null)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DevInfo_nofind, new string[]
                {
                    gatewayID
                }));
                return;
            }
            this.m_gatewayID     = gatewayID;
            this.m_branchID      = BranchID;
            this.labDevName.Text = gateWaybyBID.GatewayName;
            this.labDevIp.Text   = InSnergyService.getGatewayIP(gateWaybyBID.GatewayID);
            this.labDevType.Text = gateWaybyBID.GatewayType;
            Branch branch = gateWaybyBID.BranchList[0];

            if (branch == null)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.DevInfo_nofind, new string[]
                {
                    BranchID
                }));
                return;
            }
            this.tbBranchNm.Text   = branch.BranchName;
            this.tbBranchLoct.Text = branch.Location;
            this.dgvtbISG_SubMElecUsage.Items.Clear();
            this.dgvtbISG_SubMElecUsage.Items.Add("IT Power");
            this.dgvtbISG_SubMElecUsage.Items.Add("Non IT Power");
            this.dgvtbISG_SubMElecUsage.Items.Add("Undefined");
            this.dgvSubMeters.Rows.Clear();
            string text = "";
            int    num  = 1;

            System.Collections.Generic.Dictionary <string, IMeter> branch2 = InSnergyService.GetBranch(this.m_gatewayID, this.m_branchID);
            foreach (SubMeter current in branch.SubMeterList)
            {
                switch (current.ElectricityUsage)
                {
                case 0:
                    text = "Undefined";
                    break;

                case 1:
                    text = "IT Power";
                    break;

                case 2:
                    text = "Non IT Power";
                    break;
                }
                string submeterID = current.SubmeterID;
                string text2      = "";
                string text3      = "";
                string text4      = "";
                string text5      = "";
                string text6      = "";
                string text7      = "";
                if (branch2.ContainsKey(submeterID))
                {
                    IMeter meter = branch2[submeterID];
                    if (meter.listParam.ContainsKey(2))
                    {
                        double dvalue = meter.listParam[2].dvalue;
                        text2 = dvalue.ToString("F2");
                    }
                    if (meter.listParam.ContainsKey(1))
                    {
                        double dvalue = meter.listParam[1].dvalue;
                        text3 = dvalue.ToString("F2");
                    }
                    if (meter.listParam.ContainsKey(3))
                    {
                        double dvalue = meter.listParam[3].dvalue;
                        text4 = dvalue.ToString("F1");
                    }
                    if (meter.listParam.ContainsKey(5))
                    {
                        double dvalue = meter.listParam[5].dvalue;
                        text5 = dvalue.ToString("F2");
                    }
                    if (meter.listParam.ContainsKey(8))
                    {
                        double dvalue = meter.listParam[8].dvalue;
                        text6 = dvalue.ToString("F3");
                    }
                    if (meter.listParam.ContainsKey(4))
                    {
                        double dvalue = meter.listParam[4].dvalue;
                        text7 = dvalue.ToString("F2");
                    }
                }
                string[] values = new string[]
                {
                    num.ToString(),
                         text2,
                         text3,
                         text4,
                         text5,
                         text6,
                         text7,
                         current.Capacity.ToString("F2"),
                    text,
                    current.GatewayID,
                    current.BranchID,
                    current.SubmeterID
                };
                this.dgvSubMeters.Rows.Add(values);
                num++;
            }
        }
Example #4
0
        private void InitializeComponent()
        {
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(DevManPage));

            this.flowLayoutPanelDevManPage = new FlowLayoutPanel();
            this.butZoneNew     = new Button();
            this.butRackNew     = new Button();
            this.butDevSetup    = new Button();
            this.butDataGroup   = new Button();
            this.butOtherDevice = new Button();
            this.panel1         = new Panel();
            this.panel2         = new Panel();
            this.otherDevices1  = new OtherDevices.OtherDevices();
            this.manZone1       = new ManZone();
            this.manRack1       = new ManRack();
            this.devManDevice1  = new DevManDevice.DevManDevice();
            this.dataGroup1     = new DataGroup.DataGroup();
            this.flowLayoutPanelDevManPage.SuspendLayout();
            this.panel1.SuspendLayout();
            this.panel2.SuspendLayout();
            base.SuspendLayout();
            this.flowLayoutPanelDevManPage.BackColor = Color.FromArgb(18, 160, 143);
            this.flowLayoutPanelDevManPage.Controls.Add(this.butZoneNew);
            this.flowLayoutPanelDevManPage.Controls.Add(this.butRackNew);
            this.flowLayoutPanelDevManPage.Controls.Add(this.butDevSetup);
            this.flowLayoutPanelDevManPage.Controls.Add(this.butDataGroup);
            this.flowLayoutPanelDevManPage.Controls.Add(this.butOtherDevice);
            componentResourceManager.ApplyResources(this.flowLayoutPanelDevManPage, "flowLayoutPanelDevManPage");
            this.flowLayoutPanelDevManPage.MinimumSize = new Size(889, 27);
            this.flowLayoutPanelDevManPage.Name        = "flowLayoutPanelDevManPage";
            componentResourceManager.ApplyResources(this.butZoneNew, "butZoneNew");
            this.butZoneNew.BackColor               = Color.FromArgb(18, 160, 143);
            this.butZoneNew.MinimumSize             = new Size(160, 27);
            this.butZoneNew.Name                    = "butZoneNew";
            this.butZoneNew.Tag                     = "Tag_ZoneDefine";
            this.butZoneNew.UseVisualStyleBackColor = true;
            this.butZoneNew.Click                  += new System.EventHandler(this.comm_butClick);
            componentResourceManager.ApplyResources(this.butRackNew, "butRackNew");
            this.butRackNew.BackColor               = Color.FromArgb(18, 160, 143);
            this.butRackNew.MinimumSize             = new Size(160, 27);
            this.butRackNew.Name                    = "butRackNew";
            this.butRackNew.Tag                     = "Tag_TestRack";
            this.butRackNew.UseVisualStyleBackColor = true;
            this.butRackNew.Click                  += new System.EventHandler(this.comm_butClick);
            componentResourceManager.ApplyResources(this.butDevSetup, "butDevSetup");
            this.butDevSetup.MinimumSize             = new Size(160, 27);
            this.butDevSetup.Name                    = "butDevSetup";
            this.butDevSetup.Tag                     = "PDU Setup";
            this.butDevSetup.UseVisualStyleBackColor = true;
            this.butDevSetup.Click                  += new System.EventHandler(this.comm_butClick);
            componentResourceManager.ApplyResources(this.butDataGroup, "butDataGroup");
            this.butDataGroup.MinimumSize             = new Size(160, 27);
            this.butDataGroup.Name                    = "butDataGroup";
            this.butDataGroup.Tag                     = "Tag_datagroup";
            this.butDataGroup.UseVisualStyleBackColor = true;
            this.butDataGroup.Click                  += new System.EventHandler(this.comm_butClick);
            componentResourceManager.ApplyResources(this.butOtherDevice, "butOtherDevice");
            this.butOtherDevice.MinimumSize             = new Size(160, 27);
            this.butOtherDevice.Name                    = "butOtherDevice";
            this.butOtherDevice.Tag                     = "Tag_OtherDevice";
            this.butOtherDevice.UseVisualStyleBackColor = true;
            this.butOtherDevice.Click                  += new System.EventHandler(this.comm_butClick);
            this.panel1.BackColor = Color.FromArgb(18, 160, 143);
            this.panel1.Controls.Add(this.flowLayoutPanelDevManPage);
            componentResourceManager.ApplyResources(this.panel1, "panel1");
            this.panel1.Name = "panel1";
            this.panel2.Controls.Add(this.otherDevices1);
            this.panel2.Controls.Add(this.manZone1);
            this.panel2.Controls.Add(this.manRack1);
            this.panel2.Controls.Add(this.devManDevice1);
            this.panel2.Controls.Add(this.dataGroup1);
            componentResourceManager.ApplyResources(this.panel2, "panel2");
            this.panel2.Name             = "panel2";
            this.otherDevices1.BackColor = Color.WhiteSmoke;
            componentResourceManager.ApplyResources(this.otherDevices1, "otherDevices1");
            this.otherDevices1.Name = "otherDevices1";
            this.manZone1.BackColor = Color.WhiteSmoke;
            componentResourceManager.ApplyResources(this.manZone1, "manZone1");
            this.manZone1.Name      = "manZone1";
            this.manRack1.BackColor = Color.WhiteSmoke;
            componentResourceManager.ApplyResources(this.manRack1, "manRack1");
            this.manRack1.Name           = "manRack1";
            this.devManDevice1.BackColor = Color.WhiteSmoke;
            componentResourceManager.ApplyResources(this.devManDevice1, "devManDevice1");
            this.devManDevice1.Name   = "devManDevice1";
            this.dataGroup1.BackColor = Color.WhiteSmoke;
            componentResourceManager.ApplyResources(this.dataGroup1, "dataGroup1");
            this.dataGroup1.Name = "dataGroup1";
            base.AutoScaleMode   = AutoScaleMode.None;
            this.BackColor       = Color.WhiteSmoke;
            base.Controls.Add(this.panel2);
            base.Controls.Add(this.panel1);
            componentResourceManager.ApplyResources(this, "$this");
            base.Name            = "DevManPage";
            base.VisibleChanged += new System.EventHandler(this.DevManPage_VisibleChanged);
            this.flowLayoutPanelDevManPage.ResumeLayout(false);
            this.flowLayoutPanelDevManPage.PerformLayout();
            this.panel1.ResumeLayout(false);
            this.panel2.ResumeLayout(false);
            base.ResumeLayout(false);
        }