private void AddAlert() { try { SingleAlertItem alertItem = new SingleAlertItem(); if (string.IsNullOrEmpty(selectedPair)) { throw new Exception(Resources.PleaseSelectTradePair); } alertItem.PairCode = SelectedPair; if (SelectedExchange == null) { throw new Exception(Resources.PleaseSelectExchange); } alertItem.ExchangeAbbrName = SelectedExchange.AbbrName; //if (string.IsNullOrEmpty(PriceType)) //{ // throw new Exception("请选择第一个交易所的价格类型"); //} alertItem.PriceType = PriceType; alertItem.IsHighThan = IsHighThan; alertItem.ComparePrice = ComparePrice; if (AlertColorItem == null) { throw new Exception(Resources.PleaseSelectShowColor); } SolidColorBrush brush = AlertColorItem.Background as SolidColorBrush; alertItem.AlertColor = brush.Color; alertItem.IsPlaySound = IsPlaySound; alertItem.SoundFile = SelectedSoundFile; alertItem.IsOpen = true; eventAggregator.GetEvent <AddSingleAlertItemEvent>().Publish(alertItem); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void DeleteItem(SingleAlertItem alertItem) { Alerts.Remove(alertItem); Save(); }
private void AddItem(SingleAlertItem item) { Alerts.Add(item); }