コード例 #1
0
 /// <summary>
 /// Method that removes an item from the order when a user clicks the "X" button on that item
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void OnRemoveButtonClicked(object sender, RoutedEventArgs e)
 {
     if (sender is Button)
     {
         Button     b = (Button)sender;
         IOrderItem itemToBeRemoved = (IOrderItem)b.DataContext;
         Order      ord             = (Order)DataContext;
         ord.Remove(itemToBeRemoved);
     }
 }
コード例 #2
0
 /// <summary>
 /// Removes item
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void OnRemoveItem(object sender, RoutedEventArgs e)
 {
     if (sender is Button)
     {
         Button     b = (Button)sender;
         IOrderItem i = (IOrderItem)b.DataContext;
         Order      o = (Order)DataContext;
         o.Remove(i);
     }
 }
コード例 #3
0
        private void DeleteBtn_Click(object sender, RoutedEventArgs e)
        {
            Order items = DataContext as Order;
            var   item  = (e.OriginalSource as FrameworkElement).DataContext;

            items.Remove(item as IOrderItem);
            var screen       = new MenuItemSelectionControl();
            var orderControl = this.FindAncestor <OrderControl>();

            orderControl?.SwapScreen(screen);
        }
コード例 #4
0
 /// <summary>
 /// Removes the item when the X button is clicked
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void OnRemoveItem(object sender, RoutedEventArgs e)
 {
     if (DataContext is Order Order)
     {
         if (sender is Button button)
         {
             IOrderItem item = button.DataContext as IOrderItem;
             Order.Remove(item);
         }
     }
 }
コード例 #5
0
        /// <summary>
        /// clears order
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ClearOrderItem(object sender, RoutedEventArgs e)
        {
            if (DataContext is Order order)
            {
                int index = itemsListView.SelectedIndex;
                order.Remove(order[index]);

                //how to find index of one I want to remove?
                //need a reference to the item that needs to be deleted
            }
        }
コード例 #6
0
        void clickRemoveItem(object sender, RoutedEventArgs e)
        {
            try
            {
                ListViewItem selectedItem = (ListViewItem)listview.SelectedItem;
                if (selectedItem != null)
                {
                    IOrderItem i = (IOrderItem)selectedItem.Tag;

                    Orders.Remove(i);
                    listviewload();
                }
            }
            catch (Exception ex)
            {
                throw new NotImplementedException(ex.ToString());
            }
        }
コード例 #7
0
 private void DeleteItem(object sender, RoutedEventArgs e)
 {
     if (sender is Button b)
     {
         if (b.DataContext is IOrderItem item)
         {
             try
             {
                 Order currentOrder = (Order)this.DataContext;
                 currentOrder.Remove(item);
             }
             catch
             {
                 throw new System.Exception();
             }
         }
     }
     ReplaceScreen();
 }
コード例 #8
0
        private void TryAddEntree(Entree e)
        {
            if (entree == null)
            {
                Order order = (Order)DataContext;
                entree = e;
                if (!isForCombo)
                {
                    order.Add(entree);
                }
            }
            else
            {
                Order order = (Order)DataContext;
                if (!isForCombo)
                {
                    order.Remove(entree);
                }

                entree = e;
                if (!isForCombo)
                {
                    order.Add(entree);
                }
            }
            CustomizeEntree ce = new CustomizeEntree(entree, isForCombo);

            ce.DataContext = this.DataContext;
            NavigationService.Navigate(ce);

            /*
             * MainWindow mw = (MainWindow)Application.Current.MainWindow;
             * mw.OrderList.OrderItems.SelectedItem = entree;
             *
             * NavigationService.Navigate(new MenuCategorySelection());
             */
        }
コード例 #9
0
 private void RemoveItem(object sender, RoutedEventArgs e)
 {
     order.Remove((IOrderItem)ordersListBox.SelectedItem);
 }
コード例 #10
0
 /// <summary>
 /// removes item from Order named price
 /// </summary>
 /// <param name="item">item</param>
 public void Remove(IOrderItem item)
 {
     price.Remove(price[itemsListView.SelectedIndex]);
 }
コード例 #11
0
        /// <summary>
        /// Listener for removing an item from order
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnRemoveClick(object sender, RoutedEventArgs e)
        {
            IOrderItem item = listView.SelectedItem as IOrderItem;

            order.Remove(item);
        }