void CreateNewOrder(Point position) { var selectedItem = (ListBoxItem)orderTypeListBox.SelectedItem; var orderTypeName = (string)selectedItem.Content; IOrder newOrder; switch (orderTypeName) { case "Attack": newOrder = new AttackOrder(0, 0); break; case "Guard": //newOrder = new GuardOrder(0, 0); break; case "Repair": //newOrder = new RepairOrder(0, 0); break; default: throw new Exception("Ordertype not expected: " + orderTypeName); } //action.Orders.Add(newOrder); }
void CreateNewOrder(Point position) { var selectedItem = (ListBoxItem) orderTypeListBox.SelectedItem; var orderTypeName = (string)selectedItem.Content; IOrder newOrder; switch (orderTypeName) { case "Move": newOrder = new MoveOrder(position.X, position.Y); break; case "Patrol": newOrder = new PatrolOrder(position.X, position.Y); break; case "Stop": newOrder = new StopOrder(); break; case "Fight": newOrder = new FightOrder(position.X, position.Y); break; case "Attack": newOrder = new AttackOrder(position.X, position.Y); break; case "Hold Position": newOrder = new MoveStateOrder(0); break; case "Maneuver": newOrder = new MoveStateOrder(1); break; case "Roam": newOrder = new MoveStateOrder(2); break; case "Hold Fire": newOrder = new FireStateOrder(0); break; case "Return Fire": newOrder = new FireStateOrder(1); break; case "Fire At Will": newOrder = new FireStateOrder(2); break; case "Enable Repeat Mode": newOrder = new RepeatOrder(1); break; case "Disable Repeat Mode": newOrder = new RepeatOrder(0); break; default: throw new Exception("Ordertype not expected: " + orderTypeName); } action.Orders.Add(newOrder); }