Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
        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);
        }
Exemplo n.º 5
0
 public InstantViewModel(IMTProtoService protoService, ICacheService cacheService, ITelegramEventAggregator aggregator)
     : base(protoService, cacheService, aggregator)
 {
     _gallery = new InstantGalleryViewModel();
 }