Ejemplo n.º 1
0
 public JournalViewModel(Factories factories, BackgroundWorkerFactory workerFactory,
     SugarEditingViewModel sugarEditing)
 {
     this.factories = factories;
     this.workerFactory = workerFactory;
     this.sugarEditing = sugarEditing;
     InitializeSugarEditing();
 }
 public GroupingJournalViewModel(Factories factories, BackgroundWorkerFactory workerFactory,
     SugarEditingViewModel sugarEditing)
     : base(factories, workerFactory, sugarEditing)
 {
     Grouping = new GroupingViewModel<JournalItemViewModel, DateViewModel>(this, () => Items,
         keySelector: item => item.Date,
         predicate: item => item.FilterIn(search),
         choose: Choose);
 }
Ejemplo n.º 3
0
 public void Initialize(SugarEditingViewModel viewModel)
 {
     Delete = Picker.ApplicationBarInfo.Buttons[2];
     ViewModel = viewModel;
     ViewModel.NeedToShow += delegate
     {
         DataContext = ViewModel.Subject;
         Delete.IsEnabled = ViewModel.CanDelete;
         Picker.IsPopupOpen = true;
         controlledClosing = false;
     };
     TranslateApplicationBar();
 }
 public void TestInitialize()
 {
     factories = Substitute.For<Factories>();
     factories.InsulinCircumstances.Returns(new List<InsulinCircumstance>());
     factories.MealNames.Returns(new List<MealName>());
     factories.Insulins.Returns(new List<Insulin>());
     factories.Sugars.Returns(new List<Sugar>());
     factories.Meals.Returns(new List<Meal>());
     factories.Settings.Returns(new Settings());
     sugarEditing = Substitute.For<SugarEditingViewModel>();
     sut = new JournalViewModel(factories, new BackgroundWorkerSyncFactory(), sugarEditing);
     stateProvider = Substitute.For<StateProvider>();
     stateProvider.State.Returns(new Dictionary<string, object>());
     sut.StateProvider = stateProvider;
     navigator = Substitute.For<Navigator>();
     sut.Navigator = navigator;
 }
Ejemplo n.º 5
0
 private void UntombstoneSugarEditing()
 {
     var state = StateProvider.State;
     var sugarEditing = false;
     if (state.ContainsKey(SUGAR_EDITING))
     {
         sugarEditing = (bool)state[SUGAR_EDITING];
     }
     if (sugarEditing)
     {
         var editedSugarDate = (DateTime)state[EDITED_SUGAR_DATE];
         var sugar = Items.FirstOrDefault(vm => vm.DateTime == editedSugarDate
             && vm is SugarViewModel);
         if (sugar != null)
             Choose(sugar);
     }
 }
 public TelerikJournalViewModel(Factories factories, BackgroundWorkerFactory workerFactory,
     SugarEditingViewModel sugarEditing)
     : base(factories, workerFactory, sugarEditing)
 {
 }