/// <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(); }
/// <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(); }