public override DataTemplate SelectTemplate(object item, DependencyObject container) { FrameworkElement element = container as FrameworkElement; if (element != null && item != null && item is MessageItemViewModel) { MessageItemViewModel message = item as MessageItemViewModel; if (message.Attachments == null) { return(element.FindResource("MessagesTemplate") as DataTemplate); } if (message.Attachments[0].type == "gift") { return(element.FindResource("MessagesGift") as DataTemplate); } if (message.Attachments[0].type == "sticker") { return(element.FindResource("MessagesSticker") as DataTemplate); } if (message.Attachments[0].type == "photo") { return(element.FindResource("MessagesPhoto") as DataTemplate); } if (message.Attachments[0].type == "video") { return(element.FindResource("MessagesVideo") as DataTemplate); } } return(null); }
public MessageSQLiteModel(MessageItemViewModel model) { ID = model.ID; Title = model.Title; TimeStamp = model.TimeStamp; MessageLink = model.MessageLink; IsRead = model.IsRead; }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { MessagePageCell cell = tableView.DequeueReusableCell(MessagePageCell.Key, indexPath) as MessagePageCell; MessageItemViewModel model = _models[indexPath.Row]; cell.Update(model); return(cell); }
public void Update(MessageItemViewModel message) { StyleUtil.InitLabelWithSpacing(Label1, StyleUtil.FontType.FontRegular, message.Title, 1.14, 16, 28); StyleUtil.InitLabelWithSpacing(Label2, StyleUtil.FontType.FontRegular, DateUtils.GetDateFromDateTime(message.TimeStamp, "d. MMMMM"), 1.14, 12, 17); StyleUtil.InitLabelWithSpacing(Label3, StyleUtil.FontType.FontRegular, MessageItemViewModel.MESSAGES_RECOMMENDATIONS, 1.14, 12, 17); IndicatorView.Alpha = message.IsRead ? 0 : 1; this.BackgroundColor = message.IsRead ? new UIColor(new nfloat(1), new nfloat(0.1)) : new UIColor(new nfloat(1), new nfloat(0.25)); IndicatorView.Layer.CornerRadius = IndicatorView.Layer.Frame.Height / 2; }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { MessagePageCell cell = tableView.DequeueReusableCell(MessagePageCell.Key, indexPath) as MessagePageCell; MessageItemViewModel model = _models[indexPath.Section]; cell.Layer.CornerRadius = 14; cell.Layer.BorderColor = ColorHelper.MESSAGE_BORDER_COLOR.CGColor; cell.Layer.BorderWidth = 1; cell.ClipsToBounds = true; cell.Update(model); return(cell); }
public void Update(MessageItemViewModel message) { StyleUtil.InitLabelWithSpacing(Label1, StyleUtil.FontType.FontMedium, message.Title.Translate(), 1.14, 18, 28); StyleUtil.InitLabelWithSpacing(Label2, StyleUtil.FontType.FontRegular, DateUtils.GetDateFromDateTime(message.TimeStamp, "d. MMMMM"), 1.14, 15, 17); StyleUtil.InitLabelWithSpacing(Label3, StyleUtil.FontType.FontRegular, MessageItemViewModel.MESSAGES_RECOMMENDATIONS, 1.14, 15, 17); StyleUtil.InitLabelWithSpacing(UnreadLabel, StyleUtil.FontType.FontBold, MessagesViewModel.MESSAGES_NEW_ITEM, 1.14, 15, 17); if (message.IsRead) { IndicatorView.Hidden = true; UnreadLabel.Hidden = true; Label2.LeadingAnchor.ConstraintEqualTo(Label3.LeadingAnchor).Active = true; } this.BackgroundColor = message.IsRead ? new UIColor(new nfloat(1), new nfloat(0.1)) : new UIColor(new nfloat(1), new nfloat(0.25)); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { MessagePageCell cell = tableView.DequeueReusableCell(MessagePageCell.Key, indexPath) as MessagePageCell; MessageItemViewModel model = _models[indexPath.Section]; cell.ContentView.Subviews[0].Layer.CornerRadius = 14; cell.ContentView.Subviews[0].Layer.BorderColor = ColorHelper.MESSAGE_BORDER_COLOR.CGColor; cell.ContentView.Subviews[0].Layer.BorderWidth = 1; cell.ContentView.Subviews[0].ClipsToBounds = true; cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.Update(model); cell.AccessibilityTraits = UIAccessibilityTrait.Link; return(cell); }
public void Update(MessageItemViewModel message) { if (AppDelegate.ShouldOperateIn12_5Mode) { IndicatorView.BackgroundColor = UIColor.Red; IndicatorView.Layer.CornerRadius = IndicatorView.Layer.Frame.Height / 2; } StyleUtil.InitLabelWithSpacing(Label1, StyleUtil.FontType.FontMedium, message.Title.Translate(), 1.14, 18, 28); StyleUtil.InitLabelWithSpacing(Label2, StyleUtil.FontType.FontRegular, DateUtils.GetDateFromDateTime(message.TimeStamp, "d. MMMMM"), 1.14, 15, 17); StyleUtil.InitLabelWithSpacing(Label3, StyleUtil.FontType.FontRegular, MessageItemViewModel.MESSAGES_RECOMMENDATIONS, 1.14, 15, 17); StyleUtil.InitLabelWithSpacing(UnreadLabel, StyleUtil.FontType.FontBold, MessagesViewModel.MESSAGES_NEW_ITEM, 1.14, 15, 17); if (message.IsRead) { IndicatorView.Hidden = true; UnreadLabel.Hidden = true; Label2.LeadingAnchor.ConstraintEqualTo(Label3.LeadingAnchor).Active = true; } this.BackgroundColor = UIColor.Clear; }
public static void MarkAsRead(MessageItemViewModel message, bool isRead) { _manager.MarkAsRead(new MessageSQLiteModel(message), isRead); }