示例#1
0
        public Result <TModel> Get()
        {
            var result = Repository.Get();

            if (result.IsSuccess)
            {
                return(EntityToModel(result.Data));
            }

            return(new ErrorResult <TModel>("Entity doesn't exist."));
        }
示例#2
0
        public override void Shutdown()
        {
            var result = _settingsRepository.Get();

            if (result.IsSuccess)
            {
                _entityLoader.WriteToFile(result.Data, SettingsFile);
            }
        }
示例#3
0
        public Result <SoundCloudAuthenticationStateEnum> Logout()
        {
            var result = _clientInfoRepository.Get();

            if (!result.IsSuccess)
            {
                _messenger.Send(new SoundCloudAuthenticationMessage(SoundCloudAuthenticationStateEnum.LoggedOut));
                _client = null;

                Logger.Info("SoundCloudClientInfo missing. No Client initialization");

                return(new ErrorResult <SoundCloudAuthenticationStateEnum>(Localization.Messages.CouldNotInitializeSoundCloudClient));
            }

            _client = SoundCloudClient.CreateUnauthorized(result.Data.ClientId);
            Logger.Info("Unauthorized client initialized");

            _messenger.Send(new SoundCloudAuthenticationMessage(SoundCloudAuthenticationStateEnum.LoggedInUnauthenticated));
            return(new SuccessResult <SoundCloudAuthenticationStateEnum>(SoundCloudAuthenticationStateEnum.LoggedInUnauthenticated));
        }