private void Context_AddBoatPosition(object sender, RoutedEventArgs e)
        {
            FleetUnit unit = (sender as MenuItem).DataContext as FleetUnit;

            SimpleDropdownSelect select = new SimpleDropdownSelect(
                CommonData.boatRoles.ConvertAll <string>((r) => {
                return(r.name);
            }));

            select.ReturnSelected += (index) => {
                MessageRouter.Instance.Send(
                    MessageRouter.Service.Ops,
                    new ANWI.Messaging.Ops.AddPosition()
                {
                    opUUID   = opUUID,
                    unitUUID = unit.uuid,
                    roleID   = new List <int>()
                    {
                        CommonData.boatRoles[index].id
                    }
                },
                    null);
            };
            select.ShowDialog();
        }
예제 #2
0
        /// <summary>
        /// Adds an embarked hull to this ship
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button_AddEquip_Click(object sender, RoutedEventArgs e)
        {
            if (Tabs_Embarked.SelectedIndex != 1)
            {
                return;
            }

            SimpleDropdownSelect select
                = new SimpleDropdownSelect(
                      CommonData.smallHulls.ConvertAll <string>((h) => {
                return(h.name);
            }));

            select.ReturnSelected += (i) => {
                AddEquipment(currentVessel.id, i);
            };
            select.ShowDialog();
        }
예제 #3
0
        /// <summary>
        /// Opens the change ship status window
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button_EditStatus_Click(object sender, RoutedEventArgs e)
        {
            List <string> statuses = new List <string>()
            {
                VesselStatus.ACTIVE.ToFriendlyString(),
                          VesselStatus.DESTROYED.ToFriendlyString(),
                          VesselStatus.DESTROYED_WAITING_REPLACEMENT.ToFriendlyString(),
                          VesselStatus.DRYDOCKED.ToFriendlyString(),
                          VesselStatus.DECOMMISSIONED.ToFriendlyString()
            };

            SimpleDropdownSelect select = new SimpleDropdownSelect(statuses);

            select.ReturnSelected += (s) => {
                UpdateShipStatus(currentVessel.id, (VesselStatus)s);
            };
            select.ShowDialog();
        }
        private void Context_AddWingMember(object sender, RoutedEventArgs e)
        {
            FleetUnit wing = (sender as MenuItem).DataContext as FleetUnit;

            SimpleDropdownSelect select = new SimpleDropdownSelect(
                CommonData.smallHulls.ConvertAll <string>((h) => {
                return(h.name);
            }));

            select.ReturnSelected += (index) => {
                MessageRouter.Instance.Send(
                    MessageRouter.Service.Ops,
                    new ANWI.Messaging.Ops.AddOOBUnit()
                {
                    opUUID   = opUUID,
                    wingUUID = wing.uuid,
                    type     = ANWI.Messaging.Ops.AddOOBUnit.Type.Boat,
                    hullId   = CommonData.smallHulls[index].id
                },
                    null);
            };
            select.ShowDialog();
        }