Exemplo n.º 1
0
        public ImportWindowVM()
        {
            MyMainWindow = System.Windows.Application.Current.MainWindow as MainWindow;

            SettingVMs = new ObservableCollection <SettingDataVM>();
            ClockVMs   = new ClockVMCollection(null);
        }
Exemplo n.º 2
0
        internal void Reset(DataFile importDataFile)
        {
            SelectedFilePath = "";

            ClockVMs = new ClockVMCollection(importDataFile);
            ClockVMs.Init();

            SettingVMs = new ObservableCollection <SettingDataVM>();
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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;
        }