public void PurgeAllMessages()
        {
            BackgroundWorker bw = new BackgroundWorker();

            bw.DoWork += (sender, arg) => {
                ThreadState s = arg.Argument as ThreadState;
                StopMonitoring();

                while (!s.Stopped)
                {
                    Thread.Sleep(100);
                }

                try {
                    _mgr.PurgeAllMessages();
                } finally {
                    StartMonitoring();
                }
            };

            bw.RunWorkerCompleted += (object s, RunWorkerCompletedEventArgs ev) => {
                if (ev.Error != null)
                {
                    throw ev.Error;
                }
            };

            bw.RunWorkerAsync(_currentMonitor);
        }
        public async Task PurgeAllMessages()
        {
            _log.Trace("Purge All Messages...");

            InvokeWhileMonitoringPaused(() => {
                _mgr.PurgeAllMessages();
            });
        }
Beispiel #3
0
        public void PurgeAllMessages()
        {
            Task.Factory.StartNew((data) => {
                ThreadState s = data as ThreadState;

                StopMonitoring();
                while (!s.Stopped)
                {
                    Thread.Sleep(100);
                }

                try {
                    _mgr.PurgeAllMessages();
                } finally {
                    StartMonitoring();
                }
            }, _currentMonitor);
        }
Beispiel #4
0
        public async Task PurgeAllMessages()
        {
            if (_currentMonitor == null)
            {
                return;
            }

            BackgroundWorker bw = new BackgroundWorker();

            bw.DoWork += (sender, arg) => {
                ThreadState s = arg.Argument as ThreadState;
                PauseMonitoring();
                OnStartedLoadingQueues();

                while (!s.Paused)
                {
                    Thread.Sleep(100);
                }

                try {
                    _mgr.PurgeAllMessages();
                } finally {
                    OnFinishedLoadingQueues();
                    ResumeMonitoring();
                }
            };

            bw.RunWorkerCompleted += (object s, RunWorkerCompletedEventArgs ev) => {
                if (ev.Error != null)
                {
                    throw ev.Error;
                }
            };

            bw.RunWorkerAsync(_currentMonitor);
        }
Beispiel #5
0
 private void miDeleteAllMessage_Click(object sender, RoutedEventArgs e)
 {
     _mgr.PurgeAllMessages();
 }