コード例 #1
0
        public AccountLoginViewModel(
            IEventAggregator eventAggregator,
            ILoginService loginService,
            IUserService userService,
            ICredentialManageService credentialStorageService
            )
        {
            this._eventAggregator          = eventAggregator;
            this._loginService             = loginService;
            this._userService              = userService;
            this._credentialStorageService = credentialStorageService;

            LoginCommand = DelegateCommand <object> .FromAsyncHandler(LoginAsync);
        }
コード例 #2
0
        public AccountRegionController(
            IUnityContainer container,
            IRegionManager regionManager,
            IEventAggregator eventAggregator,
            ICredentialManageService credentialStorageService)
        {
            this._container                = container;
            this._regionManager            = regionManager;
            this._eventAggregator          = eventAggregator;
            this._credentialStorageService = credentialStorageService;

            this._eventAggregator.GetEvent <UserStateChangedEvent>().Subscribe(HandleUserStateChange);
            TryLoadCredentialAsync();
        }
コード例 #3
0
        public UserInfoViewModel(
            IEventAggregator eventAggregator,
            ILoginService loginService,
            IUserService userService,
            ICredentialManageService credentialManageService,
            LoginResult loginResult)
        {
            this._eventAggregator         = eventAggregator;
            this._loginService            = loginService;
            this._userService             = userService;
            this._credentialManageService = credentialManageService;
            this._loginResult             = loginResult;

            this.LogOffCommand = new DelegateCommand(LogOff);

            GetUserInfo().ConfigureAwait(false);
        }
コード例 #4
0
        public NowPlayingViewModel(
            IEventAggregator eventAggregator,
            IAudioEngine playEngine,
            ISongService songService,
            ILyricsService lyricService,
            ICredentialManageService credentialStorageService)
        {
            this._eventAggregator          = eventAggregator;
            this._playEngine               = playEngine;
            this._songService              = songService;
            this._lyricsService            = lyricService;
            this._credentialStorageService = credentialStorageService;

            PlayList = new Queue <Song>();

            var switchChannelEvent = _eventAggregator.GetEvent <SwitchChannelEvent>();

            switchChannelEvent.Subscribe(async c => await HandleChannelChange(c));

            _userStateChangedEvent = _eventAggregator.GetEvent <UserStateChangedEvent>();
            _userStateChangedEvent.Subscribe(HandleUserStateChange);

            playEngine.TrackEnded += playEngine_TrackeEnded;

            LoadedCommand = DelegateCommand.FromAsyncHandler(Loaded);

            PlayNextCommand = DelegateCommand.FromAsyncHandler(async() => await PlayNext(false));

            LikeCommand = DelegateCommand.FromAsyncHandler(Like, () => this.IsLoggedIn);

            UnlikeCommand = DelegateCommand.FromAsyncHandler(Unlike, () => this.IsLoggedIn);

            BanCommand = DelegateCommand.FromAsyncHandler(Ban, () => this.IsLoggedIn);

            _timer = new DispatcherTimer {
                Interval = TimeSpan.FromSeconds(0.4)
            };
            _timer.Tick += _timer_Tick;
            _timer.Start();
        }