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;
		}
        public override void ViewDidLoad()
        {
            View = new UIView(){ BackgroundColor = UIColor.White};
            base.ViewDidLoad();

            var label = new UILabel(new RectangleF(10, 10, 300, 40));
            Add(label);
            var textField = new UITextField(new RectangleF(10, 50, 300, 40));
            Add(textField);
            var button = new UIButton(UIButtonType.RoundedRect);
            button.SetTitle("Click Me", UIControlState.Normal);
            button.Frame = new RectangleF(10, 90, 300, 40);
            Add(button);
            var button2 = new UIButton(UIButtonType.RoundedRect);
            button2.SetTitle("Go Second", UIControlState.Normal);
            button2.Frame = new RectangleF(10, 130, 300, 40);
            Add(button2);

            var set = this.CreateBindingSet<FirstView, Core.ViewModels.FirstViewModel>();
            set.Bind(label).To(vm => vm.Hello);
            set.Bind(textField).To(vm => vm.Hello);
            set.Bind(button).To(vm => vm.MyCommand);
            set.Bind(button2).To(vm => vm.GoSecondCommand);
            set.Apply();
        }
 protected PrettyDialogViewController()
 {
     HeaderView = new ImageAndTitleHeaderView();
     SlideUpTitle = new SlideUpTitleView(44f) { Offset = 100f };
     NavigationItem.TitleView = SlideUpTitle;
     _backgroundHeaderView = new UIView();
 }
		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);
		}
 private UIView getRootSuperView(UIView view)
 {
     if (view.Superview == null)
         return view;
     else
         return getRootSuperView(view.Superview);
 }
Example #6
0
		public override bool FinishedLaunching(UIApplication app, NSDictionary options)
		{
			window = new UIWindow(UIScreen.MainScreen.Bounds);

			var controller = new UIViewController();
			var view = new UIView (UIScreen.MainScreen.Bounds);
			view.BackgroundColor = UIColor.White;
			controller.View = view;

			controller.NavigationItem.Title = "SignalR Client";

			var textView = new UITextView(new CGRect(0, 0, 320, view.Frame.Height - 0));
			view.AddSubview (textView);


			navController = new UINavigationController (controller);

			window.RootViewController = navController;
			window.MakeKeyAndVisible();

			if (SIGNALR_DEMO_SERVER == "http://YOUR-SERVER-INSTANCE-HERE") {
				textView.Text = "You need to configure the app to point to your own SignalR Demo service.  Please see the Getting Started Guide for more information!";
				return true;
			}
			
			var traceWriter = new TextViewWriter(SynchronizationContext.Current, textView);

			var client = new CommonClient(traceWriter);
			client.RunAsync(SIGNALR_DEMO_SERVER);

			return true;
		}
Example #7
0
        private void AddMsgToView(AppMsg appMsg)
        {
            UIApplication.SharedApplication.InvokeOnMainThread(() =>
            {
                var layout = new UIView
                {
                    BackgroundColor = appMsg.Style.Background
                };
                if (appMsg.Position == DisplayPosition.Top)
                {
                    layout.Frame = new RectangleF(0, UIApplication.SharedApplication.StatusBarFrame.Height, UIScreen.MainScreen.Bounds.Width, AppMsg.MsgViewHeight);
                }
                else if (appMsg.Position == DisplayPosition.Center)
                {
                    layout.Frame = new RectangleF(0, (UIScreen.MainScreen.Bounds.Bottom - AppMsg.MsgViewHeight) / 2,
                        UIScreen.MainScreen.Bounds.Width, AppMsg.MsgViewHeight);
                }
                else
                {
                    layout.Frame = new RectangleF(0, UIScreen.MainScreen.Bounds.Bottom - AppMsg.MsgViewHeight,
                            UIScreen.MainScreen.Bounds.Width, AppMsg.MsgViewHeight);

                }

                var inner = new UILabel
                {
                    Frame = new RectangleF(10, 5, UIScreen.MainScreen.Bounds.Width - 20, AppMsg.MsgViewHeight - 10),
                    Text = appMsg.Msg,
                    Font = UIFont.BoldSystemFontOfSize(14f),
                    TextColor = UIColor.White,
                    //BackgroundColor = appMsg.Style.Background,
                    TextAlignment = UITextAlignment.Center
                };
                layout.AddSubview(inner);
                appMsg.View = layout;

                UIApplication.SharedApplication.KeyWindow.AddSubview(layout);

                appMsg.State = MsgState.IsShowing;
                    Task.Delay(appMsg.Duration-500).ContinueWith(r => UIApplication.SharedApplication.InvokeOnMainThread(() =>
                {
                            UIView.AnimateAsync(.5,()=>{
                                inner.Hidden=true;
                                layout.BackgroundColor=layout.BackgroundColor.ColorWithAlpha(0);
                            }).ContinueWith(t=>{

                                InvokeOnMainThread (()=>{layout.Hidden=true;layout.RemoveFromSuperview();});
                            });

                    //layout.Hidden = true;

                    appMsg.State = MsgState.Display;
                    if (msgQueue.Count == 0)
                    {
                        needGoon = false;
                    }
                    allDone.Set();
                }));
            });
        }
		public override void ViewDidLoad ()
		{
            loadingBg = new UIView (this.View.Frame) { 
                BackgroundColor = UIColor.Black, 
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight 
            };
            loadingView = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.WhiteLarge) {
                AutoresizingMask = UIViewAutoresizing.FlexibleMargins
            };
			loadingView.Frame = new CGRect ((this.View.Frame.Width - loadingView.Frame.Width) / 2, 
				(this.View.Frame.Height - loadingView.Frame.Height) / 2,
				loadingView.Frame.Width, 
				loadingView.Frame.Height);
			
			loadingBg.AddSubview (loadingView);
			View.AddSubview (loadingBg);
			loadingView.StartAnimating ();

			scannerView = new AVCaptureScannerView(new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Height));
			scannerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
			scannerView.UseCustomOverlayView = this.Scanner.UseCustomOverlay;
			scannerView.CustomOverlayView = this.Scanner.CustomOverlay;
			scannerView.TopText = this.Scanner.TopText;
			scannerView.BottomText = this.Scanner.BottomText;
			scannerView.CancelButtonText = this.Scanner.CancelButtonText;
			scannerView.FlashButtonText = this.Scanner.FlashButtonText;
            scannerView.OnCancelButtonPressed += () => {
                Scanner.Cancel ();
            };

			this.View.AddSubview(scannerView);
			this.View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
		}
        public override void LoadView ()
        {
            View = new UIView ().Apply (Style.Screen);

            Add (new SeparatorView ().Apply (Style.Settings.Separator));
            Add (askProjectView = new LabelSwitchView () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply (Style.Settings.RowBackground).Apply (BindAskProjectView));
            askProjectView.Label.Apply (Style.Settings.SettingLabel);
            askProjectView.Label.Text = "SettingsAskProject".Tr ();
            askProjectView.Switch.ValueChanged += OnAskProjectViewValueChanged;

            Add (new SeparatorView ().Apply (Style.Settings.Separator));
            Add (new UILabel () {
                Text = "SettingsAskProjectDesc".Tr (),
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply (Style.Settings.DescriptionLabel));

            Add (new SeparatorView ().Apply (Style.Settings.Separator));
            Add (mobileTagView = new LabelSwitchView () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply (Style.Settings.RowBackground).Apply (BindMobileTagView));
            mobileTagView.Label.Apply (Style.Settings.SettingLabel);
            mobileTagView.Label.Text = "SettingsMobileTag".Tr ();
            mobileTagView.Switch.ValueChanged += OnMobileTagViewValueChanged;

            Add (new SeparatorView ().Apply (Style.Settings.Separator));
            Add (new UILabel () {
                Text = "SettingsMobileTagDesc".Tr (),
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply (Style.Settings.DescriptionLabel));

            View.AddConstraints (MakeConstraints (View));
        }
 void ReleaseDesignerOutlets()
 {
     if (ScrollReqProf != null) {
         ScrollReqProf.Dispose ();
         ScrollReqProf = null;
     }
 }
        public void buildReport()
        {
            Root = new RootElement ("");
            var v = new UIView ();
            v.Frame = new RectangleF (10, 10, 600, 10);
            var dummy = new Section (v);
            Root.Add (dummy);
            var headerLabel = new UILabel (new RectangleF (10, 10, 800, 48)) {
                Font = UIFont.BoldSystemFontOfSize (18),
                BackgroundColor = ColorHelper.GetGPPurple (),
                TextAlignment = UITextAlignment.Center,
                TextColor = UIColor.White,
                Text = "Branch Matter Analysis"
            };
            var view = new UIViewBordered ();
            view.Frame = new RectangleF (10, 20, 800, 48);
            view.Add (headerLabel);
            Root.Add (new Section (view));
            //
            for (int i = 0; i < report.branches.Count; i++) {
                Branch branch = report.branches [i];

                Section s = new Section (branch.name + " Branch Totals");
                Root.Add (s);
                //
                if (branch.branchTotals.matterActivity != null) {
                    var matterActivitySection = new Section ();
                    var mTitle = new TitleElement ("Matter Activity");
                    matterActivitySection.Add (mTitle);
                    matterActivitySection.Add (new NumberElement (branch.branchTotals.matterActivity.active, "Active Matters: "));
                    matterActivitySection.Add (new NumberElement (
                        branch.branchTotals.matterActivity.deactivated,
                        "Deactivated Matters: "
                    ));
                    matterActivitySection.Add (new NumberElement (branch.branchTotals.matterActivity.newWork, "New Work: "));
                    matterActivitySection.Add (new NumberElement (branch.branchTotals.matterActivity.workedOn, "Worked On: "));

                    matterActivitySection.Add (new NumberElement (branch.branchTotals.matterActivity.noActivity, "No Activity: "));
                    matterActivitySection.Add (new StringElement ("No Activity Duration: " + branch.branchTotals.matterActivity.noActivityDuration));
                    Root.Add (matterActivitySection);
                }
                //
                if (branch.branchTotals.matterBalances != null) {
                    var matterBalancesSection = new Section ();
                    var mTitle = new TitleElement ("Matter Balances");
                    matterBalancesSection.Add (mTitle);
                    matterBalancesSection.Add (getElement (branch.branchTotals.matterBalances.business, S.GetText (S.BUSINESS) + ": "));
                    matterBalancesSection.Add (getElement (branch.branchTotals.matterBalances.trust, S.GetText (S.TRUST_BALANCE) + ": "));
                    matterBalancesSection.Add (getElement (branch.branchTotals.matterBalances.investment, S.GetText (S.INVESTMENTS) + ": "));
                    matterBalancesSection.Add (getElement (branch.branchTotals.matterBalances.unbilled, "Unbilled: "));
                    matterBalancesSection.Add (getElement (branch.branchTotals.matterBalances.pendingDisbursements, "Pending Disb.: "));
                    Root.Add (matterBalancesSection);
                }

            }

            for (var i = 0; i < 10; i++) {
                Root.Add (new Section (" "));
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var view = new UIView
            {
                BackgroundColor = UIColor.White
            };

            var label = new UILabel
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Text = "No Conversation Selected",
                TextColor = UIColor.FromWhiteAlpha(0.0f, 0.4f),
                Font = UIFont.PreferredHeadline
            };
            view.AddSubview(label);

            view.AddConstraint(NSLayoutConstraint.Create(label, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal,
                    view, NSLayoutAttribute.CenterX, 1.0f, 0.0f));
            view.AddConstraint(NSLayoutConstraint.Create(label, NSLayoutAttribute.CenterY, NSLayoutRelation.Equal,
                    view, NSLayoutAttribute.CenterY, 1.0f, 0.0f));

            View = view;
        }
        static NSLayoutConstraint CompileConstraint(BinaryExpression expr, UIView constrainedView)
        {
            var rel = NSLayoutRelation.Equal;
            switch (expr.NodeType)
            {
                case ExpressionType.Equal:
                    rel = NSLayoutRelation.Equal;
                    break;
                case ExpressionType.LessThanOrEqual:
                    rel = NSLayoutRelation.LessThanOrEqual;
                    break;
                case ExpressionType.GreaterThanOrEqual:
                    rel = NSLayoutRelation.GreaterThanOrEqual;
                    break;
                default:
                    throw new NotSupportedException("Not a valid relationship for a constrain.");
            }

            var left = GetViewAndAttribute(expr.Left);
            if (left.Item1 != constrainedView)
            {
                left.Item1.TranslatesAutoresizingMaskIntoConstraints = false;
            }

            var right = GetRight(expr.Right);

            return NSLayoutConstraint.Create(
                left.Item1, left.Item2,
                rel,
                right.Item1, right.Item2,
                right.Item3, right.Item4);
        }
        public override void ViewDidLoad()
        {
            View = new UIView(){ BackgroundColor = UIColor.White};
            base.ViewDidLoad();

            // ios7 layout
            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
                EdgesForExtendedLayout = UIRectEdge.None;

            var textField = new UITextField(new RectangleF(10, 10, 300, 40));
            Add(textField);

            var tableView = new UITableView(new RectangleF(0, 50, 320, 500), UITableViewStyle.Plain);
            Add(tableView);

			// choice here:
			//
			//   for original demo use:
            //     var source = new MvxStandardTableViewSource(tableView, "TitleText");
			//
			//   or for prettier cells from XIB file use:
			//     tableView.RowHeight = 88;
			//     var source = new MvxSimpleTableViewSource(tableView, BookCell.Key, BookCell.Key);

			tableView.RowHeight = 88;
			var source = new MvxSimpleTableViewSource(tableView, BookCell.Key, BookCell.Key);
			tableView.Source = source;

            var set = this.CreateBindingSet<FirstView, Core.ViewModels.FirstViewModel>();
            set.Bind(textField).To(vm => vm.SearchTerm);
            set.Bind(source).To(vm => vm.Results);
            set.Apply();

            tableView.ReloadData();
        }
Example #15
0
        //
        public Container()
        {
            ClipsToBounds = true;
              _state = State.Collapsed;

              Layer.BackgroundColor = UIColor.White.CGColor;
              Layer.BorderColor = UIColor.LightGray.CGColor;
              Layer.BorderWidth = 1;

              Header = this.Add<Header>();
              _content = this.Add<UIView>();
              _content.ClipsToBounds = true;

              Header.BackgroundColor = UIColor.White;
              Header.Layer.BorderColor = UIColor.LightGray.CGColor;
              Header.Layer.BorderWidth = 1;

              Header
            .Anchor(NSLayoutAttribute.Top, this, NSLayoutAttribute.Top)
            .Anchor(NSLayoutAttribute.Left, this, NSLayoutAttribute.Left)
            .Anchor(NSLayoutAttribute.Right, this, NSLayoutAttribute.Right);

              _content
            .Anchor(NSLayoutAttribute.Top, Header, NSLayoutAttribute.Bottom)
            .Anchor(NSLayoutAttribute.Left, this, NSLayoutAttribute.Left)
            .Anchor(NSLayoutAttribute.Right, this, NSLayoutAttribute.Right)
            .Anchor(NSLayoutAttribute.Bottom, this, NSLayoutAttribute.Bottom);
        }
		public static void PushView(UIView view, bool animated)
		{
			CurrentDialogViewController = CreateDialogViewController(view, false);
			CurrentViewController = CurrentDialogViewController;
			
			NavigationController.PushViewController(CurrentViewController, animated);
		}
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
                EdgesForExtendedLayout = UIRectEdge.None;

            var source = new MvxStandardTableViewSource(TableView, UITableViewCellStyle.Subtitle, new NSString("sub"), "TitleText PriceText;ImageUrl ImageUri;DetailText DetailsText", UITableViewCellAccessory.DisclosureIndicator);
            TableView.Source = source;

            var set = this.CreateBindingSet<SearchResultsView, SearchResultsViewModel>();
            set.Bind(source).To(vm => vm.Properties);
            set.Bind(source).For(s => s.SelectionChangedCommand).To(vm => vm.PropertiesSelectedCommand);
            set.Bind(this).For(s => s.Title).To(vm => vm.Title);
            var myFooter = new UIView(new RectangleF(0, 0, 320, 40));

            UIButton loadMoreButton = new UIButton(new RectangleF(0, 0, 320, 40));
            loadMoreButton.SetTitle("Load More", UIControlState.Normal);
            loadMoreButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            set.Bind(loadMoreButton).To(vm => vm.LoadMoreCommand);
            set.Bind(loadMoreButton).For("Title").To(vm => vm.Title);

            myFooter.Add(loadMoreButton);

            TableView.TableFooterView = myFooter;

            set.Apply();

            TableView.ReloadData();
            ViewModel.WeakSubscribe(PropertyChanged);

            NavigationItem.BackBarButtonItem = new UIBarButtonItem("Results",
                         UIBarButtonItemStyle.Bordered, BackButtonEventHandler);
        }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			view1 = new UIImageView (UIImage.FromFile ("monkey1.png")) {
				Frame = View.Frame,
				ContentMode = UIViewContentMode.ScaleAspectFit
			};
			View.AddSubview (view1);
			
			view2 = new UIImageView (UIImage.FromFile ("monkey2.png")) {
				Frame = View.Frame,
				ContentMode = UIViewContentMode.ScaleAspectFit
			};

			view1.UserInteractionEnabled = true;

			view1.AddGestureRecognizer (new UITapGestureRecognizer (() => { 
				UIView.Transition (
					fromView: view1,
					toView: view2,
					duration: 2,
					options: UIViewAnimationOptions.TransitionFlipFromTop | UIViewAnimationOptions.CurveEaseInOut,
					completion: () => { Console.WriteLine ("transition complete"); });
			}));


		    
		}
		private UIView AddShadowToView (UIView view, bool reverse)
		{
			UIView containerView = view.Superview;

			var viewWithShadow = new UIView (view.Frame);
			containerView.InsertSubviewAbove (viewWithShadow, view);
			view.RemoveFromSuperview ();

			var shadowView = new UIView (viewWithShadow.Bounds);

			var colors = new CGColor[] {
				UIColor.FromWhiteAlpha(0f, 0f).CGColor,
				UIColor.FromWhiteAlpha(0f, 0.5f).CGColor
			};

			var gradient = new CAGradientLayer () {
				Frame = shadowView.Bounds,
				Colors =  colors
			};

			gradient.StartPoint = new CGPoint (reverse ? 0f : 1f, 0f);
			gradient.EndPoint = new CGPoint (reverse ? 1f : 0f, 0f);
			shadowView.Layer.InsertSublayer (gradient, 1);

			view.Frame = view.Bounds;
			viewWithShadow.AddSubview (view);

			viewWithShadow.AddSubview (shadowView);
			return viewWithShadow;
		}
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _canvasView = new UIView
            {
                BackgroundColor = CanvasBackgroundColor,
                Bounds = new CGRect(CGPoint.Empty, CanvasSize),
            };

            _scrollView = new UIScrollView()
            {
                ContentSize = CanvasSize,
                ViewForZoomingInScrollView = sv => _canvasView,
                BackgroundColor = ScrollViewBackgroundColor,
            };

            _scrollView.AddSubview(_canvasView);

            View.AddSubview(_scrollView);

            AddGestures();

            AddInitialElements();
        }
        public Task SaveAndLaunchFile(Stream stream, string fileType)
        {
            if (OriginView == null) return Task.FromResult(true);

            var data = NSData.FromStream(stream);
            var width = 824;
            var height = 668;

            var popoverView = new UIView(new RectangleF(0, 0, width, height));
            popoverView.BackgroundColor = UIColor.White;
            var webView = new UIWebView();
            webView.Frame = new RectangleF(0, 45, width, height - 45);

            var b = new UIButton(UIButtonType.RoundedRect);
            b.SetTitle("Done", UIControlState.Normal);
            b.Frame = new RectangleF(10,10, 60, 25);
            b.TouchUpInside += (o, e) => _popoverController.Dismiss(true);

            popoverView.AddSubview(b);
            popoverView.AddSubview(webView);

            var bundlePath = NSBundle.MainBundle.BundlePath;
            System.Diagnostics.Debug.WriteLine(bundlePath);
            webView.LoadData(data, "application/pdf", "utf-8", NSUrl.FromString("http://google.com"));

            var popoverContent = new UIViewController();
            popoverContent.View = popoverView;

            _popoverController = new UIPopoverController(popoverContent);
            _popoverController.PopoverContentSize = new SizeF(width, height);
            _popoverController.PresentFromRect(new RectangleF(OriginView.Frame.Width/2, 50, 1, 1), OriginView, UIPopoverArrowDirection.Any, true);
            _popoverController.DidDismiss += (o, e) => _popoverController = null;

            return Task.FromResult(true);
        }
Example #22
0
		public BindingContext(UIView view, string title, Theme currentTheme)
		{
			if (view == null)
				throw new ArgumentNullException("view");
			
			var parser = new ViewParser();

			parser.Parse(view, title, currentTheme);
			Root = parser.Root;

			var viewContext = view as IBindingContext;
			if (viewContext != null)
			{
				viewContext.BindingContext = this;
				var dataContext = view as IDataContext;
				if (dataContext != null)
				{
					var vmContext = dataContext.DataContext as IBindingContext;
					if (vmContext != null)
					{
						vmContext.BindingContext = this;
					}
				}
			}
		}
		void ReleaseDesignerOutlets ()
		{
			if (btnFinished != null) {
				btnFinished.Dispose ();
				btnFinished = null;
			}
			if (imgBeer1 != null) {
				imgBeer1.Dispose ();
				imgBeer1 = null;
			}
			if (imgBeer2 != null) {
				imgBeer2.Dispose ();
				imgBeer2 = null;
			}
			if (imgBeer3 != null) {
				imgBeer3.Dispose ();
				imgBeer3 = null;
			}
			if (imgBeer4 != null) {
				imgBeer4.Dispose ();
				imgBeer4 = null;
			}
			if (lblBeersCount != null) {
				lblBeersCount.Dispose ();
				lblBeersCount = null;
			}
			if (tinderView != null) {
				tinderView.Dispose ();
				tinderView = null;
			}
		}
Example #24
0
        public TabControlItem(CGRect frame, string title)
        {
            this.Frame = frame;
            var parentFrame = frame;
            var labelFont = UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad ? UIFont.BoldSystemFontOfSize(15) : UIFont.BoldSystemFontOfSize(10);

            this.labelTitle = new UILabel(new CGRect(0, 0, parentFrame.Width / 2, parentFrame.Height))
            {
                Text = title,
                TextAlignment = UITextAlignment.Center,
                AdjustsFontSizeToFitWidth = true,
                LineBreakMode = UILineBreakMode.TailTruncation,
                Lines = 2,
                Font = labelFont
            };

            this.button = new UIButton(new CGRect(0, 0, parentFrame.Width, parentFrame.Height));
            this.viewColor = new UIView(new CGRect(0, parentFrame.Height - 1, parentFrame.Width, 1));

            this.Add(this.labelTitle);
            this.Add(this.button);
            this.Add(this.viewColor);

            this.button.TouchUpInside += (s, e) =>
            {
                if (tabEnabled)
                {
                    SelectTab();
                }
            };
        }
Example #25
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 ();
            normalButton = GetButton (new CGRect (10, 120, 295, 48),
                                      FoodyTheme.SharedTheme.ButtonImage,
                                      "Standard Button");
            View.AddSubview (normalButton);

            pressedButton = GetButton (new CGRect (10, 190, 295, 48),
                                       FoodyTheme.SharedTheme.PressedButtonImage,
                                       "Button Pressed");
            View.AddSubview (pressedButton);

            label = new UILabel (new CGRect (15, 40, 400, 30));
            FoodyTheme.Apply (label);
            label.Text = "Label";
            View.AddSubview (label);

            var paddingView = new UIView (new CGRect (0, 0, 5, 20));
            TextField.LeftView = paddingView;
            TextField.LeftViewMode = UITextFieldViewMode.Always;
            TextField.ShouldReturn = TextFieldShouldReturn;
            TextField.Background = FoodyTheme.SharedTheme.TextFieldBackground;

            progress = new UIProgressView (new CGRect (13, 300, 292, 10));
            progress.Progress = 0.5f;
            View.AddSubview (progress);

            slider = new UISlider (new CGRect (10, 330, 298, 10));
            slider.Value = 0.5f;
            slider.ValueChanged += HandleValueChanged;
            View.AddSubview (slider);

            FoodyTheme.Apply (View);
        }
Example #27
0
		public void Show()
		{
			var parentWindow = UIApplication.SharedApplication.KeyWindow;
			_view = FormsViewHelper.ConvertFormsToNative (_popup, parentWindow.Bounds);

			parentWindow.AddSubview (_view);
		}
        //Recipe 2-1 Adding Nested Subviews
        public override void LoadView()
        {
            //Create the main view
            RectangleF appRect = UIScreen.MainScreen.ApplicationFrame;

            contentView = new UIView(appRect);
            contentView.BackgroundColor = UIColor.Green;

            //Provide support for autorotation and resizing
            contentView.AutosizesSubviews = true;
            contentView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.View = contentView;

            // reset the origin point for subviews. The new origin is 0, 0
            appRect.Location = new PointF(0.0f, 0.0f);

            //Add the subviews, each stepped by 32 pixels on each side
            var subview = new UIView(RectangleF.Inflate(appRect, -32.0f, -32.0f));
            subview.BackgroundColor = UIColor.Clear;
            contentView.AddSubview(subview);

            subview = new UIView(RectangleF.Inflate(appRect, -64.0f, -64.0f));
            subview.BackgroundColor = UIColor.DarkGray;
            contentView.AddSubview(subview);

            subview = new UIView(RectangleF.Inflate(appRect, -96.0f, -96.0f));
            subview.BackgroundColor = UIColor.Black;
            contentView.AddSubview(subview);
        }
Example #29
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View = new UIView() { BackgroundColor = UIColor.White };

            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
                EdgesForExtendedLayout = UIRectEdge.None;

            TableView = new UITableView(UIScreen.MainScreen.Bounds);
            var source = new MvxStandardTableViewSource(
                TableView,
                UITableViewCellStyle.Subtitle,
                CellIdentifier,
                "TitleText Title; DetailText Start"
            );

            TableView.Source = source;

            var set = this.CreateBindingSet<ConferenceView, ConferenceViewModel>();
            set.Bind(source).To(vm => vm.Sessions);
            set.Apply();

            TableView.ReloadData();
        }
 /// <summary>
 ///   Constructor
 /// </summary>
 /// <param name="caption">
 /// The caption, only used for RootElements that might want to summarize results
 /// </param>
 /// <param name="view">
 /// The view to display
 /// </param>
 /// <param name="transparent">
 /// If this is set, then the view is responsible for painting the entire area,
 /// otherwise the default cell paint code will be used.
 /// </param>
 public UIViewElement(string caption, UIView view, bool transparent)
     : base(caption)
 {
     this.View = view;
     this.Flags = transparent ? CellFlags.Transparent : 0;
     key = new NSString("UIViewElement" + _count++);
 }
        void getRotatorItem()
        {
            SFRotatorItem item1  = new SFRotatorItem();
            UIView        view1  = new UIView();
            UIImageView   image1 = new UIImageView();

            image1.Frame = view1.Frame;
            image1.Image = UIImage.FromFile("movie1.png");
            item1.View   = view1;
            view1.AddSubview(image1);

            SFRotatorItem item2  = new SFRotatorItem();
            UIView        view2  = new UIView();
            UIImageView   image2 = new UIImageView();

            image2.Frame = view2.Frame;
            image2.Image = UIImage.FromFile("movie2.png");
            item2.View   = view2;
            view2.AddSubview(image2);

            SFRotatorItem item3  = new SFRotatorItem();
            UIView        view3  = new UIView();
            UIImageView   image3 = new UIImageView();

            image3.Frame = view3.Frame;
            image3.Image = UIImage.FromFile("movie3.png");
            item3.View   = view3;
            view3.AddSubview(image3);

            SFRotatorItem item4  = new SFRotatorItem();
            UIView        view4  = new UIView();
            UIImageView   image4 = new UIImageView();

            image4.Frame = view4.Frame;
            image4.Image = UIImage.FromFile("movie4.png");
            item4.View   = view4;
            view4.AddSubview(image4);

            SFRotatorItem item5  = new SFRotatorItem();
            UIView        view5  = new UIView();
            UIImageView   image5 = new UIImageView();

            image5.Frame = view5.Frame;
            image5.Image = UIImage.FromFile("movie5.png");
            item5.View   = view5;
            view5.AddSubview(image5);

            SFRotatorItem item6  = new SFRotatorItem();
            UIView        view6  = new UIView();
            UIImageView   image6 = new UIImageView();

            image6.Frame = view6.Frame;
            image6.Image = UIImage.FromFile("movie6.png");
            item6.View   = view6;
            view6.AddSubview(image6);

            SFRotatorItem item7  = new SFRotatorItem();
            UIView        view7  = new UIView();
            UIImageView   image7 = new UIImageView();

            image7.Frame = view7.Frame;
            image7.Image = UIImage.FromFile("movie7.png");
            item7.View   = view7;
            view7.AddSubview(image7);

            image1.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            image2.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            image3.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            image4.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            image5.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            image6.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            image7.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;

            array.Add(item1);
            array.Add(item2);
            array.Add(item3);
            array.Add(item4);
            array.Add(item5);
            //array.Add (item6);
            //array.Add (item7);
        }
Example #32
0
 private void Present()
 {
     UIView.Animate(0.25, 0, UIViewAnimationOptions.CurveEaseIn, () =>
                    _innerView.Frame = new CGRect(0, Frame.Height - _innerView.Frame.Height, _innerView.Frame.Width, _innerView.Frame.Height), null);
 }
 public MvxUIViewTapTargetBinding(UIView target, uint numberOfTapsRequired = 1, uint numberOfTouchesRequired = 1, bool cancelsTouchesInView = true)
     : base(target)
 {
     _behaviour = new MvxTapGestureRecognizerBehaviour(target, numberOfTapsRequired, numberOfTouchesRequired, cancelsTouchesInView);
 }
Example #34
0
        public NPCButchererHotbar(CheatSheet mod)
        {
            this.mod = mod;
            //parentHotbar = mod.hotbar;

            this.buttonView = new UIView();
            base.Visible    = false;

            // Button images
            bButcherHostiles = new UIImage(Main.itemTexture[ItemID.DemonHeart]);
            bButcherBoth     = new UIImage(Main.itemTexture[ItemID.CrimsonHeart]);
            bButcherTownNPCs = new UIImage(Main.itemTexture[ItemID.Heart]);

            // Button tooltips
            bButcherHostiles.Tooltip = "Butcher hostile NPCs";
            bButcherBoth.Tooltip     = "Butcher hostile and friendly NPCs";
            bButcherTownNPCs.Tooltip = "Butcher friendly NPCs";

            // Button EventHandlers
            bButcherHostiles.onLeftClick += (s, e) =>
            {
                HandleButcher(0);
            };
            bButcherBoth.onLeftClick += (s, e) =>
            {
                HandleButcher(1);
            };
            bButcherTownNPCs.onLeftClick += (s, e) =>
            {
                HandleButcher(2);
            };

            // Register mousedown
            onMouseDown += (s, e) =>
            {
                if (!Main.LocalPlayer.mouseInterface && !mod.hotbar.MouseInside && !mod.hotbar.button.MouseInside)
                {
                    mouseDown = true;
                    Main.LocalPlayer.mouseInterface = true;
                }
            };
            onMouseUp += (s, e) => { justMouseDown = true; mouseDown = false; /*startTileX = -1; startTileY = -1;*/ };

            // ButtonView
            buttonView.AddChild(bButcherHostiles);
            buttonView.AddChild(bButcherBoth);
            buttonView.AddChild(bButcherTownNPCs);

            base.Width             = 200f;
            base.Height            = 55f;
            this.buttonView.Height = base.Height;
            base.Anchor            = AnchorPosition.Top;
            this.AddChild(this.buttonView);
            base.Position = new Vector2(Hotbar.xPosition, this.hiddenPosition);
            base.CenterXAxisToParentCenter();
            float num = this.spacing;

            for (int i = 0; i < this.buttonView.children.Count; i++)
            {
                this.buttonView.children[i].Anchor   = AnchorPosition.Left;
                this.buttonView.children[i].Position = new Vector2(num, 0f);
                this.buttonView.children[i].CenterYAxisToParentCenter();
                this.buttonView.children[i].Visible         = true;
                this.buttonView.children[i].ForegroundColor = buttonUnselectedColor;
                num += this.buttonView.children[i].Width + this.spacing;
            }
            this.Resize();
        }
        //private UIView MainRect;

        public DropDownControl(DropDownView view, nfloat fSize) : base()
        {
            this.Parent            = view;
            UserInteractionEnabled = true;
            MultipleTouchEnabled   = true;

            this._Button1 = new UIButton();
            this._Button1.SetTitle(view.Title, UIControlState.Normal);
            this._Button1.SetTitleColor(UIColor.Black, UIControlState.Normal);
            this._Button1.BackgroundColor        = UIColor.White;
            this._Button1.UserInteractionEnabled = true;
            this._Button1.MultipleTouchEnabled   = true;

            if (fSize > 1)
            {
                this._Button1.Font = UIFont.SystemFontOfSize(fSize);
            }

            this._DropDownView = new UIView();
            this._DropDownView.Layer.MasksToBounds = false;
            //			this._DropDownView.Layer.BorderColor = UIColor.Clear.CGColor;
            //			this._DropDownView.Layer.CornerRadius = 4;
            //			this._DropDownView.Layer.BorderWidth = 1;
            //			this._DropDownView.AddBorder (UIRectEdge.Left, UIColor.Black, 1);

            this._DropDownView.BackgroundColor       = UIColor.Clear;
            this._DropDownView.Layer.BackgroundColor = UIColor.Clear.CGColor;             // = UIColor.FromRGB (0, 175, 63).CGColor;



            this._Button1.HorizontalAlignment  = UIControlContentHorizontalAlignment.Left;
            this._Button1.TitleEdgeInsets      = new UIEdgeInsets(0, 10, 0, 0);
            this._Button1.MultipleTouchEnabled = true;

            // add to view
            //this.Add (this._Button1);
            //this.Add (this._DropDownView);

            //MainRect = new UIView ();
            this.AddSubview(this._Button1);


            var top = UIApplication.SharedApplication.KeyWindow.RootViewController;

//			var v = top.View;
//			v.MultipleTouchEnabled = true;

            top.Add(_DropDownView);

            //this.AddSubview (this._DropDownView);
            //this.MainRect.BackgroundColor = UIColor.Yellow;

            this._Button1.TouchDown += Button1Click;

            // handle selection
            SelectedText = (x) => {
                SetTitle(x);
            };
//
//			this.BackgroundColor = UIColor.Clear;
            this.Layer.BorderColor     = UIColor.Blue.CGColor;
            this.Layer.BackgroundColor = UIColor.Green.CGColor;
            this.Layer.BorderWidth     = 1;
            this.Layer.CornerRadius    = 4;
        }
Example #36
0
        public override void Start()
        {
            // Generates the following UI:
            // /NAME-----------\ <-- UIDragHandle
            // |---------------|-|
            // |               | |<-- _messageBox, _getscrollablepanel
            // |               | |
            // |---------------| |
            // |               | |<-- _chatText
            // |---------------|-|
            //                 |-|<-- _resize
            //                  ^
            //                  ¦-- _scrollbar, _trackingsprite, _trackingthumb

            backgroundSprite = "GenericPanel";
            name             = "ChatLogPanel";
            color            = new Color32(22, 22, 22, 240);

            // Activates the dragging of the window
            _draghandle      = AddUIComponent <UIDragHandle>();
            _draghandle.name = "ChatLogPanelDragHandle";

            // Grab the view for calculating width and height of game
            UIView view = UIView.GetAView();

            // Center this window in the game
            relativePosition = new Vector3(10.0f, view.fixedHeight - 440.0f);

            width       = 500;
            height      = 310;
            minimumSize = new Vector2(300, 310);

            // Add resize component
            _resize                  = AddUIComponent <UIResizeHandle>();
            _resize.position         = new Vector2((width - 20), (-height + 10));
            _resize.width            = 20f;
            _resize.height           = 20f;
            _resize.color            = new Color32(255, 255, 255, 255);
            _resize.backgroundSprite = "GenericTabPressed";
            _resize.name             = "ChatLogPanelResize";

            // Add scrollable panel component
            _scrollablepanel              = AddUIComponent <UIScrollablePanel>();
            _scrollablepanel.width        = 490;
            _scrollablepanel.height       = 240;
            _scrollablepanel.position     = new Vector2(10, -30);
            _scrollablepanel.clipChildren = true;
            _scrollablepanel.name         = "ChatLogPanelScrollablePanel";

            // Add title
            _title           = AddUIComponent <UILabel>();
            _title.position  = new Vector2(10, -5);
            _title.text      = "Multiplayer Chat";
            _title.textScale = 0.8f;
            _title.autoSize  = true;
            _title.name      = "ChatLogPanelTitle";

            // Add messagebox component
            _messageBox            = _scrollablepanel.AddUIComponent <UILabel>();
            _messageBox.isVisible  = true;
            _messageBox.isEnabled  = true;
            _messageBox.autoSize   = false;
            _messageBox.autoHeight = true;
            _messageBox.width      = 470;
            _messageBox.height     = 240;
            _messageBox.position   = new Vector2(10, -30);
            _messageBox.textScale  = 0.8f;
            _messageBox.wordWrap   = true;
            _messageBox.name       = "ChatLogPanelMessageBox";

            // Add scrollbar component
            _scrollbar                 = AddUIComponent <UIScrollbar>();
            _scrollbar.name            = "Scrollbar";
            _scrollbar.width           = 20f;
            _scrollbar.height          = _scrollablepanel.height;
            _scrollbar.orientation     = UIOrientation.Vertical;
            _scrollbar.pivot           = UIPivotPoint.TopLeft;
            _scrollbar.position        = new Vector2(480, -30);
            _scrollbar.minValue        = 0;
            _scrollbar.value           = 0;
            _scrollbar.incrementAmount = 50;
            _scrollbar.name            = "ChatLogPanelScrollBar";

            // Add scrollbar background sprite component
            _trackingsprite               = _scrollbar.AddUIComponent <UISlicedSprite>();
            _trackingsprite.position      = new Vector2(0, 0);
            _trackingsprite.autoSize      = true;
            _trackingsprite.size          = _trackingsprite.parent.size;
            _trackingsprite.fillDirection = UIFillDirection.Vertical;
            _trackingsprite.spriteName    = "ScrollbarTrack";
            _trackingsprite.name          = "ChatLogPanelTrack";
            _scrollbar.trackObject        = _trackingsprite;
            _scrollbar.trackObject.height = _scrollbar.height;

            // Add scrollbar thumb component
            _trackingthumb               = _scrollbar.AddUIComponent <UISlicedSprite>();
            _trackingthumb.position      = new Vector2(0, 0);
            _trackingthumb.fillDirection = UIFillDirection.Vertical;
            _trackingthumb.autoSize      = true;
            _trackingthumb.width         = _trackingthumb.parent.width - 8;
            _trackingthumb.spriteName    = "ScrollbarThumb";
            _trackingthumb.name          = "ChatLogPanelThumb";

            _scrollbar.thumbObject             = _trackingthumb;
            _scrollbar.isVisible               = true;
            _scrollbar.isEnabled               = true;
            _scrollablepanel.verticalScrollbar = _scrollbar;

            // Add text field component (used for inputting)
            _chatText                      = (UITextField)AddUIComponent(typeof(UITextField));
            _chatText.width                = width;
            _chatText.height               = 30;
            _chatText.position             = new Vector2(0, -280);
            _chatText.atlas                = UiHelpers.GetAtlas("Ingame");
            _chatText.normalBgSprite       = "TextFieldPanelHovered";
            _chatText.builtinKeyNavigation = true;
            _chatText.isInteractive        = true;
            _chatText.readOnly             = false;
            _chatText.horizontalAlignment  = UIHorizontalAlignment.Left;
            _chatText.eventKeyDown        += OnChatKeyDown;
            _chatText.textColor            = new Color32(0, 0, 0, 255);
            _chatText.padding              = new RectOffset(6, 6, 6, 6);
            _chatText.selectionSprite      = "EmptySprite";
            _chatText.name                 = "ChatLogPanelChatText";

            WelcomeChatMessage();

            // Add resizable adjustments
            eventSizeChanged += (component, param) =>
            {
                _scrollablepanel.width  = (width - 30);
                _scrollablepanel.height = (height - 70);
                _messageBox.width       = (width - 30);
                _chatText.width         = width;
                _scrollbar.height       = _scrollablepanel.height;
                _trackingsprite.size    = _trackingsprite.parent.size;
                _chatText.position      = new Vector3(0, (-height + 30));
                _resize.position        = new Vector2((width - 20), (-height + 10));
                _scrollbar.position     = new Vector2((width - 20), (-30));
            };

            base.Start();
        }
Example #37
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            var tint = UIColor.FromRGB(118, 53, 235);

            UINavigationBar.Appearance.BarTintColor = UIColor.FromRGB(250, 250, 250); //bar background
            UINavigationBar.Appearance.TintColor    = tint;                           //Tint color of button items

            UIBarButtonItem.Appearance.TintColor = tint;                              //Tint color of button items

            UITabBar.Appearance.TintColor = tint;

            UISwitch.Appearance.OnTintColor = tint;

            UIAlertView.Appearance.TintColor = tint;

            UIView.AppearanceWhenContainedIn(typeof(UIAlertController)).TintColor        = tint;
            UIView.AppearanceWhenContainedIn(typeof(UIActivityViewController)).TintColor = tint;
            UIView.AppearanceWhenContainedIn(typeof(SLComposeViewController)).TintColor  = tint;


            Forms.Init();
            FormsMaps.Init();
            Toolkit.Init();

            AppIndexing.SharedInstance.RegisterApp(618319027);

            ZXing.Net.Mobile.Forms.iOS.Platform.Init();
            // Code for starting up the Xamarin Test Cloud Agent
            #if ENABLE_TEST_CLOUD
            Xamarin.Calabash.Start();
            //Mapping StyleId to iOS Labels
            Forms.ViewInitialized += (object sender, ViewInitializedEventArgs e) =>
            {
                if (null != e.View.StyleId)
                {
                    e.NativeView.AccessibilityIdentifier = e.View.StyleId;
                }
            };
            #endif

            SetMinimumBackgroundFetchInterval();

            //Random Inits for Linking out.
            Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
            Plugin.Share.ShareImplementation.ExcludedUIActivityTypes = new List <NSString>
            {
                UIActivityType.PostToFacebook,
                UIActivityType.AssignToContact,
                UIActivityType.OpenInIBooks,
                UIActivityType.PostToVimeo,
                UIActivityType.PostToFlickr,
                UIActivityType.SaveToCameraRoll
            };
            ImageCircle.Forms.Plugin.iOS.ImageCircleRenderer.Init();
            ZXing.Net.Mobile.Forms.iOS.Platform.Init();
            NonScrollableListViewRenderer.Initialize();
            SelectedTabPageRenderer.Initialize();
            TextViewValue1Renderer.Init();
            PullToRefreshLayoutRenderer.Init();
            LoadApplication(new App());



            // Process any potential notification data from launch
            ProcessNotification(options);

            NSNotificationCenter.DefaultCenter.AddObserver(UIApplication.DidBecomeActiveNotification, DidBecomeActive);



            return(base.FinishedLaunching(app, options));
        }
Example #38
0
        public override void Start()
        {
            // Activates the dragging of the window
            AddUIComponent(typeof(UIDragHandle));

            backgroundSprite = "GenericPanel";
            name             = "MPHostGamePanel";
            color            = new Color32(110, 110, 110, 250);

            // Grab the view for calculating width and height of game
            UIView view = UIView.GetAView();

            // Center this window in the game
            relativePosition = new Vector3(view.fixedWidth / 2.0f - 180.0f, view.fixedHeight / 2.0f - 250.0f);

            width  = 360;
            height = 530;

            // Title Label
            this.CreateTitleLabel("Host Server", new Vector2(120, -20));

            // Port Label
            this.CreateLabel("Port:", new Vector2(10, -65));
            // Port field
            _portField = this.CreateTextField("4230", new Vector2(10, -90));
            _portField.numericalOnly = true;

            // Password label
            this.CreateLabel("Password (Optional):", new Vector2(10, -145));
            // Password checkbox
            _passwordBox           = this.CreateCheckBox("Show Password", new Vector2(10, -170));
            _passwordBox.isChecked = false;
            // Password field
            _passwordField = this.CreateTextField("", new Vector2(10, -190));
            _passwordField.isPasswordField = true;

            // Username label
            this.CreateLabel("Username:"******"", new Vector2(10, -270));
            if (PlatformService.active && PlatformService.personaName != null)
            {
                _usernameField.text = PlatformService.personaName;
            }

            _connectionStatus = this.CreateLabel("", new Vector2(10, -310));
            _connectionStatus.textAlignment = UIHorizontalAlignment.Center;
            _connectionStatus.textColor     = new Color32(255, 0, 0, 255);

            // Request IP addresses async
            new Thread(RequestIPs).Start();

            // Create Local IP Label
            _localIp = this.CreateLabel("", new Vector2(10, -330));
            _localIp.textAlignment = UIHorizontalAlignment.Center;

            // Create External IP Label
            _externalIp = this.CreateLabel("", new Vector2(10, -350));
            _externalIp.textAlignment = UIHorizontalAlignment.Center;

            // Create Server Button
            _createButton             = this.CreateButton("Create Server", new Vector2(10, -390));
            _createButton.eventClick += OnCreateServerClick;

            // Close this dialog
            _closeButton             = this.CreateButton("Cancel", new Vector2(10, -460));
            _closeButton.eventClick += (component, param) =>
            {
                isVisible = false;
            };

            _passwordBox.eventClicked += (component, param) =>
            {
                _passwordField.isPasswordField = !_passwordBox.isChecked;
            };
        }
        public override void LoadView()
        {
            // Create the views.
            View = new UIView {
                BackgroundColor = ApplicationTheme.BackgroundColor
            };

            UIScrollView outerScroller = new UIScrollView();

            outerScroller.TranslatesAutoresizingMaskIntoConstraints = false;

            UIStackView outerStackView = new UIStackView();

            outerStackView.TranslatesAutoresizingMaskIntoConstraints = false;
            outerStackView.Axis         = UILayoutConstraintAxis.Horizontal;
            outerStackView.Alignment    = UIStackViewAlignment.Center;
            outerStackView.Distribution = UIStackViewDistribution.Fill;

            UIStackView innerStackView = new UIStackView();

            innerStackView.TranslatesAutoresizingMaskIntoConstraints = false;
            innerStackView.Axis      = UILayoutConstraintAxis.Vertical;
            innerStackView.Alignment = UIStackViewAlignment.Fill;
            innerStackView.Spacing   = 5;

            outerStackView.AddArrangedSubview(innerStackView);

            innerStackView.AddArrangedSubview(getLabel("Configure basemap"));

            innerStackView.AddArrangedSubview(getSliderRow("Min scale: ", 0, 23, _minScale, "", (sender, args) => { _minScale = (int)((UISlider)sender).Value; }));

            innerStackView.AddArrangedSubview(getSliderRow("Max scale: ", 0, 23, _maxScale, "", (sender, args) => { _maxScale = (int)((UISlider)sender).Value; }));

            innerStackView.AddArrangedSubview(getSliderRow("Buffer dist.: ", 0, 500, _bufferExtent, "m", (sender, args) => { _bufferExtent = (int)((UISlider)sender).Value; }));

            innerStackView.AddArrangedSubview(getLabel("Include layers"));

            innerStackView.AddArrangedSubview(getCheckRow("System valves: ", (sender, args) => { _includeSystemValues = !_includeSystemValues; }));

            innerStackView.AddArrangedSubview(getCheckRow("Service connections: ", (sender, args) => { _includeServiceConn = !_includeServiceConn; }));

            innerStackView.AddArrangedSubview(getLabel("Filter feature layer"));

            innerStackView.AddArrangedSubview(getSliderRow("Min. flow: ", 0, 1000, _flowRate, "", (sender, args) => { _flowRate = (int)((UISlider)sender).Value; }));

            innerStackView.AddArrangedSubview(getLabel("Crop layer to extent"));

            innerStackView.AddArrangedSubview(getCheckRow("Water pipes: ", (sender, args) => _cropWaterPipes = !_cropWaterPipes));

            _takeOfflineButton = new UIButton();
            _takeOfflineButton.TranslatesAutoresizingMaskIntoConstraints = false;
            _takeOfflineButton.SetTitle("Take map offline", UIControlState.Normal);
            _takeOfflineButton.SetTitleColor(View.TintColor, UIControlState.Normal);
            innerStackView.AddArrangedSubview(_takeOfflineButton);

            // Add the views.
            View.AddSubview(outerScroller);
            outerScroller.AddSubview(outerStackView);

            // Lay out the views.
            NSLayoutConstraint.ActivateConstraints(new[]
            {
                outerScroller.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor),
                outerScroller.LeadingAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.LeadingAnchor),
                outerScroller.TrailingAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.TrailingAnchor),
                outerScroller.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor),
                outerStackView.LeadingAnchor.ConstraintEqualTo(outerScroller.LeadingAnchor),
                outerStackView.TrailingAnchor.ConstraintEqualTo(outerScroller.TrailingAnchor),
                outerStackView.TopAnchor.ConstraintEqualTo(outerScroller.TopAnchor),
                outerStackView.BottomAnchor.ConstraintEqualTo(outerScroller.BottomAnchor),
                outerStackView.WidthAnchor.ConstraintEqualTo(outerScroller.WidthAnchor)
            });
        }
Example #40
0
 private void Dismiss()
 {
     UIView.Animate(0.25, 0, UIViewAnimationOptions.CurveEaseIn, () =>
                    _innerView.Frame = new CGRect(0, Frame.Height, _innerView.Frame.Width, _innerView.Frame.Height), RemoveFromSuperview);
 }
Example #41
0
 public void Dismiss(UIView sender) => this.viewController.Ht_dismiss(sender);
        public override void LoadView()
        {
            // Create the views.
            View = new UIView {
                BackgroundColor = ApplicationTheme.BackgroundColor
            };

            _myMapView = new MapView();
            _myMapView.TranslatesAutoresizingMaskIntoConstraints = false;

            _takeMapOfflineButton       = new UIBarButtonItem();
            _takeMapOfflineButton.Title = "Generate offline map";

            UIToolbar toolbar = new UIToolbar();

            toolbar.TranslatesAutoresizingMaskIntoConstraints = false;
            toolbar.Items = new[]
            {
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                _takeMapOfflineButton
            };

            _statusLabel = new UILabel
            {
                Text = "Use the button to take the map offline.",
                AdjustsFontSizeToFitWidth = true,
                TextAlignment             = UITextAlignment.Center,
                BackgroundColor           = UIColor.FromWhiteAlpha(0, .6f),
                TextColor = UIColor.White,
                Lines     = 1,
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            _loadingIndicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.WhiteLarge);
            _loadingIndicator.TranslatesAutoresizingMaskIntoConstraints = false;
            _loadingIndicator.BackgroundColor = UIColor.FromWhiteAlpha(0, .6f);

            // Add the views.
            View.AddSubviews(_myMapView, toolbar, _loadingIndicator, _statusLabel);

            // Lay out the views.
            NSLayoutConstraint.ActivateConstraints(new[]
            {
                _myMapView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor),
                _myMapView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor),
                _myMapView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor),
                _myMapView.BottomAnchor.ConstraintEqualTo(toolbar.TopAnchor),

                toolbar.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor),
                toolbar.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor),
                toolbar.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor),

                _statusLabel.TopAnchor.ConstraintEqualTo(_myMapView.TopAnchor),
                _statusLabel.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor),
                _statusLabel.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor),
                _statusLabel.HeightAnchor.ConstraintEqualTo(40),

                _loadingIndicator.TopAnchor.ConstraintEqualTo(_statusLabel.BottomAnchor),
                _loadingIndicator.BottomAnchor.ConstraintEqualTo(View.BottomAnchor),
                _loadingIndicator.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor),
                _loadingIndicator.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor)
            });
        }
Example #43
0
        public BubbleVisualization()
        {
            SFMap maps = new SFMap();

            view          = new UIView();
            view.Frame    = new CGRect(0, 0, 300, 400);
            busyindicator = new SfBusyIndicator();
            busyindicator.ViewBoxWidth  = 75;
            busyindicator.ViewBoxHeight = 75;
            busyindicator.Foreground    = UIColor.FromRGB(0x77, 0x97, 0x72); /*#779772*/
            busyindicator.AnimationType = SFBusyIndicatorAnimationType.SFBusyIndicatorAnimationTypeSlicedCircle;
            view.AddSubview(busyindicator);
            label = new UILabel();
            label.TextAlignment = UITextAlignment.Center;
            label.Text          = "Top 40 Population Countries With Bubbles";
            label.Font          = UIFont.SystemFontOfSize(18);
            label.Frame         = new  CGRect(0, 0, 400, 40);
            label.TextColor     = UIColor.Black;
            view.AddSubview(label);

            NSTimer.CreateScheduledTimer(TimeSpan.FromSeconds(0.3), delegate {
                if (isDisposed)
                {
                    return;
                }
                maps.Frame = new CGRect(Frame.Location.X, 60, Frame.Size.Width - 6, Frame.Size.Height - 60);

                view.AddSubview(maps);
            });

            SFShapeFileLayer layer = new SFShapeFileLayer();

            layer.Uri               = (NSString)NSBundle.MainBundle.PathForResource("world1", "shp");
            layer.ShapeIDPath       = (NSString)"Country";
            layer.ShapeIDTableField = (NSString)"NAME";
            layer.ShowMapItems      = true;
            layer.DataSource        = GetDataSource();

            SFShapeSetting shapeSettings = new SFShapeSetting();

            shapeSettings.Fill  = UIColor.LightGray;
            layer.ShapeSettings = shapeSettings;

            SFBubbleMarkerSetting marker = new SFBubbleMarkerSetting();

            marker.ValuePath      = (NSString)"Percent";
            marker.ColorValuePath = (NSString)"Percent";

            BubbleCustomTooltipSetting tooltipSetting = new BubbleCustomTooltipSetting();

            tooltipSetting.ShowTooltip = true;
            marker.TooltipSettings     = tooltipSetting;

            ObservableCollection <SFMapColorMapping> colorMappings = new ObservableCollection <SFMapColorMapping>();

            SFRangeColorMapping rangeColorMapping1 = new SFRangeColorMapping();

            rangeColorMapping1.To          = 20;
            rangeColorMapping1.From        = 4;
            rangeColorMapping1.LegendLabel = (NSString)"Above 4%";
            rangeColorMapping1.Color       = UIColor.FromRGB(46, 118, 159);
            colorMappings.Add(rangeColorMapping1);

            SFRangeColorMapping rangeColorMapping2 = new SFRangeColorMapping();

            rangeColorMapping2.To          = 4;
            rangeColorMapping2.From        = 2;
            rangeColorMapping2.LegendLabel = (NSString)"4% - 2%";
            rangeColorMapping2.Color       = UIColor.FromRGB(216, 68, 68);
            colorMappings.Add(rangeColorMapping2);

            SFRangeColorMapping rangeColorMapping3 = new SFRangeColorMapping();

            rangeColorMapping3.To          = 2;
            rangeColorMapping3.From        = 1;
            rangeColorMapping3.LegendLabel = (NSString)"2% - 1%";
            rangeColorMapping3.Color       = UIColor.FromRGB(129, 111, 40);
            colorMappings.Add(rangeColorMapping3);

            SFRangeColorMapping rangeColorMapping4 = new SFRangeColorMapping();

            rangeColorMapping4.To          = 1;
            rangeColorMapping4.From        = 0;
            rangeColorMapping4.LegendLabel = (NSString)"Below 1%";
            rangeColorMapping4.Color       = UIColor.FromRGB(127, 56, 160);
            colorMappings.Add(rangeColorMapping4);

            marker.ColorMappings = colorMappings;

            layer.BubbleMarkerSetting = marker;

            SFMapLegendSettings mapLegendSettings = new SFMapLegendSettings();

            mapLegendSettings.ShowLegend = true;
            mapLegendSettings.LegendType = LegendType.Bubbles;

            layer.LegendSettings = mapLegendSettings;

            maps.Layers.Add(layer);


            label2 = new UILabel();
            label2.TextAlignment = UITextAlignment.Center;
            var text1 = new NSString("en.wikipedia.org");

            label2.Text = text1;
            label2.Font = UIFont.SystemFontOfSize(12);
            var stringAtribute = new NSDictionary(UIStringAttributeKey.Font, label2.Font,
                                                  UIStringAttributeKey.ForegroundColor, UIColor.FromRGB(0, 191, 255));
            UIStringAttributes strAtr1 = new UIStringAttributes(stringAtribute);

            label2Size       = text1.GetSizeUsingAttributes(strAtr1);
            label2.TextColor = UIColor.FromRGB(0, 191, 255);
            label2.Frame     = new CGRect(Frame.Size.Width, Frame.Size.Height - 20, 100, 20);
            label2.UserInteractionEnabled = true;
            UITapGestureRecognizer tapGesture = new UITapGestureRecognizer();

            tapGesture.ShouldReceiveTouch += TapGesture_ShouldReceiveTouch;
            label2.AddGestureRecognizer(tapGesture);

            view.AddSubview(label2);

            AddSubview(view);
            maps.Delegate = new MapsBubbleDelegate(this);
        }
        private void InitElements()
        {
            // Enable back navigation using swipe.
            NavigationController.InteractivePopGestureRecognizer.Delegate = null;

            new AppDelegate().disableAllOrientation = true;

            UINavigationController_ = this.NavigationController;

            cellHeight = View.Frame.Height / 12;
            viewWidth  = View.Frame.Width;
            var deviceModel = Xamarin.iOS.DeviceHardware.Model;

            if (deviceModel.Contains("X"))
            {
                headerView.Frame  = new Rectangle(0, 0, Convert.ToInt32(View.Frame.Width), (Convert.ToInt32(View.Frame.Height) / 10) + 8);
                backBn.Frame      = new Rectangle(0, (Convert.ToInt32(View.Frame.Width) / 20) + 20, Convert.ToInt32(View.Frame.Width) / 8, Convert.ToInt32(View.Frame.Width) / 8);
                headerLabel.Frame = new Rectangle(Convert.ToInt32(View.Frame.Width) / 5, (Convert.ToInt32(View.Frame.Width) / 12) + 20, (Convert.ToInt32(View.Frame.Width) / 5) * 3, Convert.ToInt32(View.Frame.Width) / 18);
            }
            else
            {
                headerView.Frame  = new Rectangle(0, 0, Convert.ToInt32(View.Frame.Width), (Convert.ToInt32(View.Frame.Height) / 10));
                backBn.Frame      = new Rectangle(0, Convert.ToInt32(View.Frame.Width) / 20, Convert.ToInt32(View.Frame.Width) / 8, Convert.ToInt32(View.Frame.Width) / 8);
                headerLabel.Frame = new Rectangle(Convert.ToInt32(View.Frame.Width) / 5, Convert.ToInt32(View.Frame.Width) / 12, (Convert.ToInt32(View.Frame.Width) / 5) * 3, Convert.ToInt32(View.Frame.Width) / 18);
            }
            View.BackgroundColor       = UIColor.FromRGB(36, 43, 52);
            headerView.BackgroundColor = UIColor.FromRGB(36, 43, 52);
            headerLabel.Text           = "Создание визитки";

            backBn.ImageEdgeInsets       = new UIEdgeInsets(backBn.Frame.Height / 3.5F, backBn.Frame.Width / 2.35F, backBn.Frame.Height / 3.5F, backBn.Frame.Width / 3);
            create_newBn.BackgroundColor = UIColor.FromRGB(36, 43, 52);
            inner_view.BackgroundColor   = UIColor.FromRGB(36, 43, 52);
            create_newBn.TitleEdgeInsets = new UIEdgeInsets(0, 17, 0, 0);
            create_newBn.SetTitle("Создать новую визитку", UIControlState.Normal);
            create_newBn.Frame      = new Rectangle(0, Convert.ToInt32(headerView.Frame.Y + headerView.Frame.Height), Convert.ToInt32(View.Frame.Width), Convert.ToInt32(View.Frame.Height) / 12);
            create_newBn.Font       = create_newBn.Font.WithSize(19f);
            create_new_forwBn.Frame = new Rectangle(Convert.ToInt32(View.Frame.Width - View.Frame.Width / 20),
                                                    Convert.ToInt32((headerView.Frame.Y + headerView.Frame.Height) + (create_newBn.Frame.Height / 2) - View.Frame.Width / 50),
                                                    Convert.ToInt32(View.Frame.Width / 42),
                                                    Convert.ToInt32(View.Frame.Width) / 25);
            copyFromExistingLabel.Frame = new Rectangle(17, Convert.ToInt32(create_newBn.Frame.Y + create_newBn.Frame.Height), Convert.ToInt32(View.Frame.Width), Convert.ToInt32(View.Frame.Height) / 16);
            copyFromExistingLabel.Text  = "или скопировать из существующих";

            tableView.BackgroundColor = UIColor.FromRGB(36, 43, 52);
            tableView.Frame           = new Rectangle(0,
                                                      (int)(headerView.Frame.Height + create_newBn.Frame.Height + copyFromExistingLabel.Frame.Height),
                                                      (int)(View.Frame.Width),
                                                      (int)(View.Frame.Height - headerView.Frame.Height - create_newBn.Frame.Height - copyFromExistingLabel.Frame.Height));
            emailLogo.Frame = new Rectangle(Convert.ToInt32(View.Frame.Width) / 3,
                                            Convert.ToInt32(View.Frame.Width) / 3,
                                            Convert.ToInt32(View.Frame.Width) / 3,
                                            Convert.ToInt32(View.Frame.Width) / 3);
            mainTextTV.Frame = new Rectangle(0, (Convert.ToInt32(emailLogo.Frame.Y) + Convert.ToInt32(emailLogo.Frame.Height)) + 40, Convert.ToInt32(View.Frame.Width), 26);
            //var d = cardsLogo.Frame.X;
            mainTextTV.Text              = "Получение данных";
            mainTextTV.Font              = mainTextTV.Font.WithSize(22f);
            activityIndicator.Frame      = new Rectangle((int)(View.Frame.Width / 2 - View.Frame.Width / 20), (int)(View.Frame.Height - View.Frame.Width / 5), (int)(View.Frame.Width / 10), (int)(View.Frame.Width / 10));
            activityIndicator.Color      = UIColor.FromRGB(255, 99, 62);
            headerView.Hidden            = true;
            create_newBn.Hidden          = true;
            create_new_forwBn.Hidden     = true;
            copyFromExistingLabel.Hidden = true;
            tableView.Hidden             = true;
            mainTextTV.Hidden            = false;
            emailLogo.Hidden             = false;
            activityIndicator.Hidden     = false;


            staticLoaderView                 = new UIView();
            staticLoaderView.Frame           = new CoreGraphics.CGRect(0, 0, View.Frame.Width, View.Frame.Height);
            staticLoaderView.BackgroundColor = UIColor.FromRGB(36, 43, 52);
            loaderLogo       = new UIImageView();
            loaderLogo.Frame = new Rectangle(Convert.ToInt32(View.Frame.Width) / 3,
                                             Convert.ToInt32(View.Frame.Width) / 3,
                                             Convert.ToInt32(View.Frame.Width) / 3,
                                             Convert.ToInt32(View.Frame.Width) / 3);
            loaderLogo.Image      = UIImage.FromBundle("email_confirm_waiting.png");
            loaderIndicator       = new UIActivityIndicatorView();
            loaderIndicator.Color = UIColor.FromRGB(255, 99, 62);
            loaderIndicator.StartAnimating();
            loaderIndicator.Frame = new Rectangle((int)(View.Frame.Width / 2 - View.Frame.Width / 20), (int)(View.Frame.Height - View.Frame.Width / 5), (int)(View.Frame.Width / 10), (int)(View.Frame.Width / 10));
            loaderLabel           = new UILabel();
            loaderLabel.Frame     = new Rectangle(0, (Convert.ToInt32(loaderLogo.Frame.Y) + Convert.ToInt32(loaderLogo.Frame.Height)) + 40, Convert.ToInt32(View.Frame.Width), 26);
            //var d = cardsLogo.Frame.X;
            loaderLabel.Text          = "Получение данных";
            loaderLabel.TextColor     = UIColor.White;
            loaderLabel.Font          = loaderLabel.Font.WithSize(22f);
            loaderLabel.TextAlignment = UITextAlignment.Center;

            staticLoaderView.AddSubviews(loaderLogo, loaderLabel, loaderIndicator);
            staticLoaderView.Hidden = true;
            View.AddSubview(staticLoaderView);

            create_newBn.Font = UIFont.FromName(Constants.fira_sans, 17f);
            mainTextTV.Font   = UIFont.FromName(Constants.fira_sans, 17f);
        }
 void ReleaseDesignerOutlets()
 {
     if (btn_askButton != null)
     {
         btn_askButton.Dispose();
         btn_askButton = null;
     }
     if (btn_Game != null)
     {
         btn_Game.Dispose();
         btn_Game = null;
     }
     if (btn_left != null)
     {
         btn_left.Dispose();
         btn_left = null;
     }
     if (btn_map != null)
     {
         btn_map.Dispose();
         btn_map = null;
     }
     if (btn_menu != null)
     {
         btn_menu.Dispose();
         btn_menu = null;
     }
     if (btn_right != null)
     {
         btn_right.Dispose();
         btn_right = null;
     }
     if (img_animation != null)
     {
         img_animation.Dispose();
         img_animation = null;
     }
     if (img_background != null)
     {
         img_background.Dispose();
         img_background = null;
     }
     if (img_exhibit != null)
     {
         img_exhibit.Dispose();
         img_exhibit = null;
     }
     if (lbl_exhibit != null)
     {
         lbl_exhibit.Dispose();
         lbl_exhibit = null;
     }
     if (lbl_exibitName != null)
     {
         lbl_exibitName.Dispose();
         lbl_exibitName = null;
     }
     if (scroll_lower != null)
     {
         scroll_lower.Dispose();
         scroll_lower = null;
     }
     if (txt_askQuestion != null)
     {
         txt_askQuestion.Dispose();
         txt_askQuestion = null;
     }
     if (txt_basicInfo != null)
     {
         txt_basicInfo.Dispose();
         txt_basicInfo = null;
     }
     if (txt_moreInfo != null)
     {
         txt_moreInfo.Dispose();
         txt_moreInfo = null;
     }
     if (view_base != null)
     {
         view_base.Dispose();
         view_base = null;
     }
 }
Example #46
0
        public void mainPageDesign()
        {
            redpanel = new UIView();
            redpanel.BackgroundColor = UIColor.Red;
            this.AddSubview(redpanel);
            //emaill
            email                 = new UILabel();
            email.TextColor       = UIColor.White;
            email.BackgroundColor = UIColor.Clear;
            email.Text            = @"Email - Compose";
            email.TextAlignment   = UITextAlignment.Left;
            email.Font            = UIFont.FromName("Helvetica", 16f);
            redpanel.AddSubview(email);

            //attachl
            attach                 = new UILabel();
            attach.TextColor       = UIColor.White;
            attach.BackgroundColor = UIColor.Clear;
            attach.Text            = @"Attach";
            attach.TextAlignment   = UITextAlignment.Left;
            attach.Font            = UIFont.FromName("Helvetica", 16f);
            redpanel.AddSubview(attach);

            //sendl
            send                 = new UILabel();
            send.TextColor       = UIColor.White;
            send.BackgroundColor = UIColor.Clear;
            send.Text            = @"Send";
            send.TextAlignment   = UITextAlignment.Left;
            send.Font            = UIFont.FromName("Helvetica", 16f);
            redpanel.AddSubview(send);

            //ToLabell
            ToLabel                 = new UILabel();
            ToLabel.TextColor       = UIColor.Black;
            ToLabel.BackgroundColor = UIColor.Clear;
            ToLabel.Text            = @"To";
            ToLabel.TextAlignment   = UITextAlignment.Left;
            ToLabel.Font            = UIFont.FromName("Helvetica", 13f);
            this.AddSubview(ToLabel);

            //ccLabell
            ccLabel                 = new UILabel();
            ccLabel.TextColor       = UIColor.Black;
            ccLabel.BackgroundColor = UIColor.Clear;
            ccLabel.Text            = @"Cc";
            ccLabel.TextAlignment   = UITextAlignment.Left;
            ccLabel.Font            = UIFont.FromName("Helvetica", 13f);
            this.AddSubview(ccLabel);

            //bcclabell
            bcclabel                 = new UILabel();
            bcclabel.TextColor       = UIColor.Black;
            bcclabel.BackgroundColor = UIColor.Clear;
            bcclabel.Text            = @"Bcc";
            bcclabel.TextAlignment   = UITextAlignment.Left;
            bcclabel.Font            = UIFont.FromName("Helvetica", 13f);
            this.AddSubview(bcclabel);

            this.BackgroundColor = UIColor.White;
        }
Example #47
0
		public static void SetBindingContext(this UIView target, object bindingContext, Func<UIView, IEnumerable<UIView>> getChildren = null)
		{
			NativeBindingHelpers.SetBindingContext(target, bindingContext, getChildren);
		}
        void getPropertiesInitialization()
        {
            navigationModePicker      = new UIPickerView();
            navigationDirectionPicker = new UIPickerView();
            tabStripPicker            = new UIPickerView();
            PickerModel navigationModeModel = new PickerModel(navigationModeList);

            navigationModePicker.Model = navigationModeModel;
            PickerModel navigationDirectionModel = new PickerModel(navigationDirectionList);

            navigationDirectionPicker.Model = navigationDirectionModel;
            PickerModel tabStripModel = new PickerModel(tabStripPositionList);

            tabStripPicker.Model = tabStripModel;

            //navigationModeLabel
            navigationModeLabel                    = new UILabel();
            navigationModeLabel.Text               = "NavigationStrip Mode";
            navigationModeLabel.Font               = UIFont.FromName("Helvetica", 14f);
            navigationModeLabel.TextColor          = UIColor.Black;
            navigationModeLabel.TextAlignment      = UITextAlignment.Left;
            navigationDirectionLabel               = new UILabel();
            navigationDirectionLabel.Text          = "Navigation Direction";
            navigationDirectionLabel.Font          = UIFont.FromName("Helvetica", 14f);
            navigationDirectionLabel.TextColor     = UIColor.Black;
            navigationDirectionLabel.TextAlignment = UITextAlignment.Left;
            tabStripLabel               = new UILabel();
            tabStripLabel.Text          = "NavigationStrip Position";
            tabStripLabel.Font          = UIFont.FromName("Helvetica", 14f);
            tabStripLabel.TextColor     = UIColor.Black;
            tabStripLabel.TextAlignment = UITextAlignment.Left;

            //navigationModeButton
            navigationModeButton = new UIButton();
            navigationModeButton.SetTitle("Dots", UIControlState.Normal);
            navigationModeButton.Font = UIFont.FromName("Helvetica", 14f);
            navigationModeButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            navigationModeButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            navigationModeButton.Layer.CornerRadius  = 8;
            navigationModeButton.Layer.BorderWidth   = 2;
            navigationModeButton.TouchUpInside      += ShownavigationModePicker;
            navigationModeButton.Layer.BorderColor   = UIColor.FromRGB(246, 246, 246).CGColor;

            //navigationDirectionButton
            navigationDirectionButton = new UIButton();
            navigationDirectionButton.SetTitle("Horizontal", UIControlState.Normal);
            navigationDirectionButton.Font = UIFont.FromName("Helvetica", 14f);
            navigationDirectionButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            navigationDirectionButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            navigationDirectionButton.Layer.CornerRadius  = 8;
            navigationDirectionButton.Layer.BorderWidth   = 2;
            navigationDirectionButton.TouchUpInside      += ShownavigationDirectionPicker;
            navigationDirectionButton.Layer.BorderColor   = UIColor.FromRGB(246, 246, 246).CGColor;

            //tabStripButton
            tabStripButton = new UIButton();
            tabStripButton.SetTitle("Bottom", UIControlState.Normal);
            tabStripButton.Font = UIFont.FromName("Helvetica", 14f);
            tabStripButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            tabStripButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            tabStripButton.Layer.CornerRadius  = 8;
            tabStripButton.Layer.BorderWidth   = 2;
            tabStripButton.TouchUpInside      += ShowtabStripPicker;
            tabStripButton.Layer.BorderColor   = UIColor.FromRGB(246, 246, 246).CGColor;

            //doneButton
            doneButton = new UIButton();
            doneButton.SetTitle("Done\t", UIControlState.Normal);
            doneButton.Font = UIFont.FromName("Helvetica", 14f);
            doneButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            doneButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
            doneButton.TouchUpInside      += HidePicker;
            doneButton.Hidden          = true;
            doneButton.BackgroundColor = UIColor.FromRGB(240, 240, 240);

            //picker
            navigationModeModel.PickerChanged               += navigationModeSelectedIndexChanged;
            navigationDirectionModel.PickerChanged          += navigationDirectionSelectedIndexChanged;
            tabStripModel.PickerChanged                     += tabStripSelectedIndexChanged;
            navigationModePicker.ShowSelectionIndicator      = true;
            navigationModePicker.Hidden                      = true;
            navigationModePicker.BackgroundColor             = UIColor.Gray;
            navigationDirectionPicker.BackgroundColor        = UIColor.Gray;
            navigationDirectionPicker.ShowSelectionIndicator = true;
            navigationDirectionPicker.Hidden                 = true;
            tabStripPicker.BackgroundColor                   = UIColor.Gray;
            tabStripPicker.ShowSelectionIndicator            = true;
            tabStripPicker.Hidden = true;

            //autoPlayLabel
            autoPlayLabel                 = new UILabel();
            autoPlayLabel.TextColor       = UIColor.Black;
            autoPlayLabel.BackgroundColor = UIColor.Clear;
            autoPlayLabel.Text            = @"Enable AutoPlay";
            autoPlayLabel.TextAlignment   = UITextAlignment.Left;
            autoPlayLabel.Font            = UIFont.FromName("Helvetica", 14f);
            //allowSwitch
            autoPlaySwitch = new UISwitch();
            autoPlaySwitch.ValueChanged += autoPlayToggleChanged;
            autoPlaySwitch.On            = false;
            autoPlaySwitch.OnTintColor   = UIColor.FromRGB(50, 150, 221);

            controlView.AddSubview(rotator);
            this.AddSubview(controlView);

            sub_View           = new UIView();
            propertiesLabel    = new UILabel();
            closeButton        = new UIButton();
            showPropertyButton = new UIButton();

            //adding to content view
            contentView.AddSubview(navigationModeLabel);
            contentView.AddSubview(navigationModeButton);
            contentView.AddSubview(navigationDirectionLabel);
            contentView.AddSubview(navigationDirectionButton);
            contentView.AddSubview(tabStripLabel);
            contentView.AddSubview(tabStripButton);
            contentView.AddSubview(autoPlayLabel);
            contentView.AddSubview(autoPlaySwitch);
            contentView.AddSubview(doneButton);
            contentView.AddSubview(navigationModePicker);
            contentView.AddSubview(tabStripPicker);
            contentView.AddSubview(navigationDirectionPicker);
            contentView.BackgroundColor = UIColor.FromRGB(240, 240, 240);

            //adding to sub_view
            sub_View.AddSubview(contentView);
            sub_View.AddSubview(closeButton);
            sub_View.AddSubview(propertiesLabel);
            sub_View.BackgroundColor = UIColor.FromRGB(230, 230, 230);
            this.AddSubview(sub_View);
            propertiesLabel.Text = "OPTIONS";

            //showPropertyButton
            showPropertyButton.Hidden = true;
            showPropertyButton.SetTitle("OPTIONS\t", UIControlState.Normal);
            showPropertyButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;
            showPropertyButton.BackgroundColor     = UIColor.FromRGB(230, 230, 230);
            showPropertyButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            showPropertyButton.TouchUpInside += (object sender, EventArgs e) => {
                sub_View.Hidden           = false;
                showPropertyButton.Hidden = true;
            };
            this.AddSubview(showPropertyButton);

            //CloseButton
            closeButton.SetTitle("X\t", UIControlState.Normal);
            closeButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;
            closeButton.BackgroundColor     = UIColor.FromRGB(230, 230, 230);
            closeButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            closeButton.TouchUpInside += (object sender, EventArgs e) => {
                sub_View.Hidden           = true;
                showPropertyButton.Hidden = false;
            };

            //AddingGesture
            UITapGestureRecognizer tapgesture = new UITapGestureRecognizer(() => {
                sub_View.Hidden           = true;
                showPropertyButton.Hidden = false;
            }
                                                                           );

            propertiesLabel.UserInteractionEnabled = true;
            propertiesLabel.AddGestureRecognizer(tapgesture);
        }
Example #49
0
		public static void SetBinding(this UIView self, BindableProperty targetProperty, BindingBase binding)
		{
			NativeBindingHelpers.SetBinding(self, targetProperty, binding);
		}
Example #50
0
		internal static void TransferbindablePropertiesToWrapper(this UIView target, View wrapper)
		{
			NativeBindingHelpers.TransferBindablePropertiesToWrapper(target, wrapper);
		}
        public async Task HandleTouch(TouchStatus status, TouchInteractionStatus?interactionStatus = null)
        {
            if (IsCanceled || effect == null)
            {
                return;
            }

            if (effect?.IsDisabled ?? true)
            {
                return;
            }

            if (interactionStatus == TouchInteractionStatus.Started)
            {
                effect?.HandleUserInteraction(TouchInteractionStatus.Started);
                interactionStatus = null;
            }

            effect?.HandleTouch(status);
            if (interactionStatus.HasValue)
            {
                effect?.HandleUserInteraction(interactionStatus.Value);
            }

            if (effect == null || (!effect.NativeAnimation && !IsButton) || !effect.CanExecute)
            {
                return;
            }

            var control = effect.Element;

            if (control?.GetRenderer() is not UIView renderer)
            {
                return;
            }

            var color        = effect.NativeAnimationColor;
            var radius       = effect.NativeAnimationRadius;
            var shadowRadius = effect.NativeAnimationShadowRadius;
            var isStarted    = status == TouchStatus.Started;

            defaultRadius       = (float?)(defaultRadius ?? renderer.Layer.CornerRadius);
            defaultShadowRadius = (float?)(defaultShadowRadius ?? renderer.Layer.ShadowRadius);
            defaultShadowOpacity ??= renderer.Layer.ShadowOpacity;

            await UIView.AnimateAsync(.2, () =>
            {
                if (color == Color.Default)
                {
                    renderer.Layer.Opacity = isStarted ? 0.5f : (float)control.Opacity;
                }
                else
                {
                    renderer.Layer.BackgroundColor = (isStarted ? color : control.BackgroundColor).ToCGColor();
                }

                renderer.Layer.CornerRadius = isStarted ? radius : defaultRadius.GetValueOrDefault();

                if (shadowRadius >= 0)
                {
                    renderer.Layer.ShadowRadius  = isStarted ? shadowRadius : defaultShadowRadius.GetValueOrDefault();
                    renderer.Layer.ShadowOpacity = isStarted ? 0.7f : defaultShadowOpacity.GetValueOrDefault();
                }
            });
        }
Example #52
0
		public static void SetValue(this UIView target, BindableProperty targetProperty, object value)
		{
			NativeBindingHelpers.SetValue(target, targetProperty, value);
		}
 public TagCell(IntPtr handle) : base(handle)
 {
     this.Apply(Style.Screen);
     ContentView.Add(nameLabel = new UILabel().Apply(Style.TagList.NameLabel));
     BackgroundView            = new UIView().Apply(Style.TagList.RowBackground);
 }
Example #54
0
		public static IEnumerable<UIView> Descendants(this UIView self)
		{
			if (self.Subviews == null)
				return Enumerable.Empty<UIView>();
			return self.Subviews.Concat(self.Subviews.SelectMany(s => s.Descendants()));
		}
        public void OnToolbarItemActivated(AccountSwitchingOverlayView accountSwitchingOverlayView, UIView containerView)
        {
            var overlayVisible = accountSwitchingOverlayView.IsVisible;

            if (!overlayVisible)
            {
                // So that the animation doesn't break we only care about showing it
                // and the hiding if done through AccountSwitchingOverlayView -> AfterHide
                containerView.Hidden = false;
            }
            accountSwitchingOverlayView.ToggleVisibililtyCommand.Execute(null);
            containerView.UserInteractionEnabled             = !overlayVisible;
            containerView.Subviews[0].UserInteractionEnabled = !overlayVisible;
        }
Example #56
0
        public override void LoadView()
        {
            View = new UIView()
                   .Apply(Style.Screen);

            View.Add(inputsContainer = new UIView().Apply(Style.Login.InputsContainer));

            inputsContainer.Add(topBorder = new UIView().Apply(Style.Login.InputsBorder));

            inputsContainer.Add(emailTextField = new UITextField()
            {
                Placeholder            = "LoginEmailHint".Tr(),
                AutocapitalizationType = UITextAutocapitalizationType.None,
                KeyboardType           = UIKeyboardType.EmailAddress,
                ReturnKeyType          = UIReturnKeyType.Next,
                ClearButtonMode        = UITextFieldViewMode.Always,
                ShouldReturn           = HandleShouldReturn,
                AutocorrectionType     = UITextAutocorrectionType.No
            }.Apply(Style.Login.EmailField));

            inputsContainer.Add(middleBorder = new UIView().Apply(Style.Login.InputsBorder));

            inputsContainer.Add(passwordTextField = new PasswordTextField()
            {
                Placeholder            = "LoginPasswordHint".Tr(),
                AutocapitalizationType = UITextAutocapitalizationType.None,
                AutocorrectionType     = UITextAutocorrectionType.No,
                SecureTextEntry        = true,
                ReturnKeyType          = UIReturnKeyType.Go,
                ShouldReturn           = HandleShouldReturn,
            }.Apply(Style.Login.PasswordField));

            inputsContainer.Add(bottomBorder = new UIView().Apply(Style.Login.InputsBorder));

            View.Add(passwordActionButton = new UIButton()
                                            .Apply(Style.Login.LoginButton));
            passwordActionButton.SetTitle("LoginLoginButtonText".Tr(), UIControlState.Normal);
            passwordActionButton.TouchUpInside += OnPasswordActionButtonTouchUpInside;

            inputsContainer.AddConstraints(
                topBorder.AtTopOf(inputsContainer),
                topBorder.AtLeftOf(inputsContainer),
                topBorder.AtRightOf(inputsContainer),
                topBorder.Height().EqualTo(1f),

                emailTextField.Below(topBorder),
                emailTextField.AtLeftOf(inputsContainer, 20f),
                emailTextField.AtRightOf(inputsContainer, 10f),
                emailTextField.Height().EqualTo(42f),

                middleBorder.Below(emailTextField),
                middleBorder.AtLeftOf(inputsContainer, 20f),
                middleBorder.AtRightOf(inputsContainer),
                middleBorder.Height().EqualTo(1f),

                passwordTextField.Below(middleBorder),
                passwordTextField.AtLeftOf(inputsContainer, 20f),
                passwordTextField.AtRightOf(inputsContainer),
                passwordTextField.Height().EqualTo(42f),

                bottomBorder.Below(passwordTextField),
                bottomBorder.AtLeftOf(inputsContainer),
                bottomBorder.AtRightOf(inputsContainer),
                bottomBorder.AtBottomOf(inputsContainer),
                bottomBorder.Height().EqualTo(1f)
                );

            inputsContainer.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                inputsContainer.AtTopOf(View, 80f),
                inputsContainer.AtLeftOf(View),
                inputsContainer.AtRightOf(View),

                passwordActionButton.Below(inputsContainer, 20f),
                passwordActionButton.AtLeftOf(View),
                passwordActionButton.AtRightOf(View),
                passwordActionButton.Height().EqualTo(60f)
                );

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
        }
Example #57
0
        public override void LayoutSubviews()
        {
            base.LayoutSubviews();

            // update bottom border frame
            _bottomBorder.Frame = new CGRect(0.0f, Frame.Size.Height - 1.0f, Frame.Size.Width, 1.0f);

            _validationLabel.SizeToFit();
            _validationLabel.Frame = new CGRect(
                0, Frame.Height,
                Frame.Width, _validationLabel.Font.LineHeight);

            Action updateLabel = () =>
            {
                if (!string.IsNullOrEmpty(Text))
                {
                    _floatingLabel.Alpha = 1.0f;
                    _floatingLabel.Frame =
                        new CGRect(
                            _floatingLabel.Frame.Location.X,
                            2.0f,
                            _floatingLabel.Frame.Size.Width,
                            _floatingLabel.Frame.Size.Height);
                }
                else
                {
                    _floatingLabel.Alpha = 0.0f;
                    _floatingLabel.Frame =
                        new CGRect(
                            _floatingLabel.Frame.Location.X,
                            _floatingLabel.Font.LineHeight,
                            _floatingLabel.Frame.Size.Width,
                            _floatingLabel.Frame.Size.Height);
                }
            };

            if (IsFirstResponder)
            {
                _floatingLabel.TextColor = FloatingLabelActiveTextColor;

                var shouldFloat = !string.IsNullOrEmpty(Text);
                var isFloating  = _floatingLabel.Alpha == 1f;

                if (shouldFloat == isFloating)
                {
                    updateLabel();
                }
                else
                {
                    UIView.Animate(
                        0.3f, 0.0f,
                        UIViewAnimationOptions.BeginFromCurrentState
                        | UIViewAnimationOptions.CurveEaseOut,
                        () => updateLabel(),
                        () => { });
                }
            }
            else
            {
                _floatingLabel.TextColor = FloatingLabelTextColor;

                updateLabel();
            }
        }
Example #58
0
        // Override GetView to create different label colors for each type of transformation.
        public override UIView GetView(UIPickerView pickerView, nint row, nint component, UIView view)
        {
            // Get the transformation being displayed.
            DatumTransformation thisTransform = _datumTransformations[(int)row];

            // See if this is the default transformation and if it's available (has required PE files).
            bool isDefault      = thisTransform.Name == _defaultTransformation.Name;
            bool isNotAvailable = thisTransform.IsMissingProjectionEngineFiles;

            // Create the correct color for the transform type (available=black, default=blue, or unavailable=gray).
            UIColor labelColor = UIColor.Black;

            if (isNotAvailable)
            {
                labelColor = UIColor.Gray;
            }

            if (isDefault)
            {
                labelColor = UIColor.Black;
            }

            // Create a label to display the transform.
            return(new UILabel(new RectangleF(0, 0, 260f, 30f))
            {
                TextColor = labelColor,
                Font = UIFont.SystemFontOfSize(16f),
                TextAlignment = UITextAlignment.Center,
                Text = thisTransform.Name
            });
        }
Example #59
0
        private void ReloopForInterfaceChange()
        {
            if (this.updating)
            {
                return;
            }
            UIImage single      = int.Parse(UIDevice.CurrentDevice.SystemVersion.Split('.')[0]) >= 7 ? this.TintedImage(this.AnimationImage) : this.AnimationImage;
            var     imgs        = this.AnimationImages;
            var     masterImage = this.MasterImage;

            if (this.MasterImage == null || imgs == null || imgs.Count == 0 || imgs.First().Size.Width != this.Frame.Width)
            {
                var  expectedWidth  = this.Frame.Width + SingleElementWidth;
                bool completeReloop = this.MasterImage == null;

                if (completeReloop)
                {
                    masterImage = new UIImage(single.CGImage);
                    while (masterImage.Size.Width - SingleElementWidth < expectedWidth)
                    {
                        masterImage = masterImage.AttachImageRight(single);
                    }
                }
                else
                {
                    if (masterImage.Size.Width - SingleElementWidth < expectedWidth)
                    {
                        while (masterImage.Size.Width - SingleElementWidth < expectedWidth)
                        {
                            masterImage = masterImage.AttachImageRight(single);
                        }
                    }
                    else
                    {
                        while (masterImage.Size.Width - SingleElementWidth > expectedWidth + SingleElementWidth)
                        {
                            masterImage = masterImage.CropByX(SingleElementWidth);
                        }
                    }
                }

                this.MasterImage = masterImage;

                if (imgs == null)
                {
                    imgs = new List <UIImage>();
                }
                else
                {
                    imgs.Clear();
                }

                var size    = new CGSize(this.Frame.Width, masterImage.Size.Height);
                var pixels  = single.Size.Width * single.CurrentScale;
                var anchorX = -Math.Abs(masterImage.Size.Width - size.Width);
                for (int i = 0; i <= pixels; i++)
                {
                    UIGraphics.BeginImageContextWithOptions(size, false, single.CurrentScale);
                    CGContext context = UIGraphics.GetCurrentContext();
                    if (context != null)
                    {
                        context.TranslateCTM(0, masterImage.Size.Height);
                        context.ScaleCTM(1, -1);

                        context.DrawImage(new CGRect(anchorX + i, 0.0, masterImage.Size.Width, masterImage.Size.Height), masterImage.CGImage);

                        UIImage result = UIGraphics.GetImageFromCurrentImageContext();

                        imgs.Add(result);
                    }

                    UIGraphics.EndImageContext();
                }
            }

            this.AnimationImages = imgs;

            if (this.theImageView == null)
            {
                this.theImageView = new UIImageView();
            }
            if (this.host == null)
            {
                this.host = new UIView(this.Bounds);
                this.host.BackgroundColor = UIColor.Clear;

                if (int.Parse(UIDevice.CurrentDevice.SystemVersion.Split('.')[0]) >= 7)
                {
                    // this.host.Layer.CornerRadius = this.Frame.Size.Height / 2.0f;
                }
                else
                {
                    this.host.Layer.CornerRadius = this.theImageView.Frame.Size.Height / 2;
                }
                this.host.ClipsToBounds = true;
            }

            this.theImageView.Layer.MasksToBounds = true;

            if (this.host.Superview != this)
            {
                this.AddSubview(this.host);
            }

            if (this.theImageView.Superview != this.host)
            {
                this.host.AddSubview(this.theImageView);
            }

            this.theImageView.AnimationImages = imgs.ToArray();

            if (this.theImageView.AnimationDuration != this.animationSpeed)
            {
                this.theImageView.AnimationDuration = this.animationSpeed;
            }

            this.LayoutImageView();

            if (!this.theImageView.IsAnimating)
            {
                this.theImageView.StartAnimating();
            }
        }
Example #60
0
        public void HandleLongPressGesture(UILongPressGestureRecognizer recognizer)
        {
            var point = recognizer.LocationInView(_paletteView);

            switch (recognizer.State)
            {
            case UIGestureRecognizerState.Began:
            {
                if (_currentView == null)
                {
                    var touchedView = _paletteView.HitTest(point, null);

                    if (!touchedView.Equals(_paletteView))
                    {
                        UIView.Animate(0.5, () =>
                            {
                                _previousDeleteViewFrame = _deleteView.Frame;
                                var frame = _deleteView.Frame;
                                frame.Y   = frame.Y - 190f;

                                _deleteView.Frame = frame;
                                _paletteView.BringSubviewToFront(_deleteView);
                            });

                        _paletteView.BringSubviewToFront(touchedView);
                        _currentView   = touchedView;
                        _previousView  = touchedView;
                        _previousPoint = touchedView.Center;
                    }
                }
            }
            break;

            case UIGestureRecognizerState.Changed:
            {
                if (_currentView != null)
                {
                    var center = _currentView.Center;
                    center.X += point.X - _previousView.Center.X;
                    center.Y += point.Y - _previousView.Center.Y;

                    _currentView.Center = center;
                }
            }
            break;

            case UIGestureRecognizerState.Ended:
            {
                if (_currentView != null)
                {
                    var deletePoint = recognizer.LocationInView(_deleteView);

                    if (_deleteView.Bounds.Contains(deletePoint))
                    {
                        var temp  = _currentView.Layer.Sublayers.First().Name.Split(new char[] { '_' });
                        var index = int.Parse(temp[1]);
                        var color = _colors.ElementAt(index);
                        _colors.Remove(color.Key);

                        _favoriteColorManager.Delete(color.Key);

                        ClearColorGrid();
                        SetColorGrid();
                    }

                    _currentView.Center = _previousPoint;
                    _currentView        = null;

                    UIView.Animate(0.5, () =>
                        {
                            _deleteView.Frame = _previousDeleteViewFrame;
                        });
                }
            }
            break;
            }
        }