private void cbONVIFProfile_SelectedIndexChanged(object sender, EventArgs e) { #if NETCOREAPP MessageBox.Show("ONVIF not avauilable for .Net Core SDK build."); #else edONVIFLiveVideoURL.Text = cbIPURL.Text = onvifControl?.GetVideoURL(cbONVIFProfile.SelectedIndex); #endif }
private void btONVIFConnect_Click(object sender, RoutedEventArgs e) { if (btONVIFConnect.Content.ToString() == "Connect") { btONVIFConnect.Content = "Disconnect"; if (onvifControl != null) { onvifControl.Disconnect(); onvifControl.Dispose(); onvifControl = null; } if (string.IsNullOrEmpty(edONVIFLogin.Text) || string.IsNullOrEmpty(edONVIFPassword.Text)) { MessageBox.Show("Please specify IP camera user name and password."); return; } onvifControl = new ONVIFControl(); var result = onvifControl.Connect(edONVIFURL.Text, edONVIFLogin.Text, edONVIFPassword.Text); if (!result) { onvifControl = null; MessageBox.Show("Unable to connect to ONVIF camera."); return; } var deviceInfo = onvifControl.GetDeviceInformation(); lbONVIFCameraInfo.Content = $"Model {deviceInfo.Model}, Firmware {deviceInfo.Firmware}"; edONVIFLiveVideoURL.Text = edIPUrl.Text = onvifControl.GetVideoURL(); edIPLogin.Text = edONVIFLogin.Text; edIPPassword.Text = edONVIFPassword.Text; cbONVIFProfile.Items.Clear(); var profiles = onvifControl.GetProfiles(); foreach (var profile in profiles) { cbONVIFProfile.Items.Add($"{profile.Name}"); } if (cbONVIFProfile.Items.Count > 0) { cbONVIFProfile.SelectedIndex = 0; } onvifPtzRanges = onvifControl.PTZ_GetRanges(); onvifControl.PTZ_SetAbsolute(0, 0, 0); onvifPtzX = 0; onvifPtzY = 0; onvifPtzZoom = 0; } else { btONVIFConnect.Content = "Connect"; if (onvifControl != null) { onvifControl.Disconnect(); onvifControl.Dispose(); onvifControl = null; } } }
private void btONVIFConnect_Click(object sender, EventArgs e) { #if NETCOREAPP MessageBox.Show("ONVIF not avauilable for .Net Core SDK build."); #else if (btONVIFConnect.Text == "Connect") { btONVIFConnect.Text = "Disconnect"; if (onvifControl != null) { onvifControl.Disconnect(); onvifControl.Dispose(); onvifControl = null; } if (string.IsNullOrEmpty(edONVIFLogin.Text) || string.IsNullOrEmpty(edONVIFPassword.Text)) { MessageBox.Show("Please specify IP camera user name and password."); return; } onvifControl = new ONVIFControl(); var result = onvifControl.Connect(edONVIFURL.Text, edONVIFLogin.Text, edONVIFPassword.Text); if (!result) { onvifControl = null; MessageBox.Show("Unable to connect to ONVIF camera."); return; } var deviceInfo = onvifControl.GetDeviceInformation(); if (deviceInfo != null) { lbONVIFCameraInfo.Text = $"Model {deviceInfo.Model}, Firmware {deviceInfo.Firmware}"; } cbONVIFProfile.Items.Clear(); var profiles = onvifControl.GetProfiles(); foreach (var profile in profiles) { cbONVIFProfile.Items.Add($"{profile.Name}"); } if (cbONVIFProfile.Items.Count > 0) { cbONVIFProfile.SelectedIndex = 0; } edONVIFLiveVideoURL.Text = cbIPURL.Text = onvifControl.GetVideoURL(); edIPLogin.Text = edONVIFLogin.Text; edIPPassword.Text = edONVIFPassword.Text; onvifPtzRanges = onvifControl.PTZ_GetRanges(); onvifControl.PTZ_SetHome(); onvifPtzX = 0; onvifPtzY = 0; onvifPtzZoom = 0; } else { btONVIFConnect.Text = "Connect"; if (onvifControl != null) { onvifControl.Disconnect(); onvifControl.Dispose(); onvifControl = null; } } #endif }
private void cbONVIFProfile_SelectedIndexChanged(object sender, EventArgs e) { edONVIFLiveVideoURL.Text = cbIPURL.Text = onvifControl?.GetVideoURL(cbONVIFProfile.SelectedIndex); }