// public event PropertyChangedEventHandler PropertyChanged = null; internal OnVifMedia(OnVifDevice onVifDevice) { m_ProfileEncodings = new ObservableCollection <OnVifCameraProfile>(); m_onVifDevice = onVifDevice; m_OnVif1Media = null; m_OnVif2Media = null; m_binitalized = false; m_ErrorMessage = ""; }
public async Task <bool> InitalizeAsync() { m_binitalized = false; if (this.m_onVifDevice.Device == null) { bool b = await this.m_onVifDevice.InitalizeDeviceAsync(); if (this.m_onVifDevice.Device == null) { return(false); } } if (this.m_onVifDevice.ServicesResponse == null) { bool b = await this.m_onVifDevice.InitalizeDeviceAsync(); if (this.m_onVifDevice.ServicesResponse == null) { return(false); } } try { bool bMedia1Present = false; bool bMedia2Present = false; foreach (var service in this.m_onVifDevice.ServicesResponse.Service) { if (service.Namespace == "http://www.onvif.org/ver10/media/wsdl") { bMedia1Present = true; } if (service.Namespace == "http://www.onvif.org/ver20/media/wsdl") { bMedia2Present = true; } } if (bMedia2Present) { this.m_ProfileEncodings.Clear(); m_OnVif2Media = new OnVifServices.OnVif2Media(this.m_onVifDevice); m_binitalized = await m_OnVif2Media.InitalizeAsync(); } else if (bMedia1Present) { this.m_ProfileEncodings.Clear(); m_OnVif1Media = new OnVifServices.OnVif1Media(this.m_onVifDevice); m_binitalized = await m_OnVif1Media.InitalizeAsync(); } createProfiles(); } catch (Exception ex) { m_ErrorMessage = ex.Message; throw new OnVifException("OnVifMedia.InitalizeAsync", ex); // return false; } return(m_binitalized); }