private void LoadOnClick(object sender, RoutedEventArgs e) { var json = _control.Config.Text; if (String.IsNullOrWhiteSpace(json)) { var res = MessageBox.Show("Cannot deserialize an empty JSON!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } HandleException(() => { SetConfig(() => ConfigSerializer.FromJson(json)); ((SettingsWindowPackage)Package).OptionJsonConfig = json; MessageBox.Show("Successfully deserialized config!", "Info", MessageBoxButton.OK, MessageBoxImage.Information); }, "Json deserialization error"); HandleException(() => _control.MainControl.FromConfig(_config), "Oups! Something went wrong :("); CreateForm(); if (_drawingMode == DrawingMode.NotChanged) { _drawingMode = DrawingMode.ShouldBeRedrawn; HandleException(DrawGraph, "Error while drawing graph"); } }
public void TestMethod() { ConfigSerializer.FromJson(OldFormatSamples.JsonNoProperties); var res = ConfigSerializer.FromJson(OldFormatSamples.JsonDfsOldFormat); ConfigSerializer.FromJson(OldFormatSamples.JsonOldFormatAllProperties); Debug.WriteLine(res); }