Example #1
0
        public void start(ViewModel_BetCollection vm, ManualResetEvent sync)
        {
            _vm        = vm;
            multiplier = 1;
            multiplier = _vm.CurrentBet < 1 ? 100 : 1;

            //this.FormBorderStyle = FormBorderStyle.None;
            //this.MaximizeBox = false;
            //this.MinimizeBox = false;
            // Remove the control box so the form will only display client area.
            //this.ControlBox = false;
            sync1 = sync;
            init();
        }
        public void OnReceiveRequestBet(Shared.Message m)
        {
            if (MySeatNo > 0)
            {
                // Need to change this to assign to the view model of the seat rather than the view of the seat.
                //Dict_View_Seats[MySeatNo].SimulateRequestBet(m.Content);
                vm_bc = new ViewModel_BetCollection();
                vm_bc.AvailableMoney = _vm_table.get_VM_Seat(MySeatNo).ChipCounts;
                string[] arr         = m.Content.Split(':');
                string   tableno     = arr[0];
                decimal  potsize     = Convert.ToDecimal(arr[1]);
                decimal  postedbet   = Convert.ToDecimal(arr[2]);
                decimal  currentbet  = Convert.ToDecimal(arr[3]);
                decimal  maxraisebet = Convert.ToDecimal(arr[4]);
                decimal  minbet      = this._vm_table.getBigBlindAmount();
                string   gameStage   = arr[5];

                vm_bc.PostedBet     = postedbet;
                vm_bc.CurrentBet    = currentbet;
                vm_bc.PotValue      = potsize;
                vm_bc.MinBetAllowed = Math.Max(minbet, currentbet - postedbet);
                vm_bc.UserName      = this.UserName;
                decimal          betmade = 0;
                ManualResetEvent evt1    = new ManualResetEvent(false);

                Task taskA = Task.Factory.StartNew(() =>
                {
                    this.Invoke((MethodInvoker) delegate
                    {
                        this.lPotValue.Text = "Pot = " + potsize.ToString();
                        //using (Dialogs.BetCollectorControl x1 = new Dialogs.BetCollectorControl(vm_bc))
                        //{
                        //    x1.StartPosition = FormStartPosition.Manual;
                        //    x1.ShowInTaskbar = false;
                        //    x1.Location = this.PointToScreen(Point.Empty);
                        //    x1.MaximizeBox = false;
                        //    x1.MinimizeBox = false;
                        //    DialogResult result = x1.ShowDialog(this);

                        //    if (result == DialogResult.Cancel)
                        //        betmade = -1;
                        //    else
                        //        betmade = x1.getModel().BetChoosen;
                        //}
                        betctrl.Visible = true;
                        betctrl.start(vm_bc, evt1);
                        betctrl.BringToFront();
                        //this.Controls.Remove(betctrl);
                    });
                    evt1.WaitOne();
                    //betmade = vm_bc.BetChoosen;
                    betmade = betctrl.getModel().BetChoosen;
                    this.Invoke((MethodInvoker) delegate
                    {
                        betctrl.Visible = false;
                    });
                    this.ReceiveBetEvent.Invoke(this._vm_table.TableNo, betmade, gameStage);
                    Console.WriteLine("OnReceiveRequestBet " + m.Content);
                });
                //taskA.Wait();
            }

            //Console.WriteLine("OnReceiveRequestBet " + m.Content);
        }