コード例 #1
0
        public InstantViewModel(IProtoService protoService, ICacheService cacheService, IEventAggregator aggregator)
            : base(protoService, cacheService, aggregator)
        {
            _gallery = new InstantGalleryViewModel(aggregator);

            ShareCommand    = new RelayCommand(ShareExecute);
            FeedbackCommand = new RelayCommand(FeedbackExecute);
        }
コード例 #2
0
        public InstantViewModel(IMTProtoService protoService, ICacheService cacheService, ITelegramEventAggregator aggregator)
            : base(protoService, cacheService, aggregator)
        {
            _gallery = new InstantGalleryViewModel();

            ShareCommand       = new RelayCommand(ShareExecute);
            FeedbackCommand    = new RelayCommand(FeedbackExecute);
            ChannelOpenCommand = new RelayCommand <TLChannel>(ChannelOpenExecute);
            ChannelJoinCommand = new RelayCommand <TLChannel>(ChannelJoinExecute);
        }
コード例 #3
0
        public InstantViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IMessageFactory messageFactory, IEventAggregator aggregator)
            : base(protoService, cacheService, settingsService, aggregator)
        {
            _messageFactory = messageFactory;
            _gallery        = new InstantGalleryViewModel(protoService, aggregator);

            ShareCommand    = new RelayCommand(ShareExecute);
            FeedbackCommand = new RelayCommand(FeedbackExecute);
            BrowserCommand  = new RelayCommand(BrowserExecute);
            CopyCommand     = new RelayCommand(CopyExecute);
        }
コード例 #4
0
        public static async Task <InstantGalleryViewModel> CreateAsync(IProtoService protoService, IEventAggregator aggregator, MessageViewModel message, WebPage webPage)
        {
            var items = new List <GalleryContent>();

            var response = await protoService.SendAsync(new GetWebPageInstantView(webPage.Url, false));

            if (response is WebPageInstantView instantView && instantView.IsFull)
            {
                foreach (var block in instantView.PageBlocks)
                {
                    if (block is PageBlockSlideshow slideshow)
                    {
                        foreach (var item in slideshow.PageBlocks)
                        {
                            items.Add(CountBlock(protoService, instantView, item));
                        }
                    }
                    else if (block is PageBlockCollage collage)
                    {
                        foreach (var item in collage.PageBlocks)
                        {
                            items.Add(CountBlock(protoService, instantView, item));
                        }
                    }
                }
            }

            var result = new InstantGalleryViewModel(protoService, aggregator);

            result.Items.ReplaceWith(items);
            result.FirstItem    = items.FirstOrDefault();
            result.SelectedItem = items.FirstOrDefault();
            result.TotalItems   = items.Count;

            return(result);
        }
コード例 #5
0
ファイル: InstantViewModel.cs プロジェクト: Fart03/lau
 public InstantViewModel(IMTProtoService protoService, ICacheService cacheService, ITelegramEventAggregator aggregator)
     : base(protoService, cacheService, aggregator)
 {
     _gallery = new InstantGalleryViewModel();
 }