예제 #1
0
        public MessageViewModel(IProtoService protoService, IMessageDelegate delegato, Message message)
        {
            _protoService = protoService;
            _delegate     = delegato;

            _message = message;
        }
예제 #2
0
        public MessageViewModel Create(IMessageDelegate delegato, Message message)
        {
            if (message == null)
            {
                return(null);
            }

            return(new MessageViewModel(_protoService, _playbackService, delegato, message));
        }
예제 #3
0
 public ItemsCollection(IProtoService protoService, IMessageDelegate delegato, long chatId, bool channel)
 {
     _protoService = protoService;
     _delegate     = delegato;
     _chatId       = chatId;
     _channel      = channel;
     //_inputChannel = channel.ToInputChannel();
     //_channel = channel;
     //_filter = filter;
     _hasMore = true;
 }
예제 #4
0
            public ItemsCollection(IProtoService protoService, IMessageDelegate delegato, long chatId, bool channel, ChatEventLogFilters filters, IList <int> userIds)
            {
                _protoService = protoService;
                _delegate     = delegato;
                _chatId       = chatId;
                _channel      = channel;
                _filters      = filters;
                _userIds      = userIds;

                _hasMore = true;
            }
예제 #5
0
        public void UpdateMessage(IProtoService protoService, IMessageDelegate delegato, Message message)
        {
            _protoService = protoService;
            _delegate     = delegato;

            _message = message;

            var data = message.GetFileAndThumbnailAndName(false);

            if (data.File == null)
            {
                return;
            }

            Ellipse.Background = UpdateEllipseBrush(data.FileName);

            if (string.IsNullOrEmpty(data.FileName))
            {
                if (_protoService.TryGetUser(message.SenderId, out User user))
                {
                    Title.Text = user.GetFullName();
                }
                else if (_protoService.TryGetChat(message.SenderId, out Chat chat))
                {
                    Title.Text = chat.Title;
                }
                else
                {
                    Title.Text = string.Empty;
                }
            }
            else
            {
                Title.Text = data.FileName;
            }

            if (data.Thumbnail != null)
            {
                UpdateThumbnail(message, data.Thumbnail, data.Thumbnail.File);
            }
            else
            {
                Texture.Background = null;
                Button.Style       = App.Current.Resources["InlineFileButtonStyle"] as Style;
            }

            UpdateFile(message, data.File);
        }
예제 #6
0
        public void UpdateMessage(IMessageDelegate delegato, MessageWithOwner message)
        {
            _delegate = delegato;
            _message  = message;

            var data = message.GetFileAndThumbnailAndName();

            if (data.File == null)
            {
                return;
            }

            Ellipse.Background = UpdateEllipseBrush(data.FileName);

            if (string.IsNullOrEmpty(data.FileName))
            {
                if (message.ProtoService.TryGetUser(message.SenderId, out User user))
                {
                    Title.Text = user.GetFullName();
                }
                else if (message.ProtoService.TryGetChat(message.SenderId, out Chat chat))
                {
                    Title.Text = chat.Title;
                }
                else
                {
                    Title.Text = string.Empty;
                }
            }
            else
            {
                Title.Text = data.FileName;
            }

            if (data.Thumbnail != null)
            {
                UpdateThumbnail(message, data.Thumbnail, data.Thumbnail.File);
            }
            else
            {
                Texture.Background = null;
                Button.Style       = BootStrapper.Current.Resources["InlineFileButtonStyle"] as Style;
            }

            UpdateManager.Subscribe(this, message, data.File, ref _fileToken, UpdateFile);
            UpdateFile(message, data.File);
        }
예제 #7
0
        public void UpdateMessage(IProtoService protoService, IMessageDelegate delegato, Message message)
        {
            _protoService = protoService;
            _delegate     = delegato;
            _message      = message;

            var document = message.Content as MessageDocument;

            if (document == null)
            {
                return;
            }

            Ellipse.Background = UpdateEllipseBrush(document.Document);
            Title.Text         = document.Document.FileName;

            UpdateFile(message, document.Document.DocumentValue);
        }
예제 #8
0
        public PollResultsPopup(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator, IMessageDelegate delegato, long chatId, long messageId, Poll poll)
        {
            InitializeComponent();

            _protoService = protoService;
            _delegate     = delegato;

            Title         = Strings.Resources.PollResults;
            Subtitle.Text = Locale.Declension(poll.Type is PollTypeQuiz ? "Answer" : "Vote", poll.TotalVoterCount);

            PrimaryButtonText = Strings.Resources.OK;

            var options = new List <PollResultViewModel>();

            foreach (var option in poll.Options)
            {
                options.Add(new PollResultViewModel(chatId, messageId, poll, option, protoService, cacheService, settingsService, aggregator));
            }

            Repeater.ItemsSource = options;
        }
예제 #9
0
        public void UpdateMessage(IProtoService protoService, IMessageDelegate delegato, Message message)
        {
            _protoService = protoService;
            _delegate     = delegato;

            _message = message;

            var data = message.GetFileAndName(false);

            if (data.File == null)
            {
                return;
            }

            Ellipse.Background = UpdateEllipseBrush(data.FileName);

            if (string.IsNullOrEmpty(data.FileName))
            {
                if (_protoService.TryGetUser(message.Sender, out User user))
                {
                    Title.Text = user.GetFullName();
                }
                else if (_protoService.TryGetChat(message.Sender, out Chat chat))
                {
                    Title.Text = chat.Title;
                }
                else
                {
                    Title.Text = string.Empty;
                }
            }
            else
            {
                Title.Text = data.FileName;
            }

            UpdateFile(message, data.File);
        }
예제 #10
0
 public MessageViewModel CreateMessage(IMessageDelegate delegato, Message message)
 {
     return(_messageFactory.Create(delegato, message));
 }
예제 #11
0
 public MessageViewModel(IProtoService protoService, IPlaybackService playbackService, IMessageDelegate delegato, Message message)
     : base(protoService, message)
 {
     _playbackService = playbackService;
     _delegate        = new WeakReference(delegato);
 }