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