private void OnLoadProfile(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.DefaultExt = ".json"; dlg.Filter = "json files (*.json)|*.json|All files (*.*)|*.*"; bool?result = dlg.ShowDialog(); if (result != true) { return; } object rootObject = JsonConvert.DeserializeObject(File.ReadAllText(dlg.FileName)); if (!(rootObject is JObject)) { System.Windows.MessageBox.Show("Invalid json file content!"); } JObject jRoot = (JObject)rootObject; PopulateExternalStorageFromJson(jRoot); TheAppsConfigurator.FromJson(jRoot); DesiredDiagnosticLogs.FromJson(jRoot); }
private void OnDeviceSelected(object sender, SelectionChangedEventArgs e) { string deviceIdString = (string)DeviceListBox.SelectedItem; ConnectedProperties.IsEnabled = false; if (!String.IsNullOrEmpty(deviceIdString)) { _deviceTwin = new DeviceTwinAndMethod(ConnectionStringBox.Text, deviceIdString); ConnectedProperties.IsEnabled = true; } SelectedDeviceName.Text = deviceIdString; // ToDo: There should be an easy mechanism to enumerate all sub-controls and clear them all // (or populate them with information from the device twin). // TheAppsStatus.Clear(); TheAppsConfigurator.Clear(); }
private void OnSetAppsConfiguration(object sender, RoutedEventArgs e) { SetDesired(TheAppsConfigurator.SectionName, TheAppsConfigurator.ToJson()).FireAndForget(); }