Example #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();

                var so = new SelectedOrdersData { SelectedOrders = SelectedOrders, Ticket = SelectedTicket };
                so.PublishEvent(EventTopicNames.SelectedOrdersChanged);
            }
        }
 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);
     }
 }
Example #3
0
        private void OnSelectedOrdersChanged(EventParameters<OrderViewModel> obj)
        {
            if (obj.Topic == EventTopicNames.SelectedOrdersChanged)
            {
                LastSelectedOrder = obj.Value.Selected ? obj.Value : null;
                if (SelectedOrders.Count() == 0) LastSelectedOrder = null;
                _ticketOrdersViewModel.UpdateLastSelectedOrder(LastSelectedOrder);

                RefreshSelectedItems();

                var so = new SelectedOrdersData { SelectedOrders = SelectedOrders, Ticket = SelectedTicket };
                so.PublishEvent(EventTopicNames.SelectedOrdersChanged);
            }
        }
Example #4
0
 private void OnSelectAllItemsExecute(string obj)
 {
     foreach (var order in Orders.Where(x => x.OrderNumber == obj))
         order.ToggleSelection();
     RefreshVisuals();
     var so = new SelectedOrdersData { SelectedOrders = SelectedOrders.Select(x => x.Model), Ticket = Model };
     so.PublishEvent(EventTopicNames.SelectedOrdersChanged);
 }
Example #5
0
        public void ClearSelectedItems()
        {
            foreach (var item in Orders)
                item.NotSelected();

            RefreshVisuals();
            var so = new SelectedOrdersData { SelectedOrders = SelectedOrders.Select(x => x.Model), Ticket = Model };
            so.PublishEvent(EventTopicNames.SelectedOrdersChanged);
        }
        private void OnSelectedOrdersChanged(EventParameters<OrderViewModel> obj)
        {
            if (SelectedTicket != null && obj.Topic == EventTopicNames.SelectedOrdersChanged)
            {
                LastSelectedOrder = obj.Value.Selected ? obj.Value : null;
                foreach (var item in SelectedTicket.SelectedOrders)
                {
                    item.IsLastSelected = item == LastSelectedOrder;
                }

                _selectedOrders.Clear();
                _selectedOrders.AddRange(SelectedTicket.SelectedOrders.Select(x => x.Model));
                if (_selectedOrders.Count == 0) LastSelectedOrder = null;

                RefreshSelectedItems();

                var so = new SelectedOrdersData { SelectedOrders = _selectedOrders, Ticket = SelectedTicket.Model };
                so.PublishEvent(EventTopicNames.SelectedOrdersChanged);

            }
        }