private void Alerts_Load(object sender, EventArgs e) { AlertService.Load(); cmbCoins.DataSource = _coins.OrderBy(c => c.ShortName).Select(c => c.ShortName).ToList(); txtPrice.Text = txtCurrent.Text = _coins.Where(c => c.ShortName.ExtEquals(cmbCoins.Text)).Select(c => c.Price).FirstOrDefault().ToString(); cmbOperators.DataSource = Enum.GetValues(typeof(Constants.Operators)) .Cast <Enum>() .Select(value => new { (Attribute.GetCustomAttribute(value.GetType().GetField(value.ToString()), typeof(DescriptionAttribute)) as DescriptionAttribute).Description, value }) .OrderBy(d => d.Description) .ToList(); cmbReceiveType.DataSource = Enum.GetValues(typeof(Constants.Types)) .Cast <Enum>() .Select(value => new { (Attribute.GetCustomAttribute(value.GetType().GetField(value.ToString()), typeof(DescriptionAttribute)) as DescriptionAttribute).Description, value }) .OrderBy(d => d.Description) .ToList(); //Setup inputs cbDeleteAlerts.Checked = UserConfigService.DeleteAlerts; txtSendAddress.Text = AlertService.SendAddress; txtSendPassword.Text = AlertService.SendPassword; txtReceiveAddress.Text = AlertService.ReceiveAddress; cmbReceiveType.Text = AlertService.ReceiveType.ToString(); //Set the current price for alerts foreach (AlertDataSource alert in AlertService.Alerts) { if (_coins.Any(c => c.ShortName.ExtEquals(alert.Coin))) { alert.Current = _coins.Where(c => c.ShortName.ExtEquals(alert.Coin)).Select(c => c.Price).First(); } } //Store other currency alerts _otherAlerts = AlertService.Alerts.Where(a => !a.Currency.ExtEquals(UserConfigService.Currency) || !_coins.Any(c => c.ShortName.ExtEquals(a.Coin))).OrderBy(a => a.Coin).ThenByDescending(a => a.Price).ToList(); //Show current currency alerts bsAlerts.DataSource = AlertService.Alerts.Where(a => a.Currency.ExtEquals(UserConfigService.Currency) && _coins.Any(c => c.ShortName.ExtEquals(a.Coin))).OrderBy(a => a.Coin).ThenByDescending(a => a.Price).ToList(); if (!UserConfigService.Encrypted) { grpEmail.Enabled = false; grpContact.Enabled = false; } Globals.SetTheme(this); }