Exemplo n.º 1
0
        private void ProcessUserFeedback(List <long> userIds)
        {
            this._fixedHeight = 180.0;
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            this._userNotTemplate        = new UserNotificationTemplateUC();
            this._userNotTemplate.Margin = new Thickness(0.0, 16.0, 0.0, 16.0);
            stopwatch.Stop();
            if (userIds == null || userIds.Count == 0 || Enumerable.FirstOrDefault <User>(this._users, (Func <User, bool>)(u => u.uid == userIds[0])) == null)
            {
                return;
            }
            this._fixedHeight          = this._userNotTemplate.Configure((List <User>)Enumerable.ToList <User>(Enumerable.Select <long, User>(Enumerable.Take <long>(userIds, 6), (Func <long, User>)(fu => (User)Enumerable.FirstOrDefault <User>(this._users, (Func <User, bool>)(u => u.uid == fu))))), this.GetLocalizableText(), UIStringFormatterHelper.FormatDateTimeForUI(this._notification.Date), this.GetHighlightedText(), this.GetThumb(), this._notification.NotType, userIds.Count, this._showEarlierReplies, null) + 16.0;
            this._userNotTemplate.Tap += ((EventHandler <System.Windows.Input.GestureEventArgs>)((s, e) => this.ProcessNavigationTap()));
        }
Exemplo n.º 2
0
        private void ProcessMoneyTransfer()
        {
            this._fixedHeight     = 180.0;
            this._userNotTemplate = new UserNotificationTemplateUC();
            ((FrameworkElement)this._userNotTemplate).Margin = (new Thickness(0.0, 16.0, 0.0, 16.0));
            MoneyTransfer transfer = (MoneyTransfer)this._notification.ParsedFeedback;
            User          user     = (User)Enumerable.FirstOrDefault <User>(this._users, (Func <User, bool>)(u => u.id == transfer.OtherUserId));

            if (user == null)
            {
                Group group = (Group)Enumerable.FirstOrDefault <Group>(this._groups, (Func <Group, bool>)(g => g.id == -transfer.OtherUserId));
                if (group != null)
                {
                    user = new User()
                    {
                        id         = -group.id,
                        first_name = group.name,
                        photo_max  = group.photo_200
                    }
                }
                ;
                if (user == null)
                {
                    return;
                }
            }
            UserNotificationTemplateUC userNotTemplate = this._userNotTemplate;
            List <User> users = new List <User>();

            users.Add(user);
            string localizableText = this.GetLocalizableText();
            string dateText        = UIStringFormatterHelper.FormatDateTimeForUI(this._notification.Date);
            string highlightedText = this.GetHighlightedText();
            string thumb           = this.GetThumb();
            int    notType         = (int)this._notification.NotType;
            int    totalUsersCount = 0;
            int    num             = this._showEarlierReplies ? 1 : 0;
            string forcedTypeIcon  = string.Format("/Resources/FeedbackIconsMoney{0}.png", !transfer.IsOutbox || !transfer.IsCancelled ? "Green" : "Red");

            this._fixedHeight = userNotTemplate.Configure(users, localizableText, dateText, highlightedText, thumb, (NotificationType)notType, totalUsersCount, num != 0, forcedTypeIcon) + 16.0;
            ((UIElement)this._userNotTemplate).Tap += ((EventHandler <System.Windows.Input.GestureEventArgs>)((s, e) => this.ProcessNavigationTap()));
        }