示例#1
0
		public static Result Run(Window parent, int numSels, NEVariables variables)
		{
			var dialog = new LimitDialog(numSels, variables) { Owner = parent };
			if (!dialog.ShowDialog())
				return null;

			return dialog.result;
		}
示例#2
0
		void Command_Select_Limit(LimitDialog.Result result)
		{
			var variables = GetVariables();
			var firstSel = new NEExpression(result.FirstSel).EvaluateRow<int>(variables);
			var selMult = new NEExpression(result.SelMult).EvaluateRow<int>(variables);
			var numSels = new NEExpression(result.NumSels).EvaluateRow<int>(variables);

			IEnumerable<Range> retval = Selections;

			retval = retval.Skip(firstSel - 1);
			if (result.JoinSels)
				retval = retval.Batch(selMult).Select(batch => new Range(batch.Last().End, batch.First().Start));
			else
				retval = retval.EveryNth(selMult);
			retval = retval.Take(numSels);
			Selections.Replace(retval.ToList());
		}