//Call Alpha Vantage API and receive data, switch page after process is complete private async void StockSearchButton_Clicked() { //check if the user entered something into the entry if (!String.IsNullOrEmpty(HomeStockEntry.Text)) { string StockHandle = GetStockHandle(HomeStockEntry.Text); if (!StockHandle.Contains("Invalid")) { AVApiWrapper.ApiData data = new AVApiWrapper.ApiData(await AVApiWrapper.getApiData(StockHandle, AlphaVantageKey)); setData(data, HomeStockEntry.Text.ToString()); this.CurrentPage = StockContentPage; } //user entered a not supported company else { await DisplayAlert("Warning!", "The Company you are searching for is not supported in the current version." + " Please choose a different one.", "Ok"); } } //user did not enter anything, display a warning else { await DisplayAlert("Warning!", "Please enter a company into the field.", "Ok"); } }
//Call Alpha Vantage API and receive data private async void NewStockSearch_Clicked() { AVApiWrapper.ApiData data = new AVApiWrapper.ApiData(await AVApiWrapper.getApiData(NewStockEntry.Text.ToString(), AlphaVantageKey)); setData(data, NewStockEntry.Text.ToString()); }
//Call Alpha Vantage API and receive data, switch page after process is complete private async void StockSearchButton_Clicked() { AVApiWrapper.ApiData data = new AVApiWrapper.ApiData(await AVApiWrapper.getApiData(HomeStockEntry.Text.ToString(), AlphaVantageKey)); setData(data, HomeStockEntry.Text.ToString()); this.CurrentPage = StockContentPage; }