Пример #1
0
 public void Initialize(JournalViewModel viewModel)
 {
     ViewModel = (TelerikJournalViewModel)viewModel;
     SugarEditing.Initialize(ViewModel.SugarEditing);
     DataContext = ViewModel;
     ViewModel.GroupDescriptors = List.GroupDescriptors;
     ViewModel.FilterDescriptors = List.FilterDescriptors;
     ViewModel.UpdateGroupDescriptors();
     ViewModel.DescriptorsUpdating += delegate { List.BeginDataUpdate(); };
     ViewModel.DescriptorsUpdated += delegate { List.EndDataUpdate(); };
     ViewModel.Refreshed += delegate { RestoreTopItem(); };
     ViewModel.Loaded += ViewModel_Loaded;
 }
Пример #2
0
 public MainViewModel(Factories factories, Cloud cloud, TimerFactory timerFactory,
     BackgroundWorkerFactory workerFactory, MealEditingViewModel.BackNavigation mealEditingBackNavigation,
     JournalViewModel journal, ProductListingViewModel productListing, MealItemEditingViewModel mealItemEditing,
     MessageDialog messageDialog, WelcomeScreen welcomeScreen, CloudMessages cloudMessages)
 {
     this.factories = factories;
     this.cloud = cloud;
     this.timerFactory = timerFactory;
     this.workerFactory = workerFactory;
     this.mealEditingBackNavigation = mealEditingBackNavigation;
     this.journal = journal;
     this.productListing = productListing;
     this.mealItemEditing = mealItemEditing;
     this.messageDialog = messageDialog;
     this.cloudMessages = cloudMessages;
     WelcomeScreen = welcomeScreen;
     ShareStateProvider();
 }
 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;
 }
 public void TestInitialize()
 {
     factories = Substitute.For<Factories>();
     fixture = new Fixture();
     factories.InsulinCircumstances.Returns(fixture.CreateMany<InsulinCircumstance>().ToList());
     factories.MealNames.Returns(fixture.CreateMany<MealName>().ToList());
     factories.Insulins.Returns(new List<Insulin>().ToList());
     factories.Sugars.Returns(new List<Sugar>().ToList());
     factories.Meals.Returns(new List<Meal>().ToList());
     factories.DefaultEntities.MealName.Returns(fixture.Create<MealName>());
     var sugarEditing = Substitute.For<SugarEditingViewModel>();
     viewModel = new JournalViewModel(factories, new BackgroundWorkerSyncFactory(), sugarEditing);
 }
 private MainViewModel CreateSut(Factories factories = null, Cloud cloud = null,
     TimerFactory timerFactory = null, ProductListingViewModel productListing = null,
     MealItemEditingViewModel mealItemEditing = null, MessageDialog messageDialog = null,
     WelcomeScreen welcomeScreen = null, CloudMessages cloudMessages = null)
 {
     if (factories == null)
         factories = Substitute.For<Factories>();
     if (cloud == null)
         cloud = Substitute.For<Cloud>();
     if (timerFactory == null)
         timerFactory = Substitute.For<TimerFactory>();
     if (productListing == null)
         productListing = new ProductListingViewModel(factories, new BackgroundWorkerSyncFactory());
     if (mealItemEditing == null)
         mealItemEditing = new MealItemEditingViewModel();
     if (messageDialog == null)
         messageDialog = Substitute.For<MessageDialog>();
     if (welcomeScreen == null)
         welcomeScreen = new WelcomeScreenImpl(messageDialog);
     if (cloudMessages == null)
         cloudMessages = new CloudMessages();
     var journal = new JournalViewModel(factories, new BackgroundWorkerSyncFactory(),
         new SugarEditingViewModel());
     return new MainViewModel(factories, cloud, timerFactory, new BackgroundWorkerSyncFactory(),
         new MealEditingViewModel.BackNavigation(), journal, productListing, mealItemEditing, messageDialog,
         welcomeScreen, cloudMessages);
 }
Пример #6
0
 public JournalLoader(JournalViewModel viewModel)
     : base(viewModel.workerFactory)
 {
     this.viewModel = viewModel;
     factories = viewModel.factories;
 }