Пример #1
0
		public static Result Run(Window parent)
		{
			var dialog = new CountDialog { Owner = parent };
			return dialog.ShowDialog() ? dialog.result : null;
		}
Пример #2
0
		void Command_Select_ByCount(CountDialog.Result result)
		{
			var strs = Selections.Select((range, index) => Tuple.Create(GetString(range), index)).ToList();
			var counts = new Dictionary<string, int>(result.CaseSensitive ? StringComparer.Ordinal : StringComparer.OrdinalIgnoreCase);
			foreach (var tuple in strs)
			{
				if (!counts.ContainsKey(tuple.Item1))
					counts[tuple.Item1] = 0;
				++counts[tuple.Item1];
			}
			strs = strs.Where(tuple => (counts[tuple.Item1] >= result.MinCount) && (counts[tuple.Item1] <= result.MaxCount)).ToList();
			Selections.Replace(strs.Select(tuple => Selections[tuple.Item2]).ToList());
		}