private void AddOrderEvent(object sender, RoutedEventArgs e) { if (_orderList == null) { _orderList = new List<Business.UserOrder>(); } OrderSetting setting = new OrderSetting(); if (setting.ShowDialog() == true) { int hour = setting.Order_Hour; int minu = setting.Order_Minu; Business.UserOrder temp = new Business.UserOrder(hour, minu); _orderList.Add(temp); Refresh(); } }
private void MoveDown(Object sender, RoutedEventArgs e) { Business.UserOrder orderToSwap = null; for (int i = 0; i < OrderAction.Children.Count; i++) { if ((OrderAction.Children[i] as UserOrder).IsSelected) { orderToSwap = (OrderAction.Children[i] as UserOrder).MyOrder; break; } } if (orderToSwap != null) { for (int i = 0; i < _orderList.Count(); i++) { if (_orderList[i] == orderToSwap && i != 0) { Business.UserOrder orderTemp = new Business.UserOrder(_orderList[i + 1].Hour, _orderList[i + 1].Minute); _orderList[i + 1] = orderToSwap; _orderList[i] = orderTemp; Refresh(); break; } } } }