public static AddUserControlViewModel GetInstance() { if (_instance == null) { _instance = new AddUserControlViewModel(); } return(_instance); }
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()); }
private void PushCategories() { AddUserControlViewModel.GetInstance().GetAllCategories(); EditUserControlViewModel.GetInstance().GetAllCategories(); ViewUserControlViewModel.GetInstance().UpdateTransactions(ViewUserControlViewModel.GetInstance().Dates); }