Пример #1
0
 public TimespansTabViewModel(TimespansTabModel model)
 {
     this.model              = model;
     unitNames               = new ObservableCollection <string>(model.CurrentAvailableUnits);
     CreateUnitCommand       = new RelayCommand(() => NewTimespanUnit(), () => true);
     SaveUnitCommand         = new RelayCommand(() => SaveNewTimespan(), () => CanSave());
     DeleteUnitCommand       = new RelayCommand(() => DeleteUnit(), () => CanDelete());
     SaveToFileCommand       = new RelayCommand(() => SaveToFile(), () => true);
     LoadFromFileCommand     = new RelayCommand(() => LoadFromFile(), () => true);
     LoadDefaultUnitsCommand = new RelayCommand(() => LoadDefaults(), () => true);
 }
        public TimespansTabView()
        {
            var manager = new TimespanUnitManager();

            manager.LoadDefault();
            var model = new TimespansTabModel(manager);

            this.DataContext = new TimespansTabViewModel(model);

            InitializeComponent();
        }