コード例 #1
0
        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);
        }
コード例 #2
0
        public async Task PurgeAllMessages()
        {
            _log.Trace("Purge All Messages...");

            InvokeWhileMonitoringPaused(() => {
                _mgr.PurgeAllMessages();
            });
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #5
0
 private void miDeleteAllMessage_Click(object sender, RoutedEventArgs e)
 {
     _mgr.PurgeAllMessages();
 }