Beispiel #1
0
            public PIFRow(Host host, PIF pif)
            {
                this.pif = pif;

                // cell for the name of the management interface
                DataGridViewTextBoxCell nameCell = new DataGridViewTextBoxCell();

                nameCell.Value = Helpers.GetName(host);
                Cells.Add(nameCell);

                // the icon cell
                DataGridViewImageCell iconCell = new DataGridViewImageCell();

                iconCell.Value = Images.GetImage16For(pif);
                Cells.Add(iconCell);

                // the management purpose cell
                DataGridViewTextBoxCell interfaceCell = new DataGridViewTextBoxCell();
                string purpose;

                if (pif.management)
                {
                    purpose = Messages.MANAGEMENT;
                }
                else
                {
                    var managementPurpose = pif.GetManagementPurpose();
                    purpose = string.IsNullOrEmpty(managementPurpose) ? Messages.NETWORKING_PROPERTIES_PURPOSE_UNKNOWN : managementPurpose;
                }
                interfaceCell.Value = purpose;
                Cells.Add(interfaceCell);

                // the network cell
                DataGridViewTextBoxCell networkCell = new DataGridViewTextBoxCell();

                networkCell.Value = host.Connection.Resolve(pif.network).ToString();
                Cells.Add(networkCell);

                // the NIC cell
                DataGridViewTextBoxCell nicCell = new DataGridViewTextBoxCell();

                nicCell.Value = Helpers.GetName(pif);
                Cells.Add(nicCell);

                // the IP Setup cell
                DataGridViewTextBoxCell ipSetupCell = new DataGridViewTextBoxCell();

                ipSetupCell.Value = pif.IpConfigurationModeString();
                Cells.Add(ipSetupCell);

                // the ip address of the interface
                DataGridViewTextBoxCell ipCell = new DataGridViewTextBoxCell();

                ipCell.Value = pif.IP;
                Cells.Add(ipCell);
                // the subnet mask address of the interface
                DataGridViewTextBoxCell subnetCell = new DataGridViewTextBoxCell();

                subnetCell.Value = pif.netmask;
                Cells.Add(subnetCell);

                // the gateway address of the interface
                DataGridViewTextBoxCell gatewayCell = new DataGridViewTextBoxCell();

                gatewayCell.Value = pif.gateway;
                Cells.Add(gatewayCell);
                // the dns address of the interface
                DataGridViewTextBoxCell dnsCell = new DataGridViewTextBoxCell();

                dnsCell.Value = pif.DNS;
                Cells.Add(dnsCell);
            }