예제 #1
0
        private void CheckIfWebcamResolutionChanged(object sender, ElapsedEventArgs e)
        {
            if (Store.Data.Webcam.Source == null)
            {
                changeResolutionTimer?.Stop();
                changeResolutionTimer.Dispose();
                changeResolutionTimer = null;
                return;
            }

            elapsedTimerTime += (int)changeResolutionTimer.Interval;

            if (webcamWidthBeforeChange != Store.Data.Webcam.Source.Width ||
                webcamHeightBeforeChange != Store.Data.Webcam.Source.Height)
            {
                changeResolutionTimer?.Stop();
                changeResolutionTimer.Dispose();
                changeResolutionTimer = null;

                WebcamService.CalculateItemPosition();
            }
            else if (elapsedTimerTime % 1000 == 0)
            {
                WebcamService.CalculateItemPosition();
            }

            if (elapsedTimerTime >= 5000)
            {
                // If it doesn't work in 5 seconds, stop trying
                changeResolutionTimer?.Stop();
                changeResolutionTimer.Dispose();
                changeResolutionTimer = null;
            }
        }
예제 #2
0
        private void MouseButtonUpBehavior()
        {
            if (Store.Data.Webcam.Item != null)
            {
                WebcamService.CalculateItemPosition();
            }

            ResizeMode = ResizeMode.CanResize; // Re-enable resizing on this window. Resizing disabled when mouse is dragged o nthe winform child (in DisplayPanelMoveBehavior)
        }