예제 #1
0
        protected override async Task ExitI()
        {
            _settings.AppOptions.Initialized = Common.AppCommon.InitializationLvl;
            // Storage saves also a DB so we cant close things beforehand...
            await _storage.SaveNow().ConfigureAwait(false);

            await base.ExitI().ConfigureAwait(false);
        }
예제 #2
0
        public async Task <Guid> Handle(CreateProfileCommand request)
        {
            var newProfile = _settings.GameOptions.GameSettingsController.CreateProfile(request.Name, request.Color,
                                                                                        request.Guid);

            await _storage.SaveNow().ConfigureAwait(false);

            return(newProfile.Id);
        }
        public async Task <Unit> Handle(UnpublishCollectionCommand request)
        {
            var collection = _contentList.CustomCollections.First(x => x.Id == request.Id);

            await collection.DeleteOnline(_api, _contentList).ConfigureAwait(false);

            await _storage.SaveNow().ConfigureAwait(false);

            return(Unit.Value);
        }
예제 #4
0
        public async Task <Unit> Handle(ChangeCollectionScopeCommand request)
        {
            var collection = _contentList.CustomCollections.First(x => x.Id == request.Id);

            await collection.ChangeScope(_api, request.Scope).ConfigureAwait(false);

            await _storage.SaveNow().ConfigureAwait(false);

            return(Unit.Value);
        }
        public async Task <Unit> Handle(UnsubscribeFromCollectionCommand request)
        {
            var collection = _contentList.SubscribedCollections.First(x => x.Id == request.Id);

            try {
                await collection.Unsubscribe(_api).ConfigureAwait(false);
            } catch (NotFoundException) {}

            _contentList.SubscribedCollections.RemoveLocked(collection);
            await _storage.SaveNow().ConfigureAwait(false);

            return(Unit.Value);
        }
        public async Task <Unit> Handle(PublishNewCollectionVersionCommand request)
        {
            var collection = _contentList.CustomCollections.First(x => x.Id == request.Id);

            try {
                await collection.PublishNewVersion(_api).ConfigureAwait(false);
            } catch (CollectionImageUploadException ex) {
                MainLog.Logger.FormattedWarnException(ex, "Image failure");
            }

            await _storage.SaveNow().ConfigureAwait(false);

            return(Unit.Value);
        }
예제 #7
0
        public async Task <Unit> Handle(DeleteCollectionCommand request)
        {
            var collection = _contentList.CustomCollections.First(x => x.Id == request.Id);

            if (collection.PublishedId.HasValue)
            {
                try {
                    await collection.DeleteOnline(_api, _contentList).ConfigureAwait(false);
                } catch (NotFoundException) {}
            }

            _contentList.CustomCollections.RemoveLocked(collection);

            await _storage.SaveNow().ConfigureAwait(false);

            return(Unit.Value);
        }