Exemplo n.º 1
0
        public UpgradeViewPresenter(
            IApplicationSettingViewsService applicationSettingViewsService)
        {
            this.applicationSettingViewsService = applicationSettingViewsService;

            this.BuyPackageCommand = new DelegateCommand(this.BuyPackage, this.CanBuyPackage);
        }
Exemplo n.º 2
0
        public LinksRegionViewPresenter(
            IApplicationStateService stateService,
            IApplicationResources resources,
            ISearchService searchService,
            IDispatcher dispatcher,
            IGoogleMusicSynchronizationService googleMusicSynchronizationService,
            IApplicationSettingViewsService applicationSettingViewsService,
            IGoogleMusicSessionService sessionService,
            INavigationService navigationService)
        {
            this.stateService = stateService;
            this.resources    = resources;
            this.dispatcher   = dispatcher;
            this.googleMusicSynchronizationService = googleMusicSynchronizationService;
            this.sessionService          = sessionService;
            this.navigationService       = navigationService;
            this.ShowSearchCommand       = new DelegateCommand(searchService.Activate);
            this.NavigateToDownloadQueue = new DelegateCommand(async() =>
            {
                if (!this.disableClickToCache)
                {
                    await this.dispatcher.RunAsync(() => applicationSettingViewsService.Show("offlinecache"));
                }
            });

            this.UpdateLibraryCommand = new DelegateCommand(
                async() =>
            {
                if (this.UpdateLibraryCommand.CanExecute())
                {
                    this.synchronizationTimer.Stop();
                    await this.Synchronize(forceToDownloadPlaylists: true);
                }
            },
                () => !this.BindingModel.ShowProgressRing);

            this.BindingModel = new LinksRegionBindingModel();

            this.synchronizationTimer = new DispatcherTimer {
                Interval = TimeSpan.FromMinutes(5)
            };
            this.synchronizationTimer.Stop();
            this.synchronizationTime = 0;

            this.synchronizationTimer.Tick += this.SynchronizationTimerOnTick;

            this.Logger.LogTask(this.Synchronize());

            this.SetOfflineMessageIfRequired();

            this.sessionService.SessionCleared += this.SessionServiceOnSessionCleared;
        }
        public RightRegionControlService(
            ILogManager logManager,
            IApplicationResources resources,
            IMainFrameRegionProvider regionProvider,
            IApplicationSettingViewsService settingsCommands)
        {
            this.logger           = logManager.CreateLogger("RightRegionControlService");
            this.resources        = resources;
            this.regionProvider   = regionProvider;
            this.settingsCommands = settingsCommands;

            this.UpdateAdControl();
            InAppPurchases.LicenseChanged += this.UpdateAdControl;
        }
Exemplo n.º 4
0
        public static void Initialize(IApplicationSettingViewsService service, IApplicationResources resources)
        {
            service.RegisterSettings <AccountsView>("accounts", resources.GetString("SettingsAccountTitle"));
            service.RegisterSettings <AppSettingsView>("appsettings", resources.GetString("SettingsAppSettingsTitle"));
            service.RegisterSettings <OfflineCacheView>("offlinecache", resources.GetString("OfflineCacheAppSettingsTitle"), ApplicationSettingLayoutType.Large);

            bool upgradeViewRegistered = false;

            if (!InAppPurchases.HasFeature(GoogleMusicFeatures.All))
            {
                service.RegisterSettings <UpgradeView>("upgrade", resources.GetString("SettingsUpgradeTitle"));
                upgradeViewRegistered = true;
            }

            service.RegisterSettings <SupportView>("support", resources.GetString("SettingsSupportTitle"));
            service.RegisterSettings <PrivacyView>("privacy", resources.GetString("SettingsPrivacyPolicyTitle"));
            service.RegisterSettings <LegalView>("legal", resources.GetString("SettingsLegalTitle"));

            InAppPurchases.LicenseChanged += () =>
            {
                if (!InAppPurchases.HasFeature(GoogleMusicFeatures.All))
                {
                    if (!upgradeViewRegistered)
                    {
                        service.RegisterSettings <UpgradeView>("upgrade", "SettingsUpgradeTitle", ApplicationSettingLayoutType.Standard, "accounts");
                        upgradeViewRegistered = true;
                    }
                }
                else
                {
                    if (upgradeViewRegistered)
                    {
                        service.UnregisterSettings("upgrade");
                        upgradeViewRegistered = false;
                    }
                }
            };

#if DEBUG
            InAppPurchases.SimulatorInAppPurchasesInitialization();
#endif
        }
Exemplo n.º 5
0
        public PlayerMorePopupViewPresenter(
            IPlayQueueService queueService,
            IApplicationSettingViewsService applicationSettingViewsService,
            PlayerMorePopupViewBindingModel bindingModel)
        {
            this.queueService = queueService;
            this.applicationSettingViewsService = applicationSettingViewsService;

            this.BindingModel = bindingModel;

            this.RepeatAllCommand = new DelegateCommand(() => { }, () => this.queueService.State != QueueState.Busy && !queueService.IsRadio);
            this.ShuffleCommand   = new DelegateCommand(() => { }, () => this.queueService.State != QueueState.Busy && !queueService.IsRadio);
            this.ShowApplicationSettingsCommand = new DelegateCommand(async() =>
            {
                await this.Dispatcher.RunAsync(
                    () => this.applicationSettingViewsService.Show());
            });

            this.queueService.StateChanged += this.QueueServiceOnStateChanged;
        }
Exemplo n.º 6
0
        public AccountsViewPresenter(
            IApplicationResources resources,
            IGoogleAccountService googleAccountService,
            IGoogleMusicSessionService sessionService,
            ILastfmWebService lastfmWebService,
            ICurrentSongPublisherService publisherService,
            IApplicationSettingViewsService applicationSettingViewsService,
            INavigationService navigationService)
        {
            this.resources                      = resources;
            this.googleAccountService           = googleAccountService;
            this.sessionService                 = sessionService;
            this.lastfmWebService               = lastfmWebService;
            this.publisherService               = publisherService;
            this.applicationSettingViewsService = applicationSettingViewsService;
            this.navigationService              = navigationService;
            this.BindingModel                   = new AccountViewBindingModel();
            this.ForgetAccountCommand           = new DelegateCommand(this.ForgetAccount);
            this.SignOutCommand                 = new DelegateCommand(this.SignOutAccount);
            this.LastfmUnlinkCommand            = new DelegateCommand(this.LastfmUnlink);
            this.LastfmLinkCommand              = new DelegateCommand(this.LastfmLink, () => this.sessionService.GetSession().IsAuthenticated);
            this.ReloadSongsCommand             = new DelegateCommand(this.ReloadSongs, () => this.navigationService.HasHistory());

            var userInfo = this.googleAccountService.GetUserInfo();

            if (userInfo != null)
            {
                this.BindingModel.AccountName  = userInfo.Email;
                this.BindingModel.IsRemembered = userInfo.RememberAccount;
            }

            Session lastfmSession = this.lastfmWebService.GetSession();

            if (lastfmSession != null)
            {
                this.BindingModel.LastfmAccountName = lastfmSession.Name;
            }

            this.BindingModel.HasSession = this.sessionService.GetSession().IsAuthenticated;
        }
 public ApplicationSettingFramePresenter(
     IApplicationSettingViewsService applicationSettingViewsService)
 {
     this.applicationSettingViewsService = applicationSettingViewsService;
     this.GoBackCommand = new DelegateCommand(this.GoBack);
 }