private void RefreshSearch(bool isAppending)
 {
     if (isAppending)
     {
         foreach (MapItemVM mapItemVm in this.MapSearchResults.ToList <MapItemVM>())
         {
             if (mapItemVm.MapName.IndexOf(this._searchText, StringComparison.OrdinalIgnoreCase) < 0)
             {
                 this.MapSearchResults.Remove(mapItemVm);
             }
             else
             {
                 mapItemVm.UpdateSearchedText(this._searchText);
             }
         }
     }
     else
     {
         this.MapSearchResults.Clear();
         foreach (MapItemVM availableMap in this._availableMaps)
         {
             MapItemVM map = availableMap;
             if (map.MapName.IndexOf(this._searchText, StringComparison.OrdinalIgnoreCase) >= 0 && !this.MapSearchResults.Any <MapItemVM>((Func <MapItemVM, bool>)(m => m.MapName == map.MapName)))
             {
                 this.MapSearchResults.Add(map);
             }
         }
         this._availableMaps.ForEach((Action <MapItemVM>)(m => m.UpdateSearchedText(this._searchText)));
     }
 }
 private void RefreshSearch(bool isAppending)
 {
     if (isAppending)
     {
         foreach (MapItemVM mapItemVm in MapSearchResults.ToList())
         {
             if (mapItemVm.MapName.IndexOf(_searchText, StringComparison.OrdinalIgnoreCase) < 0)
             {
                 MapSearchResults.Remove(mapItemVm);
             }
             else
             {
                 mapItemVm.UpdateSearchedText(_searchText);
             }
         }
     }
     else
     {
         MapSearchResults.Clear();
         foreach (MapItemVM availableMap in _availableMaps)
         {
             MapItemVM map = availableMap;
             if (map.MapName.IndexOf(_searchText, StringComparison.OrdinalIgnoreCase) >= 0 && MapSearchResults.All(m => m.MapName != map.MapName))
             {
                 MapSearchResults.Add(map);
             }
         }
     }
 }
        private void PrepareMapLists()
        {
            this._battleMaps.Clear();
            this._villageMaps.Clear();
            this._siegeMaps.Clear();
            foreach (CustomBattleSceneData customBattleSceneData in CustomGame.Current.CustomBattleScenes.ToList <CustomBattleSceneData>())
            {
                MapItemVM mapItemVm = new MapItemVM(customBattleSceneData.Name.ToString(), customBattleSceneData.SceneID, new Action <MapItemVM>(this.OnMapSelection));
                if (customBattleSceneData.IsVillageMap)
                {
                    this._villageMaps.Add(mapItemVm);
                }
                else if (customBattleSceneData.IsSiegeMap)
                {
                    this._siegeMaps.Add(mapItemVm);
                }
                else
                {
                    this._battleMaps.Add(mapItemVm);
                }
            }
            Comparer <MapItemVM> comparer = Comparer <MapItemVM> .Create((Comparison <MapItemVM>)((x, y) => - x.MapName.CompareTo(y.MapName)));

            this._battleMaps.Sort((IComparer <MapItemVM>)comparer);
            this._villageMaps.Sort((IComparer <MapItemVM>)comparer);
            this._siegeMaps.Sort((IComparer <MapItemVM>)comparer);
        }
        private void PrepareMapLists()
        {
            _battleMaps.Clear();
            _villageMaps.Clear();
            _siegeMaps.Clear();
            foreach (var sceneData in _scenes)
            {
                MapItemVM mapItemVm = new MapItemVM(sceneData.Name.ToString(), sceneData.Id, OnMapSelection);
                if (sceneData.IsVillageMap)
                {
                    _villageMaps.Add(mapItemVm);
                }
                else if (sceneData.IsSiegeMap)
                {
                    _siegeMaps.Add(mapItemVm);
                }
                else
                {
                    _battleMaps.Add(mapItemVm);
                }
            }
            Comparer <MapItemVM> comparer = Comparer <MapItemVM> .Create((x, y) => - x.MapName.CompareTo(y.MapName));

            _battleMaps.Sort(comparer);
            _villageMaps.Sort(comparer);
            _siegeMaps.Sort(comparer);
        }
 private void OnMapSelection(MapItemVM item)
 {
     this.SelectedMap = item;
     this.SearchText  = item.MapName;
 }