Пример #1
0
 public PublishCollectionCommandHandler(IContentManager contentList, IConnectApiHandler api,
                                        IUserSettingsStorage storage)
 {
     _contentList = contentList;
     _api         = api;
     _storage     = storage;
 }
Пример #2
0
 protected CollectionSynchronizationBase(IConnectApiHandler api, IGameContext context,
                                         IContentManager contentList)
 {
     _api         = api;
     _context     = context;
     _contentList = contentList;
 }
Пример #3
0
 public CollectionNotificationHandler(IConnectApiHandler api, IGameContext context,
                                      IContentManager contentList) : base(api, context, contentList)
 {
     _api         = api;
     _context     = context;
     _contentList = contentList;
 }
 public UnsubscribeFromCollectionCommandHandler(IContentManager contentList, IConnectApiHandler api,
                                                UserSettings settings, IUserSettingsStorage storage)
 {
     _contentList = contentList;
     _api         = api;
     _storage     = storage;
 }
Пример #5
0
        public ContactList(IEventAggregator ea,
                           IConnectApiHandler handler, IMediator mediator)
        {
            _eventBus   = ea;
            _mediator   = mediator;
            _apiHandler = handler;
            _apiHandler.MessageBus.Listen <ConnectionStateChanged>().Subscribe(Handle);

            LoginState = string.IsNullOrWhiteSpace(DomainEvilGlobal.SecretData.UserInfo.AccessToken)
                ? LoginState.LoggedOut
                : LoginState.LoggedIn;

            this.WhenAnyValue(x => x.LoginState)
            .Skip(1)
            .Subscribe(HandleNewLogginState);

            // TODO: Not good

            /*
             * _apiHandler.MessageBus.Listen<ConnectionStateChanged>()
             *  .Subscribe(x => {
             *      if (LoginState == LoginState.LoggedIn)
             *          ConnectedState = x.IsConnected ? ConnectedState.Connected : ConnectedState.Connecting;
             *  });
             */
        }
Пример #6
0
        public async Task Publish(IConnectApiHandler api, IContentManager modList,
                                  CollectionScope scope   = CollectionScope.Unlisted,
                                  Guid?forkedCollectionId = null)
        {
            if (string.IsNullOrWhiteSpace(Name))
            {
                throw new CollectionNameMissingException();
            }
            //if (scope != CollectionScope.Private && string.IsNullOrWhiteSpace(Description))
            // throw new CollectionDescriptionMissingException();
            if (!Items.Any())
            {
                throw new CollectionEmptyException();
            }

            var version = defaultVersion;
            List <CollectionVersionDependencyModel> dependencies;

            lock (Items)
                dependencies = GetMods()
                               .Select(Convert)
                               .ToList();

            var hasCustomRepo = HasCustomRepo();

            if (hasCustomRepo)
            {
                UpdateRepositoriesFromCustomRepo();
            }

            var servers = GetServersForPublishing();

            var publishInfo =
                await api.PublishCollection(new CreateCollectionModel {
                GameId             = GameId,
                Name               = Name,
                Scope              = scope,
                ForkedCollectionId = forkedCollectionId,
                InitialVersion     = new CreateCollectionVersionModel {
                    Description  = Description,
                    Version      = version,
                    Dependencies = dependencies,
                    Repositories = Repositories.ToList(),
                    Servers      = servers
                }
            }).ConfigureAwait(false);

            if (hasCustomRepo)
            {
                CleanupRepo();
            }

            UpdatePublishInfo(scope, version, publishInfo);
            HandleModsetMods(modList);
            if (hasCustomRepo)
            {
                await UploadImageIfAvailable(api).ConfigureAwait(false);
            }
        }
Пример #7
0
 public MediatorApiContextDecorator(IMediator mediator, IConnectApiHandler scopeFactory) : base(mediator)
 {
     if (scopeFactory == null)
     {
         throw new ArgumentNullException(nameof(scopeFactory));
     }
     _scopeFactory = scopeFactory;
 }
Пример #8
0
        public async Task ChangeScope(IConnectApiHandler api, CollectionScope desiredScope)
        {
            await api.ChangeCollectionScope(PublishedId.Value, desiredScope).ConfigureAwait(false);

            PublishingScope = desiredScope;
            if (desiredScope == CollectionScope.Private)
            {
                Subscribers = null;
            }
        }
Пример #9
0
        public async Task DeleteOnline(IConnectApiHandler api, IContentManager modList)
        {
            await api.DeleteCollection(PublishedId.Value).ConfigureAwait(false);

            _publishedAccountId = null;
            PublishedVersion    = null;
            Version             = null;
            _publishingScope    = null;
            PublishedId         = null;
            HandleModsetMods(modList);
        }
Пример #10
0
        public HomeView(BrowserInterop browserInterop, ILoginHandler loginHandler, IConnectApiHandler connMan)
        {
            InitializeComponent();
            _loginHandler = loginHandler;

            WebControl.LifeSpanHandler = new LifeSpanHandler();

            WebControl.RegisterJsObject("six_client", new Handler(browserInterop, connMan, HandleLogin));

            this.WhenActivated(d => {
                d(this.WhenAnyValue(x => x.ViewModel).BindTo(this, v => v.DataContext));
                d(this.WhenAnyValue(x => x.ViewModel)
                  .Skip(1)
                  .Subscribe(vm => {
                    d(WebControl.WhenAnyValue(x => x.IsLoading).Subscribe(x => {
                        ViewModel.ProgressState.Active = x;
                        ViewModel.CanGoBack            = WebControl.CanGoBack;
                        ViewModel.CanGoForward         = WebControl.CanGoForward;
                    }));
                    d(vm.Navigate.Subscribe(x => {
                        switch (x)
                        {
                        case HomeViewModel.NavigateMode.GoBack: {
                            WebControl.BackCommand.Execute(null);
                            break;
                        }

                        case HomeViewModel.NavigateMode.Abort: {
                            WebControl.Stop();
                            break;
                        }

                        case HomeViewModel.NavigateMode.GoForward: {
                            WebControl.ForwardCommand.Execute(null);
                            break;
                        }

                        case HomeViewModel.NavigateMode.Reload: {
                            WebControl.Reload(false);
                            break;
                        }
                        }
                    }));
                }));

                d(this.WhenAnyValue(v => v.WebControl.IsLoading)
                  .Skip(1)
                  .Subscribe(x => ViewModel.IsNavigating = x));
            });

            CommandBindings.Add(new CommandBinding(BrowserView.CopyToClipboard, OnCopyToClipboard, CanCopyToClipboard));
            CommandBindings.Add(new CommandBinding(BrowserView.OpenInSystemBrowser, OnOpenInSystemBrowser,
                                                   CanOpenInSystemBrowser));
        }
Пример #11
0
        public async Task PublishNewVersion(IConnectApiHandler api)
        {
            if (PublishedId == null)
            {
                throw new Exception("Not a published collection");
            }
            if (string.IsNullOrWhiteSpace(Name))
            {
                throw new CollectionNameMissingException();
            }
            //if (scope != CollectionScope.Private && string.IsNullOrWhiteSpace(Description))
            // throw new CollectionDescriptionMissingException();
            if (!Items.Any())
            {
                throw new CollectionEmptyException();
            }

            await api.ChangeCollectionName(PublishedId.Value, Name).ConfigureAwait(false);

            var version = PublishedVersion.AutoIncrement();

            var hasCustomRepo = HasCustomRepo();

            if (hasCustomRepo)
            {
                UpdateRepositoriesFromCustomRepo();
            }

            var servers = GetServersForPublishing();

            await api.PublishNewCollectionVersion(new AddCollectionVersionModel {
                Description  = Description,
                CollectionId = PublishedId.Value,
                Version      = version,
                Dependencies = Items.OfType <ToggleableModProxy>()
                               .Select(Convert)
                               .ToList(),
                Repositories = Repositories.ToList(),
                Servers      = servers
            }).ConfigureAwait(false);

            if (hasCustomRepo)
            {
                CleanupRepo();
            }

            UpdatePublishInfo(version);

            if (hasCustomRepo)
            {
                await UploadImageIfAvailable(api).ConfigureAwait(false);
            }
        }
Пример #12
0
 public Task Unsubscribe(IConnectApiHandler api) => api.UnsubscribeCollection(CollectionID);
Пример #13
0
 public Handler(BrowserInterop interop, IConnectApiHandler connMan, Action <AccessInfo> handleLogin)
 {
     _interop     = interop;
     _connMan     = connMan;
     _handleLogin = handleLogin;
 }
Пример #14
0
 public FetchCollectionQueryHandler(IConnectApiHandler api, IGameContext context,
                                    IContentManager contentList)
     : base(api, context, contentList)
 {
 }
Пример #15
0
 public CollectionSynchronizer(IConnectApiHandler api, IGameContext context,
                               IContentManager contentList) : base(api, context, contentList)
 {
     _contentList = contentList;
 }
Пример #16
0
 public async Task UploadAvatar(IAbsoluteFilePath filePath, IConnectApiHandler api)
 {
     ImageLarge =
         Image  =
             "http:" + await api.UploadCollectionAvatar(filePath, PublishedId.Value).ConfigureAwait(false);
 }
Пример #17
0
 public async Task GenerateNewAvatar(IConnectApiHandler api)
 {
     ImageLarge =
         Image  = "http:" + await api.GenerateNewCollectionImage(PublishedId.Value).ConfigureAwait(false);
 }
 public UploadNewCollectionImageCommandHandler(IConnectApiHandler api, IContentManager contentList)
 {
     _api         = api;
     _contentList = contentList;
 }
Пример #19
0
 public Task Unsubscribe(IConnectApiHandler api) {
     return api.UnsubscribeCollection(CollectionID);
 }
Пример #20
0
 public ShowCollectionVisibilityQueryHandler(IContentManager contentList, IConnectApiHandler apiHandler)
 {
     _contentList = contentList;
     _apiHandler  = apiHandler;
 }