//private void SetDetailPanelOld(ViewModel_Table vm) //{ // vm.UserName = this.UserName; // View_Table vt = new View_Table(vm); // vt.JoinedTableEvent += Vt_JoinedTableEvent; // vt.ReceiveBetEvent += Vt_ReceiveBetEvent; // lock (this.CardEvent) // { // this.CardEvent[vm.TableNo] = new Action<Shared.Message>(vt.ProcessMessage); // } // lock(this.BetEvent) // { // this.BetEvent[vm.TableNo] = new Action<Shared.Message>(vt.ProcessMessage); // } // vt.SuspendLayout(); // vt.Height = splitContainer1.Panel2.Height; // vt.Width = splitContainer1.Panel2.Width; // splitContainer1.Invoke(new Action(() => splitContainer1.Panel2.Controls.Clear())); // splitContainer1.Invoke(new Action(() => splitContainer1.Panel2.Controls.Add(vt))); // vt.PerformLayout(); // _detailPanelModel = vm; // //_cache_ViewTables[vm.TableNo] = vt; //} private void Vt_JoinedTableEvent(string TableNo, short SeatNo, decimal ChipCounts) { if (JoinedTableEvent != null) { JoinedTableEvent.Invoke(TableNo, SeatNo, ChipCounts); } }
private void btnJoinLeave_Click(object sender, EventArgs e) {// this button click flips the Joined boolean property. if (_vm_seat.Joined) { _vm_seat.Joined = false; this.labelChipsCount.Text = "Empty"; // this.btnJoinLeave.Text = "Join"; // Leaving the table if (JoinedTableEvent != null) { JoinedTableEvent.Invoke(this._vm_seat.TableNo, this._vm_seat.SeatNo, -1); // sending negative chipcount to indicate leaving } } else { ViewModel_SelectMoney x = new ViewModel_SelectMoney(); x.TotalMoney = this._vm_seat.UserServices.GetPlayerProfile(this._vm_seat.CurrentUserName).TotalMoneyAvailable; x.AvailableMoney = x.TotalMoney - this._vm_seat.UserServices.GetPlayerProfile(this._vm_seat.CurrentUserName).MoneyInPlay; decimal selectedmoney = 0; using (Dialogs.AddChipsToTable x1 = new Dialogs.AddChipsToTable(x)) { x1.StartPosition = FormStartPosition.Manual; x1.ShowInTaskbar = false; x1.Location = this.Parent.PointToScreen(Point.Empty); x1.MaximizeBox = false; x1.MinimizeBox = false; DialogResult result = x1.ShowDialog(this); if (result == DialogResult.Cancel) { return; } else { selectedmoney = x1.getModel().SelectedMoney; } } _vm_seat.Joined = true; this.labelChipsCount.Text = this._vm_seat.CurrentUserName; // this.btnJoinLeave.Text = "Leave"; if (JoinedTableEvent != null) { JoinedTableEvent.Invoke(this._vm_seat.TableNo, this._vm_seat.SeatNo, selectedmoney); } } }