/// <summary> /// Constructs a new remote control window /// </summary> /// <param name="sourceDevice">source device object</param> public RemoteControlWindow(SourceDevice sourceDevice) { RemoteReleaseControl control = sourceDevice.EnterReleaseControl(); this.ViewModel = new RemoteControlViewModel(sourceDevice, control); this.DataContext = this.ViewModel; this.InitializeComponent(); }
/// <summary> /// Creates a new view model for the remote control view /// </summary> /// <param name="device">source device object</param> /// <param name="control">remote release control object</param> public RemoteControlViewModel(SourceDevice device, RemoteReleaseControl control) { this.device = device; this.control = control; this.SetupBindings(); this.control.PropertyChanged += this.OnPropertyChanged; this.control.StateChanged += this.OnStateChanged; this.control.DownloadChanged += this.OnDownloadChanged; }
/// <summary> /// Cleans up view model; unregisters camera connect handler. /// </summary> public void Dispose() { if (this.control != null) { this.control.PropertyChanged -= this.OnPropertyChanged; this.control.StateChanged -= this.OnStateChanged; this.control.DownloadChanged -= this.OnDownloadChanged; this.control.Dispose(); this.control = null; } }