/// <summary> /// This method is called when delete button is clicked /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Btn_delete_Click(object sender, RoutedEventArgs e) { #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call. ServiceCommands.DeleteFromQueueByIdAsync(currentID); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call. UpdateView(); }
/// <summary> /// Method used to update queue status and getting current queue and filling local list with ID's. /// It's get called from another thread to avoid hanging of application /// </summary> private void UpdateThread() { while (true) { CheckQueueStatus(); ServiceCommands.GetQueue("1"); IDs = ServiceCommands.IDs; if (IDs.Any()) { currentID = IDs.ElementAt(0); } currentStudent = ServiceCommands.GetStudentDetails <Student>(currentID); } }
public MainWindow() { InitializeComponent(); ResetView(); System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer(); dispatcherTimer.Tick += dispatcherTimer_Tick; dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 500); dispatcherTimer.Start(); Thread updateThread = new Thread(UpdateThread); updateThread.Start(); #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call. ServiceCommands.EditQueueStatus("1", "zamknieta"); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call. }
/// <summary> /// This method is called when pause button is clicked /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Btn_pause_Click(object sender, RoutedEventArgs e) { if (currentQueueStatus == "wstrzymana") { #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call. ServiceCommands.EditQueueStatus("1", "otwarta"); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call. } else #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call. { ServiceCommands.EditQueueStatus("1", "wstrzymana"); } #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call. }
/// <summary> /// Method used to set queue status to local variable currentQueueStatus for convenience of using it in this class /// </summary> private void CheckQueueStatus() { ServiceCommands.GetQueueStatus(); queueStatuses = ServiceCommands.queueStatuses; if (queueStatuses[0].idQueue == "1") { if (queueStatuses[0].status == "otwarta") { currentQueueStatus = "otwarta"; } else if (queueStatuses[0].status == "zamknieta") { currentQueueStatus = "zamknieta"; } else { currentQueueStatus = "wstrzymana"; } } }