private void TabControl1_SelectionChanged(object sender, SelectionChangedEventArgs e) { if ((this.TabControl1.SelectedIndex == 0)) { var apiurl = new Uri(baseUrl + ListTestRegistrationApiUrl.Replace("{centerid}", centerid)); using (var wc = new WebClient()) { wc.DownloadDataAsync(apiurl); wc.DownloadDataCompleted += (s, ee) => { try { var dataString = Encoding.UTF8.GetString(ee.Result); this.MapWildcardVM = JsonConvert.DeserializeObject <Models.DisplayAllVM>(dataString); (this.TabControl1.Items[0] as TabItem).DataContext = this.MapWildcardVM; } catch { } }; } } else if ((this.TabControl1.SelectedIndex == 1)) { this.LoadTab2(MyInfo.PID); } else if ((this.TabControl1.SelectedIndex == 2)) { this.LoadTab3(MyInfo.PID); } e.Handled = true; }
private void txtMapSearch_TextChanged(object sender, TextChangedEventArgs e) { var filtered = new Models.DisplayAllVM() { TestRegistrations = this.MapWildcardVM.TestRegistrations.Where(x => x.PID.Contains(txtMapSearch.Text) || (x.FullName).Contains(txtMapSearch.Text)).ToList(), }; (this.TabControl1.Items[0] as TabItem).DataContext = filtered; e.Handled = true; }
private void btnRefresh_click(object sender, RoutedEventArgs e) { (this.TabControl1.Items[0] as TabItem).DataContext = null; txtMapSearch.Text = string.Empty; var apiurl = new Uri(baseUrl + ListTestRegistrationApiUrl.Replace("{centerid}", centerid)); using (var wc = new WebClient()) { wc.DownloadDataAsync(apiurl); wc.DownloadDataCompleted += (s, ee) => { var dataString = Encoding.UTF8.GetString(ee.Result); this.MapWildcardVM = JsonConvert.DeserializeObject <Models.DisplayAllVM>(dataString); (this.TabControl1.Items[0] as TabItem).DataContext = this.MapWildcardVM; }; } e.Handled = true; }