private Ticker GetTicker(CoupleAlertItem item, string exchangeAbbrName)
        {
            ExchangeApi exchangeApi = apiManager.GetApi <ExchangeApi>(exchangeAbbrName);
            string      pairCode    = item.PairCode;

            if (!exchangeApi.SelectedTickers.Contains(item.PairCode))
            {
                pairCode = CurrencyPair.All[item.PairCode].Base.Code + item.ConvertQuoteCode;
            }
            return(exchangeApi.SelectedTickers[pairCode]);
        }
        private void AddAlert()
        {
            try
            {
                CoupleAlertItem alertItem = new CoupleAlertItem();
                if (string.IsNullOrEmpty(selectedPair))
                {
                    throw new Exception(Resources.PleaseSelectTradePair);
                }
                alertItem.PairCode = SelectedPair;
                if (SelectedExchange1 == null)
                {
                    throw new Exception(Resources.PleaseSelectFirstExchange);
                }
                alertItem.Exchange1AbbrName = SelectedExchange1.AbbrName;

                alertItem.PriceType1 = PriceType1;
                if (SelectedExchange2 == null)
                {
                    throw new Exception(Resources.PleaseSelectSecondExchange);
                }
                alertItem.Exchange2AbbrName = SelectedExchange2.AbbrName;
                alertItem.PriceType2        = PriceType2;

                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.PriceDifference = PriceDifference;
                alertItem.IsOpen          = true;

                var pair            = CurrencyPair.All[alertItem.PairCode];
                var quoteCode       = pair.Quote.Code;
                var existMergeItems = from i in Merges where i.ToCode == quoteCode select i;
                if (existMergeItems.Count() > 0)
                {
                    alertItem.ConvertQuoteCode = existMergeItems.FirstOrDefault().FromCode;
                }
                eventAggregator.GetEvent <AddCoupleAlertItemEvent>().Publish(alertItem);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 private void DeleteItem(CoupleAlertItem alertItem)
 {
     Alerts.Remove(alertItem);
     Save();
 }
 private void AddItem(CoupleAlertItem item)
 {
     Alerts.Add(item);
 }