public async void graphDisplayClick(object sender, RoutedEventArgs e) { FormWindowsSTS formWindow = new FormWindowsSTS(); formWindow.ShowDialog(); if (formWindow.closed == true) { return; } foreach (MenuItem button in this.buttonMenu.Items) { if (button.Name == "stock" || button.Name == "crypto" || button.Name == "currency") { button.IsEnabled = false; } if (button.Name == "clear") { button.IsEnabled = true; } } this.stockInfo = formWindow.stockInfo; await Dispatcher.BeginInvoke((Action)(() => { this.info.Name = "info"; if (this.stockInfo.view != ViewType.CURRENTVALUE) { this.info.Content = this.stockInfo.fullName + "\n" + EnumDescription(this.stockInfo.timeSeries); if (this.stockInfo.timeSeries == TimeSeries.INTRADAY) { this.info.Content += " " + ((StockInfo)this.stockInfo).interval; } } else { this.info.Content = this.stockInfo.fullName + "\n" + EnumDescription(this.stockInfo.data); } this.info.Content += ", Currency: USD"; this.info.SetValue(Label.VerticalAlignmentProperty, VerticalAlignment.Top); })); if (this.stockInfo.view == ViewType.GRAPH) { this.refreshGraphTask = new Task <Task>(refreshGraph); } else if (this.stockInfo.view == ViewType.TABLE) { this.refreshGraphTask = new Task <Task>(refreshTable); } else if (this.stockInfo.view == ViewType.CURRENTVALUE) { this.refreshGraphTask = new Task <Task>(refreshCurrentValue); } this.refreshGraphTask.Start(); await this.refreshGraphTask; }
public async void graphDisplayClick(object sender, RoutedEventArgs e) { FormWindowsSTS formWindow = new FormWindowsSTS(); formWindow.Show(); this.urlParameter = formWindow.urlParameters; Task <Task> task = new Task <Task>(refreshGraph); task.Start(); await task; }