public CameraClientViewModel() { FramesProcessed += async f => { await Task.Yield(); }; Cameras = new CollectionViewSource(); Resolutions = new CollectionViewSource(); Dispatcher = Cameras.Dispatcher; CurrentImage = this.NewProperty(x => x.CurrentImage); SelectedCamera = this.NewProperty(x => x.SelectedCamera); SelectedResolution = this.NewProperty(x => x.SelectedResolution); Countdown = this.NewProperty(x => x.Countdown); CountdownVisible = this.NewProperty(x => x.CountdownVisible); RecordingVisibility = this.NewProperty(x => x.RecordingVisibility); CountdownVisible.Value = Visibility.Collapsed; RecordingVisibility.Value = Visibility.Collapsed; _controller = new ClientController(); _controller.PrepareForRecording += PrepareForRecording; _controller.RecordingStarted += RecordingStarted; _controller.RecordingCompleted += RecordingCompleted; Record = new ActionCommand(RecordVideo); SelectedCamera.Changed += SelectedCameraChanged; SelectedResolution.Changed += SelectedResolutionChanged; _remote = new CameraClientRemoteControl(this, _controller); }
public CameraClientRemoteControl(CameraClientViewModel model, ClientController camera) { _model = model; _camera = camera; _heartbeat = new HeartbeatTimer(() => Task.FromResult(0)); _ping = new PingUtility(50123); _ping.HandlePing += ReportCamera; _listener = new CommandListener(); _listener.RegisterHandler<RecordCommand, RecordCommand>(RemoteRecord); _listener.RegisterHandler<EnableHeartbeatCommand, EnableHeartbeatCommand>(EnableHeartbeat); _listener.RegisterHandler<UpdateResolutionCommand, RemoteResolutionModel>(UpdateResolution); }