Beispiel #1
0
        public Task ShowCollectionCreatedDialog(CustomCollectionLibraryItemViewModel collection)
        {
            var collectionCreatedViewModel = _collectionCreatedFactory();

            collectionCreatedViewModel.SetCollection(collection);
            return(_specialDialogManager.ShowDialog(collectionCreatedViewModel));
        }
        public void SetCollection(CustomCollectionLibraryItemViewModel collection) {
            Contract.Requires<ArgumentNullException>(collection != null);

            Collection = collection;
            OnlineUrl = collection.Model.ProfileUrl();
            PwsUrl = collection.Model.GetPwsUri();
        }
Beispiel #3
0
        public async Task <bool> Upload(CustomCollectionLibraryItemViewModel collection)
        {
            var  scope  = CollectionScope.Private;
            bool?result = null;

            if (!await WrapAsync(collection, async() => {
                var collectionVisibilityViewModel =
                    _mediator.Send(new ShowCollectionVisibilityQuery(collection.Model.Id));
                result = (await _specialDialogManager.ShowDialog(collectionVisibilityViewModel)).GetValueOrDefault();
                scope = collectionVisibilityViewModel.Visibility;
            }))
            {
                return(false);
            }

            if (!result.GetValueOrDefault())
            {
                return(false);
            }

            await Publish(collection, scope).ConfigureAwait(false);

            if (scope != CollectionScope.Private)
            {
                await ShowCollectionCreatedDialog(collection);
            }

            return(true);
        }
        public DesignTimeModLibraryViewModel() {
            var game = new Arma1Game(Guid.NewGuid(), new GameSettingsController());
            var collectionGroup = new ModLibraryGroupViewModel(this, "Collections",
                icon: SixIconFont.withSIX_icon_Folder);
            var collections =
                new CustomCollectionLibraryItemViewModel(this,
                    new CustomCollection(Guid.NewGuid(), game) {Name = "Test ModSet"},
                    collectionGroup);
            var subscribedCollections =
                new SubscribedCollectionLibraryItemViewModel(this,
                    new SubscribedCollection(Guid.NewGuid(), Guid.NewGuid(), game) {Name = "Test ModSet3"},
                    collectionGroup);
            var mod = new Mod(Guid.Empty) {
                Name = "@TESTMOD",
                FullName = "Da Full name fewafefiejaofijeafoijeafo ieafioj eaoi",
                Author = "The Author",
                Version = "1.2.0"
            };
            collections.Items.Add(new CustomCollection(Guid.NewGuid(), game) {
                Name = "Some ModSet wuith faopek faof aepokf poaefpokpof  eaf",
                Author = "Some author",
                Version = "1.0.2"
            });
            collections.Items.Add(mod);
            collections.SelectedItem = mod;

            // TODO
            //CreateItemsView(
            //    new ReactiveList<ContentLibraryItem>(new[]
            //    {subscribedCollections, sharedCollections, localCollections}), new LibraryGroup[0]);
            SelectedItem = collections;
        }
 public async Task<bool> Sync(CustomCollectionLibraryItemViewModel collection) {
     if (!await DealWithCustomRepo(collection.Model))
         return false;
     return await
         WrapAsync(collection,
             () => _mediator.RequestAsyncWrapped(new PublishNewCollectionVersionCommand(collection.Model.Id)))
             .ConfigureAwait(false);
 }
Beispiel #6
0
 public async Task <bool> Sync(CustomCollectionLibraryItemViewModel collection)
 {
     if (!await DealWithCustomRepo(collection.Model))
     {
         return(false);
     }
     return(await
            WrapAsync(collection,
                      () => _mediator.RequestAsyncWrapped(new PublishNewCollectionVersionCommand(collection.Model.Id)))
            .ConfigureAwait(false));
 }
        public void SetCollection(CustomCollectionLibraryItemViewModel collection)
        {
            if (collection == null)
            {
                throw new ArgumentNullException(nameof(collection));
            }

            Collection = collection;
            OnlineUrl  = collection.Model.ProfileUrl();
            PwsUrl     = collection.Model.GetPwsUri();
        }
        public async Task<bool> Publish(CustomCollectionLibraryItemViewModel collection, CollectionScope scope) {
            if (!await DealWithCustomRepo(collection.Model))
                return false;

            return
                await
                    WrapAsync(collection,
                        () =>
                            _mediator.RequestAsyncWrapped(new PublishCollectionCommand(collection.Model.Id, scope,
                                collection.Model.ForkedCollectionId)))
                        .ConfigureAwait(false);
        }
Beispiel #9
0
 bool Wrap(CustomCollectionLibraryItemViewModel collection, Action act)
 {
     try {
         act();
         return(true);
     } catch (CollectionEmptyException) {
         AddSomeItems();
     } catch (CollectionNameMissingException) {
         EditName(collection);
     } catch (CollectionDescriptionMissingException) {
         EditDescription(collection);
     }
     return(false);
 }
Beispiel #10
0
        async Task <bool> WrapAsync(CustomCollectionLibraryItemViewModel collection, Func <Task> task)
        {
            try {
                await task().ConfigureAwait(false);

                return(true);
            } catch (CollectionEmptyException) {
                AddSomeItems();
            } catch (CollectionNameMissingException) {
                EditName(collection);
            } catch (CollectionDescriptionMissingException) {
                EditDescription(collection);
            }
            return(false);
        }
Beispiel #11
0
        public async Task <bool> Publish(CustomCollectionLibraryItemViewModel collection, CollectionScope scope)
        {
            if (!await DealWithCustomRepo(collection.Model))
            {
                return(false);
            }

            return
                (await
                 WrapAsync(collection,
                           () =>
                           _mediator.RequestAsyncWrapped(new PublishCollectionCommand(collection.Model.Id, scope,
                                                                                      collection.Model.ForkedCollectionId)))
                 .ConfigureAwait(false));
        }
        public DesignTimeModLibraryViewModel()
        {
            var game            = new Arma1Game(Guid.NewGuid(), new GameSettingsController());
            var collectionGroup = new ModLibraryGroupViewModel(this, "Collections",
                                                               icon: SixIconFont.withSIX_icon_Folder);
            var collections =
                new CustomCollectionLibraryItemViewModel(this,
                                                         new CustomCollection(Guid.NewGuid(), game)
            {
                Name = "Test ModSet"
            },
                                                         collectionGroup);
            var subscribedCollections =
                new SubscribedCollectionLibraryItemViewModel(this,
                                                             new SubscribedCollection(Guid.NewGuid(), Guid.NewGuid(), game)
            {
                Name = "Test ModSet3"
            },
                                                             collectionGroup);
            var mod = new Mod(Guid.Empty)
            {
                Name     = "@TESTMOD",
                FullName = "Da Full name fewafefiejaofijeafoijeafo ieafioj eaoi",
                Author   = "The Author",
                Version  = "1.2.0"
            };

            collections.Items.Add(new CustomCollection(Guid.NewGuid(), game)
            {
                Name    = "Some ModSet wuith faopek faof aepokf poaefpokpof  eaf",
                Author  = "Some author",
                Version = "1.0.2"
            });
            collections.Items.Add(mod);
            collections.SelectedItem = mod;

            // TODO
            //CreateItemsView(
            //    new ReactiveList<ContentLibraryItem>(new[]
            //    {subscribedCollections, sharedCollections, localCollections}), new LibraryGroup[0]);
            SelectedItem = collections;
        }
        public async Task<bool> Upload(CustomCollectionLibraryItemViewModel collection) {
            var scope = CollectionScope.Private;
            bool? result = null;
            if (!await WrapAsync(collection, async () => {
                var collectionVisibilityViewModel =
                    _mediator.Request(new ShowCollectionVisibilityQuery(collection.Model.Id));
                result = (await _dialogManager.ShowDialogAsync(collectionVisibilityViewModel)).GetValueOrDefault();
                scope = collectionVisibilityViewModel.Visibility;
            }))
                return false;

            if (!result.GetValueOrDefault())
                return false;

            await Publish(collection, scope).ConfigureAwait(false);

            if (scope != CollectionScope.Private)
                await ShowCollectionCreatedDialog(collection);

            return true;
        }
 public Task ShowCollectionCreatedDialog(CustomCollectionLibraryItemViewModel collection) {
     var collectionCreatedViewModel = _collectionCreatedFactory();
     collectionCreatedViewModel.SetCollection(collection);
     return _dialogManager.ShowDialogAsync(collectionCreatedViewModel);
 }
 public Task<bool> ChangeScope(CustomCollectionLibraryItemViewModel collection, CollectionScope scope) {
     return WrapAsync(collection,
         () => _mediator.RequestAsyncWrapped(new ChangeCollectionScopeCommand(collection.Model.Id, scope)));
 }
 bool Wrap(CustomCollectionLibraryItemViewModel collection, Action act) {
     try {
         act();
         return true;
     } catch (CollectionEmptyException) {
         AddSomeItems();
     } catch (CollectionNameMissingException) {
         EditName(collection);
     } catch (CollectionDescriptionMissingException) {
         EditDescription(collection);
     }
     return false;
 }
 async Task<bool> WrapAsync(CustomCollectionLibraryItemViewModel collection, Func<Task> task) {
     try {
         await task().ConfigureAwait(false);
         return true;
     } catch (CollectionEmptyException) {
         AddSomeItems();
     } catch (CollectionNameMissingException) {
         EditName(collection);
     } catch (CollectionDescriptionMissingException) {
         EditDescription(collection);
     }
     return false;
 }
Beispiel #18
0
 public Task <bool> ChangeScope(CustomCollectionLibraryItemViewModel collection, CollectionScope scope) => WrapAsync(collection,
                                                                                                                     () => _mediator.RequestAsyncWrapped(new ChangeCollectionScopeCommand(collection.Model.Id, scope)));