void ReleaseDesignerOutlets()
        {
            if (AttachmentImageView != null)
            {
                AttachmentImageView.Dispose();
                AttachmentImageView = null;
            }

            if (AttahmentImageButton != null)
            {
                AttahmentImageButton.Dispose();
                AttahmentImageButton = null;
            }

            if (BackgroundImageView != null)
            {
                BackgroundImageView.Dispose();
                BackgroundImageView = null;
            }

            if (lblMessage != null)
            {
                lblMessage.Dispose();
                lblMessage = null;
            }

            if (lblSenderName != null)
            {
                lblSenderName.Dispose();
                lblSenderName = null;
            }

            if (lblTime != null)
            {
                lblTime.Dispose();
                lblTime = null;
            }

            if (StatusTick != null)
            {
                StatusTick.Dispose();
                StatusTick = null;
            }
        }
        public void Update(GroupMessage item, UIViewController uiNewView, bool IsLeft)
        {
            this.uiNewView  = uiNewView;
            bright          = UIImage.FromFile("green.png");
            bleft           = UIImage.FromFile("grey.png");
            singleGray      = UIImage.FromFile("singleGray.png");
            doubleGray      = UIImage.FromFile("grey.png");
            doubleBlue      = UIImage.FromFile("doubleBlue.png");
            attachmentImage = UIImage.FromFile("bg.png");
            wait            = UIImage.FromFile("grey.png");

            // buggy, see https://bugzilla.xamarin.com/show_bug.cgi?id=6177
            //left = bleft.CreateResizableImage (new UIEdgeInsets (10, 16, 18, 26));
            //right = bright.CreateResizableImage (new UIEdgeInsets (11, 11, 17, 18));
            left        = bleft.StretchableImage(26, 16);
            right       = bright.StretchableImage(11, 11);
            this.isLeft = IsLeft;
            BackgroundImageView.Image = isLeft ? left : right;

            lblSenderName.Text = item.senderName;
            lblMessage.Text    = item.MessageText;
            lblTime.Text       = item.MessageTime.ToString("hh:mm tt");

            var AttachList = (item.MessageId != 0) ? Repositories.GroupRepository.GetGroupMessageAttachList(item.MessageId) : new List <GroupAttachment>();

            if (AttachList.Count > 0)
            {
                string attachmentUrl = CommonHelper.GetImageThumbUrl(AttachList.FirstOrDefault().url);
                try
                {
                    AttahmentImageButton.SetBackgroundImage(ImageClass.FromUrl(attachmentUrl), UIControlState.Normal);
                }
                catch
                {
                    AttahmentImageButton.SetBackgroundImage(UIImage.FromBundle("PlaceHolder.png"), UIControlState.Normal);
                }

                //  AttachmentImageView.SetImage(ImageClass.FromUrl(AttachList.FirstOrDefault().url), UIControlState.Normal);
                ImagePath = AttachList.FirstOrDefault().url;
            }
            else
            {
            }
            var Status = (item.MessageId != 0) ? Repositories.GroupRepository.GetGroupMessageOverallStatusbyid(item.MessageId) : new GroupMessageStatus();

            if (!this.isLeft)
            {
                if (Status.IsRead)
                {
                    StatusTick.Image = doubleBlue;
                }

                else if (Status.IsRecieved)
                {
                    StatusTick.Image = doubleGray;
                }

                else if (Status.IsSend)
                {
                    StatusTick.Image = singleGray;
                }
                else
                {
                    StatusTick.Image = singleGray;
                }
            }
            SetNeedsLayout();
        }
Beispiel #3
0
        public void Update(ChatMessage item, UIViewController uiNewView, bool IsLeft)
        {
            this.uiNewView  = uiNewView;
            bright          = UIImage.FromFile("green.png");
            bleft           = UIImage.FromFile("grey.png");
            singleGray      = UIImage.FromFile("singleGray.png");
            doubleGray      = UIImage.FromFile("grey.png");
            doubleBlue      = UIImage.FromFile("doubleBlue.png");
            attachmentImage = UIImage.FromFile("bg.png");
            wait            = UIImage.FromFile("grey.png");

            // buggy, see https://bugzilla.xamarin.com/show_bug.cgi?id=6177
            //left = bleft.CreateResizableImage (new UIEdgeInsets (10, 16, 18, 26));
            //right = bright.CreateResizableImage (new UIEdgeInsets (11, 11, 17, 18));
            left  = bleft.StretchableImage(26, 16);
            right = bright.StretchableImage(11, 11);

            var rect = new RectangleF(0, 0, 1, 1);

            this.isLeft = IsLeft;
            view        = new UIView(rect);
            BackgroundImageView.Image = isLeft ? left : right;
            //view.AddSubview(BackgroundImageView);
            //view.AddSubview(lblMessage);
            //view.AddSubview(lblTime);
            //view.AddSubview(StatusTick);
            //view.AddSubview(AttachmentImageView);
            //ContentView.Add(view);

            lblMessage.Text = item.MessageText;
            lblTime.Text    = item.MessageTime.ToString("hh:mm tt");;

            var AttachList = (item.ChatMessageId != 0) ? Repositories.ChatAttachmentRepository.GetChatAttachList(item.ChatMessageId) : new List <ChatAttachment>();


            if (AttachList.Count > 0)
            {
                string attachmentUrl = CommonHelper.GetImageThumbUrl(AttachList.FirstOrDefault().url);
                //AttachmentImageView.SetImage(new NSUrl(attachmentUrl), UIImage.FromBundle("PlaceHolder.png"));
                //var selectImageTapped = new UITapGestureRecognizer(() => { ShowUpdateUserProfileViewController(); });
                //AttachmentImageView.AddGestureRecognizer(selectImageTapped);
                try
                {
                    AttahmentImageButton.SetBackgroundImage(ImageClass.FromUrl(attachmentUrl), UIControlState.Normal);
                }
                catch
                {
                    AttahmentImageButton.SetBackgroundImage(UIImage.FromBundle("PlaceHolder.png"), UIControlState.Normal);
                }

                //  AttachmentImageView.SetImage(ImageClass.FromUrl(AttachList.FirstOrDefault().url), UIControlState.Normal);
                ImagePath = AttachList.FirstOrDefault().url;
            }
            else
            {
            }
            if (!this.isLeft)
            {
                if (item.IsRead)
                {
                    StatusTick.Image = doubleBlue;

                    // vh.iv_StatusRight.SetImageResource(Resource.Drawable.message_got_read_receipt_from_target);
                }

                else if (item.IsRecieved)
                {
                    StatusTick.Image = doubleGray;
                }

                else if (item.IsSend)
                {
                    StatusTick.Image = singleGray;
                }
                else
                {
                    StatusTick.Image = singleGray;
                }
            }
            SetNeedsLayout();
        }