public InstantViewModel(IProtoService protoService, ICacheService cacheService, IEventAggregator aggregator) : base(protoService, cacheService, aggregator) { _gallery = new InstantGalleryViewModel(aggregator); ShareCommand = new RelayCommand(ShareExecute); FeedbackCommand = new RelayCommand(FeedbackExecute); }
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); }
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); }
public InstantViewModel(IMTProtoService protoService, ICacheService cacheService, ITelegramEventAggregator aggregator) : base(protoService, cacheService, aggregator) { _gallery = new InstantGalleryViewModel(); }