/// <summary> /// Checks the responses of the popup forms /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void popupFormClear_Tick(object sender, EventArgs e) { for (int i = 0; i < popupForms.Count; i++) { PopupForm pf = popupForms[i]; if (pf.wasAccepted) { /*Get the trade from list of trades that matches trade id and accept offer*/ var trade = confirmationList.First(o => o.conf.ID == pf.tradeId); if (trade.account.AcceptConfirmation(trade.conf)) { Console.Beep(800, 100); trade.done = true; } } else if (pf.wasCancelled) { /*... decline offer*/ var trade = confirmationList.First(o => o.conf.ID == pf.tradeId); if (trade.account.DenyConfirmation(trade.conf)) { Console.Beep(800, 100); trade.done = true; } } /*Check if it just closed*/ /*User will have to approve the trade from main gui*/ if (pf.wasClosed) { popupForms.RemoveAt(i); } } }
/// <summary> /// Shows a popup form at bottom right side of screen /// </summary> /// <param name="head">Title text</param> /// <param name="body">Body text</param> private void DoPopup(Config.ConfirmationClass CC) { /*Find a good position on screen*/ Rectangle workingArea = Screen.GetWorkingArea(this); Point cPoint = new Point(workingArea.Right - 290, workingArea.Bottom - 110 - (popupForms.Count * 110)); /*Show form and add to list*/ PopupForm popupForm = new PopupForm(CC.conf.Description, CC.conf.ID, CC.account.AccountName, cPoint); popupForms.Add(popupForm); popupForm.Show(); }