Example #1
0
 /// <inheritdoc />
 public UnsubscribeActionHandler(
     IMessageLocalizer <BotResources> localizer,
     ILoggerFactory loggerFactory,
     ITransport <SendTelegramReply> reply, IChannelStore channelStore, ISubscriptionsStore subscriptionsStore)
     : base(localizer, loggerFactory, reply)
 {
     _channelStore       = channelStore;
     _subscriptionsStore = subscriptionsStore;
 }
 public OrphanSubscriptionsCleanupJob(
     ISubscriptionsStore subscriptionsStore,
     IChannelStore channelStore,
     ILogger <OrphanSubscriptionsCleanupJob> logger)
 {
     _subscriptionsStore = subscriptionsStore;
     _channelStore       = channelStore;
     _logger             = logger;
 }
Example #3
0
 public LineNotifyGateway(
     IOptions <AbpRabbitMqEventBusOptions> eventBusOptions,
     IServiceDefinitionStore serviceDefinitionStore,
     IChannelStore channelStore
     )
 {
     this.eventBusOptions        = eventBusOptions.Value;
     this.serviceDefinitionStore = serviceDefinitionStore;
     this.channelStore           = channelStore;
 }
 public AlertManagerUpdateRequestHandler(
     ITemplateEngine templateEngine,
     IChannelStore channelStore,
     ITemplatesStore templatesStore,
     ISubscriptionsStore subscriptionsStore,
     IMediator mediator)
 {
     _templateEngine     = templateEngine;
     _channelStore       = channelStore;
     _templatesStore     = templatesStore;
     _subscriptionsStore = subscriptionsStore;
     _mediator           = mediator;
 }
 public ValuesController(IChannelStore s) {
     _store = s;
 }
 public UgController(IChannelStore s) {
     _store = s;
 }
Example #7
0
        public PodcastViewModel(IScreen hostScreen,
                                IPlayerModel player,
                                IEventAggregator eventAggregator,
                                IDialogService dialogService,
                                IFeedParser feedParser,
                                IChannelStore channelStore,
                                IPlaylistStore playlistStore)
            : base(eventAggregator)
        {
            HostScreen    = hostScreen;
            Player        = player;
            DialogService = dialogService;
            FeedParser    = feedParser;

            this.channelStore  = channelStore;
            this.playlistStore = playlistStore;

            GetChannelsCommand = ReactiveCommand.CreateFromTask(async _ => await GetChannels());
            GetChannelsCommand.IsExecuting.ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(_ => OnChannelsBusy(GetChannelsCommand.GetHashCode(), _));

            PlayItemCommand = ReactiveCommand.CreateFromTask <IPlayable>(async _ => await OnPlayEpisode(_ as Episode));

            // open url
            OpenUrlDialogCommand = ReactiveCommand.CreateFromTask(async _ => await OpenUrlDialog());
            OpenUrlDialogCommand.ThrownExceptions.ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(_ => LogAndNotify(NotificationType.Error, Messages.ERR_CHANNEL_LOAD));

            // channels busy indicator
            this.WhenAnyObservable(_ => _.ChannelsBusyList.CountChanged).DistinctUntilChanged()
            .Subscribe(_ => IsChannelsBusy = _ > 0);

            // episodes busy indicator
            this.WhenAnyObservable(_ => _.EpisodesBusyList.CountChanged).DistinctUntilChanged()
            .Subscribe(_ => IsEpisodesBusy = _ > 0);

            OpenUrlCommand = ReactiveCommand.CreateFromTask <string>(async _ => await OnOpenUrl(_));
            OpenUrlCommand.ThrownExceptions.ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(_ => LogAndNotify(NotificationType.Error, Messages.ERR_CHANNEL_LOAD));

            // load channel
            LoadChannelFromUrlCommand = ReactiveCommand.CreateFromTask <string>(LoadChannelFromUrlAsync);
            OpenUrlCommand.IsExecuting.ObserveOn(RxApp.MainThreadScheduler).Subscribe(_ =>
            {
                OnChannelsBusy(OpenUrlCommand.GetHashCode(), _);
                OnEpisodesBusy(OpenUrlCommand.GetHashCode(), _);
            });

            LoadChannelFromUrlCommand.ThrownExceptions.ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(_ => LogAndNotify(NotificationType.Error, Messages.ERR_CHANNEL_LOAD));

            // delete channel
            ConfirmDeleteChannelCommand = ReactiveCommand.CreateFromTask <Channel>(async _ => await ConfirmDelete(_));
            DeleteChannelCommand        = ReactiveCommand.CreateFromTask <Channel>(async _ => await DeleteChannel(_));
            DeleteChannelCommand.ThrownExceptions.ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(_ => LogAndNotify(NotificationType.Error, Messages.ERR_CHANNEL_DELETE));
            DeleteChannelCommand.IsExecuting.Subscribe(_ =>
            {
                OnChannelsBusy(DeleteChannelCommand.GetHashCode(), _);
                OnEpisodesBusy(DeleteChannelCommand.GetHashCode(), _);
            });

            var existsSelectedChannel = this.WhenAny(vm => vm.SelectedChannel, _ => SelectedChannel != null);

            this.WhenAnyValue(vm => vm.SelectedChannel).Select(_ => _ == null ? 0 : SelectedChannel.Id)
            .ToProperty(this, _ => _.SelectedChannelId, out selectedChannelId);
            RemoveFilterCommand = ReactiveCommand.Create <Unit>(_ => SelectedChannel = null, existsSelectedChannel);

            MarkAllPlayedCommand = ReactiveCommand.CreateFromTask <Channel>(async _ => await MarkChannelPlayed(_));

            CopyUrlCommand = ReactiveCommand.Create <Channel>(_ => Clipboard.SetText(_.Link));

            var episodeSet = this.WhenAnyValue(_ => _.SelectedEpisode);

            // detail
            this.WhenAnyValue(vm => vm.SelectedChannel).NotNull().Cast <IDetailEntity>()
            .Merge(episodeSet.Cast <IDetailEntity>())
            .ToProperty(this, _ => _.CurrentDetailEntity, out currentDetailEntity);

            this.WhenAnyValue(vm => vm.Player.LocateCurrent).NotNull()
            .Subscribe(c => c.Subscribe(_ => LocatePageForCurrent()));

            // episode list is loading
            this.WhenAnyValue(_ => _.EpisodeList.IsLoading).SubscribeOn(RxApp.MainThreadScheduler)
            .Subscribe(_ => OnEpisodesBusy(EpisodeList.GetHashCode(), _));

            ScrollIntoView = ReactiveCommand.Create <int, int>(_ => _);

            // playlist
            AddToPlaylist = ReactiveCommand.CreateFromTask <Playlist>(async _ => await AddEpisodeToPlaylist(_));

            // sort order
            this.WhenAnyValue(_ => _.SelectedEpisodeSortOrder)
            .Subscribe(_ => EpisodeOrderBy.OnNext(GetEpisodeSortOrder(_)));
            ToggleSortDirectionCommand =
                ReactiveCommand.Create(
                    () => EpisodeOrderBy.OnNext(GetEpisodeSortOrder(SelectedEpisodeSortOrder, false)));

            // on channels changed
            this.WhenAnyValue(_ => _.Channels).NotNull().Subscribe(_ => OnChannelsChanged());

            // update channels
            var canUpdate = new BehaviorSubject <bool>(false);

            UpdateChannelsCommand = ReactiveCommand.CreateFromTask(async _ => await UpdateChannelsAsync(),
                                                                   canUpdate.DistinctUntilChanged());

            UpdateChannelsCommand.IsExecuting.CombineLatest(this.WhenAnyValue(_ => _.Channels.IsEmpty),
                                                            (exec, empty) => !exec && !empty && IsUpdateEnabled).DistinctUntilChanged()
            .Subscribe(_ => canUpdate.OnNext(_));

            UpdateChannelsCommand.IsExecuting.ObserveOn(RxApp.MainThreadScheduler).Subscribe(_ => IsUpdating = _);
            UpdateChannelsCommand.ThrownExceptions.ObserveOn(RxApp.MainThreadScheduler)
            .Subscribe(_ => LogAndNotify(NotificationType.Error, Messages.ERR_CHANNEL_UPDATE));

            // init episodes
            EpisodeList = InitEpisodeList();
            EpisodeList.Changed.Subscribe(_ => InitActivePlaylist());

            // detail
            ToggleShowDetailCommand = ReactiveCommand.Create <bool, bool>(_ => _);
            DeactivateCommand       = ReactiveCommand.Create(() => { });
        }