コード例 #1
0
 private void InitializeWebCamera()
 {
     webCamera = new WebCamera();
     webCamera.NewFrame += OnNewFrameRecieved;
     var webCameraInforamtion = webCamera.GetInformation();
     webCameraNameLabel.Content = webCameraInforamtion.Name;
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: AntonPashkowskiy/Labs
        static void Main(string[] arguments)
        {
            if (IsMainApplication())
            {
                try
                {
                    var camera = new WebCamera();
                    var command = arguments.Length > 1 ? arguments[0] : "";
                    var commandType = CommandList.GetCommandType(command);

                    switch (commandType)
                    {
                        case CommandType.GetInformation:
                            var webCamerainformation = camera.GetInformation();
                            DisplayInformation(webCamerainformation);
                            break;
                        case CommandType.ShootFoto:
                            var photoShootingSetting = CommandParser.Parse(arguments);
                            camera.ShootPhoto(photoShootingSetting);
                            break;
                        case CommandType.ShootVideo:
                            var videoShootingSetting = CommandParser.Parse(arguments);
                            camera.ShootVideo(videoShootingSetting);
                            break;
                        case CommandType.Exit:
                            return;
                    }
                }
                catch (CommandParserException exception)
                {
                    Log(exception.Message);
                }
                catch (WebCameraException exception)
                {
                    Log(exception.Message);
                }
            }
            else if (arguments.Length > 0 && arguments[0] == CommandList.Get(CommandType.Exit))
            {
                KillIdenticalProcess();
            }
        }