Exemple #1
0
        //
        // Utility function that configures the various buttons that we create
        //
        static UIButton ButtonWithTitle(string title, RectangleF frame, UIImage image, UIImage imagePressed, bool darkTextColor)
        {
            var button = new UIButton(frame)
            {
                VerticalAlignment   = UIControlContentVerticalAlignment.Center,
                HorizontalAlignment = UIControlContentHorizontalAlignment.Center,
                BackgroundColor     = UIColor.Clear
            };

            button.SetTitle(title, UIControlState.Normal);
            if (darkTextColor)
            {
                button.SetTitleColor(UIColor.Black, UIControlState.Normal);
            }
            else
            {
                button.SetTitleColor(UIColor.White, UIControlState.Normal);
            }

            var newImage = image.StretchableImage(12, 0);

            button.SetBackgroundImage(newImage, UIControlState.Normal);
            var newPressedImage = image.StretchableImage(12, 0);

            button.SetBackgroundImage(newPressedImage, UIControlState.Highlighted);

            button.Tag = kViewTag;
            // To support reusable cells
            button.TouchDown += delegate { Console.WriteLine("The button has been touched"); };

            return(button);
        }
Exemple #2
0
        public void Autorelease()
        {
            // this same test existed in linksdk.app and linkall.app to test the linker optimizing IL code
            // around [Autorelease] decorated methods. However iOS7 changed it's behavior and returns null now
            using (UIImage img = new UIImage()) {
#if __WATCHOS__
                if (true)
                {
#else
                if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0))
                {
#endif
#if !__TVOS__
                    Assert.Null(img.StretchableImage(10, 10), "StretchableImage");
#endif
                    Assert.Null(img.CreateResizableImage(new UIEdgeInsets(1, 2, 3, 4)), "CreateResizableImage");
                }
                else
                {
#if !__TVOS__
                    Assert.NotNull(img.StretchableImage(10, 10), "StretchableImage");
#endif
                    Assert.NotNull(img.CreateResizableImage(new UIEdgeInsets(1, 2, 3, 4)), "CreateResizableImage");
                }
            }
        }
        static BubbleCell()
        {
            bright = UIImage.FromFile("green.png");
            bleft  = UIImage.FromFile("grey.png");

            left  = bleft.StretchableImage(26, 16);
            right = bright.StretchableImage(11, 11);
        }
 public lib()
 {
     corkTexture = UIImage.FromBundle("images/corkbutton.png");
     corkTexture = corkTexture.StretchableImage(100, 0);
     woodTexture = UIImage.FromBundle("images/wood.png");
     woodTexture = woodTexture.StretchableImage(100, 0);
     calcImage   = UIImage.FromBundle("calc.png");
 }
        static BubbleCell()
        {
            bright = UIImage.FromFile("green.png");
            bleft  = 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);
        }
        static BubbleCell()
        {
            bright = UIImage.FromFile("green.png");
            bleft = 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);
        }
Exemple #7
0
        public void Autorelease()
        {
            using (UIImage img = new UIImage()) {
                // those are the two UIImage instance methods decorated with [Autorelease]
#if !__TVOS__
                img.StretchableImage(10, 10);
#endif
                img.CreateResizableImage(new UIEdgeInsets(1, 2, 3, 4));
                // note: return value is null for iOS7 (and was non-null before it)
                // anyway we care about not crashing due to the linker optimizing the IL, not the return values
            }
        }
Exemple #8
0
        public void Autorelease()
        {
            // this same test existed in linksdk.app and linkall.app to test the linker optimizing IL code
            // around [Autorelease] decorated methods. However iOS7 changed it's behavior and returns null now
            using (UIImage img = new UIImage()) {
                // different versions of iOS returns null or something - so we're not validating the return
                // value since it's not the goal of the test
#if !__TVOS__
                img.StretchableImage(10, 10);
#endif
                img.CreateResizableImage(new UIEdgeInsets(1, 2, 3, 4));
            }
        }
Exemple #9
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

             			UIImage btnImg = new UIImage(ButtonImgPath);
            UIImage btnPressedImg = new UIImage(ButtonPressedImgPath);

            UIImage phoneImg = UIImage.FromFile(PhoneImgPath);
            UIImage mailImg = UIImage.FromFile(MailImgPath);

            PhoneButton.SetTitle(string.Empty, UIControlState.Normal);
            MailButton.SetTitle(string.Empty, UIControlState.Normal);

            PhoneButton.SetImage(phoneImg, UIControlState.Normal);
            MailButton.SetImage(mailImg, UIControlState.Normal);

            PhoneButton.SetBackgroundImage(btnImg.StretchableImage(LeftCapWidth, 0), UIControlState.Normal);
            PhoneButton.SetBackgroundImage(btnPressedImg.StretchableImage(LeftCapWidth, 0), UIControlState.Highlighted);

            MailButton.SetBackgroundImage(btnImg.StretchableImage(LeftCapWidth, 0), UIControlState.Normal);
            MailButton.SetBackgroundImage(btnPressedImg.StretchableImage(LeftCapWidth, 0), UIControlState.Highlighted);

            LogoImage.Image = new UIImage(LogoImgPath);
        }
Exemple #10
0
        static GroupChatBubbleWithAttachmentCell()
        {
            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);
        }
Exemple #11
0
        private void CalculateSize()
        {
            var number = BadgeNumber.ToString();

            if (_badgeNumber > 0)
            {
                this.SetBackgroundImage(bgimage.StretchableImage(12, 0), UIControlState.Normal);
                lbl.Text = number;
                //this.SetTitle(number,UIControlState.Normal);
            }
            else
            {
                this.SetBackgroundImage(new UIImage(), UIControlState.Normal);
                lbl.Text = "";
                //this.SetTitle("",UIControlState.Normal);
            }
            CalculateSize(new PointF(Frame.X + Frame.Width, Frame.Y));
        }
        public override void LayoutSubviews()
        {
            base.LayoutSubviews();

            this.TextLabel.Frame = new CGRect(
                this.ContentView.Bounds.Left + 40f,
                8f,
                this.ContentView.Bounds.Width,
                30f);

            // layout the check button image
            UIImage checkedImage = UIImage.FromFile("images/checked.png");

            CheckButton.Frame = new CGRect(
                this.ContentView.Bounds.Left + 10f,
                12f,
                checkedImage.Size.Width,
                checkedImage.Size.Height);

            UIImage image    = this.Checked ? checkedImage : UIImage.FromFile("images/unchecked.png");
            UIImage newImage = image.StretchableImage(12, 0);

            CheckButton.SetBackgroundImage(newImage, UIControlState.Normal);
        }
	//
	// Utility function that configures the various buttons that we create
	//
	static UIButton ButtonWithTitle (string title, RectangleF frame, UIImage image, UIImage imagePressed, bool darkTextColor)
	{
		var button = new UIButton (frame) {
			VerticalAlignment = UIControlContentVerticalAlignment.Center,
			HorizontalAlignment = UIControlContentHorizontalAlignment.Center,
			BackgroundColor = UIColor.Clear
		};

		button.SetTitle (title, UIControlState.Normal);
		if (darkTextColor)
			button.SetTitleColor (UIColor.Black, UIControlState.Normal);
		else
			button.SetTitleColor (UIColor.White, UIControlState.Normal);

		var newImage = image.StretchableImage (12, 0);
		button.SetBackgroundImage (newImage, UIControlState.Normal);
		var newPressedImage = image.StretchableImage (12, 0);
		button.SetBackgroundImage (newPressedImage, UIControlState.Highlighted);
		
		button.Tag = kViewTag;   // To support reusable cells

		button.TouchDown += delegate {
			Console.WriteLine ("The button has been touched");
		};
		
		return button;
	}
        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();
        }
        UITableViewCell TableViewCellForRowAtIndexPath(UITableView aTableView, NSIndexPath indexPath)
        {
            UITableViewCell cell;

            cell = aTableView.DequeueReusableCell("MenuCell");
            if (indexPath.Section == 0)
            {
                cell.BackgroundColor = UIColor.Clear;

                UIImageView imgRow = (UIImageView)cell.ViewWithTag(1);
                imgRow.Image = UIImage.FromFile("Images/Common/user_1.png");

                UILabel lblText = (UILabel)cell.ViewWithTag(2);
                lblText.Text = "Virgil Pana";
            }
            else
            {
                cell.BackgroundColor = UIColor.Clear;
                MenuItem item = dataSource.items [indexPath.Row];

                UIImageView imgRow = (UIImageView)cell.ViewWithTag(1);
                imgRow.Image = item.Image;
                UILabel lblText = (UILabel)cell.ViewWithTag(2);
                lblText.Text = item.Name;

                UIView countView = null;
                if (item.EventCount > 0)
                {
                    string countString = item.EventCount.ToString();
                                        #if __UNIFIED__
                    SizeF sizeCount = UIStringDrawing.StringSize(countString, UIFont.SystemFontOfSize(14.0f));
                                        #else
                    SizeF sizeCount = View.StringSize(countString, UIFont.SystemFontOfSize(14.0f));
                                        #endif

                    UIImage bkgImg = UIImage.FromFile("Images/iPhone/sidemenu-count.png");
                    countView = new UIImageView(bkgImg.StretchableImage(12, 0));

                                        #if __UNIFIED__
                    countView.Frame =
                        new RectangleF(0, 0, (float)sizeCount.Width + 2 * 10, (float)bkgImg.Size.Height)
                        //.Inegral()
                    ;
                    UILabel lblCount =
                        new UILabel
                        (
                            new RectangleF(10, (float)(bkgImg.Size.Height - sizeCount.Height) / 2 - 2, (float)sizeCount.Width, (float)sizeCount.Height)
                        );
                                        #else
                    countView.Frame =
                        new RectangleF(0, 0, (float)sizeCount.Width + 2 * 10, (float)bkgImg.Size.Height)
                        .Integral()
                    ;
                    UILabel lblCount =
                        new UILabel
                        (
                            new RectangleF(10, (float)(bkgImg.Size.Height - sizeCount.Height) / 2 - 2, sizeCount.Width, sizeCount.Height)
                            .Integral()
                        );
                                        #endif
                    lblCount.Text            = countString;
                    lblCount.BackgroundColor = UIColor.Clear;
                    lblCount.TextColor       = UIColor.White;
                    lblCount.TextAlignment   = UITextAlignment.Center;
                    lblCount.Font            = UIFont.SystemFontOfSize(14.0f);
                    lblCount.ShadowColor     = UIColor.Black;
                    lblCount.ShadowOffset    = new SizeF(0, 1);
                    countView.AddSubview(lblCount);
                }
                cell.AccessoryView = countView;
            }
            return(cell);
        }
Exemple #16
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();
        }