public void ClearSelectedOrders() { if (Orders.Any(x => x.Selected)) { foreach (var item in Orders.Where(x => x.Selected)) { item.NotSelected(); } var so = new SelectedOrdersData { SelectedOrders = SelectedTicket.SelectedOrders, Ticket = SelectedTicket }; so.PublishEvent(EventTopicNames.SelectedOrdersChanged); } }
private void OnSelectedOrdersChanged(EventParameters <OrderViewModel> obj) { if (obj.Topic == EventTopicNames.SelectedOrdersChanged) { if (!obj.Value.Selected && !_ticketService.CanDeselectOrder(obj.Value.Model)) { obj.Value.ToggleSelection(); return; } if (ClearSelection) { ClearSelection = false; if (obj.Value != LastSelectedOrder) { ClearSelectedItems(); obj.Value.ToggleSelection(); return; } } LastSelectedOrder = obj.Value.Selected ? obj.Value : null; if (!SelectedOrders.Any()) { LastSelectedOrder = null; } _ticketOrdersViewModel.UpdateLastSelectedOrder(LastSelectedOrder); RefreshSelectedItems(); var so = new SelectedOrdersData { SelectedOrders = SelectedOrders, Ticket = SelectedTicket }; so.PublishEvent(EventTopicNames.SelectedOrdersChanged); } }