コード例 #1
0
        public Task ShowCollectionCreatedDialog(CustomCollectionLibraryItemViewModel collection)
        {
            var collectionCreatedViewModel = _collectionCreatedFactory();

            collectionCreatedViewModel.SetCollection(collection);
            return(_specialDialogManager.ShowDialog(collectionCreatedViewModel));
        }
コード例 #2
0
        public void SetCollection(CustomCollectionLibraryItemViewModel collection) {
            Contract.Requires<ArgumentNullException>(collection != null);

            Collection = collection;
            OnlineUrl = collection.Model.ProfileUrl();
            PwsUrl = collection.Model.GetPwsUri();
        }
コード例 #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);
        }
コード例 #4
0
        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;
        }
コード例 #5
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);
 }
コード例 #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));
 }
コード例 #7
0
        public void SetCollection(CustomCollectionLibraryItemViewModel collection)
        {
            if (collection == null)
            {
                throw new ArgumentNullException(nameof(collection));
            }

            Collection = collection;
            OnlineUrl  = collection.Model.ProfileUrl();
            PwsUrl     = collection.Model.GetPwsUri();
        }
コード例 #8
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);
        }
コード例 #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);
 }
コード例 #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);
        }
コード例 #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));
        }
コード例 #12
0
        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;
        }
コード例 #13
0
        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;
        }
コード例 #14
0
 public Task ShowCollectionCreatedDialog(CustomCollectionLibraryItemViewModel collection) {
     var collectionCreatedViewModel = _collectionCreatedFactory();
     collectionCreatedViewModel.SetCollection(collection);
     return _dialogManager.ShowDialogAsync(collectionCreatedViewModel);
 }
コード例 #15
0
 public Task<bool> ChangeScope(CustomCollectionLibraryItemViewModel collection, CollectionScope scope) {
     return WrapAsync(collection,
         () => _mediator.RequestAsyncWrapped(new ChangeCollectionScopeCommand(collection.Model.Id, scope)));
 }
コード例 #16
0
 bool Wrap(CustomCollectionLibraryItemViewModel collection, Action act) {
     try {
         act();
         return true;
     } catch (CollectionEmptyException) {
         AddSomeItems();
     } catch (CollectionNameMissingException) {
         EditName(collection);
     } catch (CollectionDescriptionMissingException) {
         EditDescription(collection);
     }
     return false;
 }
コード例 #17
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;
 }
コード例 #18
0
 public Task <bool> ChangeScope(CustomCollectionLibraryItemViewModel collection, CollectionScope scope) => WrapAsync(collection,
                                                                                                                     () => _mediator.RequestAsyncWrapped(new ChangeCollectionScopeCommand(collection.Model.Id, scope)));