예제 #1
0
 public TableAccessibleChatListViewItem(IProtoService protoService)
 {
     _protoService = protoService;
 }
예제 #2
0
 public SearchAnimationsCollection(IProtoService protoService, IEventAggregator aggregator, string query)
 {
     _protoService = protoService;
     _aggregator   = aggregator;
     _query        = query;
 }
예제 #3
0
 public TranslateService(IProtoService protoService, ISettingsService settings)
 {
     _protoService = protoService;
     _settings     = settings;
 }
예제 #4
0
 public ItemsCollection(IProtoService protoService, ICacheService cacheService)
 {
     _protoService = protoService;
     _cacheService = cacheService;
 }
예제 #5
0
 public SupergroupStickerSetViewModel(IProtoService protoService, IEventAggregator aggregator, StickerSetInfo info, StickerSet set)
     : base(protoService, aggregator, info, set)
 {
 }
예제 #6
0
 public void UpdateChat(IProtoService protoService, Chat chat)
 {
     _protoService = protoService;
     Update(chat);
 }
예제 #7
0
 public SettingsPrivacyAllowChatInvitesViewModel(IProtoService protoService, ICacheService cacheService, IEventAggregator aggregator)
     : base(protoService, cacheService, aggregator, new UserPrivacySettingAllowChatInvites())
 {
 }
예제 #8
0
 public SettingsMasksArchivedViewModel(IProtoService protoService, ICacheService cacheService, IEventAggregator aggregator)
     : base(protoService, cacheService, aggregator, true)
 {
 }
 public BasicGroupCreateStep1ViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator)
     : base(protoService, cacheService, settingsService, aggregator)
 {
     SendCommand      = new RelayCommand(SendExecute, () => !string.IsNullOrWhiteSpace(Title));
     EditPhotoCommand = new RelayCommand <StorageFile>(EditPhotoExecute);
 }
예제 #10
0
 public SearchChatsFilterChat(IProtoService protoService, Chat chat)
 {
     _protoService = protoService;
     _chat         = chat;
 }
예제 #11
0
 public UserCreateViewModel(IProtoService protoService, ICacheService cacheService, IEventAggregator aggregator)
     : base(protoService, cacheService, aggregator)
 {
     SendCommand = new RelayCommand(SendExecute, () => !string.IsNullOrEmpty(_firstName) && !string.IsNullOrEmpty(_phoneCode) && !string.IsNullOrEmpty(_phoneNumber));
 }
예제 #12
0
 public SettingsPhoneIntroViewModel(IProtoService protoService, ICacheService cacheService, IEventAggregator aggregator)
     : base(protoService, cacheService, aggregator)
 {
 }
예제 #13
0
 public ChatGridViewAutomationPeer(ChatGridViewItem owner, IProtoService protoService)
     : base(owner)
 {
     _owner        = owner;
     _protoService = protoService;
 }
예제 #14
0
 public ChatGridViewItem(IProtoService protoService)
 {
     _protoService = protoService;
 }
예제 #15
0
 public SettingsStickersArchivedViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator)
     : base(protoService, cacheService, settingsService, aggregator, false)
 {
 }
예제 #16
0
 public SupergroupMembersViewModel(IProtoService protoService, ICacheService cacheService, IEventAggregator aggregator)
     : base(protoService, cacheService, aggregator, new SupergroupMembersFilterRecent(), query => new SupergroupMembersFilterSearch(query))
 {
     ParticipantPromoteCommand = new RelayCommand <ChatMember>(ParticipantPromoteExecute);
     MemberRemoveCommand       = new RelayCommand <ChatMember>(MemberRemoveExecute);
 }
예제 #17
0
 public OutputTypingManager(IProtoService protoService, Chat chat, double delay = 5.0)
 {
     _chat         = chat;
     _delay        = delay;
     _protoService = protoService;
 }
 public PaymentFormStep3ViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator)
     : base(protoService, cacheService, settingsService, aggregator)
 {
     SendCommand = new RelayCommand(SendExecute, () => !IsLoading);
 }
예제 #19
0
 public ChatInviteViewModel(IProtoService protoService, ICacheService cacheService, IEventAggregator aggregator)
     : base(protoService, cacheService, aggregator)
 {
 }
예제 #20
0
 public SettingsPasswordDoneViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator)
     : base(protoService, cacheService, settingsService, aggregator)
 {
     SendCommand = new RelayCommand(SendExecute);
 }
예제 #21
0
 public SettingsPhoneSentCodeViewModel(IProtoService protoService, ICacheService cacheService, IEventAggregator aggregator)
     : base(protoService, cacheService, aggregator)
 {
     SendCommand   = new RelayCommand(SendExecute, () => !IsLoading);
     ResendCommand = new RelayCommand(ResendExecute, () => !IsLoading);
 }
예제 #22
0
        public static string GetSummary(IProtoService protoService, Message message)
        {
            if (message.IsService())
            {
                return(MessageService.GetText(new ViewModels.MessageViewModel(protoService, null, null, message)) + ", ");
            }

            if (message.Content is MessageText text)
            {
                return(text.Text.Text + ", ");
            }
            if (message.Content is MessageDice dice)
            {
                return(dice.Emoji + ", ");
            }
            if (message.Content is MessageGame gameMedia)
            {
                return(Strings.Resources.AttachGame + ", " + gameMedia.Game.Title + ", ");
            }
            if (message.Content is MessageExpiredVideo)
            {
                return(Strings.Resources.AttachVideoExpired + ", ");
            }
            else if (message.Content is MessageExpiredPhoto)
            {
                return(Strings.Resources.AttachPhotoExpired + ", ");
            }
            else if (message.Content is MessageVideoNote)
            {
                return(Strings.Resources.AttachRound + ", ");
            }
            else if (message.Content is MessageSticker sticker)
            {
                if (string.IsNullOrEmpty(sticker.Sticker.Emoji))
                {
                    return(Strings.Resources.AttachSticker + ", ");
                }

                return($"{sticker.Sticker.Emoji} {Strings.Resources.AttachSticker}" + ", ");
            }

            string GetCaption(string caption)
            {
                return(string.IsNullOrEmpty(caption) ? string.Empty : ", " + caption);
            }

            if (message.Content is MessageVoiceNote voiceNote)
            {
                return(Strings.Resources.AttachAudio + GetCaption(voiceNote.Caption.Text) + ", ");
            }
            else if (message.Content is MessageVideo video)
            {
                return((video.IsSecret ? Strings.Resources.AttachDestructingVideo : Strings.Resources.AttachVideo) + GetCaption(video.Caption.Text) + ", ");
            }
            else if (message.Content is MessageAnimation animation)
            {
                return(Strings.Resources.AttachGif + GetCaption(animation.Caption.Text) + ", ");
            }
            else if (message.Content is MessageAudio audio)
            {
                var performer = string.IsNullOrEmpty(audio.Audio.Performer) ? null : audio.Audio.Performer;
                var title     = string.IsNullOrEmpty(audio.Audio.Title) ? null : audio.Audio.Title;

                if (performer == null && title == null)
                {
                    return(Strings.Resources.AttachMusic + GetCaption(audio.Caption.Text) + ", ");
                }
                else
                {
                    return($"{performer ?? Strings.Resources.AudioUnknownArtist} - {title ?? Strings.Resources.AudioUnknownTitle}" + GetCaption(audio.Caption.Text) + ", ");
                }
            }
            else if (message.Content is MessageDocument document)
            {
                if (string.IsNullOrEmpty(document.Document.FileName))
                {
                    return(Strings.Resources.AttachDocument + GetCaption(document.Caption.Text) + ", ");
                }

                return(document.Document.FileName + GetCaption(document.Caption.Text) + ", ");
            }
            else if (message.Content is MessageInvoice invoice)
            {
                return(Strings.Resources.PaymentInvoice + ", " + invoice.Title + ", ");
            }
            else if (message.Content is MessageContact)
            {
                return(Strings.Resources.AttachContact + ", ");
            }
            else if (message.Content is MessageLocation location)
            {
                return((location.LivePeriod > 0 ? Strings.Resources.AttachLiveLocation : Strings.Resources.AttachLocation) + ", ");
            }
            else if (message.Content is MessageVenue vanue)
            {
                return(Strings.Resources.AttachLocation + ", ");
            }
            else if (message.Content is MessagePhoto photo)
            {
                return((photo.IsSecret ? Strings.Resources.AttachDestructingPhoto : Strings.Resources.AttachPhoto) + GetCaption(photo.Caption.Text) + ", ");
            }
            else if (message.Content is MessagePoll poll)
            {
                return(Strings.Resources.Poll + ", " + poll.Poll.Question + ", ");
            }
            else if (message.Content is MessageCall call)
            {
                var outgoing = message.IsOutgoing;
                var missed   = call.DiscardReason is CallDiscardReasonMissed || call.DiscardReason is CallDiscardReasonDeclined;

                return((missed ? (outgoing ? Strings.Resources.CallMessageOutgoingMissed : Strings.Resources.CallMessageIncomingMissed) : (outgoing ? Strings.Resources.CallMessageOutgoing : Strings.Resources.CallMessageIncoming)) + ", ");
            }
            else if (message.Content is MessageUnsupported)
            {
                return(Strings.Resources.UnsupportedAttachment + ", ");
            }

            return(null);
        }
예제 #23
0
 public GalleryContent(IProtoService protoService)
 {
     _protoService = protoService;
 }
예제 #24
0
        public static string GetDescription(IProtoService cacheService, Message message)
        {
            var chat    = cacheService.GetChat(message.ChatId);
            var content = message.Content;

            var sticker = content is MessageSticker;
            var light   = sticker || content is MessageVideoNote;

            var title = string.Empty;

            if (!light && /*message.IsFirst &&*/ !message.IsOutgoing && !message.IsChannelPost && (chat.Type is ChatTypeBasicGroup || chat.Type is ChatTypeSupergroup))
            {
                var sender = cacheService.GetUser(message.SenderUserId);
                title = sender?.GetFullName();
            }
            else if (!light && message.IsChannelPost && chat.Type is ChatTypeSupergroup)
            {
                title = cacheService.GetTitle(chat);
            }
            else if (!light && /*message.IsFirst &&*/ message.IsSaved(cacheService.Options.MyId))
            {
                if (message.ForwardInfo?.Origin is MessageForwardOriginUser fromUser)
                {
                    title = cacheService.GetUser(fromUser.SenderUserId)?.GetFullName();
                }
                else if (message.ForwardInfo?.Origin is MessageForwardOriginChannel post)
                {
                    title = cacheService.GetTitle(cacheService.GetChat(post.ChatId));
                }
                else if (message.ForwardInfo?.Origin is MessageForwardOriginHiddenUser fromHiddenUser)
                {
                    title = fromHiddenUser.SenderName;
                }
            }

            var builder = new StringBuilder();

            if (title?.Length > 0)
            {
                builder.AppendLine($"{title}. ");
            }

            //if (message.ReplyToMessage != null)
            //{
            //    var user = message.ProtoService.GetUser(message.ReplyToMessage.SenderUserId);
            //    if (user != null)
            //    {
            //        builder.AppendLine($"{Strings.Resources.AccDescrReplying} {user.GetFullName()}. ");
            //    }
            //}

            builder.Append(Automation.GetSummary(cacheService, message));

            var date = string.Format(Strings.Resources.TodayAtFormatted, BindConvert.Current.ShortTime.Format(Utils.UnixTimestampToDateTime(message.Date)));

            if (message.IsOutgoing)
            {
                builder.Append(string.Format(Strings.Resources.AccDescrSentDate, date));
            }
            else
            {
                builder.Append(string.Format(Strings.Resources.AccDescrReceivedDate, date));
            }

            builder.Append(". ");

            var maxId = 0L;

            if (chat != null)
            {
                maxId = chat.LastReadOutboxMessageId;
            }

            if (message.SendingState is MessageSendingStateFailed)
            {
            }
            else if (message.SendingState is MessageSendingStatePending)
            {
            }
            else if (message.Id <= maxId)
            {
                builder.Append(Strings.Resources.AccDescrMsgRead);
            }
            else
            {
                builder.Append(Strings.Resources.AccDescrMsgUnread);
            }

            builder.Append(".");

            return(builder.ToString());
        }
예제 #25
0
 public StickerSetViewModel(IProtoService protoService, IEventAggregator aggregator, StickerSetInfo info, StickerSet set)
     : this(protoService, aggregator, info)
 {
     IsLoaded = true;
     Update(set);
 }
예제 #26
0
 public GalleryMessage(IProtoService protoService, Message message)
     : base(protoService)
 {
     _message = message;
 }
 public SettingsPrivacyShowStatusViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator)
     : base(protoService, cacheService, settingsService, aggregator, new UserPrivacySettingShowStatus())
 {
 }
예제 #28
0
 public TLMultipleViewModelBase(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator)
     : base(protoService, cacheService, settingsService, aggregator)
 {
     Children = new List <TLViewModelBase>();
 }
예제 #29
0
 public GalleryItem(IProtoService protoService)
 {
     _protoService = protoService;
 }
예제 #30
0
 public SupergroupEventLogViewModel(IProtoService protoService, ICacheService cacheService, IEventAggregator aggregator)
     : base(protoService, cacheService, aggregator)
 {
 }