private async void lbSessions_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (lbSessions.SelectedItem != null) { try { currentSession = null; currentScreens = null; txbCurrentSession.Text = ""; lbScreens.ItemsSource = null; currentSession = lbSessions.SelectedItem as ExamSession; var res = await RestClient.GetScreenshotFromSession(currentSession.id); currentScreens = JsonConvert.DeserializeObject <ScreenshotSessionData>(res); lbScreens.ItemsSource = currentScreens.Shots; txbCurrentSession.Text = currentSession.student + " [Status:" + currentSession.status + "]"; } catch (Exception ex) { await this.ShowMessageAsync("Error bij lbSessions_SelectionChanged ", "Error=" + ex.Message); } } }
private async void btnCloseSession_Click(object sender, RoutedEventArgs e) { try { timerRefresh.Stop(); ExamSession currses = (sender as Button).DataContext as ExamSession; ((sender as Button).Parent as FrameworkElement).IsEnabled = false; ((sender as Button).Parent as Grid).Background = new SolidColorBrush(Colors.DarkGray); if (chkAskConfirm.IsChecked == true) { if (await this.ShowMessageAsync("Opgelet", $"Zeker dat je sessie van {currses.OrderName} wenst af te sluiten?", MessageDialogStyle.AffirmativeAndNegative) == MessageDialogResult.Affirmative) { lbSessions.SelectedIndex = -1; lbScreens.ItemsSource = null; await CloseSession(currses); } } else { lbSessions.SelectedIndex = -1; lbScreens.ItemsSource = null; await CloseSession(currses); } } catch (Exception ex) { await this.ShowMessageAsync("Error bij btnCloseSession_Click", "Error=" + ex.Message); } RefreshDataFromServer(); timerRefresh.Start(); }
private async Task CloseSession(ExamSession currses) { try { await RestClient.CloseSession(currses.id); lbSessions.SelectedIndex = -1; } catch (Exception ex) { await this.ShowMessageAsync("Error bij CloseSession", "Sessie close failed. Error=" + ex.Message); } // }
//public FullImgWindow() //{ // InitializeComponent(); //} public FullImgWindow(ScreenshotSessionData allscreenin, ExamSession currentSessionin) { InitializeComponent(); allScreens = allscreenin; currentSession = currentSessionin; }