private void stopButton_Click(object sender, EventArgs e) { stopButton.Enabled = false; agent?.Stop(); TimerResolution.TimeEndPeriod(1); // See also the startButton_Click method. memoryViewer.Clear(); communicationLogColorListBox.Items.Clear(); }
public void RunLoop() { while (connected) { Read(); if (unsafeCodeMutex != null) { unsafeCodeMutex.WaitOne(); } GC.Collect(); GC.WaitForPendingFinalizers(); if (unsafeCodeMutex != null) { unsafeCodeMutex.ReleaseMutex(); } Thread.Sleep(millisecondSleepInterval); } captureDevice.Dispose(); TimerResolution.TimeEndPeriod(1); OnCameraStopped(); }