Beispiel #1
0
        public void SendMessageAsync(SmtpMessage msg, AsyncCallback cb)
        {
            _messageQueue.Add(1);
            SmtpClientSendMessageAsyncResult messageAsync = new SmtpClientSendMessageAsyncResult {
                CB = cb, Message = msg
            };

            Threading.Thread thread = new Threading.Thread(SendMessageAsync_Thread);
            thread.Start(messageAsync);
        }
Beispiel #2
0
        public void Start()
        {
            _device = Open();
            if (_device == null)
            {
                throw new Exception("Cannot open Ethernet interface");
            }

            _deviceMac = _device.Interface.MacAddress.GetAddressBytes();

            // filter to only bacnet packets
            _device.Filter = "ether proto 0x82";

            System.Threading.Thread th = new Threading.Thread(CaptureThread);
            th.IsBackground = true;
            th.Start();
        }
Beispiel #3
0
 /// <summary>
 /// 创建线程来执行某个方法(无返回值)
 /// </summary>
 public static void TryRunByThread(Action fun, bool skipException = true)
 {
     System.Threading.ThreadStart start  = new Threading.ThreadStart(fun);
     System.Threading.Thread      thread = new Threading.Thread(start);
     thread.IsBackground = true;
     if (skipException)
     {
         try
         {
             thread.Start();
         }
         catch { }
     }
     else
     {
         thread.Start();
     }
 }
Beispiel #4
0
        public string SertchImageWithInfo(Bitmap _Sertchin, Bitmap _Sertchfor, out bool _R, out Point point, out TimeSpan _TimeSpan, ImageScanMethode imageScanMethode, int toleranz = 0, bool jointhread = true)
        {
            var __r        = false;
            var __TimeSpan = TimeSpan.MinValue;
            var Point      = new Point(0, 0);

            var t = new Threading.Thread(() => _Thread(_Sertchin, _Sertchfor, out __r, out Point, out __TimeSpan, imageScanMethode, toleranz));

            t.Start();
            if (jointhread)
            {
                t.Join();
            }
            _R        = __r;
            point     = Point;
            _TimeSpan = __TimeSpan;

            return($"Thread returned: {_R},  X={point.X}, Y={point.Y}, TimeSpan(Millisec)={__TimeSpan.Milliseconds}");
        }
Beispiel #5
0
		public void SendMessageAsync(SmtpMessage msg, AsyncCallback cb)
		{
			_messageQueue.Add(1);
			SmtpClientSendMessageAsyncResult messageAsync = new SmtpClientSendMessageAsyncResult { CB = cb, Message = msg };

			Threading.Thread thread = new Threading.Thread(SendMessageAsync_Thread);
			thread.Start(messageAsync);
		}
 private void Form1_Load(object sender, System.EventArgs e) {
     // Dim s As New InTheHand.Windows.Forms.SelectBluetoothDeviceDialog()
     // s.ForceAuthentication = True
     // s.ShowAuthenticated = True
     // s.ShowRemembered = True
     // s.ShowUnknown = True
     // s.ShowDialog()
     System.Threading.Thread t1;
     t1 = new Threading.Thread(new System.EventHandler(this.receiveLoop));
     t1.Start();
     btClient = new BluetoothClient();
     BluetoothDeviceInfo[] bdi = btClient.DiscoverDevices();
     cboDevices.DataSource = bdi;
     cboDevices.DisplayMember = "DeviceName";
 }
    public void SendMessageAsync(SmtpMessage msg, AsyncCallback cb)
    {
      m_msg_queue.Add(1);
      SmtpClientSendMessageAsyncResult m_obj = new SmtpClientSendMessageAsyncResult();
      m_obj.cb = cb;
      m_obj.Message = msg;

      Threading.Thread m_thread = new Threading.Thread(SendMessageAsync_Thread);
      m_thread.Start(m_obj);
    }