Ejemplo n.º 1
0
        public void OnDirectMessageUpdate(object sender, PropertyChangedEventArgs e)
        {
            var dm  = kbtter.LatestDirectMessage.DirectMessage;
            var dml = DirectMessages.FirstOrDefault(p => p.CheckUserPair(dm.Recipient.ScreenName, dm.Sender.ScreenName));

            if (dml == null)
            {
                var  nd = new DirectMessageViewModel(this, kbtter.AuthenticatedUser.ScreenName);
                User tus;
                if (dm.Recipient.Id == kbtter.AuthenticatedUser.Id)
                {
                    tus = dm.Sender;
                }
                else
                {
                    tus = dm.Recipient;
                }
                nd.TargetUserName       = tus.Name;
                nd.TargetUserScreenName = tus.ScreenName;
                nd.TargetUserImageUri   = tus.ProfileImageUrlHttps;
                DirectMessages.Add(nd);
                dml = nd;
            }
            dml.AddMessage(dm);
            RaisePropertyChanged("DirectMessage");
        }
Ejemplo n.º 2
0
        ChannelViewModel GetChannelByID(string id)
        {
            ChannelViewModel channel = PublicChannels.FirstOrDefault(c => c.ID == id);

            if (channel != null)
            {
                return(channel);
            }

            channel = PrivateGroups.FirstOrDefault(c => c.ID == id);

            if (channel != null)
            {
                return(channel);
            }

            return(DirectMessages.FirstOrDefault(c => c.ID == id));
        }