public override void Execute()
        {
            try
            {
                Store.Data.Webcam.Window.Dispatcher.Invoke(new Action(() =>
                {
                    Store.Data.Webcam.Window.Left = Left.Value;
                    Store.Data.Webcam.Window.Top  = Top.Value;
                    Store.Data.Webcam.Window.Show(Width, Height);

                    if (!Store.Data.Webcam.IsWebcamEnabled)
                    {
                        Store.Data.Webcam.Window.SetWebcam(Store.Data.Webcam.DefaultWebcam);
                        Store.Data.Webcam.Window.mainBorder.Visibility = Visibility.Visible;
                    }

                    EmitService.EmitEnableWebcamResponse(AvailableCommand.EnableWebcamOnly, Store.Data.Webcam.Window.selectedWebcam.value, true);
                }));

                Store.Data.Webcam.IsWebcamEnabled = true;
                Store.Data.Webcam.IsWebcamOnly    = true;
            }
            catch (Exception ex)
            {
                //EmitService.EmitEnableWebcamResponse(AvailableCommand.EnableWebcamOnly, ex.Message, false, Constants.Webcam.ErrorMessages.EnableWebcamOnlyFailed);
                throw ex;
            }
        }
Exemplo n.º 2
0
        public override void Execute()
        {
            if (WebcamValue == Store.Data.Webcam.ActiveWebcamValue)
            {
                return;
            }

            Store.Data.Webcam.Window.Dispatcher.Invoke(new Action(() =>
            {
                if (!Left.HasValue || !Top.HasValue)
                {
                    Store.Data.Webcam.Window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                }
                else
                {
                    Store.Data.Webcam.Window.Left = Left.Value;
                    Store.Data.Webcam.Window.Top  = Top.Value;
                }

                Store.Data.Webcam.Window.Show(Width, Height);

                var webcam = WebcamService.GetWebcam(WebcamValue);

                if (webcam == null)
                {
                    webcam = Store.Data.Webcam.Webcams.FirstOrDefault();
                }

                Store.Data.Webcam.Window.SetWebcam(webcam);

                Store.Data.Webcam.Window.mainBorder.Visibility = Visibility.Visible;
                EmitService.EmitEnableWebcamResponse(AvailableCommand.EnableWebcam, Store.Data.Webcam.Window.selectedWebcam.value, true);
            }));

            Store.Data.Webcam.IsWebcamEnabled = true;
        }