Ejemplo n.º 1
0
        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();

                if (_applicationState.IsLandscape)
                {
                    var so = new SelectedOrdersData {
                        SelectedOrders = SelectedOrders, Ticket = SelectedTicket
                    };
                    OperationRequest <SelectedOrdersData> .Publish(so, EventTopicNames.DisplayTicketOrderDetails, EventTopicNames.ActivatePosView, "");
                }
            }
        }
Ejemplo n.º 2
0
        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);
            }
        }