コード例 #1
0
		protected void UpdateTransformersList()
		{
			DatabaseCommands.GetTransformersAsync(0, 256).ContinueOnSuccessInTheUIThread(transformers =>
			{
				Transformers.Clear();

				CleanGroup();

				if (string.IsNullOrWhiteSpace(SearchText.Value))
					Transformers = new ObservableCollection<TransformerDefinition>(transformers);

				else
				{
					Transformers = new ObservableCollection<TransformerDefinition>(transformers
						.Where(definition => definition.Name.IndexOf(SearchText.Value, StringComparison.InvariantCultureIgnoreCase) != -1));
					
				}

				foreach (var transformer in Transformers.OrderBy(definition => definition.Name))
				{
					var groupName = DetermineName(transformer);
					var groupItem =
						GroupedTransformers.FirstOrDefault(
							@group => string.Equals(@group.GroupName, groupName, StringComparison.OrdinalIgnoreCase));
					if (groupItem == null)
					{
						groupItem = new Group(groupName);
						GroupedTransformers.Add(groupItem);
					}

					groupItem.Items.Add(new TransformerItem { GroupName = groupName, Name = transformer.Name, Transformer = transformer });
				}

				OnPropertyChanged(() => GroupedTransformers);
				OnPropertyChanged(() => Transformers);
			});
		}
コード例 #2
0
ファイル: IndexesModel.cs プロジェクト: 925coder/ravendb
		private void UpdateGroupedIndexList(DatabaseStatistics statistics)
		{
			Indexes.Clear();
			if(string.IsNullOrWhiteSpace(SearchText.Value))
				Indexes.AddRange(statistics.Indexes.Where(stats => stats != null)
					.Select(stats => new IndexItem { Name = stats.Name, GroupName = GetIndexGroup(stats), IndexStats = stats }));
			else
				Indexes.AddRange(statistics.Indexes
					.Where(stats => stats != null && stats.Name.IndexOf(SearchText.Value, StringComparison.InvariantCultureIgnoreCase) != -1)
					.Select(stats => new IndexItem { Name = stats.Name, GroupName = GetIndexGroup(stats), IndexStats = stats }));
			
			CleanGroupIndexes();
			foreach (var indexItem in Indexes)
			{
				var groupItem = GroupedIndexes.FirstOrDefault(@group => string.Equals(@group.GroupName, indexItem.GroupName, StringComparison.OrdinalIgnoreCase));
				if (groupItem == null)
				{
					groupItem = new Group(indexItem.GroupName);
					GroupedIndexes.Add(groupItem);
				}

				groupItem.Items.Add(indexItem);
			}

			OnPropertyChanged(() => GroupedIndexes);
		}
コード例 #3
0
ファイル: IndexesModel.cs プロジェクト: robashton/ravendb
		private void UpdateGroupedIndexList(DatabaseStatistics statistics)
		{
			Indexes.Clear();
			Indexes.AddRange(statistics.Indexes.Select(stats => new IndexItem{Name = stats.Name, GroupName = GetIndexGroup(stats), IndexStats = stats}));
			
			CleanGroupIndexes();
			foreach (var indexItem in Indexes)
			{
				var groupItem = GroupedIndexes.FirstOrDefault(@group => string.Equals(@group.GroupName, indexItem.GroupName, StringComparison.OrdinalIgnoreCase));
				if (groupItem == null)
				{
					groupItem = new Group(indexItem.GroupName);
					GroupedIndexes.Add(groupItem);
				}

				groupItem.Items.Add(indexItem);
			}

			OnPropertyChanged(() => GroupedIndexes);
		}