private void DoCleanup() { _svc.PropertyChanged -= new PropertyChangedEventHandler(SVC_PropertyChanged); if (presets != null) { presets.SaveThumbnailImages(); } if (client != null) { client.Closed -= new EventHandler(client_Closed); client.PropertyChanged -= new PropertyChangedEventHandler(client_PropertyChanged); client.ChannelScanStarted -= new EventHandler(client_ChannelScanStarted); client.ChannelScanProgressUpdate -= new EventHandler(client_ChannelScanProgressUpdate); client.ChannelScanComplete -= new EventHandler <ChannelScanCompleteEventArgs>(client_ChannelScanComplete); client = null; } }
public void Start() { if (StreamViewerControl == null) { throw new ArgumentNullException("StreamViewerControl must not be null!"); } if (StreamViewerControl.SourceInfo == null) { throw new ArgumentNullException("StreamViewerControl.SourceInfo may not be null!"); } if (StreamViewerControl.SourceInfo.MicrowaveControl == null) { throw new ArgumentNullException("StreamViewerControl.SourceInfo.CameraControl may not be null!"); } if (string.IsNullOrEmpty(StreamViewerControl.ServerAddress)) { throw new ArgumentException("StreamViewerControl.ServerAddress must not be empty!"); } client = new Client.MicrowaveControl2(StreamViewerControl.ServerAddress); client.Closed += new EventHandler(client_Closed); client.Open(new ClientConnectRequest(StreamViewerControl.SourceInfo.SourceName)); client.RelinquishTimeout = StreamViewerControl.SourceInfo.MicrowaveControl.RelinquishTimer; client.PropertyChanged += new PropertyChangedEventHandler(client_PropertyChanged); client.ChannelScanStarted += new EventHandler(client_ChannelScanStarted); client.ChannelScanProgressUpdate += new EventHandler(client_ChannelScanProgressUpdate); client.ChannelScanComplete += new EventHandler <ChannelScanCompleteEventArgs>(client_ChannelScanComplete); //start listening to SVC's property events _svc.PropertyChanged += new PropertyChangedEventHandler(SVC_PropertyChanged); }