public ImportWindowVM() { MyMainWindow = System.Windows.Application.Current.MainWindow as MainWindow; SettingVMs = new ObservableCollection <SettingDataVM>(); ClockVMs = new ClockVMCollection(null); }
internal void Reset(DataFile importDataFile) { SelectedFilePath = ""; ClockVMs = new ClockVMCollection(importDataFile); ClockVMs.Init(); SettingVMs = new ObservableCollection <SettingDataVM>(); }
public ClockVM(ClockM model, ClockVMCollection coll) { Collection = coll; Model = model; Model.PropertyChanged += Model_PropertyChanged; Collection.SubscribeToClock(this); MyToggleCommand = new RelayCommand(OnToggle); MyDeleteCommand = new RelayCommand(OnDelete); }
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(); } }
private void Popup_Loaded(object sender, RoutedEventArgs e) { Clocks = (Application.Current.MainWindow as MainWindow).VM.ClockVMCollection; }
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); Clocks = (Application.Current.MainWindow as MainWindow).VM.ClockVMCollection; }