Exemplo n.º 1
0
        private void UpdateEthernetAdapterStatus()
        {
            //labelDisplayStaticIP.Enabled = (NetworkTests.UpdateNetworkInterfaceWithStaticIPList().Count > 0);
            List <NetworkInterface> adapters = NetworkTests.UpdateNetworkInterfaceWithStaticIPList();

            foreach (NetworkInterface adapter in adapters)
            {
                bool isKnown = false;

                if (networkInterfaces != null)
                {
                    foreach (NetworkInterface known in networkInterfaces)
                    {
                        if (known.Name == adapter.Name)
                        {
                            isKnown = true;
                            break;
                        }
                    }
                }

                if (!isKnown)
                {
                    _asyncOutputBufferSpecial += "Devices with Static IPv4 address:\r\n";
                    _asyncOutputBufferSpecial += "> " + adapter.Description + "\r\n";
                }
            }

            networkInterfaces = adapters;
        }
Exemplo n.º 2
0
        private void TelnetWork(Object o, DoWorkEventArgs e)
        {
            while (true)
            {
                if ((_ticker++ % 10) == 0)
                {
                    _ping = NetworkTests.GetPingResult(Settings.Default.ONTIPADDRESS);
                }

                if (!_ping)
                {
                    TelnetDisconnect();
                    continue;
                }

                if (!this.IsConnected)
                {
                    Thread.Sleep(POLL_SLEEP * 2);
                    TelnetInit();

                    continue;
                }

                TelnetBufferRead();
                InjectSLID();
                TelnetBufferWrite();

                Thread.Sleep(POLL_SLEEP);
            }
        }
Exemplo n.º 3
0
        private void UpdateLabelStatus()
        {
            Color defaultBackColor = Color.FromName("ControlLightLight");
            Color defaultForeColor = Color.FromName("GrayText");
            Color backColor        = defaultBackColor;
            Color foreColor        = defaultForeColor;

            if ((ticker % 10) == 0)
            {
                modulator = !modulator;
            }

            labelDisplayONTConnected.Enabled = (ontInterface.IsConnected);

            labelDisplayONTProvisioned.Enabled = ((ontInterface.State == ProvisionState.Validated) || (ontInterface.State == ProvisionState.Invalid));

            if (modulator)
            {
                if (ontInterface.State == ProvisionState.Validated)
                {
                    backColor = Color.LimeGreen;
                }
                if (ontInterface.State == ProvisionState.Invalid)
                {
                    backColor = Color.OrangeRed;
                }

                foreColor = Color.White;
            }

            labelDisplayONTProvisioned.BackColor = backColor;
            labelDisplayONTProvisioned.ForeColor = foreColor;

            labelDisplayFault.BackColor = (modulator && (ontInterface.State == ProvisionState.Disabled))
                ? Color.FromArgb(192, 0, 0)
                : defaultBackColor;
            labelDisplayFault.ForeColor = (modulator && (ontInterface.State == ProvisionState.Disabled))
                ? defaultBackColor
                : defaultForeColor;

            labelDisplayFault.Enabled = modulator ? (ontInterface.State == ProvisionState.Disabled) : false;

            labelDisplayWWW.Enabled = (NetworkTests.GetPingResult("www.google.com", 400));

            textBoxInputASIDOrSLID.Enabled = ((ontInterface.State != ProvisionState.Disabled) && !checkBoxInputGO.Checked);
            checkBoxInputGO.Enabled        = !(ontInterface.State == ProvisionState.Disabled);

            switch (ontInterface.State)
            {
            case ProvisionState.Default:
                statusText = (ontInterface.IsConnected)
                        ? "ONT is Connected"
                        : // ternary if below :D

                             ((labelDisplayStaticIP.Enabled)
                        ? "ONT is not Detected"
                        : "Ethernet IPv4 is not Configured"
                             );

                break;

            case ProvisionState.Validated:
                statusText = "SLID is OK, ONT Reboot Required";
                break;

            case ProvisionState.Invalid:
                statusText = "SLID caused Validation Error";
                break;

            case ProvisionState.Disabled:
                statusText = "ONT is reporting a Fault";
                break;

            default:
                break;
            }

            notifyIcon1.Text = statusText;

            if (ontInterface.State != ProvisionState.Default)
            {
                ticker += 1;
            }
        }