Пример #1
0
        // Trace complete
        private void tracert_TraceComplete(object sender, EventArgs e)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new EventHandler(tracert_TraceComplete), sender, e);
            }
            else
            {
                // Save current job results
                TraceJob j = jobs[workingjobindex];
                j.nodes           = new List <TraceRtNode>(tracert.Nodes);
                j.jobcomplete     = true;
                j.targetreachable = tracert.DestResponse;

                // Update button
                if (j.targetreachable)
                {
                    routebuttons[workingjobindex].ColorNormal = ColorIndex.ControlColor3;
                }
                else
                {
                    routebuttons[workingjobindex].ColorNormal = ColorIndex.ControlColorNegative;
                }

                routebuttons[workingjobindex].SetupColors(General.Colors);

                // Next one after small delay
                tracetimer.Start();
            }
        }
Пример #2
0
        // Constructor
        public NetPingTechPanel()
        {
            InitializeComponent();
            tracert = new TraceRt();
            tracert.MaxHops = 20;
            tracert.TraceComplete += tracert_TraceComplete;

            // Make array
            routebuttons = new DisplayButton[4];
            routebuttons[0] = routebutton0;
            routebuttons[1] = routebutton1;
            routebuttons[2] = routebutton2;
            routebuttons[3] = routebutton3;

            // Make array
            hostlabels = new DisplayLabel[11];
            hostlabels[0] = hostlabel0;
            hostlabels[1] = hostlabel1;
            hostlabels[2] = hostlabel2;
            hostlabels[3] = hostlabel3;
            hostlabels[4] = hostlabel4;
            hostlabels[5] = hostlabel5;
            hostlabels[6] = hostlabel6;
            hostlabels[7] = hostlabel7;
            hostlabels[8] = hostlabel8;
            hostlabels[9] = hostlabel9;
            hostlabels[10] = hostlabel10;

            // Make array
            addresslabels = new DisplayLabel[11];
            addresslabels[0] = addresslabel0;
            addresslabels[1] = addresslabel1;
            addresslabels[2] = addresslabel2;
            addresslabels[3] = addresslabel3;
            addresslabels[4] = addresslabel4;
            addresslabels[5] = addresslabel5;
            addresslabels[6] = addresslabel6;
            addresslabels[7] = addresslabel7;
            addresslabels[8] = addresslabel8;
            addresslabels[9] = addresslabel9;
            addresslabels[10] = addresslabel10;

            // Make array
            pinglabels = new DisplayLabel[11];
            pinglabels[0] = pinglabel0;
            pinglabels[1] = pinglabel1;
            pinglabels[2] = pinglabel2;
            pinglabels[3] = pinglabel3;
            pinglabels[4] = pinglabel4;
            pinglabels[5] = pinglabel5;
            pinglabels[6] = pinglabel6;
            pinglabels[7] = pinglabel7;
            pinglabels[8] = pinglabel8;
            pinglabels[9] = pinglabel9;
            pinglabels[10] = pinglabel10;

            // The jobs we do
            jobs = new TraceJob[routebuttons.Length];
            for(int i = 0; i < routebuttons.Length; i++)
                jobs[i] = new TraceJob(routebuttons[i].Tag.ToString());
        }
Пример #3
0
        // Constructor
        public NetPingTechPanel()
        {
            InitializeComponent();
            tracert                = new TraceRt();
            tracert.MaxHops        = 20;
            tracert.TraceComplete += tracert_TraceComplete;

            // Make array
            routebuttons    = new DisplayButton[4];
            routebuttons[0] = routebutton0;
            routebuttons[1] = routebutton1;
            routebuttons[2] = routebutton2;
            routebuttons[3] = routebutton3;

            // Make array
            hostlabels     = new DisplayLabel[11];
            hostlabels[0]  = hostlabel0;
            hostlabels[1]  = hostlabel1;
            hostlabels[2]  = hostlabel2;
            hostlabels[3]  = hostlabel3;
            hostlabels[4]  = hostlabel4;
            hostlabels[5]  = hostlabel5;
            hostlabels[6]  = hostlabel6;
            hostlabels[7]  = hostlabel7;
            hostlabels[8]  = hostlabel8;
            hostlabels[9]  = hostlabel9;
            hostlabels[10] = hostlabel10;

            // Make array
            addresslabels     = new DisplayLabel[11];
            addresslabels[0]  = addresslabel0;
            addresslabels[1]  = addresslabel1;
            addresslabels[2]  = addresslabel2;
            addresslabels[3]  = addresslabel3;
            addresslabels[4]  = addresslabel4;
            addresslabels[5]  = addresslabel5;
            addresslabels[6]  = addresslabel6;
            addresslabels[7]  = addresslabel7;
            addresslabels[8]  = addresslabel8;
            addresslabels[9]  = addresslabel9;
            addresslabels[10] = addresslabel10;

            // Make array
            pinglabels     = new DisplayLabel[11];
            pinglabels[0]  = pinglabel0;
            pinglabels[1]  = pinglabel1;
            pinglabels[2]  = pinglabel2;
            pinglabels[3]  = pinglabel3;
            pinglabels[4]  = pinglabel4;
            pinglabels[5]  = pinglabel5;
            pinglabels[6]  = pinglabel6;
            pinglabels[7]  = pinglabel7;
            pinglabels[8]  = pinglabel8;
            pinglabels[9]  = pinglabel9;
            pinglabels[10] = pinglabel10;

            // The jobs we do
            jobs = new TraceJob[routebuttons.Length];
            for (int i = 0; i < routebuttons.Length; i++)
            {
                jobs[i] = new TraceJob(routebuttons[i].Tag.ToString());
            }
        }
Пример #4
0
        // This displays the specified job index
        private void DisplayJob(int displayindex)
        {
            routearrow.Visible = false;

            // Update buttons
            for (int i = 0; i < routebuttons.Length; i++)
            {
                if (i == displayindex)
                {
                    if (jobs[displayindex].targetreachable)
                    {
                        routebuttons[i].StartInfoFlash();
                    }
                    else
                    {
                        routebuttons[i].StartWarningFlash();
                    }
                }
                else
                {
                    routebuttons[i].StopInfoFlash();
                    routebuttons[i].StopWarningFlash();
                }
            }

            TraceJob j      = jobs[displayindex];
            int      offset = (j.nodes.Count <= 11) ? 0 : j.nodes.Count - addresslabels.Length;

            while ((offset > 0) && (j.nodes[offset + 10].HostAddress == null))
            {
                offset--;
            }

            if (j.nodes.Count == 0)
            {
                // Setup all labels
                for (int i = 0; i < addresslabels.Length; i++)
                {
                    hostlabels[i].Visible    = false;
                    addresslabels[i].Visible = false;
                    pinglabels[i].Visible    = false;
                    hostlabels[i].Text       = "";
                    addresslabels[i].Text    = "";
                    pinglabels[i].Text       = "";
                }
                hostlabels[1].Text    = "        Trace route not available.";
                addresslabels[1].Text = "";
                pinglabels[1].Text    = "";
            }
            else
            {
                // Setup all labels
                for (int i = 0; i < addresslabels.Length; i++)
                {
                    hostlabels[i].Visible    = false;
                    addresslabels[i].Visible = false;
                    pinglabels[i].Visible    = false;

                    int nindex = offset + i;
                    if (nindex < j.nodes.Count)
                    {
                        TraceRtNode n = j.nodes[nindex];

                        if (!string.IsNullOrEmpty(n.HostName))
                        {
                            hostlabels[i].Text = n.HostName;
                        }
                        else
                        {
                            hostlabels[i].Text = "(Unknown Routepoint)";
                        }

                        if (n.HostAddress != null)
                        {
                            addresslabels[i].Text      = n.HostAddress.ToString();
                            addresslabels[i].ColorText = ColorIndex.ControlColor4;

                            pinglabels[i].Text = n.RoundTripTime + " ms";
                            if (n.RoundTripTime > 500)
                            {
                                pinglabels[i].ColorText = ColorIndex.ControlColorNegative;
                            }
                            else
                            {
                                pinglabels[i].ColorText = ColorIndex.ControlColor3;
                            }
                        }
                        else
                        {
                            pinglabels[i].Text         = "N/A";
                            pinglabels[i].ColorText    = ColorIndex.ControlColorNegative;
                            addresslabels[i].Text      = "(Unreachable)";
                            addresslabels[i].ColorText = ColorIndex.ControlColorNegative;
                        }

                        addresslabels[i].SetupColors(General.Colors);
                        pinglabels[i].SetupColors(General.Colors);
                    }
                    else
                    {
                        hostlabels[i].Text    = "";
                        addresslabels[i].Text = "";
                        pinglabels[i].Text    = "";
                    }
                }
            }
        }