public void GetRowsIndex() { RangeRegion region = new RangeRegion(); region.Add(new Range(0, 0, 0, 0)); region.Add(new Range(2, 2, 2, 2)); int[] indexes = region.GetRowsIndex(); Assert.AreEqual(2, indexes.Length); Assert.AreEqual(0, indexes[0]); Assert.AreEqual(2, indexes[1]); }
public void GetRowsIndex_Performance() { // this test, sadly, tests nothing // remove it RangeRegion region = new RangeRegion(new Range(0, 0, 10000, 5000)); using (IPerformanceCounter counter = new PerformanceCounter()) { region.GetRowsIndex(); Console.WriteLine(string.Format( "Test executed in {0} ms", counter.GetMilisec())); } }
private void OnBoxesRemove(object sender, EventArgs e) { RangeRegion region = gridContent.Selection.GetSelectionRegion(); int[] indexes = region.GetRowsIndex(); // no selection -> exit if (indexes.Length == 0) { return; } Items.RemoveAt(indexes[0] - 1); FillGridContent(); OnCompute(sender, e); }
/// <summary> /// 活动剪切 /// </summary> private void ActionCut() { RangeRegion region = gridSource.Selection.GetSelectionRegion(); int[] index = region.GetRowsIndex(); if (index.Length == 0) { return; } clipBoardData = new List <ActionBase>(); foreach (var i in index) { clipBoardData.Add(DataSource[i - 1]); } }