// 新版本的事件 #pragma warning disable VSTHRD100 // 避免使用 Async Void 方法 private async void CurrentApp_NewTagChanged(object sender, NewTagChangedEventArgs e) #pragma warning restore VSTHRD100 // 避免使用 Async Void 方法 { /* * { * await ShelfData.ChangeEntitiesAsync((BaseChannel<IRfid>)sender, * sep_result, * () => * { * // 如果图书数量有变动,要自动清除挡在前面的残留的对话框 * CloseDialogs(); * }); * } */ // TODO: 对离开的 tag 变化为灰色颜色 foreach (var tag in e.AddTags) { ProcessTag(tag); } foreach (var tag in e.UpdateTags) { ProcessTag(tag); } }
// 新版本的事件 #pragma warning disable VSTHRD100 // 避免使用 Async Void 方法 private async void CurrentApp_NewTagChanged(object sender, NewTagChangedEventArgs e) #pragma warning restore VSTHRD100 // 避免使用 Async Void 方法 { /* * { * await ShelfData.ChangeEntitiesAsync((BaseChannel<IRfid>)sender, * sep_result, * () => * { * // 如果图书数量有变动,要自动清除挡在前面的残留的对话框 * CloseDialogs(); * }); * } */ var channel = (BaseChannel <IRfid>)sender; // TODO: 对离开的 tag 变化为灰色颜色 bool speaked = false; // 2020/10/10 // TODO: 发出什么响声表示? // 把以前遗留的出错 entity 尝试重新 GetTagInfo() foreach (var entity in InventoryData.ErrorEntities) { FillEntity(channel, entity, (e1) => { // 说过一次便不再说 if (speaked == true) { return(false); } speaked = SpeakLocation(e1); return(speaked); }); } // 筛选出需要 GetTagInfo() 的那些标签 FilterTags(channel, e.AddTags); #if NO SoundMaker.InitialSequence(e.AddTags.Count); foreach (var tag in e.AddTags) { SoundMaker.NextSound(); ProcessTag(channel, tag); } SoundMaker.StopCurrent(); #endif /* * foreach (var tag in e.UpdateTags) * { * ProcessTag(channel, tag); * } */ }
// 新版本的事件 #pragma warning disable VSTHRD100 // 避免使用 Async Void 方法 private async void CurrentApp_NewTagChanged(object sender, NewTagChangedEventArgs e) #pragma warning restore VSTHRD100 // 避免使用 Async Void 方法 { try { // throw new Exception("testing"); var channel = (BaseChannel <IRfid>)sender; // TODO: 对离开的 tag 变化为灰色颜色 bool speaked = false; // 2020/10/10 // TODO: 发出什么响声表示? // 把以前遗留的出错 entity 尝试重新 GetTagInfo() foreach (var entity in InventoryData.ErrorEntities) { FillEntity(channel, entity, (e1) => { // 说过一次便不再说 if (speaked == true) { return(false); } speaked = SpeakLocation(e1); return(speaked); }); } // 筛选出需要 GetTagInfo() 的那些标签 await FilterTags(channel, e.AddTags); #if NO SoundMaker.InitialSequence(e.AddTags.Count); foreach (var tag in e.AddTags) { SoundMaker.NextSound(); ProcessTag(channel, tag); } SoundMaker.StopCurrent(); #endif /* * foreach (var tag in e.UpdateTags) * { * ProcessTag(channel, tag); * } */ App.SetError("NewTagChanged", null); } catch (Exception ex) { App.SetError("NewTagChanged", $"CurrentApp_NewTagChanged() 捕获异常: {ex.Message}"); WpfClientInfo.WriteErrorLog($"CurrentApp_NewTagChanged() 捕获异常: {ExceptionUtil.GetDebugText(ex)}"); } }