void Objects_PayPriceReply(object sender, PayPriceReplyEventArgs e) { if (e.ObjectID != target) return; if (InvokeRequired) { BeginInvoke(new MethodInvoker(() => Objects_PayPriceReply(sender, e))); return; } switch (e.DefaultPrice) { case (int)PayPriceType.Default: txtAmount.Text = string.Empty; break; case (int)PayPriceType.Hide: txtAmount.Visible = false; break; default: txtAmount.Text = e.DefaultPrice.ToString(); break; } for (int i = 0; i < buttons.Length; i++) { switch (e.ButtonPrices[i]) { case (int)PayPriceType.Default: buttons[i].Text = string.Format("L${0}", defaultAmounts[i]); buttons[i].Tag = defaultAmounts[i]; break; case (int)PayPriceType.Hide: buttons[i].Visible = false; break; default: buttons[i].Text = string.Format("L${0}", e.ButtonPrices[i]); buttons[i].Tag = e.ButtonPrices[i]; break; } } }
///<summary>Raises the PayPriceReply Event</summary> /// <param name="e">A PayPriceReplyEventArgs object containing /// the data sent from the simulator</param> protected virtual void OnPayPriceReply(PayPriceReplyEventArgs e) { EventHandler<PayPriceReplyEventArgs> handler = m_PayPriceReply; if (handler != null) handler(this, e); }
private void PayPrice(object sender, PayPriceReplyEventArgs e) { if (e.ObjectID != target) return; if (InvokeRequired) { BeginInvoke(new MethodInvoker(delegate() { PayPrice(sender, e); })); return; } if (e.DefaultPrice > 0) { this.nudAmount.Value = (decimal)e.DefaultPrice; //SetNud(e.DefaultPrice); buyprice = e.DefaultPrice; btnPay.Text = "&Pay"; } else if (e.DefaultPrice == -1) { this.nudAmount.Value = (decimal)e.ButtonPrices[0]; //SetNud(e.ButtonPrices[0]); buyprice = e.ButtonPrices[0]; btnPay.Text = "&Pay"; } if (oprice != buyprice && buyprice != -1 & oprice != -1) { if (this.Prim.ClickAction == ClickAction.Buy || this.Prim.ClickAction == ClickAction.Pay) { label5.Text = "Buy Price: L$" + oprice; label5.Visible = true; } } }