private MainWindowViewModel() { AddUserControlViewModel = AddUserControlViewModel.GetInstance(); AddUserControlViewModel.Date = DateTimeHelper.PstNow(); EditUserControlViewModel = EditUserControlViewModel.GetInstance(); EditUserControlViewModel.Date = DateTimeHelper.PstNow(); ViewUserControlViewModel = ViewUserControlViewModel.GetInstance(); ViewUserControlViewModel.Dates = new List <DateTime> { DateTimeHelper.PstNow() }; SelectedTabIndex = 0; SelectionMode = CalendarSelectionMode.SingleRange; IObservable <int> tabSelection = this.WhenAnyValue(x => x.SelectedTabIndex); SelectedDateObservable = this.WhenAnyValue(x => x.SelectedDate); IObserver <int> updateRadioButton = Observer.Create <int>( tabIndex => UpdateRadioButtonSelection(tabIndex)); SelectedDateObservable.Subscribe(AddUserControlViewModel.DateTimeObserver); SelectedDateObservable.Subscribe(EditUserControlViewModel.DateTimeObserver); tabSelection.Subscribe(updateRadioButton); SelectedDate = DateTimeHelper.PstNow(); Classes = new ObservableCollection <AssetClass>(AssetClass.ConstructTestData()); }
public MainWindow() { InitializeComponent(); classes = new ObservableCollection <AssetClass>(AssetClass.ConstructTestData()); this.DataContext = classes; }