/// <summary> /// Initialise /// </summary> public TreeGrid() { InitializeComponent(); this.DataContextChanged += SetModel; SetModel(null, new DependencyPropertyChangedEventArgs()); _lines = new List<TreeGridLine>(); _items = new List<TreeGridItem>(); _grids = new Dictionary<TreeGridItem, TreeGridStart>(); _canvases = new Dictionary<HoldemHandRound, Canvas>(); _canvases[HoldemHandRound.PreFlop] = PreflopCanvas; _canvases[HoldemHandRound.Flop] = FlopCanvas; _canvases[HoldemHandRound.Turn] = TurnCanvas; _canvases[HoldemHandRound.River] = RiverCanvas; _columns = new Dictionary<Canvas, ColumnDefinition>(); _columns[PreflopCanvas] = Preflop; _columns[FlopCanvas] = Flop; _columns[TurnCanvas] = Turn; _columns[RiverCanvas] = River; StartGrid = new TreeGridStart(); PreflopCanvas.Children.Add(StartGrid); }
private void SetGridStartForRound(HoldemHandRound round) { ((Canvas)StartGrid.Parent).Children.Remove(StartGrid); StartGrid = new TreeGridStart(); _canvases[round].Children.Add(StartGrid); }
/// <summary> /// /// </summary> /// <param name="node"></param> /// <param name="parentDisplay"></param> /// <returns></returns> protected TreeGridStart GetNewGridStart(BetTreeNodeModel node, TreeGridItem parentDisplay) { TreeGridStart start = new TreeGridStart(); start.LinkedItem = parentDisplay; start.LayoutUpdated += this.RefreshCanvas; Canvas canvas = _canvases[node.Snapshot.Round]; canvas.Children.Add(start); _grids[parentDisplay] = start; return start; }
protected TreeGridStart GetGrid(TreeGridItem item, TreeGridStart defaultGrid) { if (item != null && _grids.ContainsKey(item)) return _grids[item]; else return defaultGrid; }