public LocalXiehuoPage() { InitializeComponent(); xiehuoViewModel = new XiehuoViewModel(this.Navigation); this.BindingContext = xiehuoViewModel; //注册扫描 broadcastService = BroadcastHelp.CreateBarcode1Service(); broadcastService.Result += BroadcastService_Result; }
public void OnInit() { _broadcastHelp = new BroadcastHelp(); //可以写在对应频道 也可以 _netThread = new Thread(RunAsync); _netThread.Start(); nets = new Dictionary <ENetType, Ichnl> { { ENetType.UDP, UdpChnl = new UdpChnl() }, { ENetType.TCP, TcpChnl = new TcpChnl() } }; #if UNITY_EDITOR UnityEditor.EditorApplication.playModeStateChanged -= OnEditorPlayModeChanged; UnityEditor.EditorApplication.playModeStateChanged += OnEditorPlayModeChanged; #endif }