コード例 #1
0
        async Task PullData()
        {
            LoadingIcon.IsRunning = true;

            string newSymbol = StockSearch.Text;

            stockData = await StockDataModel.GetSymbolData(newSymbol);

            if (stockData == null)
            {
                StockSearch.Text          = oldSymbol;
                StockDataModel.lastSymbol = oldSymbol;
                await DisplayAlert("Stock Not Found", "No stock matching symbol:\n\"" + newSymbol + "\"", "Close");
            }
            else
            {
                StocksListView.IsVisible   = true;
                StocksListView.ItemsSource = stockData;
                HighestLabel.Text          = StockDataModel.GetHighestString();
                LowestLabel.Text           = StockDataModel.GetLowestString();
                oldSymbol = newSymbol;
            }

            LoadingIcon.IsRunning = false;
        }
コード例 #2
0
        async Task PullData()
        {
            LoadingIcon.IsRunning = true;

            string newSymbol = StockSearch.Text;

            stockData = await StockDataModel.GetSymbolData(newSymbol);

            if (stockData == null)
            {
                StockSearch.Text          = oldSymbol;
                StockDataModel.lastSymbol = oldSymbol;
                await DisplayAlert("Stock Not Found", "No stock matching symbol:\n\"" + newSymbol + "\"", "Close");
            }
            else
            {
                Chart30Days.Chart = new LineChart()
                {
                    Entries = StockDataModel.GetPastDayRange(30)
                };
                Chart100Days.Chart = new LineChart()
                {
                    Entries = StockDataModel.GetPastDayRange(100)
                };

                Chart30Days.Chart.LabelTextSize    = 30;
                Chart100Days.Chart.LabelTextSize   = 30;
                Chart30Days.Chart.BackgroundColor  = SKColors.Transparent;
                Chart100Days.Chart.BackgroundColor = SKColors.Transparent;

                Chart30Days.Chart.MaxValue  = (float)StockDataModel.GetHighestNum();
                Chart30Days.Chart.MinValue  = (float)StockDataModel.GetLowestNum();
                Chart100Days.Chart.MaxValue = (float)StockDataModel.GetHighestNum();
                Chart100Days.Chart.MinValue = (float)StockDataModel.GetLowestNum();

                HighestLabel.Text = StockDataModel.GetHighestString();
                LowestLabel.Text  = StockDataModel.GetLowestString();

                ChartsAndLabels.IsVisible = true;

                oldSymbol = newSymbol;
            }

            LoadingIcon.IsRunning = false;
        }