void PasteRows(GridViewBase view, BindingList <CopyPasteOutlookData> list) { if (view != null) { ArrayList arrayList = null; IDataObject dataObj = GetClipboardDataObject(); string format = typeof(ArrayList).FullName; if (dataObj != null && dataObj.GetDataPresent(format)) { positionsNewRowsList.Clear(); pasteWithoutAnimation = null; animation = true; StartPasteForCanCommands(); arrayList = dataObj.GetData(format) as ArrayList; object[] objectsForCopy = arrayList.ToArray(); int positionNewRow = view.FocusedRowHandle == DataControlBase.InvalidRowHandle ? 0 : view.Grid.GetListIndexByRowHandle(view.FocusedRowHandle) + 1; if (maxAnimationRows > objectsForCopy.Length) { PasteRowsWithAnimation(ref positionNewRow, view, list, objectsForCopy, 0, objectsForCopy.Length); } else { PasteRowsWithAnimation(ref positionNewRow, view, list, objectsForCopy, 0, maxAnimationRows); } pastingGrid = FocusedGrid; Dispatcher.BeginInvoke(new System.Action(AnimationRowsOfPasted), DispatcherPriority.Background); } } else { textEdit.Paste(); } }
void AssertGridsAndButtonState(FocusedGrid focusedGrid, bool copyBtn, bool cutBtn, bool pasteBtn, bool delBtn) { Assert.AreEqual(focusedGrid, CopyPasteModule.FocusedGrid); Assert.AreEqual(copyBtn, CopyPasteModule.CopyButton.IsEnabled); Assert.AreEqual(cutBtn, CopyPasteModule.CutButton.IsEnabled); Assert.AreEqual(pasteBtn, CopyPasteModule.PasteButton.IsEnabled); Assert.AreEqual(delBtn, CopyPasteModule.DeleteButton.IsEnabled); }
public static Unit Grid(FocusedGrid <bool> grid) { var i = 0; PrintGrid(grid, i); while (i <= 120) { i++; grid = grid.Extend(GameOfLifeCell); PrintGrid(grid, i); Thread.Sleep(1000); } return(unit); }
static void Main(string[] args) { var gr = from g in FocusedGrid <int> .Create(PentaDecathlon) from b in Some(g.Map(x => x == 1)) select b; gr.Match( Some: x => Grid(x), None: () => { Console.WriteLine("Invalid Grid"); return(unit); }); var xs = new Seq <int>(new[] { 0, 1, 2, 3, 4, 5 }); var ne = NonEmptyList <int> .Create(xs); ne.Match( Some: x => List(x), None: () => { Console.WriteLine("FAILED"); return(unit); }); }
void secondGrid_PreviewMouseDown(object sender, MouseButtonEventArgs e) { FocusedGrid = FocusedGrid.Second; }
void firstGrid_PreviewMouseDown(object sender, MouseButtonEventArgs e) { FocusedGrid = FocusedGrid.First; }
private static int CountLiveNeighbours(FocusedGrid <bool> grid) => neighbours.Map(x => grid.PeekS(x.Item1, x.Item2)) .Somes() .Where(x => x) .Count();
private static bool GameOfLifeCell(FocusedGrid <bool> grid) => grid.Extract() ? Seq(2, 3).Contains(CountLiveNeighbours(grid)) : CountLiveNeighbours(grid) == 3;