public void addIndicator(Exchanges selectedExchange, Coins selectedCoin, Coins selectedPairing, CandleWidth selectedWidth, Indicators selectedIndicator, IndicatorConditions selectedCondition, double value) { foreach (AlertLayout l in listCellCoin.Children) //in every current layout { if (l.Coin == selectedCoin && l.Pair == selectedPairing && l.Exchange == selectedExchange) // if layout exists with params { foreach (AlertCard c in l.CardGrid.Children) //search for card with same indicator exists { if (c.Indicator == selectedIndicator && c.CandleWidth == selectedWidth) //if card with same indicator and candle width exists { c.addCondition(selectedCondition, value); //just needed to add condition, else it is a new card return; } } //indicator was not found in card list, need to create new one AlertCard _card = new AlertCard(l, selectedWidth, selectedExchange, selectedCoin, selectedPairing, selectedIndicator); _card.addCondition(selectedCondition, value); l.addTo(_card); return; } } AlertLayout alert = new AlertLayout(selectedExchange, selectedCoin, selectedPairing); AlertCard card = new AlertCard(alert, selectedWidth, selectedExchange, selectedCoin, selectedPairing, selectedIndicator); card.addCondition(selectedCondition, value); alert.addTo(card); listCellCoin.Children.Add(alert); reSize(); }
public void add(CandleWidth selectedWidth, Indicators selectedIndicator, IndicatorConditions selectedCondition, double value) { foreach (AlertCard c in CardGrid.Children) //search for card with same indicator exists { if (c.Indicator == selectedIndicator && c.CandleWidth == selectedWidth) //if card with same indicator and candle width exists { c.addCondition(selectedCondition, value); //just needed to add condition, else it is a new card return; } } AlertCard card = new AlertCard(this, selectedWidth, Exchange, Coin, Pair, selectedIndicator); card.addCondition(selectedCondition, value); addTo(card); SetPosition(); }