Пример #1
0
            public MicrocontrollerListViewItem(MicroConfig config, MicrocontrollerListView listView) : base(config.name)
            {
                if (IPAddress.TryParse(config.address, out address))
                {
                    this.Group    = listView.Groups["groupMicros"];
                    this.ImageKey = "micro";

                    if (LicenseManager.UsageMode == LicenseUsageMode.Runtime)
                    {
                        ping = new Ping();
                        ping.PingCompleted += new PingCompletedEventHandler(ping_PingCompleted);
                    }
                }
                else
                {
                    this.Group    = listView.Groups["groupPower"];
                    this.ImageKey = "power";
                }

                this.powerPort      = config.powerPort;
                this.supportsTiming = config.supportsTiming;

                // add the subitems
                for (int i = 0; i < listView.Columns.Count - 1; i++)
                {
                    this.SubItems.Add("");
                }

                if (address != null)
                {
                    this.SubItems[listView.columnAddress.DisplayIndex].Text = address.ToString();
                }

                if (supportsTiming)
                {
                    this.SubItems[listView.columnSyncPulse.DisplayIndex].Text = "?/?";
                }
                else
                {
                    this.SubItems[listView.columnSyncPulse.DisplayIndex].Text = " - ";
                }

                if (powerPort != -1)
                {
                    this.SubItems[listView.columnPowerStatus.DisplayIndex].Text = powerPort.ToString() + "/?";
                }
                else
                {
                    this.SubItems[listView.columnPowerStatus.DisplayIndex].Text = " - ";
                }
            }
            public MicrocontrollerListViewItem(MicroConfig config, MicrocontrollerListView listView)
                : base(config.name)
            {
                if (IPAddress.TryParse(config.address, out address)) {
                    this.Group = listView.Groups["groupMicros"];
                    this.ImageKey = "micro";

                    if (LicenseManager.UsageMode == LicenseUsageMode.Runtime) {
                        ping = new Ping();
                        ping.PingCompleted += new PingCompletedEventHandler(ping_PingCompleted);
                    }
                }
                else {
                    this.Group = listView.Groups["groupPower"];
                    this.ImageKey = "power";
                }

                this.powerPort = config.powerPort;
                this.supportsTiming = config.supportsTiming;

                // add the subitems
                for (int i = 0; i < listView.Columns.Count-1; i++) {
                    this.SubItems.Add("");
                }

                if (address != null) {
                    this.SubItems[listView.columnAddress.DisplayIndex].Text = address.ToString();
                }

                if (supportsTiming) {
                    this.SubItems[listView.columnSyncPulse.DisplayIndex].Text = "?/?";
                }
                else {
                    this.SubItems[listView.columnSyncPulse.DisplayIndex].Text = " - ";
                }

                if (powerPort != -1) {
                    this.SubItems[listView.columnPowerStatus.DisplayIndex].Text = powerPort.ToString() + "/?";
                }
                else {
                    this.SubItems[listView.columnPowerStatus.DisplayIndex].Text = " - ";
                }
            }