public static void UpdateUI(this WaveLenghts waves, UIList ui) { ui.dgrid.ItemsSource = waves.Wave; ui.dgrid.Items.Refresh(); ui.wavePlot.PlotLines(waves.Wave); }
private void LoadConfig_Click(object sender, RoutedEventArgs e) { var debugPath = "../../json.json"; string configFilePath = debugPath; var openDialog = new OpenFileDialog(); openDialog.Filter = "Config files (*.xconf)|*.xconf|All file (*.*)|*.*"; if (openDialog.ShowDialog() == false) { return; } configFilePath = openDialog.FileName; System.IO.StreamReader sw = new System.IO.StreamReader(configFilePath); var jsonConf = sw.ReadLine(); m_SysConf = JsonConvert.DeserializeObject <SystemConfig>(jsonConf); jsonConf = sw.ReadLine(); var waveBase = JsonConvert.DeserializeObject <WaveLengthLoader>(jsonConf); m_WavesDataBase = new WaveLengthLoader(waveBase); jsonConf = sw.ReadLine(); m_SelectedWaves = JsonConvert.DeserializeObject <WaveLenghts>(jsonConf); m_SelectedWaves.onWaveAdd += SelectedWaves_onWaveAdd; m_SelectedWaves.onWaveChange += SelectedWaves_onWaveChange; m_SysConf.onChange += SysConf_onChange; m_SysConf.onWaveLimitChange += SysConf_onWaveLimitChange; SysConf_onChange(this, null); m_SelectedWaves.UpdateUI(m_UIS); m_WavePlot.SetWaveLimits(m_SysConf.waveLimits); }
public MainWindow() { InitializeComponent(); System.Globalization.CultureInfo.DefaultThreadCurrentCulture = new System.Globalization.CultureInfo("en-US"); System.Globalization.CultureInfo.DefaultThreadCurrentUICulture = new System.Globalization.CultureInfo("en-US"); m_SelectedWaves = new WaveLenghts(); m_SelectedWaves.onWaveAdd += SelectedWaves_onWaveAdd; m_SelectedWaves.onWaveChange += SelectedWaves_onWaveChange; m_SysConf = new SystemConfig(); m_SysConf.onChange += SysConf_onChange; m_SysConf.onWaveLimitChange += SysConf_onWaveLimitChange; this.DataContext = m_SysConf; m_WavePlot = new WavePlotter(WavePlotCanvas); m_ConfPlot = new ConfigPlotter(ConfigurationPlot); m_CrystalPlot = new Interface.CrystalPlot(CrystalPlotViev); m_Detector = new Detector(); m_DetectorPlot = new DetectorPlot(DetectorPlotCanvas, ObservedSpectrumCanvas); m_DetectorPlot.XZoom += DetectorPlot_XZoom; m_DetectorPlot.YZoom += DetectorPlot_YZoom; m_UIS = new UIList() { dgrid = SelectedWavesList, wavePlot = m_WavePlot, detector = m_Detector, detectorPlot = m_DetectorPlot }; Logger.InitLogger("ExceptionLog.txt"); }