private void PokerClientForm_Load(object sender, EventArgs e) { ViewModel_Table vm_table = new ViewModel_Table(); View_Table v_table = new View_Table(vm_table); this.Dock = DockStyle.Fill; this.AutoSize = false; v_table.Dock = DockStyle.Fill; v_table.AutoSize = false; this.Controls.Add(v_table); }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { if (e.Action == TreeViewAction.Unknown) { return; } ViewModel_Table vm = (ViewModel_Table)e.Node.Tag; ViewModel_Table latest = _casinoModel.GetLatest(vm); if (vm == null) { return; } SetDetailPanel(latest.TableNo); }
private void SetDetailPanel(string tableno) { this.Invoke((MethodInvoker) delegate { //vm.UserName = this.UserName; View_Table vt = GetViewTable(tableno); if (_currentViewTable != null) { // _currentViewTable.Visible = false; } _currentViewTable = vt; _currentViewTable.Visible = true; _currentViewTable.Invalidate(); _currentViewTable.Update(); _currentViewTable.repaint(); _detailPanelModel = _casinoModel.GetVMTable(tableno); }); }
public void TableUpdateMessage(Poker.Shared.Message message) { if (message.MessageType == MessageType.TableUpdate) { ViewModel_Table vm_table = JsonConvert.DeserializeObject <ViewModel_Table>(message.Content); vm_table.UserName = this.UserName; vm_table.UserServices = this._casinoModel.UserServices; if (_casinoModel != null) { _casinoModel.Replace(vm_table); } Console.WriteLine("Recevied table update message for TableNo -- " + vm_table.TableNo); if ((_detailPanelModel != null) && (_detailPanelModel.TableNo == vm_table.TableNo)) { SetDetailPanel(vm_table.TableNo); } else { SetDetailPanel(vm_table.TableNo); } } }
private View_Table GetViewTable(string tableno) { View_Table vt; ViewModel_Table vm = _casinoModel.GetVMTable(tableno); vm.UserName = this.UserName; vm.UserServices = _casinoModel.UserServices; if (this._cache_ViewTables.ContainsKey(tableno)) { vt = _cache_ViewTables[tableno]; vt.SetViewModel(vm); } else { 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.Visible = false; vt.Height = splitContainer1.Panel2.Height; vt.Width = splitContainer1.Panel2.Width; //splitContainer1.Invoke(new Action(() => splitContainer1.Panel2.Controls.Add(vt))); _cache_ViewTables[tableno] = vt; AddToScreen(vt); } return(vt); }
public void SetViewModel(ViewModel_Table vm) { _vm_table.CopyFrom(vm); }
public View_Table(ViewModel_Table vm_table) { _vm_table = vm_table; this.DoubleBuffered = true; InitializeComponent(); }