private void UpdateAvailableObjects() { switch (PatchOn) { case PatchOnOptions.Collection: ApplicationModel.Current.Server.Value.SelectedDatabase.Value.AsyncDatabaseCommands.GetTermsCount( CollectionsIndex, "Tag", "", 100) .ContinueOnSuccessInTheUIThread(collections => { AvailableObjects.Clear(); AvailableObjects.AddRange(collections.OrderByDescending(x => x.Count) .Where(x => x.Count > 0) .Select(col => col.Name).ToList()); SelectedItem = AvailableObjects.FirstOrDefault(); }); break; case PatchOnOptions.Index: ApplicationModel.Database.Value.AsyncDatabaseCommands.GetIndexNamesAsync(0, 500) .ContinueOnSuccessInTheUIThread(indexes => { AvailableObjects.Clear(); AvailableObjects.AddRange(indexes.OrderBy(x => x)); SelectedItem = AvailableObjects.FirstOrDefault(); }); break; } }
//=============================== FUNCTIONALITY ==============================// private void CreateNewMap(object sender, RoutedEventArgs args) { ClearMap(); UpdateSelectorComboBox(ResourceType.Terrain); AvailableObjects.Clear(); _admin = new AdminRestrictionsWindow(this); Grids["Admin"] = CreateAdminTab(); ShowGameBoard(); }