private void refreshList()
        {
            string strRoutineName = "txtTcpPortKeyPress";

            try
            {
                int rowCnt = 0;
                ucmc.lvMasterConfiguration.Items.Clear();
                string[]     row1    = { "1", "ADR", adrgroup.getCount().ToString() };
                ListViewItem lvItem1 = new ListViewItem(row1);
                if (rowCnt++ % 2 == 0)
                {
                    lvItem1.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                }
                ucmc.lvMasterConfiguration.Items.Add(lvItem1);
                string[]     row2    = { "2", "IEC101", iec101Grp.getCount().ToString() };
                ListViewItem lvItem2 = new ListViewItem(row2);
                if (rowCnt++ % 2 == 0)
                {
                    lvItem2.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                }
                ucmc.lvMasterConfiguration.Items.Add(lvItem2);
                string[]     row3    = { "3", "IEC103", iecGrp.getCount().ToString() };
                ListViewItem lvItem3 = new ListViewItem(row3);
                if (rowCnt++ % 2 == 0)
                {
                    lvItem3.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                }
                ucmc.lvMasterConfiguration.Items.Add(lvItem3);
                string[]     row5    = { "4", "MODBUS", mbGrp.getCount().ToString() };
                ListViewItem lvItem5 = new ListViewItem(row5);
                if (rowCnt++ % 2 == 0)
                {
                    lvItem5.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                }
                ucmc.lvMasterConfiguration.Items.Add(lvItem5);
                string[]     row6    = { "5", "Virtual", vGrp.getCount().ToString() };
                ListViewItem lvItem6 = new ListViewItem(row6);
                if (rowCnt++ % 2 == 0)
                {
                    lvItem6.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                }
                ucmc.lvMasterConfiguration.Items.Add(lvItem6);
            }
            catch (Exception ex)
            {
                MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
        private void refreshList()
        {
            string strRoutineName = "txtTcpPortKeyPress";

            try
            {
                int iCount = 0; //Ajay: 23/11/2018

                int rowCnt = 0;
                ucmc.lvMasterConfiguration.Items.Clear();
                if (ProtocolGateway.AppMode == ProtocolGateway.AppModes.Full) //Ajay: 23/11/2018
                {
                    iCount = 0;
                    if (adrgroup != null)
                    {
                        iCount = adrgroup.getCount();
                    }
                    string[]     row1    = { "1", "ADR", iCount.ToString() };
                    ListViewItem lvItem1 = new ListViewItem(row1);
                    if (rowCnt++ % 2 == 0)
                    {
                        lvItem1.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                    }
                    ucmc.lvMasterConfiguration.Items.Add(lvItem1);

                    iCount = 0;
                    if (iec101Grp != null)
                    {
                        iCount = iec101Grp.getCount();
                    }
                    string[]     row2    = { "2", "IEC101", iCount.ToString() };
                    ListViewItem lvItem2 = new ListViewItem(row2);
                    if (rowCnt++ % 2 == 0)
                    {
                        lvItem2.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                    }
                    ucmc.lvMasterConfiguration.Items.Add(lvItem2);

                    iCount = 0;
                    if (iec103Grp != null)
                    {
                        iCount = iec103Grp.getCount();
                    }
                    string[]     row3    = { "3", "IEC103", iCount.ToString() };
                    ListViewItem lvItem3 = new ListViewItem(row3);
                    if (rowCnt++ % 2 == 0)
                    {
                        lvItem3.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                    }
                    ucmc.lvMasterConfiguration.Items.Add(lvItem3);

                    iCount = 0;
                    if (mbGrp != null)
                    {
                        iCount = mbGrp.getCount();
                    }
                    string[]     row4    = { "4", "MODBUS", iCount.ToString() };
                    ListViewItem lvItem4 = new ListViewItem(row4);
                    if (rowCnt++ % 2 == 0)
                    {
                        lvItem4.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                    }
                    ucmc.lvMasterConfiguration.Items.Add(lvItem4);

                    iCount = 0;
                    if (server61850 != null)
                    {
                        iCount = server61850.getCount();
                    }
                    string[]     row5    = { "5", "IEC61850", iCount.ToString() };
                    ListViewItem lvItem5 = new ListViewItem(row5);
                    if (rowCnt++ % 2 == 0)
                    {
                        lvItem5.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                    }
                    ucmc.lvMasterConfiguration.Items.Add(lvItem5);

                    iCount = 0;
                    if (iec104Grp != null)
                    {
                        iCount = iec104Grp.getCount();
                    }
                    string[]     row6    = { "6", "IEC104", iCount.ToString() };
                    ListViewItem lvItem6 = new ListViewItem(row6);
                    if (rowCnt++ % 2 == 0)
                    {
                        lvItem6.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                    }
                    ucmc.lvMasterConfiguration.Items.Add(lvItem6);

                    iCount = 0;
                    if (Sport != null)
                    {
                        iCount = Sport.getCount();
                    }
                    string[]     row7    = { "7", "SPORT", iCount.ToString() };
                    ListViewItem lvItem7 = new ListViewItem(row7);
                    if (rowCnt++ % 2 == 0)
                    {
                        lvItem7.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                    }
                    ucmc.lvMasterConfiguration.Items.Add(lvItem7);

                    iCount = 0;
                    if (vGrp != null)
                    {
                        iCount = vGrp.getCount();
                    }
                    string[]     row8    = { "8", "Virtual", iCount.ToString() };
                    ListViewItem lvItem8 = new ListViewItem(row8);
                    if (rowCnt++ % 2 == 0)
                    {
                        lvItem8.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                    }
                    ucmc.lvMasterConfiguration.Items.Add(lvItem8);

                    iCount = 0;
                    if (LoadProfileGrp != null)
                    {
                        iCount = LoadProfileGrp.getCount();
                    }
                    //Ajay: 31/07/2018
                    string[]     row9    = { "9", "LoadProfile", iCount.ToString() };
                    ListViewItem lvItem9 = new ListViewItem(row9);
                    if (rowCnt++ % 2 == 0)
                    {
                        lvItem9.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                    }
                    ucmc.lvMasterConfiguration.Items.Add(lvItem9);
                }
                //Ajay: 23/11/2018
                else if (ProtocolGateway.AppMode == ProtocolGateway.AppModes.Restricted)
                {
                    if (ProtocolGateway.OppADRGroup_Visible)
                    {
                        iCount = 0;
                        if (adrgroup != null)
                        {
                            iCount = adrgroup.getCount();
                        }
                        string[]     row1    = { "1", "ADR", iCount.ToString() };
                        ListViewItem lvItem1 = new ListViewItem(row1);
                        if (rowCnt++ % 2 == 0)
                        {
                            lvItem1.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                        }
                        ucmc.lvMasterConfiguration.Items.Add(lvItem1);
                    }
                    else
                    {
                    }
                    if (ProtocolGateway.OppIEC101Group_Visible)
                    {
                        iCount = 0;
                        if (iec101Grp != null)
                        {
                            iCount = iec101Grp.getCount();
                        }
                        string[]     row2    = { "2", "IEC101", iCount.ToString() };
                        ListViewItem lvItem2 = new ListViewItem(row2);
                        if (rowCnt++ % 2 == 0)
                        {
                            lvItem2.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                        }
                        ucmc.lvMasterConfiguration.Items.Add(lvItem2);
                    }
                    else
                    {
                    }
                    if (ProtocolGateway.OppIEC103Group_Visible)
                    {
                        iCount = 0;
                        if (iec103Grp != null)
                        {
                            iCount = iec103Grp.getCount();
                        }
                        string[]     row3    = { "3", "IEC103", iCount.ToString() };
                        ListViewItem lvItem3 = new ListViewItem(row3);
                        if (rowCnt++ % 2 == 0)
                        {
                            lvItem3.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                        }
                        ucmc.lvMasterConfiguration.Items.Add(lvItem3);
                    }
                    else
                    {
                    }
                    if (ProtocolGateway.OppMODBUSGroup_Visible)
                    {
                        iCount = 0;
                        if (mbGrp != null)
                        {
                            iCount = mbGrp.getCount();
                        }
                        string[]     row4    = { "4", "MODBUS", iCount.ToString() };
                        ListViewItem lvItem4 = new ListViewItem(row4);
                        if (rowCnt++ % 2 == 0)
                        {
                            lvItem4.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                        }
                        ucmc.lvMasterConfiguration.Items.Add(lvItem4);
                    }
                    else
                    {
                    }
                    if (ProtocolGateway.OppIEC61850Group_Visible)
                    {
                        iCount = 0;
                        if (server61850 != null)
                        {
                            iCount = server61850.getCount();
                        }
                        string[]     row5    = { "5", "IEC61850", iCount.ToString() };
                        ListViewItem lvItem5 = new ListViewItem(row5);
                        if (rowCnt++ % 2 == 0)
                        {
                            lvItem5.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                        }
                        ucmc.lvMasterConfiguration.Items.Add(lvItem5);
                    }
                    else
                    {
                    }
                    if (ProtocolGateway.OppIEC104Group_Visible)
                    {
                        iCount = 0;
                        if (iec104Grp != null)
                        {
                            iCount = iec104Grp.getCount();
                        }
                        string[]     row6    = { "6", "IEC104", iCount.ToString() };
                        ListViewItem lvItem6 = new ListViewItem(row6);
                        if (rowCnt++ % 2 == 0)
                        {
                            lvItem6.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                        }
                        ucmc.lvMasterConfiguration.Items.Add(lvItem6);
                    }
                    else
                    {
                    }
                    if (ProtocolGateway.OppSPORTGroup_Visible)
                    {
                        iCount = 0;
                        if (Sport != null)
                        {
                            iCount = Sport.getCount();
                        }
                        string[]     row7    = { "7", "SPORT", iCount.ToString() };
                        ListViewItem lvItem7 = new ListViewItem(row7);
                        if (rowCnt++ % 2 == 0)
                        {
                            lvItem7.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                        }
                        ucmc.lvMasterConfiguration.Items.Add(lvItem7);
                    }
                    else
                    {
                    }
                    if (ProtocolGateway.OppVirtualGroup_Visible)
                    {
                        iCount = 0;
                        if (vGrp != null)
                        {
                            iCount = vGrp.getCount();
                        }
                        string[]     row8    = { "8", "Virtual", iCount.ToString() };
                        ListViewItem lvItem8 = new ListViewItem(row8);
                        if (rowCnt++ % 2 == 0)
                        {
                            lvItem8.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                        }
                        ucmc.lvMasterConfiguration.Items.Add(lvItem8);
                    }
                    else
                    {
                    }
                    if (ProtocolGateway.OppLoadProfileGroup_Visible)
                    {
                        iCount = 0;
                        if (LoadProfileGrp != null)
                        {
                            iCount = LoadProfileGrp.getCount();
                        }
                        //Ajay: 31/07/2018
                        string[]     row9    = { "9", "LoadProfile", iCount.ToString() };
                        ListViewItem lvItem9 = new ListViewItem(row9);
                        if (rowCnt++ % 2 == 0)
                        {
                            lvItem9.BackColor = ColorTranslator.FromHtml(Globals.rowColour);
                        }
                        ucmc.lvMasterConfiguration.Items.Add(lvItem9);
                    }
                    else
                    {
                    }
                }
                else
                {
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(strRoutineName + ": " + "Error: " + ex.Message.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }