public CoinHistoryViewModel(string coin, string format)
        {
            try
            {
                List <CoinValue> BeCoins = FactoryBL.get().getCoinHistory(coin, format);

                history = (from c in BeCoins
                           select new CoinModel(coin, c.date, c.CoinValueId, 0)).ToList();

                if (history.Count == 1) //precaution for break mode ,if the graph has only single value (y = 4 for example) the code will enter break mode
                {
                    CoinModel tempC = history.First();
                    history.Add(new CoinModel(tempC.coin, tempC.lastUpdate - TimeSpan.FromDays(1), tempC.value + 0.0000001));
                    history.Add(new CoinModel(tempC.coin, tempC.lastUpdate - TimeSpan.FromDays(2), tempC.value));
                }

                if (FactoryBL.get().GetSlope(coin) == 0) //another reprecaution for break mode ,so the graph won't have only 1 value and enter a break mode
                {
                    CoinModel tempC = history.First();
                    history.Remove(tempC);
                    history.Add(new CoinModel(tempC.coin, tempC.lastUpdate - TimeSpan.FromDays(1), tempC.value + 0.0000001));
                }
            }
            catch (Exception ex)
            {
                history = new List <CoinModel>();
                history.Add(new CoinModel("NOT FOUND", DateTime.Now, 1));
            }

            YFormatter = valueTostring;
        }
Пример #2
0
        private async void setCoins()
        {
            List <CurrentCoinValue> BeCoins = FactoryBL.get().getCoinsValue();

            Coins = (from c in BeCoins
                     select new CoinModel(c.CurrentCoinValueId, c.date, c.value, FactoryBL.get().GetSlope(c.CurrentCoinValueId))).ToList();
        }
Пример #3
0
        private void IntegerTextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (!(originCoin.SelectedItem is CoinModel && destinationCoin.SelectedItem is CoinModel))
            {
                return;
            }

            destinationValue.Text = FactoryBL.get().Relation(((CoinModel)originCoin.SelectedItem).coin, ((CoinModel)destinationCoin.SelectedItem).coin, (double)originValue.Value).ToString();
        }