internal void Reset(DataFile importDataFile) { SelectedFilePath = ""; ClockVMs = new ClockVMCollection(importDataFile); ClockVMs.Init(); SettingVMs = new ObservableCollection <SettingDataVM>(); }
private void OnSelectedFilePathChanged() { DisplayFilePath = SelectedFilePath != "" ? SelectedFilePath : "No file selected."; if (SelectedFilePath != "") { DataFile idf; idf = new DataFile(); if (!idf.LoadFromFileWPF(SelectedFilePath)) { // TODO: show the exception message, not this: MessageBox.Show("Error when loading the selected file path. Please try opening it with the main window for a better description of the error."); SelectedFilePath = ""; return; } SettingVMs.Clear(); foreach (KeyValuePair <string, SettingDataM> p in idf.Settings) { var s = new SettingDataVM(p.Value); s.IsChecked = true; SettingVMs.Add(s); } ClockVMs = idf.ClockVMCollection; //ClockVMs.Init(); //foreach (ClockVM vm in idf.ClockVMCollection.VMs) //{ // ClockVMs.VMs.Add(vm); //} } else { SettingVMs.Clear(); ClockVMs = new ClockVMCollection(null); ClockVMs.Init(); } }