public BetTreeNodeModel AddChild(BetTreeModel tree, BetTreeNodeModel parent) { HoldemHandRound round = parent.Snapshot.NextPlayer == null ? (HoldemHandRound)((int)parent.Snapshot.Round) + 1 : parent.Snapshot.Round; int? player = parent.Snapshot.NextPlayer == null ? parent.Snapshot.GetNextRoundStart() : parent.Snapshot.NextPlayer; BetTreeNodeModel model; switch (round) { case HoldemHandRound.PreFlop: model = AddPreflopStandard(parent, round, (int)player); break; case HoldemHandRound.Flop: case HoldemHandRound.Turn: case HoldemHandRound.River: model = AddPostflopStandard(parent, round, (int)player); break; default: model = AddShowdownStandard(parent); break; } parent.AddChild(model); model.AddNode += tree.OnAddNode; model.EditNode += tree.OnEditNode; model.DeleteNode += tree.OnDeleteNode; model.ShowWizard += tree.OnShowWizard; return model; }
public PartialWizard GenerateWizard(BetTreeModel tree, BetTreeNodeService service) { Type type = System.Type.GetType(Class); PartialWizard wizard = Activator.CreateInstance(type) as PartialWizard; wizard.Tree = tree; wizard.Service = service; return wizard; }
public PartialGenerator(TreePartialMeta meta, BetTreeModel tree, BetTreeNodeModel node, BetTreeNodeService service) { this.Meta = meta; this.Wizard = tree.GeneratePartialWizard(meta); this.Tree = tree; this.Node = node; this.Service = service; SetContainer(); }
public BetTreeNodeModel(BetTreeModel tree, BetTreeNodeDisplay display, BetTreeNodeStyle style, HandSnapshotModel snapshot, BetTreeNodeModel parent, bool isDynamic) { this.Tree = tree; this.DisplayModel = display; this.StyleModel = style; this._parentSnapshot = snapshot; this.Snapshot = snapshot; this.Parent = parent; this.IsDynamic = isDynamic; this.Result = new BetTreeNodeResults(snapshot.Stacks.Length); this.Children = new ObservableCollection<BetTreeNodeModel>(); this.CanRemove = IsFixed() ? Visibility.Collapsed : Visibility.Visible; this.Info = new BetTreeNodeInfoModel(this, this.Data is ManualResultsModel); }
public BetTreeNodeModel(BetTreeModel tree, BetTreeNodeDisplay display, BetTreeNodeStyle style, HandSnapshotModel snapshot, BetTreeNodeModel parent) : this(tree, display, style, snapshot, parent, false) { }
public BetTreeNodeModel(BetTreeModel tree, BetTreeNodeDisplay display, BetTreeNodeStyle style, HandSnapshotModel snapshot) : this(tree, display, style, snapshot, null) { }
protected void SetModel(object sender, DependencyPropertyChangedEventArgs e) { _model = this.DataContext as BetTreeModel; if (_model == null) return; _model.NodeAdded += NodeAdded; _model.NodeDeleted += NodeDeleted; }
protected void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { Controller = this.DataContext as BetTreeModel; if (Controller == null) return; Controller.ShowWizard += ShowPartialDialog; Controller.EditNode += EditNode; Controller.TreeInitialised += TreeInitialised; Controller.Calculate += OnCalculate; TreeInitialised(); Controller.RefreshTree(); }
public BetTreeNodeModel GetRootNode(BetTreeModel tree, HandSnapshotModel snapshot) { BetTreeNodeStyle style = _roundStyles[snapshot.Round]; BetTreeNodeModel model = new BetTreeNodeModel(tree, _nodeStyles[typeof(RootNodeDataModel)], style, snapshot); ObservableCollection<BetTreeDataNodeMeta> metaList = new ObservableCollection<BetTreeDataNodeMeta>(); metaList.Add(new BetTreeDataNodeMeta(ROOT_NODE_META, new RootNodeDataModel())); model.AllowedNodeTypes = metaList; model.Meta = ROOT_NODE_META; model.AddNode += tree.OnAddNode; model.EditNode += tree.OnEditNode; model.DeleteNode += tree.OnDeleteNode; model.ShowWizard += tree.OnShowWizard; return model; }