public ResultItem(IPAddressHelper.ScanResult result)
        {
            RI         = result;
            RI.Update += OnUpdate;

            Text = result.IP.ToString();
            SubItems.Add("");
            SubItems.Add("");
            SubItems.Add("");
            SubItems.Add("");
            DoRefresh();
        }
 void ScanOutput(IPAddressHelper.ScanResult result)
 {
     if (InvokeRequired)
     {
         BeginInvoke((MethodInvoker)(() => { ScanOutput(result); }));
     }
     else
     {
         LV.BeginUpdate();
         LV.Items.Add(new ResultItem(result));
         LV.EndUpdate();
     }
 }
 private void ReturnItem(IPAddressHelper.ScanResult result)
 {
     if (result != null)
     {
         ComWrapper.WrapperType currentWrapper = Settings.GetObject("ComWrapper Protocol", ComWrapper.WrapperType.UsbSerial);
         if (currentWrapper == ComWrapper.WrapperType.Telnet)
         {
             RV = $"{result.IP}:{result.Port}";
         }
         else if (currentWrapper == ComWrapper.WrapperType.LaserWebESP8266)
         {
             RV = $"ws://{result.IP}:{result.Port}/";
         }
         Close();
     }
 }
Esempio n. 4
0
        private void PingCompleted(object sender, PingCompletedEventArgs e)
        {
            Ping P = sender as Ping;

            try
            {
                if (e.Reply.Status == IPStatus.Success)
                {
                    IPAddressHelper.ScanResult SR = new IPAddressHelper.ScanResult(e.Reply.Address, mPort, e.Reply.RoundtripTime);
                    mList.Add(SR);
                    mCallback.Invoke(SR);
                }
            }
            finally
            {
                lock (this)
                    mRespCount++;

                P.PingCompleted -= PingCompleted;
                P.Dispose();
            }
        }