Exemplo n.º 1
0
 /// <summary>
 /// 运行aap服务器
 /// </summary>
 /// <param name="app"></param>
 public void StartApp(ConnectedEvent app)
 {
     AppServer.Start();
     App = new Thread(() => {
         while (true)
         {
             try
             {
                 var v = AppServer.GetContext();
                 app?.Invoke(v);
             }
             catch (Exception ex)
             {
                 ThreadMsgEvent?.BeginInvoke(ex.StackTrace, null, null);
             }
         }
     });
     App.Start();
 }
Exemplo n.º 2
0
 /// <summary>
 /// 运行图像上传服务器
 /// </summary>
 /// <param name="img"></param>
 public void StartImg(ConnectedEvent img)
 {
     ImgServer.Start();
     Img = new Thread(() => {
         while (true)
         {
             Sem2.WaitOne();
             try
             {
                 var v = ImgServer.GetContext();
                 img?.Invoke(v);
             }
             catch (Exception ex)
             {
                 ThreadMsgEvent?.BeginInvoke(ex.StackTrace, null, null);
             }
             Sem2.Release();
         }
     });
     Img.Start();
 }