Example #1
0
 public WindowsSettingsViewModel(ISettingsFacade settingsFacade,
                                 IDialogService dialogService,
                                 IThemeSelectorAdapter themeSelectorAdapter)
     : base(settingsFacade, dialogService)
 {
     this.themeSelectorAdapter = themeSelectorAdapter;
 }
 public StatisticCategorySummaryViewModel(IMediator mediator,
                                          ISettingsFacade settingsFacade)
     : base(mediator, settingsFacade)
 {
     CategorySummary      = new ObservableCollection <CategoryOverviewViewModel>();
     IncomeExpenseBalance = new IncomeExpenseBalanceViewModel();
 }
        public void Logout_PropertiesSet()
        {
            // Setup
            IConnectivityAdapter connectivitySetup   = Substitute.For <IConnectivityAdapter>();
            ISettingsFacade      settingsManagerMock = Substitute.For <ISettingsFacade>();

            bool logoutCommandCalled = false;

            IBackupService backupServiceMock = Substitute.For <IBackupService>();

            backupServiceMock.When(x => x.LogoutAsync())
            .Do(x => logoutCommandCalled = true);

            //execute
            var vm = new BackupViewModel(backupServiceMock,
                                         null,
                                         connectivitySetup,
                                         settingsManagerMock,
                                         null);

            vm.LogoutCommand.Execute(null);

            //assert
            logoutCommandCalled.Should().BeTrue();
            settingsManagerMock.IsLoggedInToBackupService.Should().BeFalse();
        }
Example #4
0
 public StatisticCategorySummaryViewModel(ICategorySummaryDataProvider categorySummaryDataDataProvider,
                                          ISettingsFacade settingsFacade)
     : base(settingsFacade)
 {
     this.categorySummaryDataDataProvider = categorySummaryDataDataProvider;
     CategorySummary = new ObservableCollection <CategoryOverviewViewModel>();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:CustomerPortalApp.ViewModels.DashboardPageViewModel"/> class.
        /// </summary>
        /// <param name="dialogService">Dialog service.</param>
        /// <param name="authenticationFacade">Authentication facade.</param>
        /// <param name="settingsFacade">Settings facade.</param>
        /// <param name="propertyFacade">Property facade.</param>
        /// <param name="storyFacade">Story facade.</param>
        /// <param name="keychainService">Keychain service.</param>
        public DashboardPageViewModel(
            IPageDialogService dialogService,
            IAuthenticationFacade authenticationFacade,
            ISettingsFacade settingsFacade,
            INavigationService navigationService,
            IPropertyFacade propertyFacade,
            IStoryFacade storyFacade,
            IKeychainService keychainService)
            : base(dialogService, authenticationFacade)
        {
            this.keychainService   = keychainService;
            this.settingsFacade    = settingsFacade;
            this.propertyFacade    = propertyFacade;
            this.storyFacade       = storyFacade;
            this.Title             = Constants.PageTitleDashboard;
            this.navigationService = navigationService;

            this.properties    = new ObservableCollection <PropertyViewModel>();
            this.Communities   = new ObservableCollection <StoryViewModel>();
            this.Events        = new ObservableCollection <StoryViewModel>();
            this.ActiveTabData = new ObservableCollection <StoryViewModel>();

            this.ExecuteAsyncTask(async() =>
            {
                await Task.WhenAll(new Task[] {
                    this.LoadProperty(),
                    this.LoadStories("event"),
                    this.LoadStories("story")
                });
            }).Forget();

            PopulateFakeProperties();
        }
        public void Initialize_ConnectivityLoggedIn_MethodsCalled()
        {
            // Setup
            IConnectivityAdapter connectivitySetup = Substitute.For <IConnectivityAdapter>();

            connectivitySetup.IsConnected.Returns(true);

            ISettingsFacade settingsManagerMock = Substitute.For <ISettingsFacade>();

            settingsManagerMock.IsLoggedInToBackupService.Returns(true);

            DateTime returnDate = DateTime.Today;

            IBackupService backupServiceMock = Substitute.For <IBackupService>();

            backupServiceMock.IsBackupExistingAsync().Returns(true);
            backupServiceMock.GetBackupDateAsync().Returns(returnDate);

            //execute
            var vm = new BackupViewModel(backupServiceMock,
                                         null,
                                         connectivitySetup,
                                         settingsManagerMock,
                                         null);

            vm.InitializeCommand.Execute(null);

            //assert
            vm.IsLoadingBackupAvailability.Should().BeFalse();
            vm.BackupAvailable.Should().BeTrue();
            vm.BackupLastModified.Should().Be(returnDate);
        }
        public async Task Initialize_ConnectivityNotLoggedIn_NothingCalled()
        {
            // Setup
            IConnectivityAdapter connectivitySetup = Substitute.For <IConnectivityAdapter>();

            connectivitySetup.IsConnected.Returns(true);

            ISettingsFacade settingsManagerMock = Substitute.For <ISettingsFacade>();
            IBackupService  backupServiceMock   = Substitute.For <IBackupService>();

            //execute
            var vm = new BackupViewModel(backupServiceMock,
                                         null,
                                         connectivitySetup,
                                         settingsManagerMock,
                                         null);

            vm.InitializeCommand.Execute(null);

            //assert
            vm.IsLoadingBackupAvailability.Should().BeFalse();
            await backupServiceMock.Received(0).IsBackupExistingAsync();

            await backupServiceMock.Received(0).GetBackupDateAsync();
        }
Example #8
0
 /// <summary>
 ///     Constructor
 /// </summary>
 public LoginViewModel(ISettingsFacade settingsFacade,
                       IMvxLogProvider logProvider,
                       IMvxNavigationService navigationService) : base(logProvider, navigationService)
 {
     this.settingsFacade    = settingsFacade;
     this.navigationService = navigationService;
 }
Example #9
0
        public StatisticCashFlowViewModel(ICashFlowDataProvider cashFlowDataProvider,
                                          ISettingsFacade settingsFacade)
            : base(settingsFacade)
        {
            this.cashFlowDataProvider = cashFlowDataProvider;

            Chart = new BarChart();
        }
Example #10
0
 public Handler(IContextAdapter contextAdapter,
                IBackupService backupService,
                ISettingsFacade settingsFacade)
 {
     this.contextAdapter = contextAdapter;
     this.backupService  = backupService;
     this.settingsFacade = settingsFacade;
 }
Example #11
0
 protected ModifyAccountViewModel(ISettingsFacade settingsFacade,
                                  IBackupService backupService,
                                  INavigationService navigationService)
 {
     this.settingsFacade = settingsFacade;
     this.backupService  = backupService;
     NavigationService   = navigationService;
 }
 /// <summary>
 ///     Constructor
 /// </summary>
 public SettingsBackgroundJobViewModel(ISettingsFacade settingsFacade,
                                       IBackgroundTaskManager backgroundTaskManager,
                                       IMvxLogProvider logProvider,
                                       IMvxNavigationService navigationService) : base(logProvider, navigationService)
 {
     this.settingsFacade        = settingsFacade;
     this.backgroundTaskManager = backgroundTaskManager;
 }
Example #13
0
        public RegionalSettingsViewModel(ISettingsFacade settingsFacade,
                                         IDialogService dialogService)
        {
            this.settingsFacade = settingsFacade;
            this.dialogService  = dialogService;

            AvailableCultures = new ObservableCollection <CultureInfo>();
        }
Example #14
0
 protected ModifyAccountViewModel(ISettingsFacade settingsFacade,
                                  IBackupService backupService,
                                  IMvxLogProvider logProvider,
                                  IMvxNavigationService navigationService) : base(logProvider, navigationService)
 {
     this.settingsFacade    = settingsFacade;
     this.backupService     = backupService;
     this.navigationService = navigationService;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:CustomerPortal.Facade.Facades.AuthenticationFacade"/> class.
 /// </summary>
 /// <param name="settingsFacade">Settings facade.</param>
 public AuthenticationFacade(ISettingsFacade settingsFacade, IAuthenticationApiWrapper authApi, ILogApiWrapper logApi,
                             IAuthenticationHelperWrapper authenticationHelperWrapper, IKeychainService keychainService)
 {
     this.settingsFacade  = settingsFacade;
     this.keychainService = keychainService;
     _authApi             = authApi;
     _logApi = logApi;
     _authenticationHelperWrapper = authenticationHelperWrapper;
 }
 public StatisticCategorySummaryViewModel(ICategorySummaryDataProvider categorySummaryDataDataProvider,
                                          IMvxMessenger messenger,
                                          ISettingsFacade settingsFacade,
                                          IMvxLogProvider logProvider,
                                          IMvxNavigationService navigationService) : base(messenger, settingsFacade, logProvider, navigationService)
 {
     this.categorySummaryDataDataProvider = categorySummaryDataDataProvider;
     CategorySummary = new ObservableCollection <CategoryOverviewViewModel>();
 }
 /// <summary>
 ///     Contstructor
 /// </summary>
 public StatisticCategorySpreadingViewModel(ICategorySpreadingDataProvider spreadingDataProvider,
                                            IMvxMessenger messenger,
                                            ISettingsFacade settingsFacade,
                                            IMvxLogProvider logProvider,
                                            IMvxNavigationService navigationService)
     : base(messenger, settingsFacade, logProvider, navigationService)
 {
     this.spreadingDataProvider = spreadingDataProvider;
 }
 public SettingsSecurityViewModel(ISettingsFacade settingsFacade,
                                  IPasswordStorage passwordStorage,
                                  IDialogService dialogService,
                                  IMvxLogProvider logProvider,
                                  IMvxNavigationService navigationService) : base(logProvider, navigationService)
 {
     this.settingsFacade  = settingsFacade;
     this.passwordStorage = passwordStorage;
     this.dialogService   = dialogService;
 }
Example #19
0
        public TrayForm(ISleepManagementFacade sleepManagementFacade, ISettingsFacade settingsFacade)
        {
            _sleepManagementFacade = sleepManagementFacade;
            _settingsFacade        = settingsFacade;
            InitializeComponent();

            _settings = _settingsFacade.GetSettings();
            ConfigureSettingsControls(_settings);
            SetSleepMode(_settings.DefaultSleepMode);
        }
Example #20
0
 public BackupViewModel(IBackupService backupService,
                        IDialogService dialogService,
                        IConnectivityAdapter connectivity,
                        ISettingsFacade settingsFacade)
 {
     this.backupService  = backupService;
     this.dialogService  = dialogService;
     this.connectivity   = connectivity;
     this.settingsFacade = settingsFacade;
 }
 /// <summary>
 ///     Constructor
 /// </summary>
 protected ModifyCategoryViewModel(ICrudServicesAsync crudServices,
                                   ISettingsFacade settingsFacade,
                                   IBackupService backupService,
                                   IMvxLogProvider logProvider,
                                   IMvxNavigationService navigationService) : base(logProvider, navigationService)
 {
     this.settingsFacade = settingsFacade;
     this.backupService  = backupService;
     this.crudServices   = crudServices;
 }
Example #22
0
        public AddCategoryViewModel(ICrudServicesAsync crudServices,
                                    IDialogService dialogService,
                                    ISettingsFacade settingsFacade,
                                    IBackupService backupService,
                                    INavigationService navigationService) : base(crudServices, settingsFacade, backupService, navigationService)
        {
            this.crudServices  = crudServices;
            this.dialogService = dialogService;

            Title = Strings.AddCategoryTitle;
        }
Example #23
0
        public StatisticCategorySummaryViewModel(IMediator mediator,
                                                 ISettingsFacade settingsFacade,
                                                 IDialogService dialogService,
                                                 INavigationService navigationService) : base(mediator, settingsFacade)
        {
            this.dialogService     = dialogService;
            this.navigationService = navigationService;

            CategorySummary      = new ObservableCollection <CategoryOverviewViewModel>();
            IncomeExpenseBalance = new IncomeExpenseBalanceViewModel();
        }
        /// <summary>
        ///     Constructor
        /// </summary>
        protected ModifyCategoryViewModel(ICrudServicesAsync crudServices,
                                          ISettingsFacade settingsFacade,
                                          IBackupService backupService,
                                          INavigationService navigationService)
        {
            this.settingsFacade = settingsFacade;
            this.backupService  = backupService;
            this.crudServices   = crudServices;

            NavigationService = navigationService;
        }
        public StatisticCashFlowViewModel(IMvxMessenger messenger,
                                          ICashFlowDataProvider cashFlowDataProvider,
                                          ISettingsFacade settingsFacade,
                                          IMvxNavigationService navigationService,
                                          IMvxLogProvider logProvider)
            : base(messenger, settingsFacade, logProvider, navigationService)
        {
            this.cashFlowDataProvider = cashFlowDataProvider;

            Chart = new BarChart();
        }
 public AddCategoryViewModel(ICrudServicesAsync crudServices,
                             IDialogService dialogService,
                             ISettingsFacade settingsFacade,
                             IBackupService backupService,
                             IMvxLogProvider logProvider,
                             IMvxNavigationService navigationService)
     : base(crudServices, settingsFacade, backupService, logProvider, navigationService)
 {
     this.crudServices  = crudServices;
     this.dialogService = dialogService;
 }
 public EditAccountViewModel(ICrudServicesAsync crudServices,
                             ISettingsFacade settingsFacade,
                             IBackupService backupService,
                             IDialogService dialogService,
                             INavigationService navigationService) : base(settingsFacade, backupService, navigationService)
 {
     this.crudServices   = crudServices;
     this.settingsFacade = settingsFacade;
     this.backupService  = backupService;
     this.dialogService  = dialogService;
 }
        /// <summary>
        ///     Constructor
        /// </summary>
        protected ModifyCategoryViewModel(IMediator mediator,
                                          ISettingsFacade settingsFacade,
                                          IBackupService backupService,
                                          INavigationService navigationService, IMapper mapper)
        {
            this.settingsFacade = settingsFacade;
            this.backupService  = backupService;
            this.mediator       = mediator;

            NavigationService = navigationService;
            this.mapper       = mapper;
        }
Example #29
0
 public BackupViewModel(IBackupService backupService,
                        IDialogService dialogService,
                        IConnectivityAdapter connectivity,
                        ISettingsFacade settingsFacade,
                        IMvxLogProvider logProvider,
                        IMvxNavigationService navigationService) : base(logProvider, navigationService)
 {
     this.backupService  = backupService;
     this.dialogService  = dialogService;
     this.connectivity   = connectivity;
     this.settingsFacade = settingsFacade;
 }
Example #30
0
 public BackupService(ICloudBackupService cloudBackupService,
                      IFileStore fileStore,
                      ISettingsFacade settingsFacade,
                      IConnectivityAdapter connectivity,
                      IContextAdapter contextAdapter)
 {
     this.cloudBackupService = cloudBackupService;
     this.fileStore          = fileStore;
     this.settingsFacade     = settingsFacade;
     this.connectivity       = connectivity;
     this.contextAdapter     = contextAdapter;
 }