void btnImagesClear_Click(object sender, RoutedEventArgs e) { try { this.Cursor = Cursors.Wait; JMMService.CmdProcessorImages.Stop(); // wait until the queue stops while (JMMService.CmdProcessorImages.ProcessingCommands) { Thread.Sleep(200); } Thread.Sleep(200); CommandRequestRepository repCR = new CommandRequestRepository(); foreach (CommandRequest cr in repCR.GetAllCommandRequestImages()) repCR.Delete(cr.CommandRequestID); JMMService.CmdProcessorImages.Init(); } catch (Exception ex) { Utils.ShowErrorMessage(ex.Message); } this.Cursor = Cursors.Arrow; }
public void ClearImagesQueue() { try { JMMService.CmdProcessorImages.Stop(); // wait until the queue stops while (JMMService.CmdProcessorImages.ProcessingCommands) { Thread.Sleep(200); } Thread.Sleep(200); CommandRequestRepository repCR = new CommandRequestRepository(); foreach (CommandRequest cr in repCR.GetAllCommandRequestImages()) repCR.Delete(cr.CommandRequestID); JMMService.CmdProcessorImages.Init(); } catch (Exception ex) { logger.ErrorException(ex.ToString(), ex); } }