private void MonitorButton_Click(object sender, EventArgs e) { var currency = allCurrencies[CurrencyList.SelectedItem.ToString()]; var newCrypto = new Monitored(); var found = false; newCrypto.crypto = currency; newCrypto.maximumValue = Convert.ToDouble(Maximum.Text); newCrypto.minimumValue = Convert.ToDouble(Minimum.Text); foreach (Monitored watched in watchedCurrencies) { if (watched.crypto == newCrypto.crypto) //updates values of existing watched crypto { watched.maximumValue = newCrypto.maximumValue; watched.minimumValue = newCrypto.minimumValue; found = true; break; } } if (found == false) //if a new crypto to be added to list, adds to list and to combobox { watchedCurrencies.Add(newCrypto); MonitorBox.Items.Add(newCrypto.crypto.Name); } }
private void AboveMax(Monitored currency) { email.Subject = currency.crypto.Name + " is above your maximum of " + currency.maximumValue.ToString(); client.Send(email); return; }
private void BelowMin(Monitored currency) { email.Subject = currency.crypto.Name + " is below your minimum of " + currency.minimumValue.ToString(); client.Send(email); return; }