private void ShowBuyQuery(PropertyListing property) { if (this.Dispatcher.CheckAccess()) { myBoard.Dice.ToggleEndTurnEnabled(true); if (property.IsOwned) { string msg = localPlayer.PlayerGUID + Message.DELIMETER + property.Owner + Message.DELIMETER + property.CalculateRent(); comm.Send(new Message(Message.Type.Rent, Encoding.UTF8.GetBytes(msg)).ToBytes()); PayRent(localPlayer.PlayerGUID, property.Owner, property.CalculateRent()); return; } if (property.Cost > localPlayer.Money) { MessageBox.Show("You cannot afford this property"); return; } if (property.Cost == 0) { return; } BuyQuery bq = new BuyQuery(this, property); bq.Result += new EventHandler <BuyPropertyEventArgs>(bq_Result); bq.ShowDialog(); } else { this.Dispatcher.BeginInvoke(new Action <PropertyListing>(ShowBuyQuery), new object[] { property }); } }
public BuyQuery(Window owner, PropertyListing property) { InitializeComponent(); index = property.Location; this.Owner = owner; PropertyName.Text = property.Name; TitleBorder.Background = property.ColorGroup; Rent.Text = "$" + property.CalculateRent(); Rent1.Text = property.House1 == 0 ? "N/A" : "$" + property.House1; Rent2.Text = property.House2 == 0 ? "N/A" : "$" + property.House2; Rent3.Text = property.House3 == 0 ? "N/A" : "$" + property.House3; Rent4.Text = property.House4 == 0 ? "N/A" : "$" + property.House4; RentH.Text = property.Hotel == 0 ? "N/A" : "$" + property.Hotel; CostH.Text = property.HouseCost == 0 ? "N/A" : "$" + property.HouseCost; CostHo.Text = property.HouseCost == 0 ? "N/A" : "$" + property.HouseCost; Mortgage.Text = property.Mortgage == 0 ? "N/A" : "$" + property.Mortgage; PurchaseText.Text = "Would you like to purchase " + property.Name + " for $" + property.Cost + "?"; }
private void ShowBuyQuery(PropertyListing property) { if (this.Dispatcher.CheckAccess()) { myBoard.Dice.ToggleEndTurnEnabled(true); if (property.IsOwned) { string msg = localPlayer.PlayerGUID + Message.DELIMETER + property.Owner + Message.DELIMETER + property.CalculateRent(); comm.Send(new Message(Message.Type.Rent, Encoding.UTF8.GetBytes(msg)).ToBytes()); PayRent(localPlayer.PlayerGUID, property.Owner, property.CalculateRent()); return; } if (property.Cost > localPlayer.Money) { MessageBox.Show("You cannot afford this property"); return; } if(property.Cost == 0) { return; } BuyQuery bq = new BuyQuery(this, property); bq.Result += new EventHandler<BuyPropertyEventArgs>(bq_Result); bq.ShowDialog(); } else this.Dispatcher.BeginInvoke(new Action<PropertyListing>(ShowBuyQuery), new object[] { property }); }