void ReleaseDesignerOutlets() { if (ChatMessage != null) { ChatMessage.Dispose(); ChatMessage = null; } if (MessageBackgroundView != null) { MessageBackgroundView.Dispose(); MessageBackgroundView = null; } if (ReceivedMessageDate != null) { ReceivedMessageDate.Dispose(); ReceivedMessageDate = null; } if (SentMessageDate != null) { SentMessageDate.Dispose(); SentMessageDate = null; } }
public void Configure(ChatMessage message, Action <NSUrl> onLinkTap) { this.message = message; ChatMessage.Text = message.Text; ChatMessage.Delegate = new LinkDelegate(onLinkTap); ChatMessage.Font = Fonts.GetMediumFont(15); ChatMessage.TextColor = Colors.SentMessageTextColor; MessageBackgroundView.Layer.CornerRadius = 10; MessageBackgroundView.Layer.BorderWidth = 1; if (message.MessageDirection == Core.Common.EnumDefinitions.MessageDirection.Sent) { MessageBackgroundView.Layer.BorderColor = Colors.SentMessageBorderColor.CGColor; SentMessageDate.Text = GetTimestamp(message.Created); SentMessageDate.Hidden = false; ReceivedMessageDate.Hidden = false; ReceivedMessageDate.TextColor = Colors.DateLabelTextColor; ReceivedMessageDate.UserInteractionEnabled = false; ReceivedMessageDate.Text = message.StatusOfChat.GetChatStatusText(); if (message.StatusOfChat == ChatStatus.Error) { ReceivedMessageDate.TextColor = UIColor.Red; if (resendMessageTapGesture != null) { ReceivedMessageDate.RemoveGestureRecognizer(resendMessageTapGesture); resendMessageTapGesture = null; } resendMessageTapGesture = new UITapGestureRecognizer(ErrorStatus_tapped); ReceivedMessageDate.AddGestureRecognizer(resendMessageTapGesture); ReceivedMessageDate.UserInteractionEnabled = true; } } else { MessageBackgroundView.Layer.BorderColor = Colors.UnselectedLabelBorderColor.CGColor; ReceivedMessageDate.Text = GetTimestamp(message.Created); SentMessageDate.Hidden = true; ReceivedMessageDate.Hidden = false; ReceivedMessageDate.TextColor = Colors.DateLabelTextColor; ReceivedMessageDate.UserInteractionEnabled = false; } }