OSDN Git Service

Fix a bug where the stop button not stop continuous shooting at once
authorKazuhiro <fujieda@users.osdn.me>
Sun, 4 Oct 2015 14:22:06 +0000 (23:22 +0900)
committerKazuhiro <fujieda@users.osdn.me>
Mon, 5 Oct 2015 13:44:54 +0000 (22:44 +0900)
BurageSnap/FormMain.cs
BurageSnap/Recorder.cs

index e3d26f5..6f9bb0f 100644 (file)
@@ -110,7 +110,14 @@ namespace BurageSnap
             }
             else
             {
-                _recorder.Stop(_config.RingBuffer == 0 || _confirmDialog.ShowDialog(this) != DialogResult.Yes);
+                _recorder.Stop();
+                if (_config.RingBuffer > 0)
+                {
+                   if (_confirmDialog.ShowDialog(this) == DialogResult.Yes)
+                        _recorder.SaveBuffer();
+                   else
+                        _recorder.DiscardBuffer();
+                }
                 AbortRecording();
             }
         }
index d7378dd..72d6481 100644 (file)
@@ -78,21 +78,23 @@ namespace BurageSnap
                 TIME_PERIODIC | TIME_KILL_SYNCHRONOUS);
         }
 
-        public void Stop(bool discard = false)
+        public void Stop()
         {
             if (_timerId != 0)
                 timeKillEvent(_timerId);
-            if (_config.RingBuffer == 0)
-                return;
-            if (discard)
-            {
-                _ringBuffer.Clear();
-                return;
-            }
+        }
+
+        public void SaveBuffer()
+        {
             if (!SaveRingBuffer())
                 ReportCaptureResult(Resources.Recorder_IO_Error);
         }
 
+        public void DiscardBuffer()
+        {
+            _ringBuffer.Clear();
+        }
+
         [DllImport("winmm.dll")]
         private static extern uint timeSetEvent(uint delay, uint resolution, TimeProc timeProc,
             ref uint user, uint eventType);