private void button5_Click(object sender, EventArgs e) { try { IOrder o = _market.GetUserPendingOrder(_user); if (o == null || o.OrderType != OrderOptionEnum.Buy) { return; } using (NewPrice np = new NewPrice(o.Wanted - o.Satisfied, (decimal)_market.SharePrice, false)) { np.ShowDialog(); if (np.newValue > 0) { _market.SuggestNewSharePrice((float)np.newValue, _user, o); } } } catch (SocketException exception) { Debug.WriteLine(exception.Message); } UpdateView(); }
private void button4_Click(object sender, EventArgs e) { try { if (numericUpDown2.Value <= 0) { return; } int howmany = (int)numericUpDown2.Value; int result = _market.BuyDiginotes(howmany, _user); if (result < numericUpDown2.Value) { using (NewPrice np = new NewPrice(howmany, howmany - result, (decimal)_market.SharePrice, false)) { np.ShowDialog(); if (np.newValue > 0) { _market.SuggestNewSharePrice((float)np.newValue, _user, false, howmany - result); } } } else { MessageBox.Show(@"Your have new diginotes!", @"Success", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } UpdateView(); } catch (SocketException exception) { ServerDown(exception); } }