private async void OnUpdateButtonClick(object sender, RoutedEventArgs e) { WifiNetworkInfo info = ComboBoxWifi.SelectedItem as WifiNetworkInfo; if (info != null && info.SSID == "disabled") { info = null; } device.CameraInfo.WifiNetwork = info; string error = await device.UpdateWifiSettings(); if (error != null) { ShowError(error); return; } if (CheckBoxAll.IsChecked == true) { await UpdateWifiOnAllCameras(info); } this.CloseCurrentFlyout(); }
private async Task UpdateWifiOnAllCameras(WifiNetworkInfo info) { foreach (var camera in DataStore.Instance.Cameras) { if (camera != this.device.CameraInfo) { FoscamDevice temp = new FoscamDevice() { CameraInfo = camera }; if (camera.WifiNetwork == null || camera.WifiNetwork.SSID != info.SSID || camera.WifiPassword != device.CameraInfo.WifiPassword) { camera.WifiPassword = device.CameraInfo.WifiPassword; temp.CameraInfo.WifiNetwork = info; await temp.UpdateWifiSettings(); } } } }