Esempio n. 1
0
        private static SelectionType TranslateSelectionType(MissionTreeSelection treeSelection)
        {
            List <MissionAsset> items = treeSelection.properties;

            MissionTreeView.ItemType itemType = treeSelection.itemType;

            if (items == null || items.Count == 0)
            {
                return(SelectionType.None);
            }

            SelectionType retn = items.Count > 1 ? SelectionType.Multiple : SelectionType.None;

            switch (itemType)
            {
            case MissionTreeView.ItemType.Faction:
                return(retn | SelectionType.Faction);

            case MissionTreeView.ItemType.FlightGroup:
                return(retn | SelectionType.FlightGroup);

            case MissionTreeView.ItemType.Entity:
                return(retn | SelectionType.Entity);

            case MissionTreeView.ItemType.Root:
                return(SelectionType.None);

            default:
                throw new ArgumentOutOfRangeException(nameof(itemType), itemType, null);
            }
        }
Esempio n. 2
0
 private void OnSelectionChanged(MissionTreeSelection treeSelection)
 {
     //todo currently ignoring multiselect
     selectionType = TranslateSelectionType(treeSelection);
     selectedAsset = treeSelection.properties?[0];
     if (selectedAsset == null)
     {
         reflectedSelection = null;
     }
     else
     {
         reflectedSelection = new ReflectedObject(selectedAsset);
     }
 }