/// <summary>
        /// Loads the image into given imageView using defined parameters.
        /// </summary>
        /// <param name="parameters">Parameters for loading the image.</param>
        /// <param name="imageView">Image view that should receive the image.</param>
        /// <param name="imageScale">Optional scale factor to use when interpreting the image data. If unspecified it will use the device scale (ie: Retina = 2, non retina = 1)</param>
        public static IScheduledWork Into(this TaskParameter parameters, UIImageView imageView, float imageScale = -1f)
        {
            var weakRef = new WeakReference<UIImageView>(imageView);
            Func<UIImageView> getNativeControl = () => {
                UIImageView refView;
                if (!weakRef.TryGetTarget(out refView))
                    return null;
                return refView;
            };

			Action<UIImage, bool> doWithImage = (img, fromCache) => {
                UIImageView refView = getNativeControl();
                if (refView == null)
                    return;

				var isFadeAnimationEnabled = parameters.FadeAnimationEnabled.HasValue ? 
					parameters.FadeAnimationEnabled.Value : ImageService.Config.FadeAnimationEnabled;

				if (isFadeAnimationEnabled && !fromCache)
				{
					// fade animation
					UIView.Transition(refView, 0.4f, 
						UIViewAnimationOptions.TransitionCrossDissolve 
						| UIViewAnimationOptions.BeginFromCurrentState,
						() => { refView.Image = img; },
						() => {  });
				}
				else
				{
					refView.Image = img;
				}
            };

            return parameters.Into(getNativeControl, doWithImage, imageScale);
        }
		public override UIView ViewForItem(CarouselView carousel, uint index, UIView reusingView)
		{

			UILabel label;

			if (reusingView == null)
			{
				var imgView = new UIImageView(new RectangleF(0, 0, 200, 200))
				{

					Image = FromUrl( index > 1 ? product[0].ImageForSize(250) : product[(int)index].ImageForSize(250) ),
					ContentMode = UIViewContentMode.Center
				};


				label = new UILabel(imgView.Bounds)
				{
					BackgroundColor = UIColor.Clear,
					TextAlignment = UITextAlignment.Center,
					Tag = 1
				};
				label.Font = label.Font.WithSize(50);
				imgView.AddSubview(label);
				reusingView = imgView;
			}
			else
			{
				label = (UILabel)reusingView.ViewWithTag(1);
			}
				

			return reusingView;
		}
Beispiel #3
0
		public async void BeginDownloadingPOC (UIViewController controller, UIImageView imageView, UIActivityIndicatorView acIndicator, string imagePath, bool isCache)
		{
			if (acIndicator != null)
				acIndicator.StartAnimating ();

			UIImage data = null;
			if (imagePath != null)
				data = await GetImageData (imagePath, isCache);
				
			CGPoint center = imageView.Center;

			UIImage finalImage = null;
			if (data != null) {
				finalImage = MUtils.scaledToWidth (data, imageView.Frame.Width * 2);
				imageView.Frame = new CGRect (0.0f, 0.0f, finalImage.Size.Width / 2, finalImage.Size.Height / 2);
			}

			imageView.Image = getImageFrom (finalImage, "noimage.png");
			imageView.Center = center;

			if (acIndicator != null) {
				acIndicator.StopAnimating ();
				acIndicator.Color = UIColor.Clear;
			}
		}
		public void AddToMainWindow(UIView view)
		{
			if (this.Hidden)
			{
				_previousKeyWindow = UIApplication.SharedApplication.KeyWindow;
				this.Alpha = 0.0f;
				this.Hidden = false;
				this.UserInteractionEnabled = true;
				this.MakeKeyWindow();
			}
			
			if (this.Subviews.Length > 0)
			{
				this.Subviews.Last().UserInteractionEnabled = false;
			}
			
			if (BackgroundImage != null)
			{
				UIImageView backgroundView = new UIImageView(BackgroundImage);
				backgroundView.Frame = this.Bounds;
				backgroundView.ContentMode = UIViewContentMode.ScaleToFill;
				this.AddSubview(backgroundView);
				//[backgroundView release];
				//[_backgroundImage release];
				BackgroundImage = null;
			}  
			this.StatusBarDidChangeFrame(null);
			view.AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleLeftMargin
				| UIViewAutoresizing.FlexibleRightMargin | UIViewAutoresizing.FlexibleTopMargin;
			this.AddSubview(view);
		}
Beispiel #5
0
 public Cell()
 {
     ImageView = new UIImageView(RectangleF.Empty);
     ImageView.ContentMode = UIViewContentMode.ScaleToFill;
     this.AddSubview(ImageView);
     BackgroundColor = UIColor.White;
 }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			
			// set the background color of the view to white
			View.BackgroundColor = UIColor.White;
			
			// instantiate a new image view that takes up the whole screen and add it to 
			// the view hierarchy
			RectangleF imageViewFrame = new RectangleF (0, -NavigationController.NavigationBar.Frame.Height, View.Frame.Width, View.Frame.Height);
			imageView = new UIImageView (imageViewFrame);
			View.AddSubview (imageView);
			
			// create our offscreen bitmap context
			// size
			SizeF bitmapSize = new SizeF (imageView.Frame.Size);
			using (CGBitmapContext context = new CGBitmapContext (IntPtr.Zero,
									      (int)bitmapSize.Width, (int)bitmapSize.Height, 8,
									      (int)(4 * bitmapSize.Width), CGColorSpace.CreateDeviceRGB (),
									      CGImageAlphaInfo.PremultipliedFirst)) {
				
				// draw our coordinates for reference
				DrawCoordinateSpace (context);
				
				// draw our flag
				DrawFlag (context);
				
				// add a label
				DrawCenteredTextAtPoint (context, 384, 700, "Stars and Stripes", 60);
								
				// output the drawing to the view
				imageView.Image = UIImage.FromImage (context.ToImage ());
			}
		}
        public ProvisioningDialog()
            : base(UITableViewStyle.Grouped, null)
        {
            Root = new RootElement ("GhostPractice Mobile");
            var topSec = new Section ("Welcome");
            topSec.Add (new StringElement ("Please enter activation code"));
            activation = new EntryElement ("Code", "Activation Code", "999998-zcrdbrkqwogh");
            topSec.Add (activation);
            var submit = new StringElement ("Send Code");
            submit.Alignment = UITextAlignment.Center;

            submit.Tapped += delegate {
                if (activation.Value == null || activation.Value == string.Empty) {
                    new UIAlertView ("Device Activation", "Please enter activation code", null, "OK", null).Show ();
                    return;
                }
                if (!isBusy) {
                    getAsyncAppAndPlatform ();
                } else {
                    Wait ();
                }

            };
            topSec.Add (submit);
            Root.Add (topSec);

            UIImage img = UIImage.FromFile ("Images/launch_small.png");
            UIImageView v = new UIImageView (new RectangleF (0, 0, 480, 600));
            v.Image = img;
            Root.Add (new Section (v));
        }
		void ReleaseDesignerOutlets ()
		{
			if (ImageMonkey != null) {
				ImageMonkey.Dispose ();
				ImageMonkey = null;
			}
		}
Beispiel #9
0
		const int buttonSpace = 45; //24;
		
		public SessionCell (UITableViewCellStyle style, NSString ident, Session showSession, string big, string small) : base (style, ident)
		{
			SelectionStyle = UITableViewCellSelectionStyle.Blue;
			
			titleLabel = new UILabel () {
				TextAlignment = UITextAlignment.Left,
				BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f)
			};
			speakerLabel = new UILabel () {
				TextAlignment = UITextAlignment.Left,
				Font = smallFont,
				TextColor = UIColor.DarkGray,
				BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f)
			};
			locationImageView = new UIImageView();
			locationImageView.Image = building;

			button = UIButton.FromType (UIButtonType.Custom);
			button.TouchDown += delegate {
				UpdateImage (ToggleFavorite ());
				if (AppDelegate.IsPad) {
					NSObject o = new NSObject();
					NSDictionary progInfo = NSDictionary.FromObjectAndKey(o, new NSString("FavUpdate"));

					NSNotificationCenter.DefaultCenter.PostNotificationName(
						"NotificationFavoriteUpdated", o, progInfo);
				}
			};
			UpdateCell (showSession, big, small);
			
			ContentView.Add (titleLabel);
			ContentView.Add (speakerLabel);
			ContentView.Add (button);
			ContentView.Add (locationImageView);
		}
		public RatingControl ()
		{
			Rating = AAPLRatingControlMinimumRating;
			var blurredEffect = UIBlurEffect.FromStyle (UIBlurEffectStyle.Light);
			backgroundView = new UIVisualEffectView (blurredEffect);
			backgroundView.ContentView.BackgroundColor = UIColor.FromWhiteAlpha (0.7f, 0.3f);
			Add (backgroundView);

			var imageViews = new NSMutableArray ();
			for (nint rating = AAPLRatingControlMinimumRating; rating <= AAPLRatingControlMaximumRating; rating++) {
				UIImageView imageView = new UIImageView ();
				imageView.UserInteractionEnabled = true;

				imageView.Image = UIImage.FromBundle ("ratingInactive");
				imageView.HighlightedImage = UIImage.FromBundle ("ratingActive");
				imageView.HighlightedImage = imageView.HighlightedImage.ImageWithRenderingMode (UIImageRenderingMode.AlwaysTemplate);

				imageView.AccessibilityLabel = string.Format ("{0} stars", rating + 1);
				Add (imageView);
				imageViews.Add (imageView);
			}

			ImageViews = imageViews;
			UpdateImageViews ();
			SetupConstraints ();
		}
Beispiel #11
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib ();

            if (!Theme.IsiOS7) {
                BackgroundView = new UIImageView { Image = Theme.Inlay };
                photoFrame.Image = Theme.PhotoFrame;
                return;
            }

            SelectionStyle = UITableViewCellSelectionStyle.Blue;
            SelectedBackgroundView = new UIView { BackgroundColor = UIColor.Clear };
            BackgroundView = new UIView { BackgroundColor = Theme.BackgroundColor };

            date.TextColor =
                description.TextColor = Theme.LabelColor;
            date.Font = Theme.FontOfSize (18);
            description.Font = Theme.FontOfSize (14);

            //Change the image frame
            var frame = photoFrame.Frame;
            frame.Y = 0;
            frame.Height = Frame.Height;
            frame.Width -= 12;
            photo.Frame = frame;

            //Changes to widths on text
            frame = date.Frame;
            frame.Width -= 15;
            date.Frame = frame;

            frame = description.Frame;
            frame.Width -= 15;
            description.Frame = frame;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
         if (AppDelegate.iOS7Plus)
            EdgesForExtendedLayout = UIRectEdge.None;

         /*
            MCvFont font = new MCvFont(
                Emgu.CV.CvEnum.FONT.CV_FONT_HERSHEY_PLAIN,
                1.0,
                1.0
            );*/

         using (Image<Bgr, Byte> image = new Image<Bgr, Byte>(320, 240))
         {
            image.SetValue(new Bgr(255, 255, 255));
            image.Draw(
               "Hello, world",
               new Point(30, 30),
               CvEnum.FontFace.HersheyPlain,
               1.0,
               new Bgr(0, 255, 0)
            );

            UIImageView imageView = new UIImageView(image.ToUIImage());
            Add(imageView);
         }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            // Setup Background image
            var imgView = new UIImageView (UIImage.FromBundle ("background")) {
                ContentMode = UIViewContentMode.ScaleToFill,
                AutoresizingMask = UIViewAutoresizing.All,
                Frame = View.Bounds
            };
            View.AddSubview (imgView);

            // Setup iCarousel view
            Carousel = new iCarousel (View.Bounds) {
                CarouselType = iCarouselType.CoverFlow2,
                DataSource = new ControlsDataSource (this)
            };

            View.AddSubview (Carousel);

            // Setup info label
            Label = new UILabel (new RectangleF (20, 362, 280, 21)) {
                BackgroundColor = UIColor.Clear,
                Text = string.Empty,
                TextAlignment = UITextAlignment.Center
            };

            View.AddSubview (Label);
        }
        public NativeiOSListViewCell(NSString cellId)
            : base(UITableViewCellStyle.Default, cellId)
        {
            SelectionStyle = UITableViewCellSelectionStyle.Gray;

            ContentView.BackgroundColor = UIColor.FromRGB(218, 255, 127);

            imageView = new UIImageView();

            headingLabel = new UILabel()
            {
                Font = UIFont.FromName("Cochin-BoldItalic", 22f),
                TextColor = UIColor.FromRGB(127, 51, 0),
                BackgroundColor = UIColor.Clear
            };

            subHeadingLabel = new UILabel()
            {
                Font = UIFont.FromName("AmericanTypewriter", 12f),
                TextColor = UIColor.FromRGB(38, 127, 0),
                TextAlignment = UITextAlignment.Center,
                BackgroundColor = UIColor.Clear
            };

            ContentView.Add(headingLabel);
            ContentView.Add(subHeadingLabel);
            ContentView.Add(imageView);
        }
		public AssignmentCell (IntPtr handle) : base (handle)
		{
			assignmentViewModel = ServiceContainer.Resolve<AssignmentViewModel>();

			if (!Theme.IsiOS7)
				SelectedBackgroundView = new UIImageView { Image = Theme.AssignmentBlue };
		}
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			// iOS7: Keep content from hiding under navigation bar.
			if (UIDevice.CurrentDevice.CheckSystemVersion (7, 0)) {
				EdgesForExtendedLayout = UIRectEdge.None;
			}

			Title = speaker.Name;
			View.BackgroundColor = UIColor.White;

			name = new UILabel (new RectangleF(10, 10, 200, 30));
			name.Font = UIFont.BoldSystemFontOfSize (20f);
			company = new UILabel (new RectangleF( 10, 40, 200, 30));
			avatar = new UIImageView (new RectangleF (230, 10, 75, 75));

			View.Add (name);
			View.Add (company);
			View.Add (avatar);

			name.Text = speaker.Name;
			company.Text = speaker.Company;
			avatar.Image = UIImage.FromBundle (speaker.HeadshotUrl);
		}
		void ReleaseDesignerOutlets ()
		{
			if (titleLabel != null) {
				titleLabel.Dispose ();
				titleLabel = null;
			}

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

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

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

			if (backgroundImageView != null) {
				backgroundImageView.Dispose ();
				backgroundImageView = null;
			}
		}
Beispiel #18
0
        public EmptyListView(UIImage image, string emptyText)
            : base(new CGRect(0, 0, 320f, 480f * 2f))
        {
            AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;

            ImageView = new UIImageView();
            Title = new UILabel();

            ImageView.Frame = new CGRect(0, 0, 64f, 64f);
            ImageView.TintColor = DefaultColor;
            ImageView.ContentMode = UIViewContentMode.ScaleAspectFit;
            ImageView.Center = new CGPoint(Frame.Width / 2f, (Frame.Height / 4f) - (ImageView.Frame.Height / 2f));
            ImageView.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin | UIViewAutoresizing.FlexibleBottomMargin;
            ImageView.Image = image;
            Add(ImageView);

            Title.Frame = new CGRect(0, 0, 256f, 20f);
            Title.Center = new CGPoint(Frame.Width / 2f, ImageView.Frame.Bottom + 30f);
            Title.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin | 
                                     UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleWidth;
            Title.Text = emptyText;
            Title.TextAlignment = UITextAlignment.Center;
            Title.Font = UIFont.PreferredHeadline;
            Title.TextColor = DefaultColor;
            Add(Title);

            BackgroundColor = UIColor.White;
        }
Beispiel #19
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            scrollView = new UIScrollView (
                new RectangleF (0, 0, View.Frame.Width,
                    View.Frame.Height));
            View.AddSubview (scrollView);

            imageView = new UIImageView (UIImage.FromBundle ("heinz-map.png"));

            scrollView.ContentSize = imageView.Image.Size;
            scrollView.AddSubview (imageView);
            scrollView.MaximumZoomScale = 0.7f;
            scrollView.MinimumZoomScale = 0.4f;
            scrollView.ContentOffset = new PointF (0, 500);
            scrollView.ZoomScale = 5f;
            scrollView.ViewForZoomingInScrollView += (UIScrollView svm) => {
                return imageView;
            };

            UITapGestureRecognizer doubletap =  new UITapGestureRecognizer(OnDoubleTap) {
                NumberOfTapsRequired = 2 // double tap
            };
            scrollView.AddGestureRecognizer(doubletap);
        }
 void ReleaseDesignerOutlets()
 {
     if (instaCamPic != null) {
         instaCamPic.Dispose ();
         instaCamPic = null;
     }
 }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			Title = session.Title;
			background = new UIImageView (UIImage.FromBundle ("images/Background"));
			View.Add (background);
			View.SendSubviewToBack (background);

			title = new UILabel (new RectangleF(10, 74, 320, 30));
			title.Font = UIFont.FromName("Avenir-Medium", 20.0f );
			title.BackgroundColor = UIColor.Clear;

			speaker = new UILabel (new RectangleF( 10, 104, 320, 30));
			speaker.Font = UIFont.FromName("Avenir-Light", 14.0f );
			speaker.BackgroundColor = UIColor.Clear;

			room = new UILabel (new RectangleF( 10, 134, 320, 30));
			room.Font = UIFont.FromName("Avenir-Light", 14.0f );
			room.TextColor = UIColor.DarkGray;
			room.BackgroundColor = UIColor.Clear;

			favorite = new UIImageView (new RectangleF (270, 104, 38, 38));
			favorite.Image = UIImage.FromBundle ("images/favorited");

			View.Add (title);
			View.Add (speaker);
			View.Add (room);
			View.Add (favorite);

			title.Text = session.Title;
			speaker.Text = session.Speaker;
			room.Text = session.Location;
		}
Beispiel #22
0
    public override bool FinishedLaunching(UIApplication app, NSDictionary options)
    {
        UIApplication.SharedApplication.StatusBarHidden = true;

        image = new UIImageView (UIScreen.MainScreen.Bounds) {
            Image = UIImage.FromFile ("Background.png")
        };
        text = new UITextField (new RectangleF (44, 32, 232, 31)) {
            BorderStyle = UITextBorderStyle.RoundedRect,
            TextColor = UIColor.Black,
            BackgroundColor = UIColor.Black,
            ClearButtonMode = UITextFieldViewMode.WhileEditing,
            Placeholder = "Hello world",
        };
        text.ShouldReturn = delegate (UITextField theTextfield) {
            text.ResignFirstResponder ();

            label.Text = text.Text;
            return true;
        };

        label = new UILabel (new RectangleF (20, 120, 280, 44)){
            TextColor = UIColor.Gray,
            BackgroundColor = UIColor.Black,
            Text = text.Placeholder
        };

        var vc = new ViewController (this) { image, text, label };

        window = new UIWindow (UIScreen.MainScreen.Bounds){ vc.View };

        window.MakeKeyAndVisible ();

        return true;
    }
		void ReleaseDesignerOutlets ()
		{
			if (AudienceLabel != null) {
				AudienceLabel.Dispose ();
				AudienceLabel = null;
			}
			if (CriticsScoreLabel != null) {
				CriticsScoreLabel.Dispose ();
				CriticsScoreLabel = null;
			}
			if (FlixsterImg != null) {
				FlixsterImg.Dispose ();
				FlixsterImg = null;
			}
			if (PosterImg != null) {
				PosterImg.Dispose ();
				PosterImg = null;
			}
			if (TitleLabel != null) {
				TitleLabel.Dispose ();
				TitleLabel = null;
			}
			if (TomatoImg != null) {
				TomatoImg.Dispose ();
				TomatoImg = null;
			}
		}
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear (animated);

             foreach (var view in View.Subviews)
             {
            view.RemoveFromSuperview ();
            view.Dispose ();
             }

             var bytes = Convert.FromBase64String (_encodedImage);
             var imageData = NSData.FromArray (bytes);

             var image = UIImage.LoadFromData (imageData);
             switch (_type)
             {
            case ImageClarityType.Default:
               break;
            case ImageClarityType.ExtraSaturation:
               image = image.ApplyFilter (0.5f, 2, 2f);
               break;
            case ImageClarityType.ExtraContrast:
               image = image.ApplyFilter (0.5f, 0, 4);
               break;
            case ImageClarityType.ExtraBrightness:
               image = image.ApplyFilter (0.5f, 0.1f, 2);
               break;
             }

             _previewImageView = new UIImageView (new CGRect (new CGPoint (0, 0), image.ScreenSize ())) {
            ContentMode = UIViewContentMode.ScaleAspectFit,
            Image = image
             };
             View.AddSubviews (_previewImageView);
        }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			Title = "Images";

			// a simple image
			var img = UIImage.FromBundle ("Images/Icons/50_icon.png");
			imageView = new UIImageView (img) {
				Frame = new CGRect (20, 20, img.CGImage.Width, img.CGImage.Height)
			};
			View.AddSubview (imageView);

			// an animating image
			imgSpinningCircle = new UIImageView {
				Frame = new CGRect (150, 20, 100, 100),
				AnimationRepeatCount = 0,
				AnimationDuration = .5,
				AnimationImages = new UIImage[] {
					UIImage.FromBundle ("Images/Spinning Circle_1.png"),
					UIImage.FromBundle ("Images/Spinning Circle_2.png"),
					UIImage.FromBundle ("Images/Spinning Circle_3.png"),
					UIImage.FromBundle ("Images/Spinning Circle_4.png")
				}
			};

			View.AddSubview (imgSpinningCircle);
			imgSpinningCircle.StartAnimating ();
		}
		public override void ViewDidLoad()
		{
			base.ViewDidLoad();
			Title = "Choose Photo";
			View.BackgroundColor = UIColor.White;

			imageView = new UIImageView(new CGRect(10, 150, 300, 300));
			Add(imageView);

			choosePhotoButton = UIButton.FromType(UIButtonType.RoundedRect);
			choosePhotoButton.Frame = new CGRect(10, 80, 100, 40);
			choosePhotoButton.SetTitle("Picker", UIControlState.Normal);
			choosePhotoButton.TouchUpInside += (s, e) => {
				// create a new picker controller
				imagePicker = new UIImagePickerController();
				
				// set our source to the photo library
				imagePicker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary;
								
				// set what media types
				imagePicker.MediaTypes = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.PhotoLibrary);
				
				imagePicker.FinishedPickingMedia += Handle_FinishedPickingMedia;
				imagePicker.Canceled += Handle_Canceled;
				
				// show the picker
				NavigationController.PresentModalViewController(imagePicker, true);
				//UIPopoverController picc = new UIPopoverController(imagePicker);

			};
			View.Add(choosePhotoButton);
		}
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			// Set the Image inside the ImageView
			var imgView = new UIImageView (UIImage.FromBundle ("leaf.jpg")) {
				ContentMode = UIViewContentMode.Center
			};

			// Set the scrollpad content size so it has plenty of room to scroll (Image Size)
			scrollPad.ContentSize = imgView.Bounds.Size;
			scrollPad.AddSubview (imgView);

			// Subscribe to normal event handler so when ScrollView is Decelerating
			// this will be called
			scrollPad.DraggingEnded += (object sender, DraggingEventArgs e) => {
				if (e.Decelerate == true) {
					Console.WriteLine ("Dragging ended, Decelerate:{0}", e.Decelerate);
					InvokeOnMainThread (() => lblStatus.Text = "Try Again.");
				}
			};

			// The Rx fun starts here, we will look at DraggingEnded event and look inside its DraggingEventArgs
			// to see if Decelerate == false, so only then we will "React" to the event.
			ScrollReactSource = Observable.FromEventPattern<DraggingEventArgs> (scrollPad, "DraggingEnded")
				.Where (ev => ev.EventArgs.Decelerate == false)
				.ToEventPattern ();

			ReactOnDecelerate += (sender, ev) => 
				InvokeOnMainThread (() => {                
					lblStatus.Text = "Cool you did it!! Rx Working!";
					Console.WriteLine ("Dragging ended from Rx, Decelerate:false");
				});

		}
		public ADVPopoverProgressBar(RectangleF frame, ADVProgressBarColor barColor): base(frame)
		{
			bgImageView = new UIImageView(new RectangleF(0, 0, frame.Width, 24));
			
			bgImageView.Image = UIImage.FromFile("progress-track.png");
			this.AddSubview(bgImageView);
			
			progressFillImage = UIImage.FromFile("progress-fill.png").CreateResizableImage(new UIEdgeInsets(0, 20, 0, 40));
			progressImageView = new UIImageView(new RectangleF(-2, 0, 0, 32));
			this.AddSubview(progressImageView);
			
			percentView = new UIView(new RectangleF(5, 4, PERCENT_VIEW_WIDTH, 15));
			percentView.Hidden = true;
			
			UILabel percentLabel = new UILabel(new RectangleF(0, 0, PERCENT_VIEW_WIDTH, 14));
			percentLabel.Tag = 1;
			percentLabel.Text = "0%";
			percentLabel.BackgroundColor = UIColor.Clear;
			percentLabel.TextColor = UIColor.Black;
			percentLabel.Font = UIFont.BoldSystemFontOfSize(11);
			percentLabel.TextAlignment = UITextAlignment.Center;
			percentLabel.AdjustsFontSizeToFitWidth = true;
			percentView.AddSubview(percentLabel);
			
			this.AddSubview(percentView);
		}
Beispiel #29
0
        public MenuItem(UIImage image, UIImage highlightImage, UIImage contentImage, UIImage highlightContentImage)
            : base()
        {
            this.Image = image;
            this.HighlightedImage = highlightImage;
            this.UserInteractionEnabled = true;

            // figure this out
            if (contentImage == null)
            {
                contentImage = image;
            }

            if (contentImage != null)
            {
                this.contentImageView = new UIImageView(contentImage);

                if (highlightContentImage != null)
                {
                    this.contentImageView.HighlightedImage = highlightContentImage;
                }

                this.AddSubview(this.contentImageView);
            }
        }
        public override UITableViewCell GetCell(UITableView tv)
        {
            var cell = tv.DequeueReusableCell(ckey);
            if (cell == null)
            {
                cell = new UITableViewCell(UITableViewCellStyle.Subtitle, ckey);
                cell.SelectionStyle = UITableViewCellSelectionStyle.Blue;
                cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            }

            cell.TextLabel.Text = detailImageData.Title;
            cell.DetailTextLabel.Text = detailImageData.SubTitle;
            cell.DetailTextLabel.LineBreakMode = UILineBreakMode.WordWrap;
            cell.DetailTextLabel.Lines = 2;

            // to show an image on the right instead of the left. Just set the accessory view to that of a UIImageView.
            if (cell.AccessoryView == null)
            {
                var img = ImageLoader.DefaultRequestImage(detailImageData.ImageUri, this);

                if (img != null)
                {
                    var imgView = new UIImageView(img);
                    imgView.Frame = new RectangleF(0,0,75,65);
                    cell.AccessoryView = imgView;
                }
            }
            return cell;
        }
            private static void OnRecognizing(LongPressGestureRecognizer recognizer, UITableView tableView, ViewCell cell)
            {
                NSIndexPath indexPath = tableView.IndexPathForRowAtPoint(recognizer.LocationInView(tableView));

                switch (recognizer.State)
                {
                case UIGestureRecognizerState.Began:
                    tableView.ScrollEnabled = false;
                    if (indexPath != null)
                    {
                        // Remember the source row
                        sourceIndexPath      = indexPath;
                        destinationIndexPath = indexPath;
                        var selectedCell = tableView.CellAt(indexPath);
                        UIGraphics.BeginImageContext(selectedCell.ContentView.Bounds.Size);
                        selectedCell.ContentView.Layer.RenderInContext(UIGraphics.GetCurrentContext());
                        UIImage img = UIGraphics.GetImageFromCurrentImageContext();
                        UIGraphics.EndImageContext();

                        UIImageView iv = new UIImageView(img);
                        dragAndDropView       = new UIView();
                        dragAndDropView.Frame = iv.Frame;
                        dragAndDropView.Add(iv);
                        //dragAndDropView.BackgroundColor = UIColor.Blue;
                        sourceTableView = tableView;

                        UIApplication.SharedApplication.KeyWindow.Add(dragAndDropView);

                        dragAndDropView.Center = recognizer.LocationInView(UIApplication.SharedApplication.KeyWindow);

                        dragAndDropView.AddGestureRecognizer(selectedCell.GestureRecognizers[0]);
                    }

                    break;

                case UIGestureRecognizerState.Changed:
                    dragAndDropView.Center = recognizer.LocationInView(UIApplication.SharedApplication.KeyWindow);
                    destinationIndexPath   = indexPath;
                    break;

                case UIGestureRecognizerState.Cancelled:
                case UIGestureRecognizerState.Failed:
                    sourceIndexPath           = null;
                    cell.View.BackgroundColor = Color.Transparent;
                    break;

                case UIGestureRecognizerState.Ended:

                    if (dragAndDropView == null)
                    {
                        return;
                    }

                    dragAndDropView.RemoveFromSuperview();
                    dragAndDropView = null;


                    UIView view = UIApplication.SharedApplication.KeyWindow;

                    UIView viewHit = view.HitTest(recognizer.LocationInView(view), null);

                    int removeLocation = (int)sourceIndexPath.Item;
                    int insertLocation = destinationIndexPath != null ? (int)destinationIndexPath.Item : -1;

                    UITableView destinationTableView = viewHit as UITableView;

                    if (viewHit is UITableView)
                    {
                        destinationTableView = viewHit as UITableView;
                    }
                    else
                    {
                        while (!(viewHit is UITableViewCell) && viewHit != null)
                        {
                            viewHit = viewHit.Superview;
                        }

                        UIView tempView = viewHit?.Superview;

                        while (!(tempView is UITableView) && tempView != null)
                        {
                            tempView = tempView.Superview;
                        }

                        if (tempView != null)
                        {
                            destinationTableView = tempView as UITableView;
                            insertLocation       = (int)destinationTableView.IndexPathForCell((UITableViewCell)viewHit).Item;
                        }
                    }

                    if (destinationTableView != null)
                    {
                        if (DragDropListRenderer.ListMap.ContainsKey(tableView.Tag.ToString()) && DragDropListRenderer.ListMap.ContainsKey(destinationTableView.Tag.ToString()))
                        {
                            var sourceList      = (IList)DragDropListRenderer.ListMap[tableView.Tag.ToString()].Item2;
                            var destinationList = (IList)DragDropListRenderer.ListMap[destinationTableView.Tag.ToString()].Item2;
                            if (!tableView.Tag.Equals(destinationTableView.Tag) || removeLocation != insertLocation)
                            {
                                if (sourceList.Contains(cell.BindingContext))
                                {
                                    sourceList.Remove(cell.BindingContext);

                                    if (insertLocation != -1)
                                    {
                                        destinationList.Insert(insertLocation, cell.BindingContext);
                                    }
                                    else
                                    {
                                        destinationList.Add(cell.BindingContext);
                                    }
                                }
                                tableView.ReloadData();
                                destinationTableView.ReloadData();
                            }
                        }
                    }


                    tableView.ScrollEnabled = true;

                    break;
                }
            }
Beispiel #32
0
        public override void LayoutSubviews()
        {
            foreach (var view in this.Subviews)
            {
                view.Frame = new CGRect(Frame.X, 0, Frame.Width, Frame.Height);
            }

            CreateOptionView();
            ScheduleEditor.Editor.Frame     = new CGRect(0, 0, this.Frame.Size.Width, this.Frame.Size.Height);
            ScheduleEditor.ScrollView.Frame = new CGRect(ScheduleEditor.Editor.Frame.X + 10, ScheduleEditor.Editor.Frame.Y + 10, ScheduleEditor.Editor.Frame.Size.Width - 10, ScheduleEditor.Editor.Frame.Size.Height);

            ScheduleEditor.EditorFrameUpdate();

            UIImageView image1 = new UIImageView();
            UIImageView image2 = new UIImageView();
            UIImageView image3 = new UIImageView();

            moveToDate = new UIButton();
            editorView = new UIButton();
            monthText  = new UILabel();

            HeaderView = new UIView();
            HeaderView.BackgroundColor = UIColor.FromRGB(214, 214, 214);

            NSDate     today    = new NSDate();
            NSCalendar calendar = NSCalendar.CurrentCalendar;

            // Get the year, month, day from the date
            NSDateComponents components = calendar.Components(
                NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, today);
            NSDate          startDate  = calendar.DateFromComponents(components);
            NSDateFormatter dateFormat = new NSDateFormatter();

            dateFormat.DateFormat = "MMMM YYYY";
            string monthName = dateFormat.ToString(startDate);

            monthText.Text          = monthName;
            monthText.TextColor     = UIColor.Black;
            monthText.TextAlignment = UITextAlignment.Left;
            moveToDate.AddSubview(image2);
            headerButton.AddSubview(image1);
            editorView.AddSubview(image3);

            string[] tableItems = new string[] { "Day", "Week", "WorkWeek", "Month" };
            TableView        = new UITableView();
            TableView.Frame  = new CGRect(0, 0, this.Frame.Size.Width / 2, 60.0f * 4);
            TableView.Hidden = true;
            TableView.Source = new ScheduleTableSource(tableItems);

            string deviceType = UIDevice.CurrentDevice.Model;

            if (deviceType == "iPhone" || deviceType == "iPod touch")
            {
                image1.Frame = new CGRect(0, 0, 60, 60);
                image1.Image = UIImage.FromFile("black-09.png");
                image2.Frame = new CGRect(0, 0, 60, 60);
                image2.Image = UIImage.FromFile("black-11.png");
                image3.Frame = new CGRect(0, 0, 60, 60);
                image3.Image = UIImage.FromFile("black-10.png");

                HeaderView.Frame   = new CGRect(0, 0, this.Frame.Size.Width, 50);
                moveToDate.Frame   = new CGRect((this.Frame.Size.Width / 6) + (this.Frame.Size.Width / 2), -10, this.Frame.Size.Width / 8, 50);
                editorView.Frame   = new CGRect((this.Frame.Size.Width / 6) + (this.Frame.Size.Width / 6) + (this.Frame.Size.Width / 2), -10, this.Frame.Size.Width / 8, 50);
                headerButton.Frame = new CGRect(-10, -10, this.Frame.Size.Width / 8, 50);
                monthText.Frame    = new CGRect(this.Frame.Size.Width / 8, -10, this.Frame.Size.Width / 2, 60);
                Schedule.Frame     = new CGRect(0, 50, this.Frame.Size.Width, this.Frame.Size.Height - 50);
            }
            else
            {
                Schedule.DayViewSettings.WorkStartHour = 7;
                Schedule.DayViewSettings.WorkEndHour   = 18;

                Schedule.WeekViewSettings.WorkStartHour = 7;
                Schedule.WeekViewSettings.WorkEndHour   = 18;

                Schedule.WorkWeekViewSettings.WorkStartHour = 7;
                Schedule.WorkWeekViewSettings.WorkEndHour   = 18;

                image1.Frame = new CGRect(0, 0, 80, 80);
                image1.Image = UIImage.FromFile("black-09.png");
                image2.Frame = new CGRect(0, 0, 80, 80);
                image2.Image = UIImage.FromFile("black-11.png");
                image3.Frame = new CGRect(0, 0, 80, 80);
                image3.Image = UIImage.FromFile("black-10.png");

                HeaderView.Frame   = new CGRect(0, 0, this.Frame.Size.Width, 60);
                moveToDate.Frame   = new CGRect((this.Frame.Size.Width / 5) + (this.Frame.Size.Width / 2) + (this.Frame.Size.Width / 8), -10, this.Frame.Size.Width / 8, 50);
                editorView.Frame   = new CGRect((this.Frame.Size.Width / 5) + (this.Frame.Size.Width / 5) + (this.Frame.Size.Width / 2), -10, this.Frame.Size.Width / 8, 50);
                headerButton.Frame = new CGRect(0, -10, this.Frame.Size.Width / 8, 50);
                monthText.Frame    = new CGRect(this.Frame.Size.Width / 8, 5, this.Frame.Size.Width / 2, 50);
                Schedule.Frame     = new CGRect(0, 60, this.Frame.Size.Width, this.Frame.Size.Height - 60);
            }

            moveToDate.TouchUpInside   += MoveToDate_TouchUpInside;
            headerButton.TouchUpInside += HeaderButton_TouchUpInside;
            editorView.TouchUpInside   += EditorView_TouchUpInside;

            HeaderView.AddSubview(moveToDate);
            HeaderView.AddSubview(editorView);
            HeaderView.AddSubview(monthText);
            HeaderView.AddSubview(headerButton);
            this.AddSubview(Schedule);
            this.AddSubview(HeaderView);
            this.AddSubview(ScheduleEditor.Editor);
            this.AddSubview(TableView);
            base.LayoutSubviews();
        }
 public void Include(UIImageView imageView)
 {
     imageView.Image = new UIImage(imageView.Image.CGImage);
 }
Beispiel #34
0
        void SetArrows()
        {
            if (Element.ShowArrows)
            {
                var o             = Element.Orientation == CarouselViewOrientation.Horizontal ? "H" : "V";
                var formatOptions = Element.Orientation == CarouselViewOrientation.Horizontal ? NSLayoutFormatOptions.AlignAllCenterY : NSLayoutFormatOptions.AlignAllCenterX;

                prevBtn                 = new UIButton();
                prevBtn.Hidden          = Element.Position == 0;
                prevBtn.BackgroundColor = Element.ArrowsBackgroundColor.ToUIColor();
                prevBtn.Alpha           = 0.5f;
                prevBtn.TranslatesAutoresizingMaskIntoConstraints = false;

                var prevArrow      = new UIImageView();
                var prevArrowImage = new UIImage(Element.Orientation == CarouselViewOrientation.Horizontal ? "Prev.png" : "Up.png");
                prevArrow.Image = prevArrowImage.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                prevArrow.TranslatesAutoresizingMaskIntoConstraints = false;
                prevArrow.TintColor = Element.ArrowsTintColor.ToUIColor();
                prevBtn.AddSubview(prevArrow);

                prevBtn.TouchUpInside += delegate
                {
                    if (Element.Position > 0)
                    {
                        Element.Position = Element.Position - 1;
                    }
                };

                var prevViewsDictionary = NSDictionary.FromObjectsAndKeys(new NSObject[] { prevBtn, prevArrow }, new NSObject[] { new NSString("superview"), new NSString("prevArrow") });
                prevBtn.AddConstraints(NSLayoutConstraint.FromVisualFormat("[prevArrow(==17)]", 0, new NSDictionary(), prevViewsDictionary));
                prevBtn.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:[prevArrow(==17)]", 0, new NSDictionary(), prevViewsDictionary));
                prevBtn.AddConstraints(NSLayoutConstraint.FromVisualFormat(o + ":[prevArrow]-(2)-|", 0, new NSDictionary(), prevViewsDictionary));
                prevBtn.AddConstraints(NSLayoutConstraint.FromVisualFormat(o + ":[superview]-(<=1)-[prevArrow]", formatOptions, new NSDictionary(), prevViewsDictionary));

                pageController.View.AddSubview(prevBtn);

                nextBtn                 = new UIButton();
                nextBtn.Hidden          = Element.Position == Element.ItemsSource.GetCount() - 1;
                nextBtn.BackgroundColor = Element.ArrowsBackgroundColor.ToUIColor();
                nextBtn.Alpha           = 0.5f;
                nextBtn.TranslatesAutoresizingMaskIntoConstraints = false;

                var nextArrow      = new UIImageView();
                var nextArrowImage = new UIImage(Element.Orientation == CarouselViewOrientation.Horizontal ? "Next.png" : "Down.png");
                nextArrow.Image = nextArrowImage.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                nextArrow.TranslatesAutoresizingMaskIntoConstraints = false;
                nextArrow.TintColor = Element.ArrowsTintColor.ToUIColor();
                nextBtn.AddSubview(nextArrow);

                nextBtn.TouchUpInside += delegate
                {
                    if (Element.Position < Element.ItemsSource.GetCount() - 1)
                    {
                        Element.Position = Element.Position + 1;
                    }
                };

                var nextViewsDictionary = NSDictionary.FromObjectsAndKeys(new NSObject[] { nextBtn, nextArrow }, new NSObject[] { new NSString("superview"), new NSString("nextArrow") });
                nextBtn.AddConstraints(NSLayoutConstraint.FromVisualFormat("[nextArrow(==17)]", 0, new NSDictionary(), nextViewsDictionary));
                nextBtn.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:[nextArrow(==17)]", 0, new NSDictionary(), nextViewsDictionary));
                nextBtn.AddConstraints(NSLayoutConstraint.FromVisualFormat(o + ":|-(2)-[nextArrow]", 0, new NSDictionary(), nextViewsDictionary));
                nextBtn.AddConstraints(NSLayoutConstraint.FromVisualFormat(o + ":[superview]-(<=1)-[nextArrow]", formatOptions, new NSDictionary(), nextViewsDictionary));

                pageController.View.AddSubview(nextBtn);

                var btnsDictionary = NSDictionary.FromObjectsAndKeys(new NSObject[] { pageController.View, prevBtn, nextBtn }, new NSObject[] { new NSString("superview"), new NSString("prevBtn"), new NSString("nextBtn") });

                var w = Element.Orientation == CarouselViewOrientation.Horizontal ? 20 : 36;
                var h = Element.Orientation == CarouselViewOrientation.Horizontal ? 36 : 20;

                pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:[prevBtn(==" + w + ")]", 0, new NSDictionary(), btnsDictionary));
                pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:[prevBtn(==" + h + ")]", 0, new NSDictionary(), btnsDictionary));
                pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat(o + ":|[prevBtn]", 0, new NSDictionary(), btnsDictionary));
                pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat(o + ":[superview]-(<=1)-[prevBtn]", formatOptions, new NSDictionary(), btnsDictionary));

                pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:[nextBtn(==" + w + ")]", 0, new NSDictionary(), btnsDictionary));
                pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:[nextBtn(==" + h + ")]", 0, new NSDictionary(), btnsDictionary));
                pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat(o + ":[nextBtn]|", 0, new NSDictionary(), btnsDictionary));
                pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat(o + ":[superview]-(<=1)-[nextBtn]", formatOptions, new NSDictionary(), btnsDictionary));
            }
            else
            {
                CleanUpArrows();
            }
        }
        MKAnnotationView GetViewForAnnotation(MKMapView mapView, NSObject annotation)
        {
            // if it's the user location, just return nil.
            if (annotation is MKUserLocation)
            {
                return(null);
            }

            // handle our two custom annotations
            //
            if (annotation is BridgeAnnotation)               // for Golden Gate Bridge
            {
                const string        BridgeAnnotationIdentifier = "bridgeAnnotationIdentifier";
                MKPinAnnotationView pinView = (MKPinAnnotationView)mapView.DequeueReusableAnnotation(BridgeAnnotationIdentifier);
                if (pinView == null)
                {
                    MKPinAnnotationView customPinView = new MKPinAnnotationView(annotation, BridgeAnnotationIdentifier);
                    customPinView.PinColor       = MKPinAnnotationColor.Purple;
                    customPinView.AnimatesDrop   = true;
                    customPinView.CanShowCallout = true;

                    UIButton rightButton = UIButton.FromType(UIButtonType.DetailDisclosure);
                    rightButton.AddTarget((object sender, EventArgs ea) => showDetails(), UIControlEvent.TouchUpInside);
                    customPinView.RightCalloutAccessoryView = rightButton;
                    pinViews.Add(customPinView);
                    return(customPinView);
                }
                else
                {
                    pinView.Annotation = annotation;
                }
                return(pinView);
            }
            else if (annotation is SFAnnotation)                 // for City of San Francisco
            {
                const string     SFAnnotationIdentifier = "SFAnnotationIdentifier";
                MKAnnotationView pinView = (MKAnnotationView)mapView.DequeueReusableAnnotation(SFAnnotationIdentifier);
                if (pinView == null)
                {
                    MKAnnotationView annotationView = new MKAnnotationView(annotation, SFAnnotationIdentifier);
                    annotationView.CanShowCallout = true;

                    UIImage flagImage = UIImage.FromFile("flag.png");

                    RectangleF resizeRect;

                    resizeRect.Size = flagImage.Size;
                    SizeF maxSize = View.Bounds.Inset(AnnotationPadding, AnnotationPadding).Size;
                    maxSize.Height -= NavigationController.NavigationBar.Frame.Size.Height - CalloutHeight;
                    if (resizeRect.Size.Width > maxSize.Width)
                    {
                        resizeRect.Size = new SizeF(maxSize.Width, resizeRect.Size.Height / resizeRect.Size.Width * maxSize.Width);
                    }
                    if (resizeRect.Size.Height > maxSize.Height)
                    {
                        resizeRect.Size = new SizeF(resizeRect.Size.Width / resizeRect.Size.Height * maxSize.Height, maxSize.Height);
                    }

                    resizeRect.Location = PointF.Empty;
                    UIGraphics.BeginImageContext(resizeRect.Size);
                    flagImage.Draw(resizeRect);

                    UIImage resizedImage = UIGraphics.GetImageFromCurrentImageContext();
                    UIGraphics.EndImageContext();

                    annotationView.Image  = resizedImage;
                    annotationView.Opaque = false;

                    UIImageView sfIconView = new UIImageView(UIImage.FromFile("SFIcon.png"));
                    annotationView.LeftCalloutAccessoryView = sfIconView;
                    pinViews.Add(annotationView);
                    return(annotationView);
                }
                else
                {
                    pinView.Annotation = annotation;
                }
                return(pinView);
            }
            return(null);
        }
        public RadialMenuCustomization()
        {
            tempColor        = GetRandomColor();
            isEraserSelected = false;
            colorPaletteView = new UIView();
            colorPaletteView.BackgroundColor = UIColor.FromRGB(230, 230, 230);
            nfloat elementCount = UIScreen.MainScreen.Bounds.Width / 30;
            nfloat xPos         = 5;

            for (int i = 0; i < elementCount; i++)
            {
                UIButton button = new UIButton();
                button.Tag = 1000 + i;
                button.Layer.CornerRadius = 15;
                button.Frame           = new CGRect(xPos, 5, 30, 30);
                button.BackgroundColor = GetRandomColor();
                button.AddTarget(HandleEventHandler, UIControlEvent.TouchDown);
                colorPaletteView.Add(button);
                xPos += 40;
            }
            startUpLabel                 = new UILabel();
            startUpLabel.Text            = "Touch to draw";
            startUpLabel.TextColor       = UIColor.FromRGB(0, 191, 255);
            startUpLabel.TextAlignment   = UITextAlignment.Center;
            startUpLabel.BackgroundColor = UIColor.Clear;

            radialMenu = new SfRadialMenu();
            radialMenu.IsDragEnabled               = false;
            radialMenu.RimRadius                   = 120;
            radialMenu.CenterButtonRadius          = 40;
            radialMenu.CenterButtonBorderThickness = 0;
            radialMenu.CenterButtonBorderColor     = UIColor.Clear;
            radialMenu.CenterButtonBackgroundColor = UIColor.Clear;
            radialMenu.EnableRotation              = true;
            radialMenu.RimColor           = UIColor.Clear;
            radialMenu.SeparatorThickness = 10;
            radialMenu.SeparatorColor     = UIColor.Clear;
            centerView        = new UIView();
            centerView.Frame  = new CGRect(0, 0, 80, 80);
            centerImage       = new UIImageView();
            centerImage.Image = UIImage.FromBundle("blue.png");
            centerImage.Frame = new CGRect(0, 0, 80, 80);
            centerView.Add(centerImage);
            UILabel centerLabel = new UILabel();

            centerLabel.Frame         = new CGRect(0, 5, 80, 80);
            centerLabel.Text          = "U";
            centerLabel.TextAlignment = UITextAlignment.Center;
            centerLabel.Font          = UIFont.FromName("ios", 30);
            centerLabel.TextColor     = UIColor.White;
            centerView.Add(centerLabel);
            radialMenu.EnableCenterButtonAnimation = false;
            radialMenu.CenterButtonView            = centerView;

            UIView penView = new UIView();

            penView.Frame = new CGRect(0, 0, 80, 80);
            UIImageView penImage = new UIImageView();

            penImage.Image = UIImage.FromBundle("green.png");
            penImage.Frame = new CGRect(0, 0, 80, 80);
            penView.Add(penImage);
            UILabel penLabel = new UILabel();

            penLabel.Frame         = new CGRect(0, 5, 80, 80);
            penLabel.Text          = "L";
            penLabel.TextAlignment = UITextAlignment.Center;
            penLabel.Font          = UIFont.FromName("ios", 30);
            penLabel.TextColor     = UIColor.White;
            penView.Add(penLabel);
            SfRadialMenuItem pen = new SfRadialMenuItem()
            {
                Height = 80, Width = 80, View = penView, BackgroundColor = UIColor.Clear
            };

            pen.ItemTapped += Pen_ItemTapped;
            radialMenu.Items.Add(pen);

            UIView brushView = new UIView();

            brushView.Frame = new CGRect(0, 0, 80, 80);
            UIImageView brushImage = new UIImageView();

            brushImage.Image = UIImage.FromBundle("green.png");
            brushImage.Frame = new CGRect(0, 0, 80, 80);
            brushView.Add(brushImage);
            UILabel brushLabel = new UILabel();

            brushLabel.Frame         = new CGRect(0, 5, 80, 80);
            brushLabel.Text          = "A";
            brushLabel.TextAlignment = UITextAlignment.Center;
            brushLabel.Font          = UIFont.FromName("ios", 30);
            brushLabel.TextColor     = UIColor.White;
            brushView.Add(brushLabel);
            SfRadialMenuItem brush = new SfRadialMenuItem()
            {
                Height = 80, Width = 80, View = brushView, BackgroundColor = UIColor.Clear
            };

            brush.ItemTapped += Brush_ItemTapped;
            radialMenu.Items.Add(brush);

            UIView eraserView = new UIView();

            eraserView.Frame = new CGRect(0, 0, 80, 80);
            UIImageView eraserImage = new UIImageView();

            eraserImage.Image = UIImage.FromBundle("green.png");
            eraserImage.Frame = new CGRect(0, 0, 80, 80);
            eraserView.Add(eraserImage);
            UILabel eraserLabel = new UILabel();

            eraserLabel.Frame         = new CGRect(0, 5, 80, 80);
            eraserLabel.Text          = "R";
            eraserLabel.TextAlignment = UITextAlignment.Center;
            eraserLabel.Font          = UIFont.FromName("ios", 30);
            eraserLabel.TextColor     = UIColor.White;
            eraserView.Add(eraserLabel);
            SfRadialMenuItem eraser = new SfRadialMenuItem()
            {
                Height = 80, Width = 80, View = eraserView, BackgroundColor = UIColor.Clear
            };

            eraser.ItemTapped += Eraser_ItemTapped;
            radialMenu.Items.Add(eraser);

            UIView removeView = new UIView();

            removeView.Frame = new CGRect(0, 0, 80, 80);
            UIImageView removeImage = new UIImageView();

            removeImage.Image = UIImage.FromBundle("green.png");
            removeImage.Frame = new CGRect(0, 0, 80, 80);
            removeView.Add(removeImage);
            UILabel removeLabel = new UILabel();

            removeLabel.Frame         = new CGRect(0, 5, 80, 80);
            removeLabel.Text          = "Q";
            removeLabel.TextAlignment = UITextAlignment.Center;
            removeLabel.Font          = UIFont.FromName("ios", 30);
            removeLabel.TextColor     = UIColor.White;
            removeView.Add(removeLabel);
            SfRadialMenuItem remove = new SfRadialMenuItem()
            {
                Height = 80, Width = 80, View = removeView, BackgroundColor = UIColor.Clear
            };

            remove.ItemTapped += Remove_ItemTapped;
            radialMenu.Items.Add(remove);

            UIView paintView = new UIView();

            paintView.Frame = new CGRect(0, 0, 80, 80);
            UIImageView paintImage = new UIImageView();

            paintImage.Image = UIImage.FromBundle("green.png");
            paintImage.Frame = new CGRect(0, 0, 80, 80);
            paintView.Add(paintImage);
            UILabel paintLabel = new UILabel();

            paintLabel.Frame         = new CGRect(0, 5, 80, 80);
            paintLabel.Text          = "G";
            paintLabel.TextAlignment = UITextAlignment.Center;
            paintLabel.Font          = UIFont.FromName("ios", 30);
            paintLabel.TextColor     = UIColor.White;
            paintView.Add(paintLabel);
            SfRadialMenuItem paint = new SfRadialMenuItem()
            {
                Height = 80, Width = 80, View = paintView, BackgroundColor = UIColor.Clear
            };

            paint.ItemTapped += Paint_ItemTapped;
            radialMenu.Items.Add(paint);

            UIView paintBoxView = new UIView();

            paintBoxView.Frame = new CGRect(0, 0, 80, 80);
            UIImageView paintBoxImage = new UIImageView();

            paintBoxImage.Image = UIImage.FromBundle("green.png");
            paintBoxImage.Frame = new CGRect(0, 0, 80, 80);
            paintBoxView.Add(paintBoxImage);
            UILabel paintBoxLabel = new UILabel();

            paintBoxLabel.Frame         = new CGRect(0, 5, 80, 80);
            paintBoxLabel.Text          = "V";
            paintBoxLabel.TextAlignment = UITextAlignment.Center;
            paintBoxLabel.Font          = UIFont.FromName("ios", 30);
            paintBoxLabel.TextColor     = UIColor.White;
            paintBoxView.Add(paintBoxLabel);
            SfRadialMenuItem paintBox = new SfRadialMenuItem()
            {
                Height = 80, Width = 80, View = paintBoxView, BackgroundColor = UIColor.Clear
            };

            paintBox.ItemTapped += PaintBox_ItemTapped;
            radialMenu.Items.Add(paintBox);


            if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                //radialMenu.RimRadius = 250;
                radialMenu.CenterButtonRadius = 50;
                centerLabel.Font  = UIFont.FromName("ios", 40);
                pen.IconFont      = UIFont.FromName("ios", 40);
                pen.Height        = 100;
                pen.Width         = 100;
                brush.IconFont    = UIFont.FromName("ios", 40);
                brush.Height      = 100;
                brush.Width       = 100;
                eraser.IconFont   = UIFont.FromName("ios", 40);
                eraser.Height     = 100;
                eraser.Width      = 100;
                remove.Height     = 100;
                remove.Width      = 100;
                remove.IconFont   = UIFont.FromName("ios", 40);
                paintBox.Height   = 100;
                paintBox.Width    = 100;
                paintBox.IconFont = UIFont.FromName("ios", 40);
                paint.Height      = 100;
                paint.Width       = 100;
                paint.IconFont    = UIFont.FromName("ios", 40);
            }

            drawingTool          = new CustomDrawing();
            drawingTool.PenColor = tempColor;
            drawingTool.Tapped  += DrawingTool_Tapped;
            this.ClipsToBounds   = true;
            this.Add(drawingTool);
            this.Add(startUpLabel);
            this.Add(colorPaletteView);
            this.Add(radialMenu);
        }
Beispiel #37
0
        public override void LoadView()
        {
            View = new UIView();
            View.BackgroundColor = UIColor.White;

            var imageView = new UIImageView();

            imageView.ContentMode = UIViewContentMode.ScaleAspectFit;
            imageView.TranslatesAutoresizingMaskIntoConstraints = false;
            ImageView = imageView;
            View.Add(ImageView);

            var ratingControl = new RatingControl();

            ratingControl.TranslatesAutoresizingMaskIntoConstraints = false;
            ratingControl.AddTarget(RatingChanges, UIControlEvent.ValueChanged);
            RatingControl = ratingControl;
            View.Add(RatingControl);

            var overlayButton = new OverlayView();

            overlayButton.TranslatesAutoresizingMaskIntoConstraints = false;
            OverlayButton = overlayButton;
            View.Add(OverlayButton);

            UpdatePhoto();

            var views = NSDictionary.FromObjectsAndKeys(
                new object[] { imageView, ratingControl, overlayButton },
                new object[] { "imageView", "ratingControl", "overlayButton" }
                );

            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("|[imageView]|",
                                                                    NSLayoutFormatOptions.DirectionLeadingToTrailing, null, views));

            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[imageView]|",
                                                                    NSLayoutFormatOptions.DirectionLeadingToTrailing, null, views));

            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("[ratingControl]-|",
                                                                    NSLayoutFormatOptions.DirectionLeadingToTrailing, null, views));

            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("[overlayButton]-|",
                                                                    NSLayoutFormatOptions.DirectionLeadingToTrailing, null, views));

            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:[overlayButton]-[ratingControl]-|",
                                                                    NSLayoutFormatOptions.DirectionLeadingToTrailing, null, views));

            var constraints = new List <NSLayoutConstraint> ();

            constraints.AddRange(NSLayoutConstraint.FromVisualFormat("|-(>=20)-[ratingControl]",
                                                                     NSLayoutFormatOptions.DirectionLeadingToTrailing, null, views));

            constraints.AddRange(NSLayoutConstraint.FromVisualFormat("|-(>=20)-[overlayButton]",
                                                                     NSLayoutFormatOptions.DirectionLeadingToTrailing, null, views));

            foreach (var constraint in constraints)
            {
                constraint.Priority = (int)UILayoutPriority.Required - 1;
            }

            View.AddConstraints(constraints.ToArray());
        }
Beispiel #38
0
        // Constructor:
        public CBoxScoreLine_Pitching(Foundation.NSString cellId) : base(UITableViewCellStyle.Default, cellId)
        {
            // ---------------------------------------------------------------------

            SelectionStyle = UITableViewCellSelectionStyle.Gray;
            ContentView.BackgroundColor = UIColor.White;
            imageView = new UIImageView();
            string fontName = "AmericanTypewriter";



            lblPName = new UILabel()
            {
                Font            = UIFont.FromName("Arial", 12f),
                TextColor       = UIColor.Black,
                TextAlignment   = UITextAlignment.Left,
                BackgroundColor = UIColor.White
            };
            lblIp = new UILabel()
            {
                Font            = UIFont.FromName(fontName, 12f),
                TextColor       = UIColor.Black,
                TextAlignment   = UITextAlignment.Right,
                BackgroundColor = UIColor.White
            };
            lblR = new UILabel()
            {
                Font            = UIFont.FromName(fontName, 12f),
                TextColor       = UIColor.Black,
                TextAlignment   = UITextAlignment.Right,
                BackgroundColor = UIColor.White
            };
            lblH = new UILabel()
            {
                Font            = UIFont.FromName(fontName, 12f),
                TextColor       = UIColor.Black,
                TextAlignment   = UITextAlignment.Right,
                BackgroundColor = UIColor.White
            };
            lblEr = new UILabel()
            {
                Font            = UIFont.FromName(fontName, 12f),
                TextColor       = UIColor.Black,
                TextAlignment   = UITextAlignment.Right,
                BackgroundColor = UIColor.White
            };
            lblBb = new UILabel()
            {
                Font            = UIFont.FromName(fontName, 12f),
                TextColor       = UIColor.Black,
                TextAlignment   = UITextAlignment.Right,
                BackgroundColor = UIColor.White
            };
            lblSo = new UILabel()
            {
                Font            = UIFont.FromName(fontName, 12f),
                TextColor       = UIColor.Black,
                TextAlignment   = UITextAlignment.Right,
                BackgroundColor = UIColor.White
            };
            lblHr = new UILabel()
            {
                Font            = UIFont.FromName(fontName, 12f),
                TextColor       = UIColor.Black,
                TextAlignment   = UITextAlignment.Right,
                BackgroundColor = UIColor.White
            };

            ContentView.AddSubviews(new UIView[] { lblPName, lblIp, lblR, lblH, lblEr, lblBb, lblSo, lblHr });
        }
Beispiel #39
0
 public void Include(UIImageView uiImageView)
 {
     uiImageView.Image = new UIImage(uiImageView.Image.CIImage);
 }
Beispiel #40
0
        public DetailsView(TweetEntry tweet)
        {
            _imageLoader = new ImageLoader();

            var bg = new UIImageView(UIImage.FromFile("Tweet/bg.png"));

            AddSubview(bg);

            var imageView = new UIImageView();

            imageView.Frame = new RectangleF(20, 30, 64, 64);

            _imageLoader.GetImage(tweet.User.ProfileImageUrl, (url, image) => InvokeOnMainThread(() =>
            {
                if (tweet.User.ProfileImageUrl == url)
                {
                    imageView.Image = image;
                }
            }));

            AddSubview(imageView);

            var author = new UILabel(new RectangleF(100, 50, 280, 300));

            author.TextColor       = UIColor.FromRGB(0x44, 0x64, 0x8f);
            author.Font            = UIFont.BoldSystemFontOfSize(16);
            author.BackgroundColor = UIColor.Clear;
            author.Text            = tweet.User.Name;
            author.SizeToFit();
            AddSubview(author);

            var via = new UILabel(new RectangleF(100, 80, 280, 300));

            via.TextColor       = UIColor.FromRGB(0x41, 0x41, 0x41);
            via.Font            = UIFont.BoldSystemFontOfSize(12);
            via.BackgroundColor = UIColor.Clear;
            via.Text            = "via Web";
            via.SizeToFit();
            AddSubview(via);

            var text = new UILabel(new RectangleF(20, 110, 280, 300));

            text.TextColor       = UIColor.FromRGB(0x41, 0x41, 0x41);
            text.Font            = UIFont.SystemFontOfSize(12);
            text.Lines           = 0;
            text.BackgroundColor = UIColor.Clear;
            text.Text            = HttpUtility.HtmlDecode(tweet.Text);
            text.SizeToFit();
            AddSubview(text);

            var line = new UIImageView(UIImage.FromFile("Tweet/line.png"));

            line.Frame = new RectangleF(20, text.Frame.Bottom + 10, 154, 1);
            AddSubview(line);

            var date = new UILabel(new RectangleF(20, line.Frame.Bottom + 5, 280, 300));

            date.TextColor       = UIColor.FromRGB(0x77, 0x77, 0x77);
            date.Font            = UIFont.BoldSystemFontOfSize(10);
            date.BackgroundColor = UIColor.Clear;
            date.Text            = tweet.CreatedAt.ToString("d", CultureInfo.CreateSpecificCulture("de-DE"));
            date.SizeToFit();
            AddSubview(date);

            var link = new UILabel(new RectangleF(date.Frame.Right + 25, date.Frame.Top, 280, 300));

            link.TextColor       = UIColor.FromRGB(0x77, 0x77, 0x77);
            link.Font            = UIFont.BoldSystemFontOfSize(10);
            link.BackgroundColor = UIColor.Clear;
            link.Text            = GetLinkFromTag(HttpUtility.HtmlDecode(tweet.Source));
            link.SizeToFit();
            AddSubview(link);
        }
        public nfloat UpdateCell(Post post, CellSizeHelper variables)
        {
            _currentPost = post;
            likesMargin  = leftMargin;

            _avatarImage?.RemoveFromSuperview();
            _avatarImage = new UIImageView(new CGRect(leftMargin, 20, 30, 30));
            _avatarImage.Layer.CornerRadius = _avatarImage.Frame.Size.Width / 2;
            _avatarImage.ClipsToBounds      = true;
            _avatarImage.ContentMode        = UIViewContentMode.ScaleAspectFill;
            _contentView.AddSubview(_avatarImage);
            _scheduledWorkAvatar?.Cancel();
            if (!string.IsNullOrEmpty(_currentPost.Avatar))
            {
                _scheduledWorkAvatar = ImageService.Instance.LoadUrl(_currentPost.Avatar, TimeSpan.FromDays(30))
                                       .WithCache(FFImageLoading.Cache.CacheType.All)
                                       .FadeAnimation(false)
                                       .DownSample(200)
                                       .LoadingPlaceholder("ic_noavatar.png")
                                       .ErrorPlaceholder("ic_noavatar.png")
                                       .WithPriority(LoadingPriority.Normal)
                                       .Into(_avatarImage);
            }
            else
            {
                _avatarImage.Image = UIImage.FromBundle("ic_noavatar");
            }

            _author.Text    = _currentPost.Author;
            _timestamp.Text = _currentPost.Created.ToPostTime();

            _photoScroll.Frame       = new CGRect(0, _avatarImage.Frame.Bottom + 20, UIScreen.MainScreen.Bounds.Width, variables.PhotoHeight);
            _photoScroll.ContentSize = new CGSize(UIScreen.MainScreen.Bounds.Width * _currentPost.Media.Length, variables.PhotoHeight);

            foreach (var subview in _photoScroll.Subviews)
            {
                subview.RemoveFromSuperview();
            }

            for (int i = 0; i < _scheduledWorkBody.Length; i++)
            {
                _scheduledWorkBody[i]?.Cancel();
            }
            _scheduledWorkBody = new IScheduledWork[_currentPost.Media.Length];

            _bodyImage = new UIImageView[_currentPost.Media.Length];
            for (int i = 0; i < _currentPost.Media.Length; i++)
            {
                _bodyImage[i] = new UIImageView();
                _bodyImage[i].ClipsToBounds          = true;
                _bodyImage[i].UserInteractionEnabled = true;
                _bodyImage[i].ContentMode            = UIViewContentMode.ScaleAspectFill;
                _bodyImage[i].Frame = new CGRect(UIScreen.MainScreen.Bounds.Width * i, 0, UIScreen.MainScreen.Bounds.Width, variables.PhotoHeight);
                _photoScroll.AddSubview(_bodyImage[i]);

                _scheduledWorkBody[i] = ImageService.Instance.LoadUrl(_currentPost.Media[i].Url)
                                        .Retry(2)
                                        .FadeAnimation(false)
                                        .WithCache(FFImageLoading.Cache.CacheType.All)
                                        .WithPriority(LoadingPriority.Highest)

                                        /* .DownloadProgress((f)=>
                                         * {
                                         * })*/
                                        .Into(_bodyImage[i]);
            }

            if (_currentPost.TopLikersAvatars.Any() && !string.IsNullOrEmpty(_currentPost.TopLikersAvatars[0]))
            {
                _firstLikerImage?.RemoveFromSuperview();
                _firstLikerImage = new UIImageView();
                _contentView.AddSubview(_firstLikerImage);
                _firstLikerImage.Layer.CornerRadius = likersCornerRadius;
                _firstLikerImage.ClipsToBounds      = true;
                _firstLikerImage.ContentMode        = UIViewContentMode.ScaleAspectFill;
                _firstLikerImage.Frame = new CGRect(leftMargin, _photoScroll.Frame.Bottom + likersY, likersImageSide, likersImageSide);
                _scheduledWorkfirst?.Cancel();

                _scheduledWorkfirst = ImageService.Instance.LoadUrl(_currentPost.TopLikersAvatars[0], TimeSpan.FromDays(30))
                                      .WithCache(FFImageLoading.Cache.CacheType.All)
                                      .LoadingPlaceholder("ic_noavatar.png")
                                      .ErrorPlaceholder("ic_noavatar.png")
                                      .DownSample(width: 100)
                                      .FadeAnimation(false)
                                      .WithPriority(LoadingPriority.Lowest)
                                      .Into(_firstLikerImage);
                likesMargin = _firstLikerImage.Frame.Right + likesMarginConst;
            }
            else if (_firstLikerImage != null)
            {
                _firstLikerImage.Hidden = true;
            }

            if (_currentPost.TopLikersAvatars.Count() >= 2 && !string.IsNullOrEmpty(_currentPost.TopLikersAvatars[1]))
            {
                _secondLikerImage?.RemoveFromSuperview();
                _secondLikerImage = new UIImageView();
                _contentView.AddSubview(_secondLikerImage);
                _secondLikerImage.Layer.CornerRadius = likersCornerRadius;
                _secondLikerImage.ClipsToBounds      = true;
                _secondLikerImage.ContentMode        = UIViewContentMode.ScaleAspectFill;
                _secondLikerImage.Frame = new CGRect(_firstLikerImage.Frame.Right - likersMargin, _photoScroll.Frame.Bottom + likersY, likersImageSide, likersImageSide);
                _scheduledWorksecond?.Cancel();

                _scheduledWorksecond = ImageService.Instance.LoadUrl(_currentPost.TopLikersAvatars[1], TimeSpan.FromDays(30))
                                       .WithCache(FFImageLoading.Cache.CacheType.All)
                                       .LoadingPlaceholder("ic_noavatar.png")
                                       .ErrorPlaceholder("ic_noavatar.png")
                                       .WithPriority(LoadingPriority.Lowest)
                                       .DownSample(width: 100)
                                       .FadeAnimation(false)
                                       .Into(_secondLikerImage);
                likesMargin = _secondLikerImage.Frame.Right + likesMarginConst;
            }
            else if (_secondLikerImage != null)
            {
                _secondLikerImage.Hidden = true;
            }

            if (_currentPost.TopLikersAvatars.Count() >= 3 && !string.IsNullOrEmpty(_currentPost.TopLikersAvatars[2]))
            {
                _thirdLikerImage?.RemoveFromSuperview();
                _thirdLikerImage = new UIImageView();
                _contentView.AddSubview(_thirdLikerImage);
                _thirdLikerImage.Layer.CornerRadius = likersCornerRadius;
                _thirdLikerImage.ClipsToBounds      = true;
                _thirdLikerImage.ContentMode        = UIViewContentMode.ScaleAspectFill;
                _thirdLikerImage.Frame = new CGRect(_secondLikerImage.Frame.Right - likersMargin, _photoScroll.Frame.Bottom + likersY, likersImageSide, likersImageSide);
                _scheduledWorkthird?.Cancel();

                _scheduledWorkthird = ImageService.Instance.LoadUrl(_currentPost.TopLikersAvatars[2], TimeSpan.FromDays(30))
                                      .WithCache(FFImageLoading.Cache.CacheType.All)
                                      .LoadingPlaceholder("ic_noavatar.png")
                                      .ErrorPlaceholder("ic_noavatar.png")
                                      .WithPriority(LoadingPriority.Lowest)
                                      .DownSample(width: 100)
                                      .FadeAnimation(false)
                                      .Into(_thirdLikerImage);
                likesMargin = _thirdLikerImage.Frame.Right + likesMarginConst;
            }
            else if (_thirdLikerImage != null)
            {
                _thirdLikerImage.Hidden = true;
            }

            nfloat flagMargin = 0;

            if (_currentPost.NetLikes != 0)
            {
                _likes.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Likes, _currentPost.NetLikes);
                var likesWidth = _likes.SizeThatFits(new CGSize(0, underPhotoPanelHeight));
                _likes.Frame = new CGRect(likesMargin, _photoScroll.Frame.Bottom, likesWidth.Width, underPhotoPanelHeight);
                flagMargin   = flagsMarginConst;
            }
            else
            {
                _likes.Frame = new CGRect(likesMargin, _photoScroll.Frame.Bottom, 0, 0);
            }

            _likersTapView.Frame = new CGRect(leftMargin, _photoScroll.Frame.Bottom, _likes.Frame.Right - leftMargin, _likes.Frame.Height);

            if (_currentPost.NetFlags != 0)
            {
                _flags.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Flags, _currentPost.NetFlags);
                var flagsWidth = _flags.SizeThatFits(new CGSize(0, underPhotoPanelHeight));
                _flags.Frame = new CGRect(likesMargin + _likes.Frame.Width + flagMargin, _photoScroll.Frame.Bottom, flagsWidth.Width, underPhotoPanelHeight);
            }
            else
            {
                _flags.Frame = new CGRect(likesMargin, _photoScroll.Frame.Bottom, 0, 0);
            }

            _like.Frame = new CGRect(_contentView.Frame.Width - likeButtonWidthConst, _photoScroll.Frame.Bottom, likeButtonWidthConst, underPhotoPanelHeight);

            _like.Transform = CGAffineTransform.MakeScale(1f, 1f);
            if (_currentPost.VoteChanging)
            {
                Animate();
            }
            else
            {
                _like.Layer.RemoveAllAnimations();
                _like.LayoutIfNeeded();
                _like.Image = _currentPost.Vote ? UIImage.FromBundle("ic_like_active") : UIImage.FromBundle("ic_like");
                _like.UserInteractionEnabled = true;
            }

            _verticalSeparator.Frame = new CGRect(_contentView.Frame.Width - likeButtonWidthConst - 1, _photoScroll.Frame.Bottom + underPhotoPanelHeight / 2 - verticalSeparatorHeight / 2, 1, verticalSeparatorHeight);

            /*
             * _rewards.Text = BaseViewController.ToFormatedCurrencyString(_currentPost.TotalPayoutReward);
             * var rewardWidth = _rewards.SizeThatFits(new CGSize(0, underPhotoPanelHeight));
             * _rewards.Frame = new CGRect(_verticalSeparator.Frame.Left - rewardWidth.Width, _photoScroll.Frame.Bottom, rewardWidth.Width, underPhotoPanelHeight);
             */

            _topSeparator.Frame = new CGRect(0, _photoScroll.Frame.Bottom + underPhotoPanelHeight, UIScreen.MainScreen.Bounds.Width, 1);

            _attributedLabel.SetText(variables.Text);
            _attributedLabel.Frame = new CGRect(new CGPoint(leftMargin, _topSeparator.Frame.Bottom + 15),
                                                new CGSize(UIScreen.MainScreen.Bounds.Width - leftMargin * 2, variables.TextHeight));

            _comments.Text = _currentPost.Children == 0
                ? AppSettings.LocalizationManager.GetText(LocalizationKeys.PostFirstComment)
                : AppSettings.LocalizationManager.GetText(LocalizationKeys.ViewComments, _currentPost.Children);

            _comments.Frame = new CGRect(leftMargin - 5, _attributedLabel.Frame.Bottom + 5, _comments.SizeThatFits(new CGSize(10, 20)).Width + 10, 20 + 10);

            _bottomSeparator.Frame = new CGRect(0, _comments.Frame.Bottom + 10, UIScreen.MainScreen.Bounds.Width, 1);

            return(_bottomSeparator.Frame.Bottom);
            //for constant size checking
            //var constantsSize = _bottomSeparator.Frame.Bottom - _attributedLabel.Frame.Height - _bodyImage.Frame.Height;
        }
        private void Initialize(bool baseProperties = true)
        {
            // add the background view
            {
                BackgroundImageView = new UIImageView();
                AddSubview(BackgroundImageView);
            }

            // add the main signature view
            {
                SignaturePadCanvas = new SignaturePadCanvasView();
                SignaturePadCanvas.StrokeCompleted += delegate
                {
                    OnSignatureStrokeCompleted();
                };
                SignaturePadCanvas.Cleared += delegate
                {
                    OnSignatureCleared();
                };
                AddSubview(SignaturePadCanvas);
            }

            // add the caption
            {
                Caption = new UILabel()
                {
                    BackgroundColor = UIColor.Clear,
                    TextAlignment   = UITextAlignment.Center,
                    Font            = UIFont.SystemFontOfSize(DefaultFontSize),
                    Text            = DefaultCaptionText,
                    TextColor       = SignaturePadDarkColor,
                };
                AddSubview(Caption);
            }

            // add the signature line
            {
                SignatureLine = new UIView()
                {
                    BackgroundColor = SignaturePadDarkColor,
                };
                SignatureLineWidth   = DefaultLineThickness;
                SignatureLineSpacing = DefaultNarrowSpacing;
                AddSubview(SignatureLine);
            }

            // add the prompt
            {
                SignaturePrompt = new UILabel()
                {
                    BackgroundColor = UIColor.Clear,
                    Font            = UIFont.BoldSystemFontOfSize(DefaultFontSize),
                    Text            = DefaultPromptText,
                    TextColor       = SignaturePadDarkColor,
                };
                AddSubview(SignaturePrompt);
            }

            // add the clear label
            {
                ClearLabel = UIButton.FromType(UIButtonType.Custom);
                ClearLabel.BackgroundColor = UIColor.Clear;
                ClearLabel.Font            = UIFont.BoldSystemFontOfSize(DefaultFontSize);
                ClearLabel.SetTitle(DefaultClearLabelText, UIControlState.Normal);
                ClearLabel.SetTitleColor(SignaturePadDarkColor, UIControlState.Normal);
                AddSubview(ClearLabel);

                // attach the "clear" command
                ClearLabel.TouchUpInside += delegate
                {
                    OnClearTapped();
                };
            }

            Padding = new UIEdgeInsets(DefaultWideSpacing, DefaultWideSpacing, DefaultNarrowSpacing, DefaultWideSpacing);

            // clear / initialize the view
            UpdateUi();
        }
Beispiel #43
0
        public void mainPageDesign()
        {
            customView = new UIView();
            customView.BackgroundColor = UIColor.FromRGB(165, 165, 165);

            //Image
            image1       = new UIImageView();
            image1.Image = UIImage.FromBundle("Images/walk.png");

            //PrecisionLabell
            precisionLabel               = new UILabel();
            precisionLabel.Text          = "Precision";
            precisionLabel.Font          = UIFont.FromName("Helvetica", 14f);
            precisionLabel.TextColor     = UIColor.Black;
            precisionLabel.TextAlignment = UITextAlignment.Left;

            //ToolTipLabell
            toolTipLabel               = new UILabel();
            toolTipLabel.Text          = "ToolTip Placement";
            toolTipLabel.Font          = UIFont.FromName("Helvetica", 14f);
            toolTipLabel.TextColor     = UIColor.Black;
            toolTipLabel.TextAlignment = UITextAlignment.Left;

            //ItemCountLabell
            itemCountLabel               = new UILabel();
            itemCountLabel.Text          = "Item Count";
            itemCountLabel.Font          = UIFont.FromName("Helvetica", 14f);
            itemCountLabel.TextColor     = UIColor.Black;
            itemCountLabel.TextAlignment = UITextAlignment.Left;

            //MovieRateLabell
            movieRateLabel               = new UILabel();
            movieRateLabel.Text          = "Movie Rating";
            movieRateLabel.TextColor     = UIColor.Black;
            movieRateLabel.TextAlignment = UITextAlignment.Left;
            movieRateLabel.Font          = UIFont.FromName("Helvetica", 22f);

            //WalkLabell
            walkLabel               = new UILabel();
            walkLabel.Text          = "The Walk (2015)";
            walkLabel.TextColor     = UIColor.Black;
            walkLabel.TextAlignment = UITextAlignment.Left;
            walkLabel.Font          = UIFont.FromName("Helvetica", 18f);

            //TimeLabell
            timeLabel               = new UILabel();
            timeLabel.Text          = "PG | 2 h 20 min";
            timeLabel.TextColor     = UIColor.Black;
            timeLabel.TextAlignment = UITextAlignment.Left;
            timeLabel.Font          = UIFont.FromName("Helvetica", 12f);

            //DescriptionLabell
            descriptionLabel               = new UILabel();
            descriptionLabel.Text          = "In 1974, high-wire artist Philippe Petit recruits a team of people to help him realize his dream: to walk the immense void between the world Trade Centre towers.";
            descriptionLabel.TextColor     = UIColor.Black;
            descriptionLabel.TextAlignment = UITextAlignment.Left;
            descriptionLabel.Font          = UIFont.FromName("Helvetica", 14f);
            descriptionLabel.LineBreakMode = UILineBreakMode.WordWrap;
            descriptionLabel.Lines         = 0;

            //RateLabell
            rateLabel               = new UILabel();
            rateLabel.Text          = "Rate";
            rateLabel.TextColor     = UIColor.Black;
            rateLabel.TextAlignment = UITextAlignment.Left;
            rateLabel.Font          = UIFont.FromName("Helvetica", 18f);

            //ValueLabell
            valueLabel               = new UILabel();
            valueLabel.TextColor     = UIColor.Black;
            valueLabel.TextAlignment = UITextAlignment.Left;
            valueLabel.Font          = UIFont.FromName("Helvetica", 14f);
            UpdateText();
        }
Beispiel #44
0
        public void SetupTrapShotExpandedViewCell(List <string> names, List <List <bool?> > roundScores)
        {
            double padding       = (this.Frame.Width / 2) - (SizeConstants.TrapGridCell * 2.5);
            var    paddingDropup = (this.Frame.Width / 2) - 5;

            if (ButtonClays == null)
            {
                ButtonClays = new UIButton[5, 5];
            }

            if (LabelNames == null)
            {
                LabelNames = new UILabel[5];
            }

            double y = 0;
            double x;

            for (int row = 0; row < names.Count; row++)
            {
                x = padding;

                if (LabelNames[row] == null)
                {
                    LabelNames[row] = new UILabel(new CGRect(0f, y, padding, SizeConstants.TrapGridCell));
                }

                LabelNames[row].TextColor                 = ColorConstants.TextColor;
                LabelNames[row].TextAlignment             = UITextAlignment.Left;
                LabelNames[row].Text                      = names[row];
                LabelNames[row].Lines                     = 1;
                LabelNames[row].AdjustsFontSizeToFitWidth = true;
                LabelNames[row].LineBreakMode             = UILineBreakMode.Clip;
                this.ContentView.AddSubview(LabelNames[row]);

                for (int i = 0; i < 5; i++)
                {
                    if (ButtonClays[row, i] == null)
                    {
                        ButtonClays[row, i] = new UIButton(new CGRect(x, y, SizeConstants.TrapGridCell, SizeConstants.TrapGridCell));
                    }

                    ButtonClays[row, i].BackgroundColor   = ColorConstants.BackgroundColor;
                    ButtonClays[row, i].Layer.BorderColor = ColorConstants.PrimaryColor.CGColor;
                    ButtonClays[row, i].Layer.BorderWidth = 1;
                    ButtonClays[row, i].SetImage(roundScores[row][i] == null ? UIImage.FromBundle("NoClay") : roundScores[row][i].Value ? UIImage.FromBundle("HitClay") : UIImage.FromBundle("MissClay"), UIControlState.Disabled);
                    ButtonClays[row, i].Enabled     = false;
                    ButtonClays[row, i].ContentMode = UIViewContentMode.ScaleAspectFit;
                    this.ContentView.AddSubview(ButtonClays[row, i]);
                    x += SizeConstants.TrapGridCell;
                }
                y += SizeConstants.TrapGridCell;
            }

            if (ButtonDropup == null)
            {
                ButtonDropup = new UIImageView(new CGRect(paddingDropup, this.Frame.Height - 10f, 10, 10));
            }

            ButtonDropup.Image = (UIImage.FromBundle("dropup"));

            this.ContentView.AddSubview(ButtonDropup);
        }
        private void BackgroundViewPressed(UITapGestureRecognizer tapGesture)
        {
            clickCount++;
            sfPopUp.IsOpen = false;
            if (imageView == null)
            {
                imageView = new UIImageView();
            }
            if (clickCount == 1)
            {
                imageView = null;
                imageView = new UIImageView();

                UIView hostingView = new UIView();
                imageView.Image         = UIImage.FromFile("Images/Popup_ResizingIllustration.png");
                sfPopUp.PopupView.Frame = new CGRect(1, this.Frame.Y, this.Frame.Width, 130);
                hostingView.Frame       = new CGRect(0, 0, 160, 130);
                imageView.Frame         = new CGRect(this.SfGrid.RowColumnIndexToPoint(new Syncfusion.GridCommon.ScrollAxis.RowColumnIndex(0, 2)).X, 0, 130, 130);
                imageView.Center        = new CGPoint(this.SfGrid.RowColumnIndexToPoint(new Syncfusion.GridCommon.ScrollAxis.RowColumnIndex(0, 2)).X, this.Frame.Y);
                hostingView.AddSubview(imageView);
                sfPopUp.PopupView.ContentView = hostingView;
                sfPopUp.IsOpen = true;
            }
            else if (clickCount == 2)
            {
                imageView       = null;
                imageView       = new UIImageView();
                imageView.Image = UIImage.FromFile("Images/Popup_EditIllustration.png");
                sfPopUp.PopupView.ContentView = imageView;
                var point = this.SfGrid.RowColumnIndexToPoint(new Syncfusion.GridCommon.ScrollAxis.RowColumnIndex(4, 2));
                sfPopUp.PopupView.Frame = new CGRect(point.X, point.Y, 150, 150);
                sfPopUp.IsOpen          = true;
            }
            else if (clickCount == 3)
            {
                imageView = null;
                UIView hostingView = new UIView();
                imageView = new UIImageView();
                imageView.StopAnimating();
                imageView.Image = UIImage.FromFile("Images/Popup_SwipeIllustration.png");
                var point = this.SfGrid.RowColumnIndexToPoint(new Syncfusion.GridCommon.ScrollAxis.RowColumnIndex(4, 0));
                sfPopUp.PopupView.Frame = new CGRect(point.X, point.Y - 10, 300, 150);
                hostingView.Frame       = new CGRect(0, sfPopUp.PopupView.Frame.Top, 300, 150);
                imageView.Frame         = new CGRect(point.X, 0, 200, 150);
                hostingView.AddSubview(imageView);
                sfPopUp.PopupView.ContentView = hostingView;
                sfPopUp.IsOpen = true;
            }
            else if (clickCount == 4)
            {
                UIView view = new UIView();
                imageView       = null;
                imageView       = new UIImageView();
                imageView.Image = UIImage.FromFile("Images/Popup_DragAndDropIllustration.png");
                imageView.Frame = new CGRect(0, 0, 200, 100);
                var point = this.SfGrid.RowColumnIndexToPoint(new Syncfusion.GridCommon.ScrollAxis.RowColumnIndex(4, 0));
                view.AddSubview(imageView);
                img       = new UIImageView();
                img.Image = UIImage.FromFile("Images/Popup_HandSymbol.png");
                img.Frame = new CGRect(10, 0, 20, 20);
                view.AddSubview(img);
                sfPopUp.PopupView.ContentView = view;
                sfPopUp.PopupView.Frame       = new CGRect(point.X + 10, point.Y + 5, 200, 100);
                nextButton.SetTitle("Ok,Got It", UIControlState.Normal);
                sfPopUp.IsOpen = true;
            }
            else if (clickCount > 4)
            {
                backgroundView.RemoveFromSuperview();
                nextButton.RemoveFromSuperview();
            }
        }
Beispiel #46
0
        public Connectors()
        {
            HeaderBar.BackgroundColor = UIColor.FromRGB(245, 245, 245);
            var label = new UILabel();

            label.Text            = "Connector Types: ";
            label.TextColor       = UIColor.Black;
            label.BackgroundColor = UIColor.Clear;
            label.TextAlignment   = UITextAlignment.Center;
            string deviceType = UIDevice.CurrentDevice.Model;
            int    offsetX;
            int    space;

            if (deviceType == "iPhone" || deviceType == "iPod touch")
            {
                offsetX = 150;
                space   = 10;
            }
            else
            {
                offsetX = 180;
                space   = 40;
            }

            label.Frame = new CGRect(0, 0, offsetX, 60);

            HeaderBar.AddSubview(label);
            offsetX += space;
            straight = AddButton(offsetX, "Images/Diagram/CSStraight.png");
            straight.TouchUpInside += Straight_TouchUpInside;
            HeaderBar.AddSubview(straight);

            offsetX             += space + 40;
            curve                = AddButton(offsetX, "Images/Diagram/CSCurve.png");
            curve.TouchUpInside += Curve_TouchUpInside;;
            HeaderBar.AddSubview(curve);

            offsetX              += space + 40;
            ortho                 = AddButton(offsetX, "Images/Diagram/CSOrtho.png");
            ortho.TouchUpInside  += Ortho_TouchUpInside;
            ortho.BackgroundColor = UIColor.FromRGB(30, 144, 255);
            HeaderBar.AddSubview(ortho);

            selectionPicker1 = new UIPickerView();
            this.OptionView  = new UIView();

            PickerModel model = new PickerModel(verticalOrientationlist);

            selectionPicker1.Model = model;

            connectorStyle               = new UILabel();
            connectorStyle.Text          = "Connector Style";
            connectorStyle.TextColor     = UIColor.Black;
            connectorStyle.TextAlignment = UITextAlignment.Left;

            connectorSize               = new UILabel();
            connectorSize.Text          = "Connector Size";
            connectorSize.TextColor     = UIColor.Black;
            connectorSize.TextAlignment = UITextAlignment.Left;

            //Represent the vertical button
            connectorStyleButton = new UIButton();
            connectorStyleButton.SetTitle("Default", UIControlState.Normal);
            connectorStyleButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            connectorStyleButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            connectorStyleButton.Layer.CornerRadius  = 8;
            connectorStyleButton.Layer.BorderWidth   = 2;
            connectorStyleButton.TouchUpInside      += ShowPicker1;
            connectorStyleButton.BackgroundColor     = UIColor.LightGray;
            connectorStyleButton.Layer.BorderColor   = UIColor.FromRGB(246, 246, 246).CGColor;

            plus = new UIButton();
            plus.BackgroundColor    = UIColor.White;
            plus.Layer.CornerRadius = 8;
            plus.Layer.BorderWidth  = 0.5f;
            plus.TouchUpInside     += Plus_TouchUpInside;
            plusimg       = new UIImageView();
            plusimg.Image = UIImage.FromBundle("Images/Diagram/CSplus.png");
            plus.AddSubview(plusimg);

            minus = new UIButton();
            minus.BackgroundColor    = UIColor.White;
            minus.Layer.CornerRadius = 8;
            minus.Layer.BorderWidth  = 0.5f;
            minus.TouchUpInside     += Minus_TouchUpInside;
            minusimg       = new UIImageView();
            minusimg.Image = UIImage.FromBundle("Images/Diagram/CSsub.png");
            minus.AddSubview(minusimg);

            sizeindicator                 = new UILabel();
            sizeindicator.Text            = width.ToString();
            sizeindicator.BackgroundColor = UIColor.Clear;
            sizeindicator.TextColor       = UIColor.Black;
            sizeindicator.TextAlignment   = UITextAlignment.Center;

            //Represent the button
            doneButton.SetTitle("Done\t", UIControlState.Normal);
            doneButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            doneButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
            doneButton.TouchUpInside      += HidePicker;
            doneButton.Hidden          = true;
            doneButton.BackgroundColor = UIColor.FromRGB(246, 246, 246);
            selectionPicker1.ShowSelectionIndicator = true;
            selectionPicker1.Hidden = true;

            ObservableCollection <EmployeeDetail> employees = new ObservableCollection <EmployeeDetail>();

            employees.Add(new EmployeeDetail()
            {
                Name = "Elizabeth", EmpId = "1", ParentId = "", Designation = "CEO"
            });
            employees.Add(new EmployeeDetail()
            {
                Name = "Christina", EmpId = "2", ParentId = "1", Designation = "Manager"
            });
            employees.Add(new EmployeeDetail()
            {
                Name = "Yang", EmpId = "3", ParentId = "1", Designation = "Manager"
            });
            employees.Add(new EmployeeDetail()
            {
                Name = "Yoshi", EmpId = "4", ParentId = "2", Designation = "Team Lead"
            });
            employees.Add(new EmployeeDetail()
            {
                Name = "Yoshi", EmpId = "5", ParentId = "2", Designation = "Co-ordinator"
            });
            employees.Add(new EmployeeDetail()
            {
                Name = "Philip", EmpId = "6", ParentId = "4", Designation = "Developer"
            });
            employees.Add(new EmployeeDetail()
            {
                Name = "Philip", EmpId = "7", ParentId = "4", Designation = "Testing Engineer"
            });
            employees.Add(new EmployeeDetail()
            {
                Name = "Roland", EmpId = "8", ParentId = "3", Designation = "Team Lead"
            });
            employees.Add(new EmployeeDetail()
            {
                Name = "Yoshi", EmpId = "9", ParentId = "3", Designation = "Co-ordinator"
            });
            employees.Add(new EmployeeDetail()
            {
                Name = "Yuonne", EmpId = "10", ParentId = "8", Designation = "Developer"
            });
            employees.Add(new EmployeeDetail()
            {
                Name = "Philip", EmpId = "10", ParentId = "8", Designation = "Testing Engineer"
            });
            //Initializes the DataSourceSettings
            diagram.DataSourceSettings = new DataSourceSettings()
            {
                DataSource = employees, Id = "EmpId", ParentId = "ParentId"
            };
            //Initializes the Layout
            DirectedTreeLayout treelayout = new DirectedTreeLayout()
            {
                HorizontalSpacing = 80, VerticalSpacing = 50, TreeOrientation = TreeOrientation.TopToBottom
            };

            diagram.LayoutManager = new LayoutManager()
            {
                Layout = treelayout
            };
            diagram.IsReadOnly          = true;
            diagram.BeginNodeRender    += Diagram_BeginNodeRender;
            diagram.Loaded             += Diagram_Loaded;
            diagramView.Frame           = new CGRect(0, 70, UIScreen.MainScreen.Bounds.Width + 40, UIScreen.MainScreen.Bounds.Height - MarginTop);
            diagramView.BackgroundColor = UIColor.Clear;
            diagram.Layer.BorderColor   = UIColor.Clear.CGColor;
            diagram.Layer.BorderWidth   = 0;
            diagramView.AddSubview(diagram);
            this.AddSubview(diagramView);
            HeaderBar.Frame = new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width, 60);
            this.AddSubview(HeaderBar);
            model.PickerChanged += SelectedIndexChanged;
            for (int i = 0; i < diagram.Connectors.Count; i++)
            {
                diagram.Connectors[i].TargetDecoratorType = DecoratorType.None;
            }
            foreach (var view in this.Subviews)
            {
                connectorStyle.Frame       = new CGRect(this.Frame.X + 10, 0, PopoverSize.Width - 20, 30);
                connectorStyleButton.Frame = new CGRect(this.Frame.X + 10, 40, PopoverSize.Width - 20, 30);
                connectorSize.Frame        = new CGRect(this.Frame.X + 10, 80, PopoverSize.Width - 20, 30);
                plus.Frame             = new CGRect(this.Frame.X + 60, 120, 30, 30);
                plusimg.Frame          = new CGRect(0, 0, 30, 30);
                minus.Frame            = new CGRect(this.Frame.X + 160, 120, 30, 30);
                minusimg.Frame         = new CGRect(0, 0, 30, 30);
                sizeindicator.Frame    = new CGRect(this.Frame.X + 110, 120, 30, 30);
                selectionPicker1.Frame = new CGRect(0, PopoverSize.Height / 2, PopoverSize.Width, PopoverSize.Height / 3);
                doneButton.Frame       = new CGRect(0, PopoverSize.Height / 2.5, PopoverSize.Width, 40);
            }
            optionView();
        }
Beispiel #47
0
        public FancyiOSCell(NSString cellId) : base(UITableViewCellStyle.Default, cellId)
        {
            SelectionStyle = UITableViewCellSelectionStyle.Gray;

            imageView = new UIImageView()
            {
                Bounds = ContentView.Bounds
            };
            thumbnailImageView = new UIImageView();
            thumbnailImageView.Layer.MasksToBounds = true;
            thumbnailImageView.Layer.CornerRadius  = 50;

            var blurEffect     = UIBlurEffect.FromStyle(UIBlurEffectStyle.ExtraLight);
            var vibrancyEffect = UIVibrancyEffect.FromBlurEffect(blurEffect);
            var blurView       = new UIVisualEffectView(blurEffect);
            var vibrancyView   = new UIVisualEffectView(vibrancyEffect);

            headingLabel = new UILabel()
            {
                Font            = UIFont.PreferredTitle1,
                TextAlignment   = UITextAlignment.Center,
                BackgroundColor = UIColor.Clear
            };

            subheadingLabel = new UILabel()
            {
                Font            = UIFont.PreferredSubheadline,
                TextAlignment   = UITextAlignment.Center,
                BackgroundColor = UIColor.Clear
            };

            // creat blur view
            vibrancyView.ContentView.Add(headingLabel);
            vibrancyView.ContentView.Add(subheadingLabel);
            vibrancyView.ContentView.Add(thumbnailImageView);
            subheadingLabel.TranslatesAutoresizingMaskIntoConstraints    = false;
            headingLabel.TranslatesAutoresizingMaskIntoConstraints       = false;
            thumbnailImageView.TranslatesAutoresizingMaskIntoConstraints = false;

            var labelViews = NSDictionary.FromObjectsAndKeys(new NSObject[] { subheadingLabel, headingLabel, vibrancyView, thumbnailImageView }, new NSObject[] { new NSString("subtitle"), new NSString("title"), new NSString("vibrancy"), new NSString("thumbnail") });

            vibrancyView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-[title]-2-[subtitle]-|", 0, new NSDictionary(), labelViews));
            vibrancyView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-[thumbnail]-|", 0, new NSDictionary(), labelViews));
            vibrancyView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-[thumbnail(100)]-|", 0, new NSDictionary(), labelViews));
            vibrancyView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-[title(>=50)]-[thumbnail(100)]-|", 0, new NSDictionary(), labelViews));
            vibrancyView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-[subtitle(>=50)]-[thumbnail(100)]-|", 0, new NSDictionary(), labelViews));

            blurView.ContentView.Add(vibrancyView);
            vibrancyView.TranslatesAutoresizingMaskIntoConstraints = false;
            blurView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-0-[vibrancy]-0-|", 0, new NSDictionary(), labelViews));
            blurView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-0-[vibrancy]-0-|", 0, new NSDictionary(), labelViews));

            // create ContentView
            ContentView.Add(imageView);
            ContentView.Add(blurView);

            imageView.TranslatesAutoresizingMaskIntoConstraints = false;
            blurView.TranslatesAutoresizingMaskIntoConstraints  = false;

            var viewsDictionary = NSDictionary.FromObjectsAndKeys(new NSObject[] { imageView, blurView }, new NSObject[] { new NSString("image"), new NSString("blur") });

            ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-0-[image]-0-|", 0, new NSDictionary(), viewsDictionary));
            ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-0-[image]-0-|", 0, new NSDictionary(), viewsDictionary));
            ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-0-[blur]-0-|", 0, new NSDictionary(), viewsDictionary));
            ContentView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-0-[blur]-0-|", 0, new NSDictionary(), viewsDictionary));
        }
Beispiel #48
0
        private void GenerateThumbnail(String bookID, String pageID, String text, bool bookmark = false)
        {
            try
            {
                // activityIndicator
                UIActivityIndicatorView activityIndicator = new UIActivityIndicatorView();
                activityIndicator.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.White;
                activityIndicator.StartAnimating();
                activityIndicator.HidesWhenStopped = true;
                activityIndicator.Frame            = new RectangleF((this.Frame.Width / 2) - 10, (this.Frame.Height / 2) - 10, 20, 20);
                this.AddSubview(activityIndicator);

                // Generate pdf thumbnail
                Page             page       = null;
                Annotation       annotation = null;
                BackgroundWorker worker     = new BackgroundWorker();
                worker.DoWork += delegate
                {
                    page = BooksOnDeviceAccessor.GetPage(bookID, pageID);

                    if (String.IsNullOrEmpty(text))
                    {
                        annotation = BooksOnDeviceAccessor.GetAnnotation(bookID, pageID);
                    }
                };
                worker.RunWorkerCompleted += delegate
                {
                    this.InvokeOnMainThread(delegate
                    {
                        activityIndicator.StopAnimating();

                        if (page != null)
                        {
                            String localPath = DownloadedFilesCache.BuildCachedFilePath(page.URL);
                            if (!String.IsNullOrEmpty(localPath))
                            {
                                CGPDFDocument pdfDoc = CGPDFDocument.FromFile(localPath);
                                if (pdfDoc != null)
                                {
                                    CGPDFPage pdfPage = pdfDoc.GetPage(1);
                                    if (pdfPage != null)
                                    {
                                        UIImage pdfImg = PDFConverter.Transform2Image(pdfPage, this.Frame.Width);

                                        // pageView
                                        UIImageView pageView = new UIImageView();
                                        pageView.Frame       = new RectangleF(0, (this.Frame.Height / 2) - (pdfImg.Size.Height / 2), pdfImg.Size.Width, pdfImg.Size.Height);

                                        // If this is annotation thumbnail, draw annotation overlay on top of pdf
                                        if (annotation != null)
                                        {
                                            Dictionary <String, PSPDFInkAnnotation> dictionary = AnnotationsDataAccessor.GenerateAnnDictionary((UInt32)page.PageNumber - 1, annotation);
                                            if (dictionary != null)
                                            {
                                                foreach (KeyValuePair <String, PSPDFInkAnnotation> item in dictionary)
                                                {
                                                    // Create full size annotation
                                                    UIImage annImg = DrawAnnotation(item.Key, item.Value);

                                                    if (annImg != null)
                                                    {
                                                        // Scale down the annotation image
                                                        annImg = annImg.Scale(new SizeF(pdfImg.Size.Width, pdfImg.Size.Height));

                                                        // Overlap pdfImg and annImg
                                                        pdfImg = Overlap(pdfImg, annImg);
                                                    }
                                                }
                                            }
                                        }

                                        pageView.Image = pdfImg;
                                        this.AddSubview(pageView);

                                        // THIS IS REQUIRED TO SKIP iCLOUD BACKUP
                                        SkipBackup2iCloud.SetAttribute(localPath);

                                        // Add ribbon if this is bookmark thumbnail
                                        if (bookmark)
                                        {
                                            UIImageView ribbon = new UIImageView();
                                            ribbon.Image       = UIImage.FromBundle("Assets/Buttons/bookmark_solid.png");
                                            ribbon.Frame       = new RectangleF(pageView.Frame.Right - 35, pageView.Frame.Y, 25, 33.78f);
                                            this.AddSubview(ribbon);
                                        }

                                        // Do not add text if this is annotation thumbnail
                                        if (!String.IsNullOrEmpty(text))
                                        {
                                            // titleLabel
                                            UILabel titleLabel         = new UILabel();
                                            titleLabel.Frame           = new RectangleF(0, pageView.Frame.Bottom + 4, this.Frame.Width, 42);
                                            titleLabel.Font            = UIFont.SystemFontOfSize(16f);
                                            titleLabel.BackgroundColor = UIColor.Clear;
                                            titleLabel.TextColor       = eBriefingAppearance.DarkGrayColor;
                                            titleLabel.Lines           = 2;
                                            titleLabel.LineBreakMode   = UILineBreakMode.TailTruncation;
                                            titleLabel.TextAlignment   = UITextAlignment.Center;
                                            titleLabel.Text            = text;
                                            this.AddSubview(titleLabel);
                                        }
                                    }
                                }
                            }
                        }
                    });
                };
                worker.RunWorkerAsync();
            }
            catch (Exception ex)
            {
                Logger.WriteLineDebugging("ThumbnailView - GenerateThumbnail: {0}", ex.ToString());
            }
        }
Beispiel #49
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            Title = "Color Controls";
            View.BackgroundColor = UIColor.White;

            resetButton       = UIButton.FromType(UIButtonType.RoundedRect);
            resetButton.Frame = new CGRect(110, 60, 90, 40);
            resetButton.SetTitle("Reset", UIControlState.Normal);
            resetButton.TouchUpInside += (sender, e) => {
                sliderSaturation.Value = 1;
                sliderBrightness.Value = 0;
                sliderContrast.Value   = 1;
                HandleValueChanged(sender, e);
            };
            View.Add(resetButton);


            labelC = new UILabel(new CGRect(10, 110, 90, 20));
            labelS = new UILabel(new CGRect(10, 160, 90, 20));
            labelB = new UILabel(new CGRect(10, 210, 90, 20));

            labelC.Text = "Contrast";
            labelS.Text = "Saturation";
            labelB.Text = "Brightness";

            View.Add(labelC);
            View.Add(labelS);
            View.Add(labelB);

            sliderBrightness = new UISlider(new CGRect(100, 110, 210, 20));
            sliderSaturation = new UISlider(new CGRect(100, 160, 210, 20));
            sliderContrast   = new UISlider(new CGRect(100, 210, 210, 20));

            // http://developer.apple.com/library/mac/#documentation/graphicsimaging/reference/CoreImageFilterReference/Reference/reference.html#//apple_ref/doc/filter/ci/CIColorControls
            // set min/max values on slider to match CIColorControls filter
            sliderSaturation.MinValue = 0;
            sliderSaturation.MaxValue = 2;
            sliderBrightness.MinValue = -1;
            sliderBrightness.MaxValue = 1;
            sliderContrast.MinValue   = 0;
            sliderContrast.MaxValue   = 4;
            // set default values
            sliderSaturation.Value = 1;
            sliderBrightness.Value = 0;
            sliderContrast.Value   = 1;

            // update the image in 'real time' as the sliders are moved
            sliderContrast.ValueChanged   += HandleValueChanged;
            sliderSaturation.ValueChanged += HandleValueChanged;
            sliderBrightness.ValueChanged += HandleValueChanged;

            // using TouchUpInside ONLY applies the filter once the slider has stopped moving
//			sliderContrast.TouchUpInside += HandleValueChanged;
//			sliderSaturation.TouchUpInside += HandleValueChanged;
//			sliderBrightness.TouchUpInside += HandleValueChanged;

            View.Add(sliderContrast);
            View.Add(sliderSaturation);
            View.Add(sliderBrightness);

            imageView       = new UIImageView(new CGRect(10, 240, 300, 200));
            sourceImage     = UIImage.FromFile("clouds.jpg");
            imageView.Image = sourceImage;
            View.Add(imageView);
        }
Beispiel #50
0
        public void LlenarInfo()
        {
            nfloat WidthView = 0;

            nfloat XLabelNombre = 0;
            nfloat XViewQR      = 106;
            nfloat XImageQR     = 0;

            for (int indice = 0; indice < this.Invitados.Count; indice++)
            {
                WidthView = WidthView + this.vwQR.Frame.Width;
            }

            if (this.Invitados.Count == 1)
            {
                this.btnAtras.Hidden  = true;
                this.btnAtras.Enabled = false;

                this.btnAdelante.Hidden  = true;
                this.btnAdelante.Enabled = false;
            }

            CGRect newFrame = new CGRect(this.vwQR.Frame.X, this.vwQR.Frame.Y, WidthView, this.vwQR.Frame.Height);

            this.vwQR.Frame = newFrame;

            var PrimerInvitado = Invitados[0];

            this.lblFecha.Text          = this.FechaReservacion;
            this.lblDomicilio.Text      = SucursalModel.Sucursal_Descripcion + " " + SucursalModel.Sucursal_Domicilio;
            this.lblNombreInvitado.Text = PrimerInvitado.Usuario_Nombre + " " + PrimerInvitado.Usuario_Apellidos;
            string newAcceso = new UsuariosController().GetLlaveAcceso(KeyChainHelper.GetKey("Usuario_Id"), KeyChainHelper.GetKey("Usuario_Tipo"));

            imgQR.Image = ImageGallery.LoadImageUrl(newAcceso);
            Invitados.Remove(PrimerInvitado);
            foreach (UsuarioModel Invitado in Invitados)
            {
                XLabelNombre = XLabelNombre + this.lblNombreInvitado.Frame.Width;
                UILabel LabelNombre = new UILabel();
                LabelNombre.Frame         = new CGRect(XLabelNombre, this.lblNombreInvitado.Frame.Y, this.lblNombreInvitado.Frame.Width, this.lblNombreInvitado.Frame.Height);
                LabelNombre.Text          = Invitado.Usuario_Nombre + " " + Invitado.Usuario_Apellidos;
                LabelNombre.Font          = lblNombreInvitado.Font;
                LabelNombre.TextColor     = UIColor.White;
                LabelNombre.TextAlignment = UITextAlignment.Left;

                XViewQR = XViewQR + vwContentQR.Frame.Width;
                UIView VistaQR = new UIView();
                VistaQR.Frame = new CGRect(XViewQR, this.vwContentQR.Frame.Y, this.vwContentQR.Frame.Width, this.vwContentQR.Frame.Height);

                UIImageView ImagenQr = new UIImageView();
                ImagenQr.Frame = this.imgQR.Frame;
                newAcceso      = new UsuariosController().GetLlaveAcceso(KeyChainHelper.GetKey("Usuario_Id"), KeyChainHelper.GetKey("Usuario_Tipo"));
                ImagenQr.Image = ImageGallery.LoadImageUrl(newAcceso);

                VistaQR.Add(ImagenQr);
                VistaQR.BackgroundColor     = UIColor.White;
                VistaQR.Layer.MasksToBounds = true;
                VistaQR.Layer.CornerRadius  = 7f;

                this.vwQR.Add(LabelNombre);
                this.vwQR.Add(VistaQR);
            }

            this.scvQR.ContentSize = this.vwQR.Frame.Size;
        }
        private UIView CreateInfoPopupContent()
        {
            UIView mainview = new UIView();

            UILabel location = new UILabel();

            location.Lines         = 10;
            location.Font          = UIFont.PreferredCaption1;
            location.TextColor     = UIColor.FromRGB(0, 124, 238);
            location.LineBreakMode = UILineBreakMode.WordWrap;
            location.Text          = (rowData as TicketBookingInfo).TheaterLocation + "421 E DRACHMAN TUCSON AZ 85705 - 7598 USA";

            UILabel facilitiesLabel = new UILabel();

            facilitiesLabel.Text          = "Available Facilities";
            facilitiesLabel.TextAlignment = UITextAlignment.Center;

            UIImageView mtick = new UIImageView();

            mtick.Image = UIImage.FromFile("Images/Popup_MTicket.png");

            UIImageView park = new UIImageView();

            park.Image = UIImage.FromFile("Images/Popup_Parking.png");

            UIImageView food = new UIImageView();

            food.Image = UIImage.FromFile("Images/Popup_FoodCourt.png");

            UILabel ticketLabel = new UILabel();

            ticketLabel.Text      = "M-Ticket";
            ticketLabel.TextColor = UIColor.Black;
            ticketLabel.Font      = UIFont.PreferredCaption2;

            UILabel parkingLabel = new UILabel();

            parkingLabel.Text      = "Parking";
            parkingLabel.TextColor = UIColor.Black;
            parkingLabel.Font      = UIFont.PreferredCaption2;

            UILabel foodLabel = new UILabel();

            foodLabel.Text      = "Food Court";
            foodLabel.TextColor = UIColor.Black;
            foodLabel.Font      = UIFont.PreferredCaption2;

            mainview.AddSubview(location);
            mainview.AddSubview(facilitiesLabel);
            mainview.AddSubview(mtick);
            mainview.AddSubview(park);
            mainview.AddSubview(food);
            mainview.AddSubview(ticketLabel);
            mainview.AddSubview(parkingLabel);
            mainview.AddSubview(foodLabel);

            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone)
            {
                location.Frame        = new CGRect(Bounds.Left + 16, Bounds.Top + 20, 240, 40);
                facilitiesLabel.Frame = new CGRect(0, location.Frame.Bottom + 12, infopopup.PopupView.Frame.Width, 40);
                mtick.Frame           = new CGRect(Bounds.Left + 55, facilitiesLabel.Frame.Bottom + 10, 20, 20);
                park.Frame            = new CGRect(mtick.Frame.Right + 65, facilitiesLabel.Frame.Bottom + 10, 20, 20);
                food.Frame            = new CGRect(park.Frame.Right + 55, facilitiesLabel.Frame.Bottom + 10, 20, 20);
                ticketLabel.Frame     = new CGRect(Bounds.Left + 45, mtick.Frame.Bottom + 10, 50, 20);
                parkingLabel.Frame    = new CGRect(ticketLabel.Frame.Right + 35, mtick.Frame.Bottom + 10, 50, 20);
                foodLabel.Frame       = new CGRect(parkingLabel.Frame.Right + 15, mtick.Frame.Bottom + 10, 60, 20);
            }
            else
            {
                location.Frame        = new CGRect(Bounds.Left + 16, Bounds.Top + 20, infopopup.PopupView.Frame.Width, 60);
                facilitiesLabel.Frame = new CGRect(0, location.Frame.Bottom + 12, infopopup.PopupView.Frame.Width, 40);
                mtick.Frame           = new CGRect(Bounds.Width / 6, facilitiesLabel.Frame.Bottom + 10, 20, 20);
                park.Frame            = new CGRect(mtick.Frame.Right + 75, facilitiesLabel.Frame.Bottom + 10, 20, 20);
                food.Frame            = new CGRect(park.Frame.Right + 75, facilitiesLabel.Frame.Bottom + 10, 20, 20);
                ticketLabel.Frame     = new CGRect(Bounds.Width / 7, mtick.Frame.Bottom + 10, 50, 20);
                parkingLabel.Frame    = new CGRect(ticketLabel.Frame.Right + 55, mtick.Frame.Bottom + 10, 50, 20);
                foodLabel.Frame       = new CGRect(parkingLabel.Frame.Right + 40, mtick.Frame.Bottom + 10, 60, 20);
            }
            return(mainview);
        }
        public void mainPageDesign()
        {
            customView = new UIView();
            customView.BackgroundColor = UIColor.FromRGB(165, 165, 165);
            this.OptionView            = new UIView();
            image1          = new UIImageView();
            precisionPicker = new UIPickerView();
            toolTipPicker   = new UIPickerView();
            PickerModel model = new PickerModel(precisionList);

            precisionPicker.Model = model;
            PickerModel model1 = new PickerModel(toottipplace);

            toolTipPicker.Model = model1;
            precisionLabel      = new UILabel();
            toolTipLabel        = new UILabel();
            itemCountLabel      = new UILabel();
            movieRateLabel      = new UILabel();
            walkLabel           = new UILabel();
            timeLabel           = new UILabel();
            descriptionLabel    = new UILabel();
            rateLabel           = new UILabel();
            valueLabel          = new UILabel();
            precisionButton     = new UIButton();
            toolTipButton       = new UIButton();
            image1.Image        = UIImage.FromBundle("Images/walk.png");

            precisionLabel.Text          = "Precision";
            precisionLabel.TextColor     = UIColor.Black;
            precisionLabel.TextAlignment = UITextAlignment.Left;

            toolTipLabel.Text          = "ToolTip Placement";
            toolTipLabel.TextColor     = UIColor.Black;
            toolTipLabel.TextAlignment = UITextAlignment.Left;

            itemCountLabel.Text          = "Item Count";
            itemCountLabel.TextColor     = UIColor.Black;
            itemCountLabel.TextAlignment = UITextAlignment.Left;
            itemCountLabel.Font          = UIFont.FromName("Helvetica", 14f);

            movieRateLabel.Text          = "Movie Rating";
            movieRateLabel.TextColor     = UIColor.Black;
            movieRateLabel.TextAlignment = UITextAlignment.Left;
            movieRateLabel.Font          = UIFont.FromName("Helvetica", 22f);

            walkLabel.Text          = "The Walk (2015)";
            walkLabel.TextColor     = UIColor.Black;
            walkLabel.TextAlignment = UITextAlignment.Left;
            walkLabel.Font          = UIFont.FromName("Helvetica", 18f);

            timeLabel.Text          = "PG | 2 h 20 min";
            timeLabel.TextColor     = UIColor.Black;
            timeLabel.TextAlignment = UITextAlignment.Left;
            timeLabel.Font          = UIFont.FromName("Helvetica", 10f);

            descriptionLabel.Text          = "In 1974, high-wire artist Philippe Petit recruits a team of people to help him realize his dream: to walk the immense void between the world Trade Centre towers.";
            descriptionLabel.TextColor     = UIColor.Black;
            descriptionLabel.TextAlignment = UITextAlignment.Left;
            descriptionLabel.Font          = UIFont.FromName("Helvetica", 12f);
            descriptionLabel.LineBreakMode = UILineBreakMode.WordWrap;
            descriptionLabel.Lines         = 0;

            rateLabel.Text          = "Rate";
            rateLabel.TextColor     = UIColor.Black;
            rateLabel.TextAlignment = UITextAlignment.Left;
            rateLabel.Font          = UIFont.FromName("Helvetica", 18f);

            valueLabel.TextColor     = UIColor.Black;
            valueLabel.TextAlignment = UITextAlignment.Left;
            valueLabel.Font          = UIFont.FromName("Helvetica", 14f);
            UpdateText();

            precisionButton.SetTitle("Standard", UIControlState.Normal);
            precisionButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            precisionButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            precisionButton.Layer.CornerRadius  = 8;
            precisionButton.Layer.BorderWidth   = 2;
            precisionButton.TouchUpInside      += ShowPicker1;
            precisionButton.Layer.BorderColor   = UIColor.FromRGB(246, 246, 246).CGColor;

            toolTipButton.SetTitle("None", UIControlState.Normal);
            toolTipButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            toolTipButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            toolTipButton.Layer.CornerRadius  = 8;
            toolTipButton.Layer.BorderWidth   = 2;
            toolTipButton.TouchUpInside      += ShowPicker2;
            toolTipButton.Layer.BorderColor   = UIColor.FromRGB(246, 246, 246).CGColor;

            doneButton.SetTitle("Done\t", UIControlState.Normal);
            doneButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            doneButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
            doneButton.TouchUpInside      += HidePicker;
            doneButton.Hidden          = true;
            doneButton.BackgroundColor = UIColor.FromRGB(246, 246, 246);

            model.PickerChanged  += SelectedIndexChanged;
            model1.PickerChanged += SelectedIndexChanged1;
            precisionPicker.ShowSelectionIndicator = true;
            precisionPicker.Hidden = true;
            toolTipPicker.Hidden   = true;
            //precisionPicker.BackgroundColor = UIColor.Gray;
            //toolTipPicker.BackgroundColor = UIColor.Gray;
            toolTipPicker.ShowSelectionIndicator = true;

            itemCountTextfield = new UITextView();
            itemCountTextfield.TextAlignment     = UITextAlignment.Center;
            itemCountTextfield.Layer.BorderColor = UIColor.Black.CGColor;
            itemCountTextfield.BackgroundColor   = UIColor.FromRGB(246, 246, 246);
            itemCountTextfield.KeyboardType      = UIKeyboardType.NumberPad;
            itemCountTextfield.Text     = "5";
            itemCountTextfield.Changed += (object sender, EventArgs e) =>
            {
                if (itemCountTextfield.Text.Length > 0)
                {
                    rating1.ItemCount = int.Parse(itemCountTextfield.Text);
                }
                else
                {
                    rating1.ItemCount = 5;
                }
                UpdateText();
            };

            this.AddSubview(movieRateLabel);
            this.AddSubview(walkLabel);
            this.AddSubview(timeLabel);
            this.AddSubview(descriptionLabel);
            this.AddSubview(rateLabel);
            this.AddSubview(valueLabel);
            this.AddSubview(image1);
            this.AddSubview(itemCountTextfield);
        }
 public static void LoadSvg(this UIImageView imageView, string svg, double size,
                            UIImageRenderingMode renderingMode = UIImageRenderingMode.Automatic)
 {
     imageView.LoadSvg(svg, new Size(size, size), renderingMode);
 }
Beispiel #54
0
 public static void ArrowImageView(UIImageView v)
 {
     v.Image = Image.ArrowEmptyState;
 }
Beispiel #55
0
 public static void Background(UIImageView v)
 {
     v.Image       = Image.LoginBackground;
     v.ContentMode = UIViewContentMode.ScaleAspectFill;
 }
        public static void LoadSvg(this UIImageView imageView, string svg, UIImageRenderingMode renderingMode = UIImageRenderingMode.Automatic)
        {
            var s = imageView.Bounds.Size;

            LoadSvg(imageView, svg, new Size(s.Width, s.Height), renderingMode);
        }
Beispiel #57
0
        private void InitializeLayout()
        {
            var color = UIColor.FromRGB(64, 64, 64);

            View.BackgroundColor = color;
            FixView = new UIView(new CGRect(0, 20, View.Bounds.Width, View.Bounds.Height - 20));
            View.AddSubview(FixView);

            ViewTop = new UIView(new CGRect(0, 0, FixView.Bounds.Width, 45));
            ViewTop.BackgroundColor     = UIColor.Clear;
            ViewTop.Layer.MasksToBounds = false;
            ViewTop.Layer.ShadowOpacity = 1f;
            ViewTop.Layer.ShadowOffset  = new CGSize(0, 2);
            ViewTop.Layer.ShadowColor   = UIColor.Gray.CGColor;
            ViewTop.Layer.CornerRadius  = 0;

            ButttonBack = new UIButton(new CGRect(0, 8, 50, 30));
            ButttonBack.SetImage(UIImage.FromBundle("arrow_left").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal), UIControlState.Normal);
            ViewTop.AddSubview(ButttonBack);

            ButtonSpinner = new UIButton(new CGRect((FixView.Frame.Width - 150) / 2, 8, 150, 30));
            ButtonSpinner.BackgroundColor = UIColor.Clear;
            ButtonSpinner.Font            = UIFont.SystemFontOfSize(13);
            ButtonSpinner.SetTitle("Select album", UIControlState.Normal);
            ButtonSpinner.Layer.CornerRadius = 3;
            ButtonSpinner.Layer.BorderColor  = UIColor.White.CGColor;
            ButtonSpinner.Layer.BorderWidth  = 1f;

            var arrow = new UIImageView();

            arrow.ContentMode = UIViewContentMode.ScaleAspectFit;
            arrow.Image       = UIImage.FromBundle("sort_down_white").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal);
            arrow.Frame       = new CGRect(ButtonSpinner.Frame.X + ButtonSpinner.Frame.Width - 15, ButtonSpinner.Frame.Y + 8, 12, 12);

            ViewTop.AddSubview(ButtonSpinner);
            ViewTop.AddSubview(arrow);

            collectionView = new UICollectionView(new CGRect(0, 45, FixView.Bounds.Width, FixView.Bounds.Height - 45), new UICollectionViewFlowLayout());
            collectionView.BackgroundColor = UIColor.White;
            galleryCollectionSource        = new GalleryCollectionSource(assets, this);

            var NumOfColumns = 3;
            var Spacing      = 2;
            var SceenWidth   = (View.Frame.Width - (NumOfColumns - 1) * Spacing) / NumOfColumns;

            var layout = new UICollectionViewFlowLayout
            {
                MinimumInteritemSpacing = Spacing,
                MinimumLineSpacing      = Spacing,
                ScrollDirection         = UICollectionViewScrollDirection.Vertical,
                ItemSize            = new CoreGraphics.CGSize(SceenWidth, SceenWidth),
                FooterReferenceSize = new CoreGraphics.CGSize(View.Frame.Width, 150)
            };

            collectionView.RegisterNibForCell(UINib.FromName("GalleryItemPhotoViewCell", NSBundle.MainBundle), "GalleryItemPhotoViewCell");
            collectionView.DataSource = galleryCollectionSource;
            collectionView.SetCollectionViewLayout(layout, true);

            FixView.AddSubview(collectionView);
            FixView.AddSubview(ViewTop);

            ViewBottom = new UIView(new CGRect(0, FixView.Bounds.Height - 45, FixView.Bounds.Width, 45));
            ViewBottom.BackgroundColor = color.ColorWithAlpha(0.7f);

            ButtonDone = new UIButton(new CGRect(ViewBottom.Frame.Width - 110, 8, 100, 30));
            ButtonDone.Layer.BackgroundColor = UIColor.FromRGB(42, 131, 193).CGColor;
            ButtonDone.Layer.CornerRadius    = 12;
            ButtonDone.SetTitle("Done", UIControlState.Normal);

            ViewBottom.AddSubview(ButtonDone);

            FixView.AddSubview(ViewBottom);

            ButttonBack.TouchUpInside += (object sender, EventArgs e) =>
            {
                DismissViewController(true, null);
            };

            ButtonDone.TouchUpInside += (object sender, EventArgs e) =>
            {
                MessagingCenter.Send <GalleryPickerController, List <PhotoSetNative> >(this, Utils.SubscribeImageFromGallery, GetCurrentSelected());
                DismissModalViewController(true);
            };

            ButtonSpinner.TouchUpInside += (sender, e) =>
            {
                ShowData();
            };

            mTMBProgressHUD = new MTMBProgressHUD(this.View);
            View.AddSubview(mTMBProgressHUD);
        }
Beispiel #58
0
 public static void Logo(UIImageView v)
 {
     v.Image       = Image.Logo;
     v.ContentMode = UIViewContentMode.Center;
 }
        public static void AddBlur(this UIImageView imageView, UIBlurEffectStyle style)
        {
            var blurView = Blur.Create(imageView.Frame, style);

            imageView.AddSubview(blurView);
        }
        public FeedCellBuilder(UIView contentView)
        {
            _contentView = contentView;

            _moreButton       = new UIButton();
            _moreButton.Frame = new CGRect(_contentView.Frame.Width - moreButtonWidth, 0, moreButtonWidth, likeButtonWidthConst);
            _moreButton.SetImage(UIImage.FromBundle("ic_more"), UIControlState.Normal);
            //_moreButton.BackgroundColor = UIColor.Black;
            _contentView.AddSubview(_moreButton);

            _avatarImage = new UIImageView(new CGRect(leftMargin, 20, 30, 30));
            _contentView.AddSubview(_avatarImage);

            var authorX = _avatarImage.Frame.Right + 10;

            _author      = new UILabel(new CGRect(authorX, _avatarImage.Frame.Top - 2, _moreButton.Frame.Left - authorX, 18));
            _author.Font = Constants.Semibold14;
            //_author.BackgroundColor = UIColor.Yellow;
            _author.LineBreakMode = UILineBreakMode.TailTruncation;
            _author.TextColor     = Constants.R15G24B30;
            _contentView.AddSubview(_author);

            _timestamp      = new UILabel(new CGRect(authorX, _author.Frame.Bottom, _moreButton.Frame.Left - authorX, 16));
            _timestamp.Font = Constants.Regular12;
            //_timestamp.BackgroundColor = UIColor.Green;
            _timestamp.LineBreakMode = UILineBreakMode.TailTruncation;
            _timestamp.TextColor     = Constants.R151G155B158;
            _contentView.AddSubview(_timestamp);

            _photoScroll = new UIScrollView();
            _photoScroll.ShowsHorizontalScrollIndicator = false;
            _photoScroll.Bounces       = false;
            _photoScroll.PagingEnabled = true;
            contentView.AddSubview(_photoScroll);

            _likes                        = new UILabel();
            _likes.Font                   = Constants.Semibold14;
            _likes.LineBreakMode          = UILineBreakMode.TailTruncation;
            _likes.TextColor              = Constants.R15G24B30;
            _likes.UserInteractionEnabled = true;
            _contentView.AddSubview(_likes);

            _flags      = new UILabel();
            _flags.Font = Constants.Semibold14;
            //_flags.BackgroundColor = UIColor.Orange;
            _flags.LineBreakMode          = UILineBreakMode.TailTruncation;
            _flags.TextColor              = Constants.R15G24B30;
            _flags.UserInteractionEnabled = true;
            _contentView.AddSubview(_flags);

            _rewards      = new UILabel();
            _rewards.Font = Constants.Semibold14;
            //_rewards.BackgroundColor = UIColor.Orange;
            _rewards.LineBreakMode          = UILineBreakMode.TailTruncation;
            _rewards.TextColor              = Constants.R15G24B30;
            _rewards.UserInteractionEnabled = true;
            _contentView.AddSubview(_rewards);

            _like             = new UIImageView();
            _like.ContentMode = UIViewContentMode.Center;
            _contentView.AddSubview(_like);

            _verticalSeparator = new UIView();
            _verticalSeparator.BackgroundColor = Constants.R244G244B246;
            _contentView.AddSubview(_verticalSeparator);

            _topSeparator = new UIView();
            _topSeparator.BackgroundColor = Constants.R244G244B246;
            _contentView.AddSubview(_topSeparator);

            _attributedLabel = new TTTAttributedLabel();
            _attributedLabel.EnabledTextCheckingTypes = NSTextCheckingType.Link;
            var prop = new NSDictionary();

            _attributedLabel.LinkAttributes       = prop;
            _attributedLabel.ActiveLinkAttributes = prop;
            _attributedLabel.Font  = Constants.Regular14;
            _attributedLabel.Lines = 0;
            _attributedLabel.UserInteractionEnabled = true;
            _attributedLabel.Enabled = true;
            //_attributedLabel.BackgroundColor = UIColor.Blue;
            _contentView.AddSubview(_attributedLabel);

            _comments      = new UILabel();
            _comments.Font = Constants.Regular14;
            //_comments.BackgroundColor = UIColor.DarkGray;
            _comments.LineBreakMode          = UILineBreakMode.TailTruncation;
            _comments.TextColor              = Constants.R151G155B158;
            _comments.UserInteractionEnabled = true;
            _comments.TextAlignment          = UITextAlignment.Center;
            _contentView.AddSubview(_comments);

            _bottomSeparator = new UIView();
            _bottomSeparator.BackgroundColor = Constants.R244G244B246;
            _contentView.AddSubview(_bottomSeparator);

            _profileTapView = new UIView(new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width / 2, likeButtonWidthConst));
            _profileTapView.UserInteractionEnabled = true;
            _contentView.AddSubview(_profileTapView);

            _likersTapView = new UIView();
            _likersTapView.UserInteractionEnabled = true;
            _contentView.AddSubview(_likersTapView);

            likersY            = underPhotoPanelHeight / 2 - likersImageSide / 2;
            likersCornerRadius = likersImageSide / 2;

            var liketap = new UITapGestureRecognizer(LikeTap);

            _like.AddGestureRecognizer(liketap);

            UITapGestureRecognizer tap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Preview, _currentPost);
            });

            _photoScroll.AddGestureRecognizer(tap);

            var profileTap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Profile, _currentPost);
            });
            var headerTap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Profile, _currentPost);
            });

            _profileTapView.AddGestureRecognizer(headerTap);
            _rewards.AddGestureRecognizer(profileTap);

            var commentTap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Comments, _currentPost);
            });

            _comments.AddGestureRecognizer(commentTap);

            var netVotesTap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Voters, _currentPost);
            });

            _likersTapView.AddGestureRecognizer(netVotesTap);

            var flagersTap = new UITapGestureRecognizer(() =>
            {
                CellAction?.Invoke(ActionType.Flagers, _currentPost);
            });

            _flags.AddGestureRecognizer(flagersTap);

            _moreButton.TouchDown += FlagButton_TouchDown;
        }