예제 #1
0
        public HomeViewModel(IBvmConstructor bvmConstructor) : base(bvmConstructor)
        {
            Title = Resources.Home;

            RecentPackages    = new ObservableRangeCollection <PackageMetadata>();
            FavouritePackages = new ObservableRangeCollection <PackageMetadata>();
            LoadCommand       = new AsyncCommand <CancellationToken>(LoadAsync);
        }
예제 #2
0
        public MainViewModel(IBvmConstructor bvmConstructor) : base(bvmConstructor)
        {
            Title = Resources.Search;

            Packages      = new ObservableRangeCollection <PackageMetadata>();
            SearchCommand = new AsyncCommand <CancellationToken>((ct) => SearchAsync(SearchText, 0, ct));
            RemainingItemsThresholdReachedCommand = new AsyncCommand(() =>
                                                                     _searchCancellation != null
                    ? SearchAsync(SearchText, Packages.Count, _searchCancellation.Token)
                    : Task.FromResult(0));
            PackageTappedCommand = new Command <PackageMetadata>(PackageTapped);
        }
예제 #3
0
        public SettingsViewModel(
            IBrowser browser,
            ILauncher launcher,
            IDeviceInfo deviceInfo,
            IAppInfo appInfo,
            IVersionTracking versionTracking,
            IEmail email,
            IStoreReview storeReview,
            IMuGetPackageService muGetPackageService,
            IBvmConstructor bvmConstructor) : base(bvmConstructor)
        {
            Title = Resources.Settings;

            _browser         = browser;
            _launcher        = launcher;
            _deviceInfo      = deviceInfo;
            _appInfo         = appInfo;
            _versionTracking = versionTracking;
            _email           = email;

            _storeReview = storeReview;

            _muGetPackageService = muGetPackageService;

            MuGetPackages = new ObservableRangeCollection <MuGetPackage>(_muGetPackageService.GetPackages());

            SettingsItemTappedCommand = new AsyncCommand <SettingItem>(SettingsItemTappedAsync);
            PackageTappedCommand      = new AsyncCommand <MuGetPackage>(async(p) =>
            {
                if (!string.IsNullOrEmpty(p?.PackageId))
                {
                    await _launcher.TryOpenAsync(string.Format(Resources.PackageUrlFormat, p.PackageId));
                }
            });
            ResetNotificationsCommand = new Command(ResetNotifications);
            RunJobsCommand            = new AsyncCommand(RunJobsAsync);
        }
예제 #4
0
 public BaseViewModel(IBvmConstructor bvmConstructor) : base()
 {
     NuGetService = bvmConstructor.NuGetService;
     Logger       = bvmConstructor.Logger;
     Dialogs      = bvmConstructor.UserDialogs;
 }