示例#1
0
        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;
        }
示例#2
0
 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;
 }
示例#3
0
        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();
        }
示例#4
0
        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);
        }
示例#5
0
 public BetTreeNodeModel(BetTreeModel tree, BetTreeNodeDisplay display, BetTreeNodeStyle style, HandSnapshotModel snapshot, BetTreeNodeModel parent)
     : this(tree, display, style, snapshot, parent, false)
 {
 }
示例#6
0
 public BetTreeNodeModel(BetTreeModel tree, BetTreeNodeDisplay display, BetTreeNodeStyle style, HandSnapshotModel snapshot)
     : this(tree, display, style, snapshot, null)
 {
 }
示例#7
0
        protected void SetModel(object sender, DependencyPropertyChangedEventArgs e)
        {
            _model = this.DataContext as BetTreeModel;
            if (_model == null) return;

            _model.NodeAdded += NodeAdded;
            _model.NodeDeleted += NodeDeleted;
        }
示例#8
0
        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();
        }
示例#9
0
        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;
        }