/**
  * Locates all textfields in the given view and registers a handler to dismiss the keyboard when the user clicks 'Done'
  */
 public static void RegisterKeyboardDismissalHandler(UIView view)
 {
     UITapGestureRecognizer gesture = new UITapGestureRecognizer(() => view.EndEditing(true));
     gesture.CancelsTouchesInView = false; //for iOS5. Otherwise events will not be fired on other controls.
     view.AddGestureRecognizer(gesture);
     RegisterKeyboardDoneHandlers (view);
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

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

            MvxFluentBindingDescriptionSet<LoginViewController, LoginViewModel> set =
                this.CreateBindingSet<LoginViewController, LoginViewModel>();
            set.Bind(textField_Email).To(vm => vm.Email);
            set.Bind(textField_Password).To(vm => vm.Password);
            set.Bind(btn_Login).To(x => x.LoginCommand);
            set.Apply();

            var gestureRecognizer = new UITapGestureRecognizer(() =>
            {
                textField_Email.ResignFirstResponder();
                textField_Password.ResignFirstResponder();
            });

            View.AddGestureRecognizer(gestureRecognizer);
        }
		public TapGestureAttacher (UIView view, int tapCount, Action handler)
		{
			var tap = new UITapGestureRecognizer (handler);
			tap.NumberOfTapsRequired = (uint)tapCount;

			view.AddGestureRecognizer (tap);
		}
        /// <summary>
        /// Initializes a new instance of the <see cref="SlideoutNavigationController"/> class.
        /// </summary>
        public SlideoutNavigationController()
        {
            SlideSpeed = 0.2f;
            SlideWidth = 245f;
            // HACK to detect pan gesture from the whole viewport
            SlideHeight = float.MaxValue;
            LayerShadowing = false;

            _internalMenuViewLeft = new ProxyNavigationController {
                ParentController = this,
                View = { AutoresizingMask = UIViewAutoresizing.FlexibleHeight }
            };
            _internalMenuViewRight = new ProxyNavigationController {
                ParentController = this,
                View = { AutoresizingMask = UIViewAutoresizing.FlexibleHeight }
            };

            _internalMenuViewLeft.SetNavigationBarHidden (DisplayNavigationBarOnLeftMenu, false);
            _internalMenuViewRight.SetNavigationBarHidden (DisplayNavigationBarOnRightMenu, false);

            _internalTopView = new UIViewController { View = { UserInteractionEnabled = true } };
            _internalTopView.View.Layer.MasksToBounds = false;

            _tapGesture = new UITapGestureRecognizer ();
            _tapGesture.AddTarget (() => Hide ());
            _tapGesture.NumberOfTapsRequired = 1;

            _panGesture = new UIPanGestureRecognizer {
                Delegate = new SlideoutPanDelegate(this),
                MaximumNumberOfTouches = 1,
                MinimumNumberOfTouches = 1
            };
            _panGesture.AddTarget (() => Pan (_internalTopView.View));
            _internalTopView.View.AddGestureRecognizer (_panGesture);
        }
        protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement == null)
            {
                var label = Control;
                label.TextColor = UIColor.Red;
                label.BackgroundColor = UIColor.Clear;
                label.UserInteractionEnabled = true;
                var tap = new UITapGestureRecognizer();

                tap.AddTarget(() =>
                {
                    var hyperLinkLabel = Element as HyperLinkControl;

                    if (hyperLinkLabel != null)
                    {
                        var uri = hyperLinkLabel.NavigateUri;

                        if (uri.Contains("@") && !uri.StartsWith("mailto:"))
                            uri = string.Format("{0}{1}", "mailto:", uri);
                        else if (uri.StartsWith("www."))
                            uri = string.Format("{0}{1}", @"http://", uri);

                        UIApplication.SharedApplication.OpenUrl(new NSUrl(uri));
                    }
                });

                tap.NumberOfTapsRequired = 1;
                tap.DelaysTouchesBegan = true;
                label.AddGestureRecognizer(tap);
            }
        }
        public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();

            View.Apply (Style.Screen);
            NavigationBar.Apply (Style.NavigationBar);
            Delegate = new NavDelegate ();

            tapGesture = new UITapGestureRecognizer (OnTapGesture) {
                ShouldReceiveTouch = (a, b) => true,
                ShouldRecognizeSimultaneously = (a, b) => true,
                CancelsTouchesInView = true
            };

            panGesture = new UIPanGestureRecognizer (OnPanGesture) {
                // TODO: TableView scroll gestures are not
                // compatible with the open / close pan gesture.
                ShouldRecognizeSimultaneously = (a, b) => ! (b.View is UITableView),
                CancelsTouchesInView = true,
            };

            View.AddGestureRecognizer (tapGesture);
            View.AddGestureRecognizer (panGesture);

            fadeView = new UIView();
            fadeView.BackgroundColor = UIColor.FromRGBA (29f / 255f, 29f / 255f, 28f / 255f, 0.5f);
            fadeView.Frame = new CGRect (0, 0, View.Frame.Width, View.Frame.Height);
            fadeView.Hidden = true;
            View.Add (fadeView);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View.BackgroundColor = UIColor.White;
            View.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;

            // Adjust taps/touches required to fit your needs.
            UITapGestureRecognizer tapRecognizer = new UITapGestureRecognizer() {
                NumberOfTapsRequired = 1,
                NumberOfTouchesRequired = 1,
            };
            tapRecognizer.AddTarget((sender) => {
                // The foreach is only necessary if you have more than one touch for your recognizer.
                // For all else just roll with zero, `PointF location = tapRecognizer.LocationOfTouch(0, View);`
                foreach (int locationIndex in Enumerable.Range(0, tapRecognizer.NumberOfTouches)) {
                    PointF location = tapRecognizer.LocationOfTouch(locationIndex, View);
                    UIView newTapView = new UIView(new RectangleF(PointF.Empty, ItemSize)) {
                        BackgroundColor = GetRandomColor(),
                    };
                    newTapView.Center = location;
                    View.Add(newTapView);
                    // Remove the view after it's been around a while.
                    Task.Delay(5000).ContinueWith(_ => InvokeOnMainThread(() => {
                        newTapView.RemoveFromSuperview();
                        newTapView.Dispose();
                    }));
                }
            });
            View.AddGestureRecognizer(tapRecognizer);
        }
        protected override void OnElementChanged(ElementChangedEventArgs<Image> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                // Get the forms view
                _formsView = (HexagonButtonView)e.NewElement;

                // Enable user interaction on the image view
                this.Control.UserInteractionEnabled = true;

                // Set up a tap gesture recognizer
                UITapGestureRecognizer tapGesture = null;

                Action action = () => {
                    // Check if the touch is on a transparent part of the image
                    if (IsPixelTransparent(tapGesture.LocationOfTouch(0, this.Control), this.Control.Image) == false) {
                        // Execute the click event
                        _formsView.Click();
                    }
                };

                tapGesture = new UITapGestureRecognizer(action);

                this.Control.AddGestureRecognizer(tapGesture);
            }
        }
        public override void ViewDidLoad()
        {
            View = new UIView(){ BackgroundColor = UIColor.White};
            base.ViewDidLoad();

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

            var binaryEdit = new BinaryEdit(new RectangleF(10, 70, 300, 120));
            Add(binaryEdit);
            var textField = new UITextField(new RectangleF(10, 190, 300, 40));
            Add(textField);
            var nicerBinaryEdit = new NicerBinaryEdit(new RectangleF(10, 260, 300, 120));
            Add(nicerBinaryEdit);

            var set = this.CreateBindingSet<FirstView, Core.ViewModels.FirstViewModel>();
            // to remove the need for `For("N28")` see Setup.FillBindingNames
            set.Bind(binaryEdit).For("N28").To(vm => vm.Counter);
            set.Bind(textField).To(vm => vm.Counter);
            // to remove the need for `For(be => be.MyCount)` see Setup.FillBindingNames
            set.Bind(nicerBinaryEdit).For(be => be.MyCount).To(vm => vm.Counter);
            set.Apply();

            var tap = new UITapGestureRecognizer(() => textField.ResignFirstResponder());
            View.AddGestureRecognizer(tap);
        }
Example #10
0
        public Easter(UIView viewForGestures, params Egg[] eggs)
            : base(eggs)
        {
            swipeUp = new UISwipeGestureRecognizer (() => AddCommand (new SwipeUpCommand()));
            swipeUp.Direction = UISwipeGestureRecognizerDirection.Up;
            viewForGestures.AddGestureRecognizer (swipeUp);

            swipeDown = new UISwipeGestureRecognizer (() => AddCommand (new SwipeDownCommand()));
            swipeDown.Direction = UISwipeGestureRecognizerDirection.Down;
            viewForGestures.AddGestureRecognizer (swipeDown);

            swipeLeft = new UISwipeGestureRecognizer (() => AddCommand (new SwipeLeftCommand()));
            swipeLeft.Direction = UISwipeGestureRecognizerDirection.Left;
            viewForGestures.AddGestureRecognizer (swipeLeft);

            swipeRight = new UISwipeGestureRecognizer (() => AddCommand (new SwipeRightCommand()));
            swipeRight.Direction = UISwipeGestureRecognizerDirection.Right;
            viewForGestures.AddGestureRecognizer (swipeRight);

            tap = new UITapGestureRecognizer (() => AddCommand (new TapCommand()));
            tap.NumberOfTapsRequired = 1;
            viewForGestures.AddGestureRecognizer (tap);

            longTap = new UILongPressGestureRecognizer (() => AddCommand (new LongTapCommand()));
            longTap.NumberOfTapsRequired = 1;
            viewForGestures.AddGestureRecognizer (longTap);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SlideoutNavigationController"/> class.
        /// </summary>
        public SlideoutNavigationController()
        {
            SlideSpeed = 0.2f;
            SlideWidth = 260f;
            SlideHeight = 44f;
            LayerShadowing = true;

            _internalMenuView = new ProxyNavigationController
                                    {
                                        ParentController = this,
                                        View = { AutoresizingMask = UIViewAutoresizing.FlexibleHeight }
                                    };
            //_internalMenuView.SetNavigationBarHidden(true, false);

            _internalTopView = new UIViewController { View = { UserInteractionEnabled = true } };
            _internalTopView.View.Layer.MasksToBounds = false;

            _tapGesture = new UITapGestureRecognizer();
            //            _tapGesture.AddTarget(new )
            _tapGesture.AddTarget(Hide);
            _tapGesture.NumberOfTapsRequired = 1;

            _panGesture = new UIPanGestureRecognizer
                              {
                                  Delegate = new SlideoutPanDelegate(this),
                                  MaximumNumberOfTouches = 1,
                                  MinimumNumberOfTouches = 1
                              };
            _panGesture.AddTarget(() => Pan(_internalTopView.View));
            _internalTopView.View.AddGestureRecognizer(_panGesture);
        }
		public override void ViewDidLoad(){
			this.TableView = new UITableView (this.View.Bounds, UITableViewStyle.Grouped);
			base.ViewDidLoad ();
			this.View.AddSubview (this.TableView);

			UITapGestureRecognizer doubleTap = new UITapGestureRecognizer ();
			doubleTap.NumberOfTapsRequired = 2;
			this.View.AddGestureRecognizer (doubleTap);

			UITapGestureRecognizer twoFingerDoubleTap = new UITapGestureRecognizer ();
			twoFingerDoubleTap.NumberOfTapsRequired = 2;
			twoFingerDoubleTap.NumberOfTouchesRequired = 2;
			this.View.AddGestureRecognizer (twoFingerDoubleTap);

			this.SetupLeftButton ();
			this.SetupRightButton ();

			UIColor barColor = new UIColor (247.0F / 255.0F, 249.0F / 255.0F, 250.0F / 255.0F, 1.0F);
			this.NavigationController.NavigationBar.BarTintColor = barColor;

			MMLogoView logo = new MMLogoView (new RectangleF (0F, 0F, 29F, 31F));
			this.NavigationItem.TitleView = logo;
			this.NavigationController.View.Layer.CornerRadius = 10.0F;

			UIView backView = new UIView ();
			backView.BackgroundColor = new UIColor (208.0F / 255.0F, 208.0F / 255.0F, 208.0F / 255.0F, 1.0F);
			this.TableView.BackgroundView = backView;
		}
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

            // ios7 layout
            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
                EdgesForExtendedLayout = UIRectEdge.None;
			
			// Perform any additional setup after loading the view, typically from a nib.
            var set = this.CreateBindingSet<AddView, AddViewModel>();
            set.Bind(CaptionText).To(vm => vm.Caption);
            set.Bind(NotesText).To(vm => vm.Notes);
            set.Bind(AddPictureButton).To(vm => vm.AddPictureCommand);
            set.Bind(SaveButton).To(vm => vm.SaveCommand);
            set.Bind(LocationSwitch).To(vm => vm.LocationKnown);
            set.Bind(MainImageView).To(vm => vm.PictureBytes).WithConversion("InMemoryImage");
            set.Apply();

		    var g = new UITapGestureRecognizer(() =>
		        {
		            CaptionText.ResignFirstResponder();
		            NotesText.ResignFirstResponder();

		        });

            View.AddGestureRecognizer(g);
		}
Example #14
0
        public override void ViewDidLoad()
        {
            View.BackgroundColor = UIColor.White;

            _imageView = new UIImageView(View.Frame)
            {
                MultipleTouchEnabled = true,
                UserInteractionEnabled = true,
                ContentMode = UIViewContentMode.ScaleAspectFit,
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight
            };

            var tapGesture = new UITapGestureRecognizer(OnImageTap);
            _imageView.AddGestureRecognizer(tapGesture);

            var leftSwipe = new UISwipeGestureRecognizer(OnImageSwipe)
            {
                Direction = UISwipeGestureRecognizerDirection.Left
            };
            _imageView.AddGestureRecognizer(leftSwipe);

            var rigthSwipe = new UISwipeGestureRecognizer(OnImageSwipe)
            {
                Direction = UISwipeGestureRecognizerDirection.Right
            };
            _imageView.AddGestureRecognizer(rigthSwipe);
            View.AddSubview(_imageView);

            PHAsset asset = _imageCache.GetAsset(_image.LocalIdentifier);
            UpdateImage(asset);
        }
Example #15
0
 private void DidTapToken(UITapGestureRecognizer gesture)
 {
     if (OnDidTapToken != null)
     {
         OnDidTapToken(this);
     }
 }
Example #16
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching (UIApplication   app, NSDictionary options)
        {

            UITabBarController tabBarController;

            window = new UIWindow (UIScreen.MainScreen.Bounds);

            //viewController = new TrafficDialogViewController();

            var dv = new TrafficDialogViewController (){
                Autorotate = true
            };

            var tap = new UITapGestureRecognizer ();
            tap.AddTarget (() =>{
                dv.View.EndEditing (true);
            });
            dv.View.AddGestureRecognizer (tap);

            tap.CancelsTouchesInView = false;


            navigation = new UINavigationController ();
            navigation.PushViewController (dv, true);

            window = new UIWindow (UIScreen.MainScreen.Bounds);
            window.MakeKeyAndVisible ();
            window.RootViewController = navigation;  

            return true;
        }
Example #17
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

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

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

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

            UITapGestureRecognizer doubletap =  new UITapGestureRecognizer(OnDoubleTap) {
                NumberOfTapsRequired = 2 // double tap
            };
            scrollView.AddGestureRecognizer(doubletap);
        }
        /// <summary>
        /// On load initialise the example
        /// </summary>
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //Subscribe to the keyboard events
            NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidHideNotification, HandleKeyboardDidHide);
            NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidShowNotification, HandleKeyboardDidShow);

            //Remove the keyboard if the screen is tapped
            var tap = new UITapGestureRecognizer();
            tap.AddTarget(() =>
            {
                this.View.EndEditing(true);
            });
            this.View.AddGestureRecognizer(tap);

            //Create the chat application instance
            ChatApplication = new ChatAppiOS(ChatHistory, MessageBox);

            //Uncomment this line to enable logging
            //EnableLogging();

            //Set the default serializer to Protobuf
            ChatApplication.Serializer = DPSManager.GetDataSerializer<NetworkCommsDotNet.DPSBase.ProtobufSerializer>();

			//Get the initial size of the chat view
			ChatApplication.OriginalViewSize = ChatView.Frame;

            //Print out the application usage instructions
            ChatApplication.PrintUsageInstructions();

            //Initialise comms to add the necessary packet handlers
            ChatApplication.RefreshNetworkCommsConfiguration();
        }
Example #19
0
		void tapGame (UITapGestureRecognizer gestureRecognizer)
		{
			if (gestureRecognizer.State == UIGestureRecognizerState.Recognized &&
				DidSelect != null) {
				CGPoint point = gestureRecognizer.LocationInView (this);
				CGRect bounds = Bounds;

				CGPoint normalizedPoint = point;
				normalizedPoint.X -= bounds.X + bounds.Size.Width / 2;
				normalizedPoint.X *= 3 / bounds.Size.Width;
				normalizedPoint.X = (float)Math.Round (normalizedPoint.X);
				normalizedPoint.X = (float)Math.Max (normalizedPoint.X, -1);
				normalizedPoint.X = (float)Math.Min (normalizedPoint.X, 1);
				TTTMoveXPosition xPosition = (TTTMoveXPosition)(int)normalizedPoint.X;

				normalizedPoint.Y -= bounds.Y + bounds.Size.Height / 2;
				normalizedPoint.Y *= 3 / bounds.Size.Height;
				normalizedPoint.Y = (float)Math.Round (normalizedPoint.Y);
				normalizedPoint.Y = (float)Math.Max (normalizedPoint.Y, -1);
				normalizedPoint.Y = (float)Math.Min (normalizedPoint.Y, 1);
				TTTMoveYPosition yPosition = (TTTMoveYPosition)(int)normalizedPoint.Y;

				if (CanSelect == null || CanSelect (this, xPosition, yPosition))
					DidSelect (this, xPosition, yPosition);
			}
		}
        public override void ViewDidLoad()
        {
            View = new UIView(){ BackgroundColor = UIColor.White};
            base.ViewDidLoad();

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


            var label = new ShapeLabel(new RectangleF(10, 10, 300, 40));
            Add(label);
            var textField = new UITextField(new RectangleF(10, 50, 300, 40));
            Add(textField);
            var shapeView = new ShapeView(new RectangleF(60, 90, 200, 200));
            Add(shapeView);

            var picker = new UIPickerView();
            var pickerViewModel = new MvxPickerViewModel(picker);
            picker.Model = pickerViewModel;
            picker.ShowSelectionIndicator = true;
            textField.InputView = picker;

            var set = this.CreateBindingSet<FirstView, Core.ViewModels.FirstViewModel>();
            set.Bind(label).For(s => s.TheShape).To(vm => vm.Shape);
            set.Bind(textField).To(vm => vm.Shape);
            set.Bind(pickerViewModel).For(p => p.ItemsSource).To(vm => vm.List);
            set.Bind(pickerViewModel).For(p => p.SelectedItem).To(vm => vm.Shape);
            set.Bind(shapeView).For(s => s.TheShape).To(vm => vm.Shape);
            set.Apply();

            var g = new UITapGestureRecognizer(() => textField.ResignFirstResponder());
            View.AddGestureRecognizer(g);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            // Perform any additional setup after loading the view, typically from a nib.
            var g = new UITapGestureRecognizer (() => View.EndEditing (true));
            g.CancelsTouchesInView = false; //for iOS5
            View.AddGestureRecognizer (g);

            txtFirst.Text = "John";
            txtLast.Text = "Smith";
            txtAddress.Text = "123 Nowhere Ln.";
            txtCity.Text = "Beverly Hills";
            txtState.Text = "CA";
            txtZip.Text = "90210-0000";
            txtIPAddress.Text = "10.244.43.106";

            txtCardNumber.Text = "4832419131427146";
            txtExpMonth.Text = "01";
            txtExpYear.Text = "2017";
            txtCVV.Text = "123";

            txtTxnAmount.Text = "12.88";
            txtTxnDescription.Text = "Test Transaction";
        }
        public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();
            
            NavigationItem.LeftBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Cancel);
            NavigationItem.LeftBarButtonItem.Clicked += (sender, e) => {
                this.NavigationController.PopViewController(true);
            };
            NavigationItem.RightBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Done);

            NavigationItem.RightBarButtonItem.Clicked += async (sender, e) => {
                await SaveCheckin();
            };

            mapView.DidUpdateUserLocation += (sender, e) => {
                if (mapView.UserLocation != null) {
                    CLLocationCoordinate2D coords = mapView.UserLocation.Coordinate;
                    UpdateMapLocation(coords);
                }
            };

            UITapGestureRecognizer doubletap = new UITapGestureRecognizer();
            doubletap.NumberOfTapsRequired = 1; // double tap
            doubletap.AddTarget (this, new ObjCRuntime.Selector("ImageTapped"));
            imageView.AddGestureRecognizer(doubletap); 

            _dataSource = new LocationsDataSource (this);
            tableLocations.Source = _dataSource;

            txtComment.ShouldEndEditing += (tf) => {
                tf.ResignFirstResponder();
                return true;
            };
        }
Example #23
0
        public override void ViewDidLoad()
        {
            View = new UIView {BackgroundColor = UIColor.White};
            NavigationItem.Title = "Search Movies";

            base.ViewDidLoad ();

            UITextField keywordView = CreateAndAddKeywordView();
            UIButton searchButton = CreateAndAddSearchButton();
            UITableView tableView = CreateAndAddTableView();

            var source = new MvxStandardTableViewSource(tableView, "TitleText title;");
            var bindingSet = this.CreateBindingSet<FirstView, FirstViewModel>();
            bindingSet.Bind(source).To(viewModel => viewModel.Movies);
            bindingSet.Bind(keywordView).To(viewModel => viewModel.Keyword);
            bindingSet.Bind(searchButton).To(viewModel => viewModel.SearchCommand);
            bindingSet.Bind(source).For(x => x.SelectionChangedCommand).To(viewModel => viewModel.ShowDetailCommand);
            bindingSet.Apply();

            tableView.Source = source;
            tableView.ReloadData();

            var responder = new UITapGestureRecognizer (() => keywordView.ResignFirstResponder ());
            responder.CancelsTouchesInView = false;
            View.AddGestureRecognizer(responder);
        }
Example #24
0
        /// <summary>
        /// On load set the config as per the chat application
        /// </summary>
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //Remove the keyboard on a tap gesture
            var tap = new UITapGestureRecognizer();
            tap.AddTarget(() =>
            {
                this.View.EndEditing(true);
            });
            this.View.AddGestureRecognizer(tap);

            //Get a reference to the chat application
            ChatAppiOS chatApplication = ChatWindow.ChatApplication;

            //Update the settings based on previous values
            LocalServerEnabled.SetState(chatApplication.LocalServerEnabled, false);
            MasterIP.Text = chatApplication.ServerIPAddress;
            MasterPort.Text = chatApplication.ServerPort.ToString();
            LocalName.Text = chatApplication.LocalName;
            EncryptionEnabled.SetState(chatApplication.EncryptionEnabled, false);

            //Set the correct segment on the connection mode toggle
            ConnectionMode.SelectedSegment = (chatApplication.ConnectionType == ConnectionType.TCP ? 0 : 1);
        }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			
			// set the background color of the view to white
			this.View.BackgroundColor = UIColor.White;
			
			this.Title = "Scroll View";
			
			// create our scroll view
			scrollView = new UIScrollView (
				new CGRect (0, 0, View.Frame.Width
				, View.Frame.Height - NavigationController.NavigationBar.Frame.Height));
			View.AddSubview (scrollView);
			
			// create our image view
			imageView = new UIImageView (UIImage.FromFile ("halloween.jpg"));
			scrollView.ContentSize = imageView.Image.Size;
			scrollView.AddSubview (imageView);
			
			// set allow zooming
			scrollView.MaximumZoomScale = 3f;
			scrollView.MinimumZoomScale = .1f;			
			scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return imageView; };

			// Create a new Tap Gesture Recognizer
			UITapGestureRecognizer doubletap = new UITapGestureRecognizer(OnDoubleTap) {
				NumberOfTapsRequired = 2 // double tap
			};
			scrollView.AddGestureRecognizer(doubletap); // detect when the scrollView is double-tapped
		}
        public BMarkerImageView(WeakReference parentView, CGPoint location)
        {
            WeakParent = parentView;
             _location = location;

             UserInteractionEnabled = true;

             Frame = new CGRect (Location.X - 22, Location.Y - 22, 44, 44);
             using (var image = UIImage.FromFile ("Images/icon_marker.png"))
             {
            Image = image;
             }

             _pan = new UIPanGestureRecognizer (() =>
             {
            if ((_pan.State == UIGestureRecognizerState.Began || _pan.State == UIGestureRecognizerState.Changed) && (_pan.NumberOfTouches == 1))
            {
               Center = _pan.LocationInView (_parent);
               Location = Center;
               _parent.SetNeedsDisplay ();
            }
            else if (_pan.State == UIGestureRecognizerState.Ended)
            {
            }
             });

             _doubleTap = new UITapGestureRecognizer ((gesture) => Crop ()) {
            NumberOfTapsRequired = 2, NumberOfTouchesRequired = 1
             };

             AddGestureRecognizer (_pan);
             AddGestureRecognizer (_doubleTap);
        }
Example #27
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

             // set the background color of the view to white
             this.View.BackgroundColor = UIColor.White;

             this.Title = "Mecut Dosya";

             // create our scroll view
             scrollView = new UIScrollView (
            new RectangleF (0, 0, View.Frame.Width
               , View.Frame.Height - NavigationController.NavigationBar.Frame.Height));
             View.AddSubview (scrollView);

             string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
             string localFilename = "original.jpg";
             string localPath = Path.Combine(documentsPath, localFilename);

             // create our image view
             imageView = new UIImageView (UIImage.FromFile (localPath));
             scrollView.ContentSize = imageView.Image.Size;
             scrollView.AddSubview (imageView);

             // set allow zooming
             scrollView.MaximumZoomScale = 3f;
             scrollView.MinimumZoomScale = .1f;
             scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return imageView; };

             // configure a double-tap gesture recognizer
             UITapGestureRecognizer doubletap = new UITapGestureRecognizer();
             doubletap.NumberOfTapsRequired = 2;
             doubletap.AddTarget (this, new MonoTouch.ObjCRuntime.Selector("DoubleTapSelector"));
             scrollView.AddGestureRecognizer(doubletap);
        }
        private void AddGestures()
        {
            var touchDownGesture = new UILongPressGestureRecognizer(HandleTouchDown) { MinimumPressDuration = 0 };
            _canvasView.AddGestureRecognizer(touchDownGesture);

            // Tap to select
            var tapGesture = new UITapGestureRecognizer(HandleTap);
            _canvasView.AddGestureRecognizer(tapGesture);

            // Move an element
            var elementDragGesture = new UIPanGestureRecognizer(HandlePan);
            _canvasView.AddGestureRecognizer(elementDragGesture);

            elementDragGesture.ShouldBegin = g => _panShouldBegin;

            var selectLongPressGesture = new UILongPressGestureRecognizer(HandleLongPress) { MinimumPressDuration = 0.1 };
            _canvasView.AddGestureRecognizer(selectLongPressGesture);

            selectLongPressGesture.ShouldReceiveTouch = (g, touch) =>
            {
                var locationInCanvas = touch.LocationInView(_canvasView);
                var touchedElement = ElementUnderPoint(locationInCanvas);

                return touchedElement != null && !IsElementSelected(touchedElement);
            };

            selectLongPressGesture.ShouldRecognizeSimultaneously = (g1, g2) => g2 == elementDragGesture;
            touchDownGesture.ShouldRecognizeSimultaneously = (g1, g2) => true;
        }
Example #29
0
        public TouchDrawView(CGRect rect)
            : base(rect)
        {
            linesInProcess = new Dictionary<string, Line>();
            this.BackgroundColor = UIColor.White;
            this.MultipleTouchEnabled = true;

            UITapGestureRecognizer tapRecognizer = new UITapGestureRecognizer(tap);
            this.AddGestureRecognizer(tapRecognizer);

            UITapGestureRecognizer dbltapRecognizer = new UITapGestureRecognizer(dblTap);
            dbltapRecognizer.NumberOfTapsRequired = 2;
            this.AddGestureRecognizer(dbltapRecognizer);

            UILongPressGestureRecognizer pressRecognizer = new UILongPressGestureRecognizer(longPress);
            this.AddGestureRecognizer(pressRecognizer);

            moveRecognizer = new UIPanGestureRecognizer(moveLine);
            moveRecognizer.WeakDelegate = this;
            moveRecognizer.CancelsTouchesInView = false;
            this.AddGestureRecognizer(moveRecognizer);

            UISwipeGestureRecognizer swipeRecognizer = new UISwipeGestureRecognizer(swipe);
            swipeRecognizer.Direction = UISwipeGestureRecognizerDirection.Up;
            swipeRecognizer.NumberOfTouchesRequired = 3;
            this.AddGestureRecognizer(swipeRecognizer);

            selectedColor = UIColor.Red;
        }
        public override void ViewDidLoad()
        {
            View = new UIView(){ BackgroundColor = UIColor.White};
            base.ViewDidLoad();

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

            var textFieldTitle = new UITextField(new RectangleF(10, 10, 300, 30));
            Add(textFieldTitle);
            var picker = new UIPickerView();
            var pickerViewModel = new MvxPickerViewModel(picker);
            picker.Model = pickerViewModel;
            picker.ShowSelectionIndicator = true; 
            textFieldTitle.InputView = picker;

            var textFieldFirstName = new UITextField(new RectangleF(10, 40, 300, 30));
            Add(textFieldFirstName);
            var textFieldLastName = new UITextField(new RectangleF(10, 70, 300, 30));
            Add(textFieldLastName);
            var acceptedLabel = new UILabel(new RectangleF(10, 100, 200, 30));
            acceptedLabel.Text = "Accepted?";
            Add(acceptedLabel);
            var accepted = new UISwitch(new RectangleF(210, 100, 100, 30));
            Add(accepted);
            var add = new UIButton(UIButtonType.RoundedRect);
            add.SetTitle("Add", UIControlState.Normal);
            add.TintColor = UIColor.Purple;
            add.Frame = new RectangleF(10,130,300,30);
            Add(add);

            var table = new UITableView(new RectangleF(10, 160, 300, 300));
            Add(table);
            var source = new MvxStandardTableViewSource(table, "TitleText FirstName");
            table.Source = source;

            var set = this.CreateBindingSet<FirstView, Core.ViewModels.FirstViewModel>();
            set.Bind(textFieldFirstName).To(vm => vm.FirstName);
            set.Bind(textFieldLastName).To(vm => vm.LastName);
            set.Bind(pickerViewModel).For(p => p.ItemsSource).To(vm => vm.Titles);
            set.Bind(pickerViewModel).For(p => p.SelectedItem).To(vm => vm.Title);
            set.Bind(textFieldTitle).To(vm => vm.Title);
            set.Bind(accepted).To(vm => vm.Accepted);
            set.Bind(add).To("Add");
            set.Bind(source).To(vm => vm.People);
            set.Apply();

            var tap = new UITapGestureRecognizer(() =>
                {
                    foreach (var view in View.Subviews)
                    {
                        var text = view as UITextField;
                        if (text != null)
                            text.ResignFirstResponder();
                    }
                });
            View.AddGestureRecognizer(tap);
        }
        void OnTapped(UITapGestureRecognizer gr)
        {
            if (!_element.IsVisible)
            {
                return;
            }

            _numberOfTaps++;
            _lastTapEventArgs = new iOSTapEventArgs(gr, _numberOfTaps);
            bool tappingHandled      = false;
            bool doubleTappedHandled = false;

            foreach (var listener in _listeners)
            {
                if (!tappingHandled && listener.HandlesTapping)
                {
                    var taskArgs = new TapEventArgs(_lastTapEventArgs, listener);
                    listener.OnTapping(taskArgs);
                    tappingHandled = taskArgs.Handled;
                }
                if (!doubleTappedHandled && _numberOfTaps % 2 == 0 && listener.HandlesDoubleTapped)
                {
                    var taskArgs = new TapEventArgs(_lastTapEventArgs, listener);
                    listener.OnDoubleTapped(taskArgs);
                    doubleTappedHandled = taskArgs.Handled;
                }
                if (tappingHandled && doubleTappedHandled)
                {
                    break;
                }
            }

            if (!_waitingForTapsToFinish && HandlesTapped)
            {
                _waitingForTapsToFinish = true;
                Device.StartTimer(Settings.TappedThreshold, () =>
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        if (_listeners != null)
                        {
                            foreach (var listener in _listeners)
                            {
                                if (listener.HandlesTapped)
                                {
                                    var taskArgs = new TapEventArgs(_lastTapEventArgs, listener);
                                    listener.OnTapped(taskArgs);
                                    if (taskArgs.Handled)
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                        _numberOfTaps           = 0;
                        _waitingForTapsToFinish = false;
                    });
                    return(false);
                });
            }
        }
Example #32
0
        UIGestureRecognizer[] CreateGestureRecognizers()
        {
            var list = new List <UIGestureRecognizer>();
            //if (HandlesDownUps)  WE NEED TO ALWAYS MONITOR FOR DOWN TO BE ABLE TO UNDO A CANCEL
            {  // commenting out if (HanglesDownUps) causes FormsDragNDrop listview to not recognize cell selections after a scroll.  Why?  I have no clue.
               // Let's always trigger the down gesture recognizer so we can get the starting location
                var downUpGestureRecognizer = new DownUpGestureRecognizer(new Action <DownUpGestureRecognizer, UITouch[]>(OnDown), new Action <DownUpGestureRecognizer, UITouch[]>(OnUp))
                {
                    ShouldRecognizeSimultaneously = ((thisGr, otherGr) => false),
                    ShouldReceiveTouch            = ((UIGestureRecognizer gr, UITouch touch) => !(touch.View is UIControl))
                };
                list.Add(downUpGestureRecognizer);
                //downUpGestureRecognizer.ShouldReceiveTouch = (recognizer, touch) => {
                //	return _element.get_IgnoreChildrenTouches() ? touch.View==_view : true;
                //};
            }
            UILongPressGestureRecognizer uILongPressGestureRecognizer = null;

            if (HandlesLongs)
            {
                uILongPressGestureRecognizer = new UILongPressGestureRecognizer(new Action <UILongPressGestureRecognizer>(OnLongPressed))
                {
                    ShouldRecognizeSimultaneously = ((thisGr, otherGr) => false)
                };
                list.Add(uILongPressGestureRecognizer);
                //uILongPressGestureRecognizer.ShouldReceiveTouch = (recognizer, touch) => {
                //	return _element.get_IgnoreChildrenTouches() ? touch.View==_view : true;
                //};
            }
            if (HandlesTaps)
            {
                var uITapGestureRecognizer = new UITapGestureRecognizer(new Action <UITapGestureRecognizer>(OnTapped))
                {
                    ShouldRecognizeSimultaneously = ((thisGr, otherGr) =>
                    {
                        return(thisGr.GetType() != otherGr.GetType());
                    }),
                    ShouldReceiveTouch = ((UIGestureRecognizer gr, UITouch touch) =>
                    {
                        // these are handled BEFORE the touch call is passed to the listener.
                        return(!(touch.View is UIControl));
                        //return touch.View == gr.View;
                    })
                };
                if (uILongPressGestureRecognizer != null)
                {
                    uITapGestureRecognizer.RequireGestureRecognizerToFail(uILongPressGestureRecognizer);
                }
                list.Add(uITapGestureRecognizer);
                //uITapGestureRecognizer.ShouldReceiveTouch = (recognizer, touch) => {
                //	return _element.get_IgnoreChildrenTouches() ? touch.View==_view : true;
                //};
            }
            if (HandlesPans)
            {
                var uIPanGestureRecognizer = new UIPanGestureRecognizer(new Action <UIPanGestureRecognizer>(OnPanned))
                {
                    MinimumNumberOfTouches        = 1,
                    ShouldRecognizeSimultaneously = ((thisGr, otherGr) => true)
                };
                list.Add(uIPanGestureRecognizer);
                //uIPanGestureRecognizer.ShouldReceiveTouch = (recognizer, touch) => {
                //	return _element.get_IgnoreChildrenTouches() ? touch.View==_view : true;
                //};
            }
            if (HandlesPinches)
            {
                var uIPinchGestureRecognizer = new UIPinchGestureRecognizer(new Action <UIPinchGestureRecognizer>(OnPinched))
                {
                    ShouldRecognizeSimultaneously = ((thisGr, otherGr) => true)
                };
                list.Add(uIPinchGestureRecognizer);
                //uIPinchGestureRecognizer.ShouldReceiveTouch = (recognizer, touch) => {
                //	return _element.get_IgnoreChildrenTouches() ? touch.View==_view : true;
                //};
            }
            if (HandlesRotates)
            {
                var uIRotationGestureRecognizer = new UIRotationGestureRecognizer(new Action <UIRotationGestureRecognizer>(OnRotated))
                {
                    ShouldRecognizeSimultaneously = ((thisGr, otherGr) => true)
                };
                list.Add(uIRotationGestureRecognizer);
                //uIRotationGestureRecognizer.ShouldReceiveTouch = (recognizer, touch) => {
                //	return _element.get_IgnoreChildrenTouches() ? touch.View==_view : true;
                //};
            }

            /*
             *          var control = (UIView)_view.GetPropertyValue ("Control");
             *          if (control is UIButton)
             *                  control.UserInteractionEnabled = !(HandlesTaps || HandlesDownUps);
             */
            return(list.ToArray());
        }
        UIGestureRecognizer[] CreateGestureRecognizers()
        {
            var list = new List <UIGestureRecognizer>();
            //if (HandlesDownUps)  WE NEED TO ALWAYS MONITOR FOR DOWN TO BE ABLE TO UNDO A CANCEL
            // commenting out if (HanglesDownUps) causes FormsDragNDrop listview to not recognize cell selections after a scroll.  Why?  I have no clue.
            // Let's always trigger the down gesture recognizer so we can get the starting location
            //var downUpGestureRecognizer = new DownUpGestureRecognizer(new Action<DownUpGestureRecognizer, UITouch[]>(OnDown), new Action<DownUpGestureRecognizer, UITouch[]>(OnUp))
            var downUpGestureRecognizer = new DownUpGestureRecognizer(OnDown, OnUp)
            {
                ShouldRecognizeSimultaneously = ((thisGr, otherGr) => false),
                ShouldReceiveTouch            = ((UIGestureRecognizer gr, UITouch touch) => !(touch.View is UIControl))
            };

            list.Add(downUpGestureRecognizer);
            UILongPressGestureRecognizer uILongPressGestureRecognizer = null;

            if (HandlesLongs)
            {
                uILongPressGestureRecognizer = new UILongPressGestureRecognizer(OnLongPressed)
                {
                    ShouldRecognizeSimultaneously = ((thisGr, otherGr) => false)
                };
                list.Add(uILongPressGestureRecognizer);
            }
            if (HandlesTaps)
            {
                var uITapGestureRecognizer = new UITapGestureRecognizer(OnTapped)
                {
                    ShouldRecognizeSimultaneously = ((thisGr, otherGr) =>
                    {
                        return(thisGr.GetType() != otherGr.GetType());
                    }),
                    ShouldReceiveTouch = ((UIGestureRecognizer gr, UITouch touch) =>
                    {
                        // these are handled BEFORE the touch call is passed to the listener.
                        return(!(touch.View is UIControl));
                    })
                };
                if (uILongPressGestureRecognizer != null)
                {
                    uITapGestureRecognizer.RequireGestureRecognizerToFail(uILongPressGestureRecognizer);
                }
                list.Add(uITapGestureRecognizer);
            }
            if (HandlesPans)
            {
                var uIPanGestureRecognizer = new UIPanGestureRecognizer(OnPanned)
                {
                    MinimumNumberOfTouches        = 1,
                    ShouldRecognizeSimultaneously = ((thisGr, otherGr) => true)
                };
                list.Add(uIPanGestureRecognizer);
            }
            if (HandlesPinches)
            {
                var uIPinchGestureRecognizer = new UIPinchGestureRecognizer(OnPinched)
                {
                    ShouldRecognizeSimultaneously = ((thisGr, otherGr) => true)
                };
                list.Add(uIPinchGestureRecognizer);
            }
            if (HandlesRotates)
            {
                var uIRotationGestureRecognizer = new UIRotationGestureRecognizer(OnRotated)
                {
                    ShouldRecognizeSimultaneously = ((thisGr, otherGr) => true)
                };
                list.Add(uIRotationGestureRecognizer);
            }
            return(list.ToArray());
        }
Example #34
0
        public TargetSHSCView(UIView containerView)
        {
            ion = AppState.context;

            tView = new UIView(new CGRect(.1 * containerView.Bounds.Width, .2 * containerView.Bounds.Height, .8 * containerView.Bounds.Width, .45 * containerView.Bounds.Height));
            tView.BackgroundColor = UIColor.White;
            tView.Hidden          = true;

            headerLabel = new UILabel(new CGRect(0, 0, tView.Bounds.Width, .1 * tView.Bounds.Height));
            headerLabel.BackgroundColor = UIColor.FromRGB(0, 174, 239);
            headerLabel.Text            = "  Set Target SH/SC";
            headerLabel.Font            = UIFont.BoldSystemFontOfSize(20f);

            closeButton = new UIButton(new CGRect(.9 * tView.Bounds.Width, .05 * headerLabel.Bounds.Height, .9 * headerLabel.Bounds.Height, .9 * headerLabel.Bounds.Height));
            closeButton.SetImage(UIImage.FromBundle("img_button_blackclosex"), UIControlState.Normal);
            closeButton.TouchUpInside += (sender, e) => {
                Console.WriteLine("Closing the target window");
                tView.Hidden = true;
            };

            nameLabel = new UILabel(new CGRect(0, .1 * tView.Bounds.Height, tView.Bounds.Width, .1 * tView.Bounds.Height));
            nameLabel.TextAlignment = UITextAlignment.Center;
            nameLabel.Text          = "PT500: S516H123";
            nameLabel.Font          = UIFont.BoldSystemFontOfSize(20f);

            directionsLabel       = new UILabel(new CGRect(.05 * tView.Bounds.Width, .2 * tView.Bounds.Height, .9 * tView.Bounds.Width, .3 * tView.Bounds.Height));
            directionsLabel.Font  = UIFont.ItalicSystemFontOfSize(20f);
            directionsLabel.Lines = 0;
            directionsLabel.Text  = "Enter the target SH/SC value as provided by the system manufacturer";

            targetInput      = new UITextField(new CGRect(.05 * tView.Bounds.Width, .5 * tView.Bounds.Height, .3 * tView.Bounds.Width, .15 * tView.Bounds.Height));
            targetInput.Text = "0.0";
            targetInput.Layer.BorderWidth = 1f;

            unitLabel      = new UILabel(new CGRect(.35 * tView.Bounds.Width, .5 * tView.Bounds.Height, .1 * tView.Bounds.Width, .15 * tView.Bounds.Height));
            unitLabel.Text = "°F";

            slideLabel = new UILabel(new CGRect(.6 * tView.Bounds.Width, .55 * tView.Bounds.Height, .3 * tView.Bounds.Width, .05 * tView.Bounds.Height));
            slideLabel.BackgroundColor   = UIColor.LightGray;
            slideLabel.Layer.BorderWidth = 1f;

            toggleLabel = new UILabel(new CGRect(.55 * tView.Bounds.Width, .5 * tView.Bounds.Height, .2 * tView.Bounds.Width, .15 * tView.Bounds.Height));
            toggleLabel.BackgroundColor        = UIColor.Blue;
            toggleLabel.Text                   = "S/H";
            toggleLabel.Font                   = UIFont.BoldSystemFontOfSize(30f);
            toggleLabel.TextColor              = UIColor.White;
            toggleLabel.TextAlignment          = UITextAlignment.Center;
            toggleLabel.UserInteractionEnabled = true;

            toggleTap = new UITapGestureRecognizer((obj) => {
                Console.WriteLine("Toggling the slider");
                if (targetSensor.fluidState == Core.Fluids.Fluid.EState.Dew)
                {
                    toggleLabel.Frame           = new CGRect(.75 * tView.Bounds.Width, .5 * tView.Bounds.Height, .2 * tView.Bounds.Width, .15 * tView.Bounds.Height);
                    toggleLabel.BackgroundColor = UIColor.Red;
                    toggleLabel.Text            = "S/C";
                    targetSensor.fluidState     = Fluid.EState.Bubble;
                }
                else
                {
                    toggleLabel.Frame           = new CGRect(.55 * tView.Bounds.Width, .5 * tView.Bounds.Height, .2 * tView.Bounds.Width, .15 * tView.Bounds.Height);
                    toggleLabel.BackgroundColor = UIColor.Blue;
                    toggleLabel.Text            = "S/H";
                    targetSensor.fluidState     = Fluid.EState.Dew;
                }
            });

            keyboardTap = new UITapGestureRecognizer((obj) => {
                targetInput.ResignFirstResponder();
            });

            toggleLabel.AddGestureRecognizer(toggleTap);
            tView.AddGestureRecognizer(keyboardTap);

            setButton = new UIButton(new CGRect(.45 * tView.Bounds.Width, .8 * tView.Bounds.Height, .1 * tView.Bounds.Width, .1 * tView.Bounds.Width));
            setButton.Layer.CornerRadius = 5f;
            setButton.Layer.BorderWidth  = 1f;
            setButton.BackgroundColor    = UIColor.FromRGB(255, 200, 46);
            setButton.SetTitle("OK", UIControlState.Normal);

            setButton.TouchUpInside += (sender, e) => {
                Console.WriteLine("Setting manifold target SHSC");
                if (targetSensor != null)
                {
                    targetSensor.targetSHSC = double.Parse(targetInput.Text);
                    targetSensor.NotifyInvalidated();
                }
                targetInput.ResignFirstResponder();

                tView.Hidden = true;
            };

            tView.AddSubview(headerLabel);
            tView.AddSubview(closeButton);
            tView.AddSubview(nameLabel);
            tView.AddSubview(directionsLabel);
            tView.AddSubview(targetInput);
            tView.AddSubview(unitLabel);
            tView.AddSubview(slideLabel);
            tView.AddSubview(toggleLabel);
            tView.AddSubview(setButton);
            containerView.AddSubview(tView);
        }
Example #35
0
        protected override void OnElementChanged(ElementChangedEventArgs <View> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null)
            {
                var mapModel = (Map)e.OldElement;

                MessagingCenter.Unsubscribe <Map, MapSpan>(this, MoveMessageName);

                ((ObservableCollection <Pin>)mapModel.Pins).CollectionChanged -= OnPinCollectionChanged;
                foreach (Pin pin in mapModel.Pins)
                {
                    pin.PropertyChanged -= PinOnPropertyChanged;
                }

                ((ObservableCollection <MapElement>)mapModel.MapElements).CollectionChanged -= OnMapElementCollectionChanged;
                foreach (MapElement mapElement in mapModel.MapElements)
                {
                    mapElement.PropertyChanged -= MapElementPropertyChanged;
                }
            }

            if (e.NewElement != null)
            {
                var mapModel = (Map)e.NewElement;

                if (Control == null)
                {
                    MKMapView mapView = null;
#if __MOBILE__
                    if (FormsMaps.IsiOs9OrNewer)
                    {
                        // See if we've got an MKMapView available in the pool; if so, use it
                        mapView = MapPool.Get();
                    }
#endif
                    if (mapView == null)
                    {
                        // If this is iOS 8 or lower, or if there weren't any MKMapViews in the pool,
                        // create a new one
                        mapView = new MKMapView(RectangleF.Empty);
                    }

                    SetNativeControl(mapView);

                    mapView.GetViewForAnnotation     = GetViewForAnnotation;
                    mapView.OverlayRenderer          = GetViewForOverlay;
                    mapView.DidSelectAnnotationView += MkMapViewOnAnnotationViewSelected;
                    mapView.RegionChanged           += MkMapViewOnRegionChanged;
#if __MOBILE__
                    mapView.AddGestureRecognizer(_mapClickedGestureRecognizer = new UITapGestureRecognizer(OnMapClicked));
#endif
                }

                MessagingCenter.Subscribe <Map, MapSpan>(this, MoveMessageName, (s, a) => MoveToRegion(a), mapModel);
                if (mapModel.LastMoveToRegion != null)
                {
                    MoveToRegion(mapModel.LastMoveToRegion, false);
                }

                UpdateTrafficEnabled();
                UpdateMapType();
                UpdateIsShowingUser();
                UpdateHasScrollEnabled();
                UpdateHasZoomEnabled();

                ((ObservableCollection <Pin>)mapModel.Pins).CollectionChanged += OnPinCollectionChanged;
                OnPinCollectionChanged(mapModel.Pins, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));

                ((ObservableCollection <MapElement>)mapModel.MapElements).CollectionChanged += OnMapElementCollectionChanged;
                OnMapElementCollectionChanged(mapModel.MapElements, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
            }
        }
Example #36
0
        void SetupRings(int itemCount)
        {
            // Define some nice colors.
            var borderColorSelected = UIColor.FromHSBA(0.07f, 0.81f, 0.98f, 1).CGColor;
            var borderColorNormal   = UIColor.DarkGray.CGColor;
            var fillColorSelected   = UIColor.FromHSBA(0.07f, 0.21f, 0.98f, 1);
            var fillColorNormal     = UIColor.White;

            // We define generators to return closures which we use to define
            // the different states of our item ring views.
            Func <RingView, Action> selectedGenerator = (view) => () => {
                view.Layer.BorderColor = borderColorSelected;
                view.BackgroundColor   = fillColorSelected;
            };

            Func <RingView, Action> normalGenerator = (view) => () => {
                view.Layer.BorderColor = borderColorNormal;
                view.BackgroundColor   = fillColorNormal;
            };

            CGPoint startPosition = Bounds.GetCenter();
            Func <RingView, Action> locationNormalGenerator = (view) => () => {
                view.Center = startPosition;
                if (!view.Selected)
                {
                    view.Alpha = 0;
                }
            };

            Func <RingView, CGVector, Action> locationFanGenerator = (view, offset) => () => {
                view.Center = startPosition.Add(offset);
                view.Alpha  = 1;
            };

            // tau is a full circle in radians
            var tau = NMath.PI * 2;
            var absoluteRingSegment        = tau / 4;
            var requiredLengthPerRing      = RingRadius * 2 + 5;
            var totalRequiredCirlceSegment = requiredLengthPerRing * (itemCount - 1);
            var fannedControlRadius        = NMath.Max(requiredLengthPerRing, totalRequiredCirlceSegment / absoluteRingSegment);
            var normalDistance             = new CGVector(0, -fannedControlRadius);

            var scale = UIScreen.MainScreen.Scale;

            // Setup our item views.
            for (int index = 0; index < itemCount; index++)
            {
                var view = new RingView(Bounds);
                view.StateClosures [Selected] = selectedGenerator(view);
                view.StateClosures [Normal]   = normalGenerator(view);

                nfloat angle = index / (nfloat)(itemCount - 1) * absoluteRingSegment;
                var    fan   = normalDistance.Apply(MakeRotation(angle)).RoundTo(scale);
                view.StateClosures [LocationFan] = locationFanGenerator(view, fan);

                view.StateClosures [LocationOrigin] = locationNormalGenerator(view);
                AddSubview(view);
                RingViews.Add(view);

                var gr = new UITapGestureRecognizer(Tap);
                view.AddGestureRecognizer(gr);
            }

            // Setup the initial selection state.
            var rv = RingViews [0];

            AddSubview(rv);
            rv.Selected  = true;
            selectedView = rv;

            UpdateViews(animated: false);
        }
        public void loadOptionView()
        {
            subView             = new UIScrollView();
            subView.ContentSize = new CGSize(Frame.Width, 400);

            //autoReverse
            autoReverse                 = new UILabel();
            autoReverse.TextColor       = UIColor.Black;
            autoReverse.BackgroundColor = UIColor.Clear;
            autoReverse.Text            = @"Auto Reverse";
            autoReverse.TextAlignment   = UITextAlignment.Left;
            autoReverse.Font            = UIFont.FromName("Helvetica", 14f);
            contentView.AddSubview(autoReverse);

            //autoSwitch
            autoSwitch = new UISwitch();
            autoSwitch.ValueChanged += autoReverseToggleChanged;
            autoSwitch.On            = false;
            autoSwitch.OnTintColor   = UIColor.FromRGB(50, 150, 221);
            contentView.AddSubview(autoSwitch);

            //spinLabel
            spinLabel                 = new UILabel();
            spinLabel.TextColor       = UIColor.Black;
            spinLabel.BackgroundColor = UIColor.Clear;
            spinLabel.Text            = @"Spin Alignment";
            spinLabel.TextAlignment   = UITextAlignment.Left;
            spinLabel.Font            = UIFont.FromName("Helvetica", 14f);
            contentView.AddSubview(spinLabel);

            //spinAlignmentButton
            spinAlignmentButton = new UIButton();
            spinAlignmentButton.SetTitle("Right", UIControlState.Normal);
            spinAlignmentButton.Font = UIFont.FromName("Helvetica", 14f);
            spinAlignmentButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            spinAlignmentButton.BackgroundColor     = UIColor.Clear;
            spinAlignmentButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            spinAlignmentButton.Hidden             = false;
            spinAlignmentButton.Layer.BorderColor  = UIColor.FromRGB(246, 246, 246).CGColor;
            spinAlignmentButton.Layer.BorderWidth  = 4;
            spinAlignmentButton.Layer.CornerRadius = 8;
            spinAlignmentButton.TouchUpInside     += ShowSpinPicker;
            contentView.AddSubview(spinAlignmentButton);

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

            //maximumLabel
            maximumLabel               = new UILabel();
            maximumLabel.Text          = "Maximum";
            maximumLabel.TextColor     = UIColor.Black;
            maximumLabel.TextAlignment = UITextAlignment.Left;
            maximumLabel.Font          = UIFont.FromName("Helvetica", 14f);
            contentView.AddSubview(minimumLabel);
            contentView.AddSubview(maximumLabel);

            //minimumText
            minimumText = new UITextView();
            minimumText.TextAlignment     = UITextAlignment.Center;
            minimumText.Layer.BorderColor = UIColor.Black.CGColor;
            minimumText.BackgroundColor   = UIColor.FromRGB(246, 246, 246);
            minimumText.KeyboardType      = UIKeyboardType.NumberPad;
            minimumText.Text     = "0";
            minimumText.Font     = UIFont.FromName("Helvetica", 14f);
            minimumText.Changed += (object sender, EventArgs e) =>
            {
                if (minimumText.Text.Length > 0)
                {
                    adultNumericUpDown.Minimum   = nfloat.Parse(minimumText.Text);
                    infantsNumericUpDown.Minimum = nfloat.Parse(minimumText.Text);
                }
            };
            contentView.AddSubview(minimumText);

            //maximumText
            maximumText = new UITextView();
            maximumText.TextAlignment     = UITextAlignment.Center;
            maximumText.Layer.BorderColor = UIColor.Black.CGColor;
            maximumText.BackgroundColor   = UIColor.FromRGB(246, 246, 246);
            maximumText.KeyboardType      = UIKeyboardType.NumberPad;
            maximumText.Text     = "100";
            maximumText.Font     = UIFont.FromName("Helvetica", 14f);
            maximumText.Changed += (object sender, EventArgs e) =>
            {
                if (maximumText.Text.Length > 0)
                {
                    adultNumericUpDown.Maximum   = nfloat.Parse(maximumText.Text);
                    infantsNumericUpDown.Maximum = nfloat.Parse(maximumText.Text);
                }
            };
            contentView.AddSubview(maximumText);

            //spinPicker
            PickerModel culturePickermodel = new PickerModel(this.cultureList);

            culturePickermodel.PickerChanged += (sender, e) =>
            {
                this.cultureSelectedType = e.SelectedValue;
                spinAlignmentButton.SetTitle(cultureSelectedType, UIControlState.Normal);
                if (cultureSelectedType == "Right")
                {
                    adultNumericUpDown.SpinButtonAlignment   = SFNumericUpDownSpinButtonAlignment.Right;
                    infantsNumericUpDown.SpinButtonAlignment = SFNumericUpDownSpinButtonAlignment.Right;
                    adultNumericUpDown.TextAlignment         = UITextAlignment.Left;
                    infantsNumericUpDown.TextAlignment       = UITextAlignment.Left;
                }
                else if (cultureSelectedType == "Left")
                {
                    adultNumericUpDown.SpinButtonAlignment   = SFNumericUpDownSpinButtonAlignment.Left;
                    infantsNumericUpDown.SpinButtonAlignment = SFNumericUpDownSpinButtonAlignment.Left;
                    adultNumericUpDown.TextAlignment         = UITextAlignment.Right;
                    infantsNumericUpDown.TextAlignment       = UITextAlignment.Right;
                }
                else if (cultureSelectedType == "Both")
                {
                    adultNumericUpDown.SpinButtonAlignment   = SFNumericUpDownSpinButtonAlignment.Both;
                    infantsNumericUpDown.SpinButtonAlignment = SFNumericUpDownSpinButtonAlignment.Both;
                    adultNumericUpDown.TextAlignment         = UITextAlignment.Center;
                    infantsNumericUpDown.TextAlignment       = UITextAlignment.Center;
                }
            };
            spinPicker = new UIPickerView();
            spinPicker.ShowSelectionIndicator = true;
            spinPicker.Hidden          = true;
            spinPicker.Model           = culturePickermodel;
            spinPicker.BackgroundColor = UIColor.Gray;
            contentView.AddSubview(spinPicker);

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

            //propertyLabel
            propertyLabel      = new UILabel();
            propertyLabel.Text = "OPTIONS";
            subView.AddSubview(propertyLabel);
            subView.BackgroundColor     = UIColor.FromRGB(230, 230, 230);
            contentView.BackgroundColor = UIColor.FromRGB(240, 240, 240);
            subView.AddSubview(contentView);
            this.AddSubview(subView);

            //ShowPropertyButton
            showPropertyButton        = new UIButton();
            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) =>
            {
                subView.Hidden            = false;
                showPropertyButton.Hidden = true;
            };
            this.AddSubview(showPropertyButton);


            //closeButton
            closeButton = new UIButton();
            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) =>
            {
                subView.Hidden            = true;
                showPropertyButton.Hidden = false;;
            };
            subView.AddSubview(closeButton);

            //Adding Gesture
            UITapGestureRecognizer tapgesture = new UITapGestureRecognizer(() =>
            {
                subView.Hidden            = true;
                showPropertyButton.Hidden = false;
            }
                                                                           );

            propertyLabel.UserInteractionEnabled = true;
            propertyLabel.AddGestureRecognizer(tapgesture);
        }
Example #38
0
        private UIView GetCustomPopupView()
        {
            UIImageView imageView1;
            UIImageView imageView2;
            UIImageView imageView3;
            UILabel     label1;
            UILabel     label2;
            UILabel     label3;
            UIView      view1;
            UIView      view2;
            UIView      view3;
            UIView      mainView;

            var height = detailsPopup.PopupView.Frame.Height / 3;

            imageView1       = new UIImageView();
            imageView1.Image = UIImage.FromBundle("Images/Popup_SendMessage.png");
            imageView1.Alpha = 0.54f;
            imageView1.Frame = new CGRect(10, 15, 20, 20);

            label1      = new UILabel();
            label1.Text = "Send Message";
            var tapGesture1 = new UITapGestureRecognizer(DisplayToast)
            {
                NumberOfTapsRequired = 1
            };

            label1.AddGestureRecognizer(tapGesture1);
            label1.TextColor = UIColor.FromRGB(0, 0, 0);
            label1.Alpha     = 0.54f;
            label1.Tag       = 11;
            label1.UserInteractionEnabled = true;
            label1.Frame = new CGRect(50, 13, this.Frame.Width, 20);

            view1 = new UIView();
            view1.AddSubview(imageView1);
            view1.AddSubview(label1);
            view1.Frame = new CGRect(10, 0, this.Frame.Width, height);

            imageView2       = new UIImageView();
            imageView2.Image = UIImage.FromBundle("Images/Popup_BlockContact.png");
            imageView2.Alpha = 0.54f;
            imageView2.Frame = new CGRect(10, 13, 22, 22);

            label2           = new UILabel();
            label2.Text      = "Block/report contact";
            label2.TextColor = UIColor.FromRGB(0, 0, 0);
            label2.UserInteractionEnabled = true;
            var tapGesture2 = new UITapGestureRecognizer(DisplayToast)
            {
                NumberOfTapsRequired = 1
            };

            label2.AddGestureRecognizer(tapGesture2);
            label2.Alpha = 0.54f;
            label2.Tag   = 22;
            label2.Frame = new CGRect(50, 13, this.Frame.Width, 20);

            view2 = new UIView();
            view2.AddSubview(imageView2);
            view2.AddSubview(label2);
            view2.Frame = new CGRect(10, height, this.Frame.Width, height);

            imageView3       = new UIImageView();
            imageView3.Image = UIImage.FromBundle("Images/Popup_ContactInfo.png");
            imageView3.Alpha = 0.54f;
            imageView3.Frame = new CGRect(10, 13, 22, 22);

            label3      = new UILabel();
            label3.Text = "Contact Details";
            label3.UserInteractionEnabled = true;
            label3.TextColor = UIColor.FromRGB(0, 0, 0);
            var tapGesture3 = new UITapGestureRecognizer(DisplayToast)
            {
                NumberOfTapsRequired = 1
            };

            label3.AddGestureRecognizer(tapGesture3);
            label3.Alpha = 0.54f;
            label3.Tag   = 33;
            label3.Frame = new CGRect(50, 13, this.Frame.Width, 20);

            view3 = new UIView();
            view3.AddSubview(imageView3);
            view3.AddSubview(label3);
            view3.Frame = new CGRect(10, height * 2, this.Frame.Width, height);

            mainView = new UIView();
            mainView.BackgroundColor = UIColor.FromRGB(255, 255, 255);
            mainView.AddSubview(view1);
            mainView.AddSubview(view2);
            mainView.AddSubview(view3);

            return(mainView);
        }
Example #39
0
        private void CreateView()
        {
            View.UserInteractionEnabled = true;

            var viewTap = new UITapGestureRecognizer(() =>
            {
                _amountTextField.ResignFirstResponder();
            });

            View.AddGestureRecognizer(viewTap);

            View.BackgroundColor = Constants.R250G250B250;

            var topBackground = new UIView();

            topBackground.BackgroundColor = UIColor.White;
            View.AddSubview(topBackground);

            topBackground.AutoPinEdgeToSuperviewEdge(ALEdge.Top, 20);
            topBackground.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            topBackground.AutoPinEdgeToSuperviewEdge(ALEdge.Right);

            var steemView = new UIView();

            topBackground.AddSubview(steemView);

            var label = new UILabel();

            label.Text = "Steem";
            label.Font = Constants.Semibold14;
            steemView.AddSubview(label);

            label.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            label.AutoPinEdgeToSuperviewEdge(ALEdge.Left);

            _firstTokenText.BaselineAdjustment        = UIBaselineAdjustment.AlignCenters;
            _firstTokenText.AdjustsFontSizeToFitWidth = true;
            _firstTokenText.TextAlignment             = UITextAlignment.Right;
            steemView.AddSubview(_firstTokenText);

            _firstTokenText.AutoAlignAxis(ALAxis.Horizontal, label);
            _firstTokenText.AutoPinEdgeToSuperviewEdge(ALEdge.Right);
            _firstTokenText.AutoPinEdge(ALEdge.Left, ALEdge.Right, label, 5);
            _firstTokenText.SetContentHuggingPriority(1, UILayoutConstraintAxis.Horizontal);

            steemView.AutoSetDimension(ALDimension.Height, 70);
            steemView.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 20);
            steemView.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 20);
            steemView.AutoPinEdgeToSuperviewEdge(ALEdge.Top);

            var separator = new UIView();

            separator.BackgroundColor = Constants.R245G245B245;

            topBackground.AddSubview(separator);

            separator.AutoSetDimension(ALDimension.Height, 1);
            separator.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 20);
            separator.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 20);
            separator.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, steemView);

            var spView = new UIView();

            topBackground.AddSubview(spView);

            var label2 = new UILabel();

            label2.Text = "Steem Power";
            label2.Font = Constants.Semibold14;
            spView.AddSubview(label2);

            label2.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            label2.AutoPinEdgeToSuperviewEdge(ALEdge.Left);

            _secondTokenText.BaselineAdjustment        = UIBaselineAdjustment.AlignCenters;
            _secondTokenText.AdjustsFontSizeToFitWidth = true;
            _secondTokenText.TextAlignment             = UITextAlignment.Right;
            spView.AddSubview(_secondTokenText);

            _secondTokenText.AutoAlignAxisToSuperviewAxis(ALAxis.Horizontal);
            _secondTokenText.AutoPinEdgeToSuperviewEdge(ALEdge.Right);
            _secondTokenText.AutoPinEdge(ALEdge.Left, ALEdge.Right, label2, 5);
            _secondTokenText.SetContentHuggingPriority(1, UILayoutConstraintAxis.Horizontal);

            spView.AutoSetDimension(ALDimension.Height, 70);
            spView.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, separator);
            spView.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 20);
            spView.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 20);
            spView.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom);

            var amountBackground = new UIView();

            amountBackground.BackgroundColor = UIColor.White;
            View.AddSubview(amountBackground);

            amountBackground.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, topBackground, 10);
            amountBackground.AutoPinEdgeToSuperviewEdge(ALEdge.Left);
            amountBackground.AutoPinEdgeToSuperviewEdge(ALEdge.Right);

            var amountLabel = new UILabel();

            amountLabel.Text = AppSettings.LocalizationManager.GetText(LocalizationKeys.Amount);
            amountLabel.Font = Constants.Semibold14;
            amountBackground.AddSubview(amountLabel);

            amountLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Top, 15);
            amountLabel.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 20);

            _amountTextField = new SearchTextField(AppSettings.LocalizationManager.GetText(LocalizationKeys.TransferAmountHint), new AmountFieldDelegate(), false);
            _amountTextField.EditingChanged    += AmountEditOnTextChanged;
            _amountTextField.KeyboardType       = UIKeyboardType.DecimalPad;
            _amountTextField.Layer.CornerRadius = 25;
            amountBackground.AddSubview(_amountTextField);

            _amountTextField.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 20);
            _amountTextField.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, amountLabel, 16);
            _amountTextField.AutoSetDimension(ALDimension.Height, 50);
            _amountTextField.AutoPinEdgeToSuperviewEdge(ALEdge.Bottom, 20);

            _amountTextField.TouchUpOutside += (object sender, EventArgs e) =>
            {
                _amountTextField.ResignFirstResponder();
            };

            errorMessage = new UILabel
            {
                Font      = Constants.Semibold14,
                TextColor = Constants.R255G34B5,
                Text      = AppSettings.LocalizationManager.GetText(LocalizationKeys.AmountLimitFull),
                Hidden    = true,
            };
            amountBackground.AddSubview(errorMessage);

            errorMessage.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, _amountTextField);
            errorMessage.AutoPinEdge(ALEdge.Left, ALEdge.Left, _amountTextField);
            errorMessage.AutoPinEdge(ALEdge.Right, ALEdge.Right, _amountTextField);

            var max = new UIButton();

            max.SetTitle(AppSettings.LocalizationManager.GetText(LocalizationKeys.Max), UIControlState.Normal);
            max.SetTitleColor(UIColor.Black, UIControlState.Normal);
            max.Font = Constants.Semibold14;
            max.Layer.BorderWidth  = 1;
            max.Layer.BorderColor  = Constants.R245G245B245.CGColor;
            max.Layer.CornerRadius = 25;

            amountBackground.AddSubview(max);

            max.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 20);
            max.AutoPinEdge(ALEdge.Left, ALEdge.Right, _amountTextField, 10);
            max.AutoSetDimensionsToSize(new CGSize(80, 50));
            max.AutoAlignAxis(ALAxis.Horizontal, _amountTextField);
            max.TouchDown += MaxBtnOnClick;

            _actionButton.SetTitle(AppSettings.LocalizationManager.GetText(_powerAction == PowerAction.PowerUp ? LocalizationKeys.PowerUp : LocalizationKeys.PowerDown), UIControlState.Normal);
            _actionButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            _actionButton.SetTitleColor(UIColor.Clear, UIControlState.Disabled);

            View.AddSubview(_actionButton);

            _actionButton.AutoPinEdge(ALEdge.Top, ALEdge.Bottom, amountBackground, 30);
            _actionButton.AutoPinEdgeToSuperviewEdge(ALEdge.Left, 20);
            _actionButton.AutoPinEdgeToSuperviewEdge(ALEdge.Right, 20);
            _actionButton.AutoSetDimension(ALDimension.Height, 50);

            _actionButton.LayoutIfNeeded();
            _actionButton.TouchDown += PowerBtnOnClick;

            _loader.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.White;
            _loader.HidesWhenStopped           = true;
            _actionButton.AddSubview(_loader);
            _loader.AutoCenterInSuperview();

            Constants.CreateGradient(_actionButton, 25);
            Constants.CreateShadowFromZeplin(_actionButton, Constants.R231G72B0, 0.3f, 0, 10, 20, 0);
        }
Example #40
0
 private void InvokeTapEvent(Xamarin.Forms.View view, Xamarin.Forms.TapGestureRecognizer tgr, UIView uiView, UITapGestureRecognizer nativeTgr)
 {
     if (tgr.Command != null)
     {
         if (tgr.Command.CanExecute(tgr.CommandParameter))
         {
             tgr.Command.Execute(tgr.CommandParameter);
         }
     }
     else
     {
         InvkokeEvent(tgr, "Tapped", view, EventArgs.Empty);
     }
 }
Example #41
0
 void Tap(UITapGestureRecognizer gesture)
 {
     gesture.View.EndEditing(true);
 }
        public override void ViewDidLoad()
        {
            View = new UIView()
            {
                BackgroundColor = UIColor.White
            };
            base.ViewDidLoad();

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

            var textFieldTitle = new UITextField(new RectangleF(10, 10, 300, 30));

            Add(textFieldTitle);
            var picker          = new UIPickerView();
            var pickerViewModel = new MvxPickerViewModel(picker);

            picker.Model = pickerViewModel;
            picker.ShowSelectionIndicator = true;
            textFieldTitle.InputView      = picker;

            var textFieldFirstName = new UITextField(new RectangleF(10, 40, 300, 30));

            Add(textFieldFirstName);
            var textFieldLastName = new UITextField(new RectangleF(10, 70, 300, 30));

            Add(textFieldLastName);
            var acceptedLabel = new UILabel(new RectangleF(10, 100, 200, 30));

            acceptedLabel.Text = "Accepted?";
            Add(acceptedLabel);
            var accepted = new UISwitch(new RectangleF(210, 100, 100, 30));

            Add(accepted);
            var add = new UIButton(UIButtonType.RoundedRect);

            add.SetTitle("Add", UIControlState.Normal);
            add.TintColor = UIColor.Purple;
            add.Frame     = new RectangleF(10, 130, 300, 30);
            Add(add);

            var table = new UITableView(new RectangleF(10, 160, 300, 300));

            Add(table);
            var source = new MvxStandardTableViewSource(table, "TitleText FirstName");

            table.Source = source;

            var set = this.CreateBindingSet <FirstView, Core.ViewModels.FirstViewModel>();

            set.Bind(textFieldFirstName).To(vm => vm.FirstName);
            set.Bind(textFieldLastName).To(vm => vm.LastName);
            set.Bind(pickerViewModel).For(p => p.ItemsSource).To(vm => vm.Titles);
            set.Bind(pickerViewModel).For(p => p.SelectedItem).To(vm => vm.Title);
            set.Bind(textFieldTitle).To(vm => vm.Title);
            set.Bind(accepted).To(vm => vm.Accepted);
            set.Bind(add).To("Add");
            set.Bind(source).To(vm => vm.People);
            set.Apply();

            var tap = new UITapGestureRecognizer(() =>
            {
                foreach (var view in View.Subviews)
                {
                    var text = view as UITextField;
                    if (text != null)
                    {
                        text.ResignFirstResponder();
                    }
                }
            });

            View.AddGestureRecognizer(tap);
        }
 void HandleTapGesture(UITapGestureRecognizer tapGestureRecognizer)
 {
     toolBar.Hidden          = !toolBar.Hidden;
     currentTimeLabel.Hidden = !currentTimeLabel.Hidden;
 }
Example #44
0
        private void SetupLeftView()
        {
            //Right Area init
            var margins = View.LayoutMarginsGuide;

            TopRightLabel = new PaddedLabel
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Text = "Orders",
            };
            TopRightLabel.Font = UIFont.BoldSystemFontOfSize(25f);

            TopRightButton = new UIButton();
            TopRightButton.SetImage(UIImage.FromBundle("Customer").
                                    ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate),
                                    UIControlState.Normal);
            TopRightButton.ContentEdgeInsets = new UIEdgeInsets(10, 0, 0, 15);
            RightStackView = new UIStackView
            {
                Axis         = UILayoutConstraintAxis.Vertical,
                Alignment    = UIStackViewAlignment.Fill,
                Distribution = UIStackViewDistribution.Fill,
                Spacing      = 10,
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            TopRightStackView = new UIStackView
            {
                Axis         = UILayoutConstraintAxis.Horizontal,
                Alignment    = UIStackViewAlignment.Fill,
                Distribution = UIStackViewDistribution.Fill,
                Spacing      = 10,
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            TopRightStackView.AddArrangedSubview(TopRightLabel);
            TopRightStackView.AddArrangedSubview(TopRightButton);

            RightStackView.AddArrangedSubview(TopRightStackView);
            //View.AddConstraint(TopLeftStackView.TopAnchor.ConstraintEqualTo(this.View.TopAnchor, 100f));
            //TopLeftStackView.TopAnchor.ConstraintEqualTo(margins.TopAnchor).Active = true;
            OrderedItem    = new List <Item>();
            RightTableView = new UITableView
            {
                Source = new SideTableViewSource(null, this)
            };
            RightTableView.RegisterClassForCellReuse(typeof(SideTableViewCell), TabelCellId);
            RightStackView.AddArrangedSubview(RightTableView);
            RightTableView.Layer.BorderColor = UIColor.LightGray.CGColor;
            RightTableView.Layer.BorderWidth = 1;

            CheckoutButton = new UIButton
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor = UIColor.FromRGB(66, 165, 245),
            };

            //CheckoutButton.Layer.CornerRadius = 10;
            CheckoutButton.SetTitle("Pay", UIControlState.Normal);
            CheckoutButton.HeightAnchor.ConstraintEqualTo(70.0f).Active = true;
            RightStackView.AddArrangedSubview(CheckoutButton);

            UIView RightView = new UIView
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            RightView.Layer.BorderColor = UIColor.LightGray.CGColor;
            RightView.Layer.BorderWidth = 1;
            //RightView.Layer.CornerRadius = 10.0f;
            View.Add(RightView);
            RightView.Add(RightStackView);


            RightView.TopAnchor.ConstraintEqualTo(margins.TopAnchor).Active      = true;
            RightView.LeadingAnchor.ConstraintEqualTo(View.LeadingAnchor).Active = true;
            RightView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor).Active   = true;
            RightView.WidthAnchor.ConstraintEqualTo(300).Active = true;

            //View.Add(LeftStackView);
            RightStackView.TopAnchor.ConstraintEqualTo(RightView.TopAnchor).Active           = true;
            RightStackView.TrailingAnchor.ConstraintEqualTo(RightView.TrailingAnchor).Active = true;
            RightStackView.BottomAnchor.ConstraintEqualTo(RightView.BottomAnchor).Active     = true;
            RightStackView.LeadingAnchor.ConstraintEqualTo(RightView.LeadingAnchor).Active   = true;

            //Right Area init
            LeftStackView = new UIStackView
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            View.Add(LeftStackView);
            LeftStackView.TopAnchor.ConstraintEqualTo(margins.TopAnchor, 5).Active             = true;
            LeftStackView.TrailingAnchor.ConstraintEqualTo(View.TrailingAnchor, -15).Active    = true;
            LeftStackView.BottomAnchor.ConstraintEqualTo(View.BottomAnchor).Active             = true;
            LeftStackView.LeadingAnchor.ConstraintEqualTo(RightView.TrailingAnchor, 15).Active = true;
            //float CVwidth = LeftStackView.SystemLayoutSizeFittingSize();
            CollectionViewlayout = new UICollectionViewFlowLayout
            {
                //SectionInset = new UIEdgeInsets(20, 5, 5, 5),
                MinimumInteritemSpacing = 20,
                MinimumLineSpacing      = 20,
                ItemSize        = new SizeF(150, 80),
                ScrollDirection = UICollectionViewScrollDirection.Vertical
            };
            ItemCollectionView CVSource = new ItemCollectionView(100, this);

            CollectionView = new UICollectionView(UIScreen.MainScreen.Bounds, CollectionViewlayout);
            //CollectionView.ContentSize = View.Frame.Size;
            CollectionView.RegisterClassForCell(typeof(ItemCell), ItemCell.CellId);
            CollectionView.BackgroundColor = UIColor.Clear;
            CollectionView.Source          = CVSource;


            LeftStackView.AddArrangedSubview(CollectionView);

            //searchResultsController: null
            SearchController = new UISearchController((UIViewController)null)
            {
                DimsBackgroundDuringPresentation = true
            };
            SearchController.HidesNavigationBarDuringPresentation = false;
            SearchController.Active = false;

            SearchController.SearchBar.Frame                      = new CGRect(0, 0, 200, 44);
            SearchController.SearchBar.ShowsCancelButton          = false;
            SearchController.ObscuresBackgroundDuringPresentation = false;
            SearchController.SearchBar.TextChanged               += (s, e) =>
            {
                try
                {
                    string text = "100";
                    if (SearchController.SearchBar.Text.Trim().Length > 0)
                    {
                        text = SearchController.SearchBar.Text;
                    }
                    CVSource.ChangeList(int.Parse(text));
                    CollectionView.ReloadData();
                }
                catch (Exception ex)
                {
                    Console.Write(ex.Message);
                }
            };
            var bar = new UIView(SearchController.SearchBar.Frame);

            bar.BackgroundColor = UIColor.Clear;
            bar.AddSubview(SearchController.SearchBar);
            NavigationItem.RightBarButtonItem          = new UIBarButtonItem(bar);
            NavigationItem.HidesSearchBarWhenScrolling = true;
            UITapGestureRecognizer gestureTap = new UITapGestureRecognizer(DismissKeyboard);

            View.AddGestureRecognizer(gestureTap);

            BackButton  = new UIButton();
            ClearButton = new UIButton();

            //BackButton.SetTitle("<", UIControlState.Normal);
            ClearButton.SetTitle("Clear", UIControlState.Normal);
            BackButton.SetImage(UIImage.FromBundle("Cancel").ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), UIControlState.Normal);
            BackButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            ClearButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            BackButton.SetTitleColor(UIColor.Green, UIControlState.Focused);
            ClearButton.SetTitleColor(UIColor.Black, UIControlState.Focused);
            ClearButton.TintColor = UIColor.White;
            BackButton.TintColor  = UIColor.White;

            UIBarButtonItem backbarbutton  = new UIBarButtonItem(BackButton);
            UIBarButtonItem clearbarbutton = new UIBarButtonItem(ClearButton);

            NavigationItem.LeftBarButtonItems = new UIBarButtonItem[] { backbarbutton, clearbarbutton };
            //BackButton.Hidden = true;
        }
 public void TapCarrierLabel(UITapGestureRecognizer uitgr)
 {
     overView.Alpha = 0;
     topView.Alpha  = 1;
 }
Example #46
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);
        }
        public override void LayoutSubviews()
        {
            base.LayoutSubviews();
            presentController = GetVisibleViewController();
            UIView mainView = new UIView();

            mainView.Frame                          = new CGRect(0, 0, Frame.Width, Frame.Height);
            mainView.BackgroundColor                = UIColor.Clear;
            sfImageEditor                           = new SfImageEditor(new CGRect(mainView.Frame.X, mainView.Frame.Y, mainView.Frame.Width, mainView.Frame.Height));
            sfImageEditor.Image                     = UIImage.FromBundle("Images/ImageEditor/Customize.jpg");
            sfImageEditor.BackgroundColor           = UIColor.Black;
            sfImageEditor.ToolBarSettings.IsVisible = false;
            //settings = new Object();
            sfImageEditor.ItemSelected += (object sender, ItemSelectedEventArgs e) =>
            {
                RightView.Alpha = 1;
                settings        = e.Settings;
            };
            mainView.AddSubview(sfImageEditor);

            /*--------------------------------------------------*/
            //TopView

            topView       = new UIView();
            topView.Frame = new CGRect(0, 15, Frame.Width, 25);
            topView.Alpha = 0;

            UIButton reset = new UIButton(new CGRect(0, 0, Frame.Width / 6, 25));

            reset.BackgroundColor = UIColor.Clear;
            reset.SetImage(UIImage.FromBundle("Images/ImageEditor/reset_customization.png"), UIControlState.Normal);
            reset.ImageView.ContentMode = UIViewContentMode.ScaleAspectFit;
            reset.TouchUpInside        += Reset_TouchUpInside;
            topView.AddSubview(reset);

            UIButton redo = new UIButton(new CGRect(Frame.Width / 6, 0, Frame.Width / 6, 25));

            redo.BackgroundColor = UIColor.Clear;
            redo.SetImage(UIImage.FromBundle("Images/ImageEditor/redo_customization.png"), UIControlState.Normal);
            redo.ImageView.ContentMode = UIViewContentMode.ScaleAspectFit;
            redo.TouchUpInside        += Redo_TouchUpInside;
            redo.Alpha = 0;
            topView.AddSubview(redo);

            UIButton undo = new UIButton(new CGRect(2 * (Frame.Width / 6), 0, Frame.Width / 6, 25));

            undo.BackgroundColor = UIColor.Clear;
            undo.SetImage(UIImage.FromBundle("Images/ImageEditor/undo_customization.png"), UIControlState.Normal);
            undo.ImageView.ContentMode = UIViewContentMode.ScaleAspectFit;
            undo.TouchUpInside        += Undo_TouchUpInside;
            topView.AddSubview(undo);

            UIButton rect = new UIButton(new CGRect(3 * (Frame.Width / 6), 0, Frame.Width / 6, 25));

            rect.BackgroundColor = UIColor.Clear;
            rect.SetImage(UIImage.FromBundle("Images/ImageEditor/rect_customization.png"), UIControlState.Normal);
            rect.ImageView.ContentMode = UIViewContentMode.ScaleAspectFit;
            rect.TouchUpInside        += Rect_TouchUpInside;
            topView.AddSubview(rect);

            UIButton text = new UIButton(new CGRect(4 * (Frame.Width / 6), 0, Frame.Width / 6, 25));

            text.BackgroundColor = UIColor.Clear;
            text.SetImage(UIImage.FromBundle("Images/ImageEditor/text_customization.png"), UIControlState.Normal);
            text.ImageView.ContentMode = UIViewContentMode.ScaleAspectFit;
            text.TouchUpInside        += Text_TouchUpInside;
            topView.AddSubview(text);

            UIButton path = new UIButton(new CGRect(5 * (Frame.Width / 6), 0, Frame.Width / 6, 25));

            path.SetImage(UIImage.FromBundle("Images/ImageEditor/pen_customization.png"), UIControlState.Normal);
            path.ImageView.ContentMode = UIViewContentMode.ScaleAspectFit;
            path.TouchUpInside        += Path_TouchUpInside;
            topView.AddSubview(path);



            /*----------------------------------------------------------*/
            //BottomView

            UIView bottomView = new UIView();

            bottomView.Frame           = new CGRect(10, Frame.Height - 50, Frame.Width, 30);
            bottomView.BackgroundColor = UIColor.Clear;

            textView = new UITextField(new CGRect(20, 0, Frame.Width - 100, 30));
            textView.Layer.CornerRadius = 10.0f;
            textView.Layer.BorderColor  = UIColor.White.CGColor;
            textView.Layer.BorderWidth  = 2;

            textView.TextColor   = UIColor.White;
            textView.Placeholder = "Enter a Caption";
            textView.Enabled     = true;
            textView.ResignFirstResponder();
            textView.MultipleTouchEnabled = true;
            bottomView.AddSubview(textView);

            UIButton share = new UIButton(new CGRect(Frame.Width - 70, 0, 50, 30));

            share.BackgroundColor = UIColor.Clear;
            share.SetImage(UIImage.FromBundle("Images/ImageEditor/share_customization.png"), UIControlState.Normal);
            share.ImageView.ContentMode = UIViewContentMode.ScaleAspectFit;
            share.TouchUpInside        += Share_TouchUpInside;
            bottomView.AddSubview(share);


            /*--------------------------------------------------*/

            //RightView
            RightView                 = new UIView();
            RightView.Frame           = new CGRect(Frame.Width - 50, 20, 30, Frame.Height);
            RightView.BackgroundColor = UIColor.Clear;

            //Color Collection
            UIColor[] array = new UIColor[10] {
                UIColor.FromRGB(68, 114, 196)
                , UIColor.FromRGB(237, 125, 49)
                , UIColor.FromRGB(255, 192, 0)
                , UIColor.FromRGB(112, 173, 71)
                , UIColor.FromRGB(91, 155, 213)
                , UIColor.FromRGB(193, 193, 193)
                , UIColor.FromRGB(111, 111, 226)
                , UIColor.FromRGB(226, 105, 174)
                , UIColor.FromRGB(158, 72, 14)
                , UIColor.FromRGB(153, 115, 0)
            };

            int y = (int)(this.Frame.Height / 2) - 175;

            for (int i = 0; i < 10; i++)
            {
                UIButton colorButton = new UIButton();
                colorButton.Frame = new CGRect(3, y + 5, 25, 25);
                colorButton.Layer.CornerRadius = 10;
                y = y + 30;
                colorButton.BackgroundColor = array[i];
                colorButton.TouchUpInside  += ColorButton_TouchUpInside;
                RightView.Add(colorButton);
            }

            mainView.AddSubview(RightView);
            mainView.AddSubview(topView);
            mainView.AddSubview(bottomView);
            RightView.Alpha = 0;

            overView                 = new UIView();
            overView.Frame           = new CGRect(0, 0, Frame.Width, Frame.Height);
            overView.BackgroundColor = UIColor.Clear;
            overView.Alpha           = 1f;
            UITapGestureRecognizer tapped = new UITapGestureRecognizer(TapCarrierLabel);

            overView.AddGestureRecognizer(tapped);

            AddSubview(mainView);

            AddSubview(overView);
        }
Example #48
0
        public CustomToolbar()
        {
            parentView     = new UIView(this.Frame);
            initialStream  = typeof(CustomToolbar).GetTypeInfo().Assembly.GetManifestResourceStream("SampleBrowser.Samples.PDFViewer.Assets.F# Succinctly.pdf");
            loadedDocument = new PdfLoadedDocument(initialStream);
            PopulateInitialBookmarkList();
            var tap = new UITapGestureRecognizer(OnSingleTap);

            tap.CancelsTouchesInView = false; //for iOS5
            highFont      = UIFont.FromName("Final_PDFViewer_IOS_FontUpdate", 30);
            fontSizeFont  = UIFont.FromName("Font size Font", 30);
            signatureFont = UIFont.FromName("Signature_PDFViewer_FONT", 30);
            //Font that defines the icons for the bookmark toolbar buttons
            bookmarkFont = UIFont.FromName("PdfViewer_FONT", 30);
            this.AddGestureRecognizer(tap);
            helper         = new TextMarkupAnnotationHelper(this);
            inkHelper      = new InkAnnotationHelper(this);
            annotHelper    = new AnnotationHelper(this);
            rangeSlider    = new SfRangeSlider();
            edittextHelper = new EditTextAnnotationHelper(this);
            shapeHelper    = new ShapeAnnotationHelper(this);
            opacitybutton.TouchUpInside += inkHelper.Opacitybutton_TouchUpInside;
            pdfViewerControl             = new SfPdfViewer();
            pdfViewerControl.PreserveSignaturePadOrientation = true;
            pdfViewerControl.Toolbar.Enabled               = false;
            pdfViewerControl.PageChanged                  += ViewerControl_PageChanged;
            pdfViewerControl.TextMarkupSelected           += helper.PdfViewerControl_TextMarkupSelected;
            pdfViewerControl.TextMarkupDeselected         += helper.PdfViewerControl_TextMarkupDeselected;
            pdfViewerControl.CanUndoModified              += PdfViewerControl_CanUndoModified;
            pdfViewerControl.CanRedoModified              += PdfViewerControl_CanRedoModified;
            pdfViewerControl.CanUndoInkModified           += inkHelper.PdfViewerControl_CanUndoInkModified;
            pdfViewerControl.CanRedoInkModified           += inkHelper.PdfViewerControl_CanRedoInkModified;
            pdfViewerControl.InkSelected                  += inkHelper.PdfViewerControl_InkSelected;
            pdfViewerControl.InkDeselected                += inkHelper.PdfViewerControl_InkDeselected;
            pdfViewerControl.FreeTextAnnotationAdded      += edittextHelper.PdfViewerControl_FreeTextAnnotationAdded;
            pdfViewerControl.FreeTextAnnotationDeselected += edittextHelper.PdfViewerControl_FreeTextAnnotationDeselected;
            pdfViewerControl.FreeTextAnnotationSelected   += edittextHelper.PdfViewerControl_FreeTextAnnotationSelected;
            pdfViewerControl.FreeTextPopupDisappeared     += edittextHelper.PdfViewerControl_FreeTextPopupDisappearing;
            pdfViewerControl.ShapeAnnotationSelected      += shapeHelper.PdfViewerControl_ShapeAnnotationSelected;
            pdfViewerControl.ShapeAnnotationDeselected    += shapeHelper.PdfViewerControl_ShapeAnnotationDeselected;
            BoldBtn1.TouchUpInside                += inkHelper.BoldColorBtn1_TouchUpInside;
            BoldColorBtn1.TouchUpInside           += inkHelper.BoldColorBtn1_TouchUpInside;
            BoldBtn2.TouchUpInside                += inkHelper.BoldColorBtn2_TouchUpInside;
            BoldColorBtn2.TouchUpInside           += inkHelper.BoldColorBtn2_TouchUpInside;
            BoldBtn3.TouchUpInside                += inkHelper.BoldColorBtn3_TouchUpInside;
            BoldColorBtn3.TouchUpInside           += inkHelper.BoldColorBtn3_TouchUpInside;
            BoldColorBtn4.TouchUpInside           += inkHelper.BoldColorBtn4_TouchUpInside;
            BoldBtn4.TouchUpInside                += inkHelper.BoldColorBtn4_TouchUpInside;
            BoldColorBtn5.TouchUpInside           += inkHelper.BoldColorBtn5_TouchUpInside;
            BoldBtn5.TouchUpInside                += inkHelper.BoldColorBtn5_TouchUpInside;
            inkColorButton.TouchUpInside          += helper.ColorButton_TouchUpInside;
            colorButton.TouchUpInside             += helper.ColorButton_TouchUpInside;
            inkAnnotationButton.TouchUpInside     += inkHelper.InkAnnotationButton_TouchUpInside;
            inkThicknessButton.TouchUpInside      += inkHelper.InkThicknessButton_TouchUpInside;
            shapeThicknessButton.TouchUpInside    += inkHelper.InkThicknessButton_TouchUpInside;
            edittextThicknessButton.TouchUpInside += edittextHelper.EditTextThicknessButton_TouchUpInside;
            edittextColorButton.TouchUpInside     += helper.ColorButton_TouchUpInside;
            shapeColorButton.TouchUpInside        += helper.ColorButton_TouchUpInside;
            pageNumberField.Text = "1";
            CreateTopToolbar();
            bottomToolBar = CreateBottomToolbar();
            toolbar       = toolBar;
            parentView.AddSubview(pdfViewerControl);
            AddSubview(parentView);
            AddSubview(toolbar);
            AddSubview(bottomToolBar);
            topBorder.BackgroundColor = UIColor.FromRGBA(red: 0.86f, green: 0.86f, blue: 0.86f, alpha: 1.0f);
            AddSubview(topBorder);
            activityDialog       = new ActivityIndicator();
            activityDialog.Frame = new CGRect(UIScreen.MainScreen.Bounds.Width / 2 - 125, UIScreen.MainScreen.Bounds.Height / 2 - 50, 250, 100);
            popUpAlertView       = new UIAlertView();
            dropDownMenu         = CreateDropDownMenu();
            dropDownMenu.DropDownMenuItemChanged += (e, a) =>
            {
                fileStream     = typeof(CustomToolbar).GetTypeInfo().Assembly.GetManifestResourceStream("SampleBrowser.Samples.PDFViewer.Assets." + a.DisplayText + ".pdf");
                loadedDocument = new PdfLoadedDocument(fileStream);
                PopulateInitialBookmarkList();
                pdfViewerControl.LoadDocument(fileStream);
                isBookmarkPaneVisible = false;
                if (bookmarkToolbar != null && bookmarkToolbar.Superview != null)
                {
                    bookmarkToolbar.RemoveFromSuperview();
                }
                ResetToolBar();
                annotHelper.RemoveAllToolbars(false);
                dropDownMenu.Close();
            };
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _navController = TabBarController != null ? TabBarController.NavigationController : NavigationController;
            _navController.NavigationBar.Translucent = false;

            _gridDelegate                   = new CollectionViewFlowDelegate(collectionView, _presenter);
            _gridDelegate.IsGrid            = false;
            _gridDelegate.ScrolledToBottom += ScrolledToBottom;
            _gridDelegate.CellClicked      += CellAction;

            _collectionViewSource        = new ProfileCollectionViewSource(_presenter, _gridDelegate);
            _collectionViewSource.IsGrid = false;
            collectionView.Source        = _collectionViewSource;
            collectionView.RegisterClassForCell(typeof(LoaderCollectionCell), nameof(LoaderCollectionCell));
            collectionView.RegisterClassForCell(typeof(PhotoCollectionViewCell), nameof(PhotoCollectionViewCell));
            collectionView.RegisterNibForCell(UINib.FromName(nameof(PhotoCollectionViewCell), NSBundle.MainBundle), nameof(PhotoCollectionViewCell));
            collectionView.RegisterClassForCell(typeof(NewFeedCollectionViewCell), nameof(NewFeedCollectionViewCell));

            _refreshControl = new UIRefreshControl();
            _refreshControl.ValueChanged += async(sender, e) =>
            {
                await GetPosts(false, true);
            };
            collectionView.Add(_refreshControl);

            _collectionViewSource.CellAction += CellAction;
            _collectionViewSource.TagAction  += TagAction;

            collectionView.SetCollectionViewLayout(new UICollectionViewFlowLayout()
            {
                MinimumLineSpacing      = 0,
                MinimumInteritemSpacing = 0,
            }, false);

            collectionView.Delegate = _gridDelegate;

            if (!BasePresenter.User.IsAuthenticated && CurrentPostCategory == null)
            {
                loginButton.Hidden             = false;
                loginButton.Layer.CornerRadius = 20;
                loginButton.Layer.BorderWidth  = 0;
            }

            loginButton.TouchDown += LoginTapped;

            hotButton.TouchDown += (object sender, EventArgs e) =>
            {
                SwitchSearchType(PostType.Hot);
            };

            topButton.TouchDown += (object sender, EventArgs e) =>
            {
                SwitchSearchType(PostType.Top);
            };

            newButton.TouchDown += (object sender, EventArgs e) =>
            {
                SwitchSearchType(PostType.New);
            };

            switcher.TouchDown += SwitchLayout;

            var searchTap = new UITapGestureRecognizer(SearchTapped);

            searchButton.AddGestureRecognizer(searchTap);

            GetPosts();
        }
Example #50
0
 public void OnSingleTap(UITapGestureRecognizer gesture)
 {
     this.EndEditing(true);
     pageNumberField.Text = pdfViewerControl.PageNumber.ToString();
 }
Example #51
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // set the background view to black so we don't get white aliasing flicker during
            // the pan
            View.BackgroundColor   = UIColor.Black;
            View.Layer.AnchorPoint = CGPoint.Empty;


            // scroll view
            ScrollView = new UIScrollViewWrapper( );
            ScrollView.Layer.AnchorPoint = CGPoint.Empty;
            ScrollView.BackgroundColor   = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor);
            ScrollView.Parent            = this;
            View.AddSubview(ScrollView);



            // create our keyboard adjustment manager, which works to make sure text fields scroll into visible
            // range when a keyboard appears
            KeyboardAdjustManager = new Rock.Mobile.PlatformSpecific.iOS.UI.KeyboardAdjustManager(View);


            // setup the First Name field
            FirstName = new StyledTextField();
            ScrollView.AddSubview(FirstName.Background);
            ControlStyling.StyleTextField(FirstName.Field, PrayerStrings.CreatePrayer_FirstNamePlaceholderText, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            ControlStyling.StyleBGLayer(FirstName.Background);

            LastName = new StyledTextField();
            ScrollView.AddSubview(LastName.Background);
            ControlStyling.StyleTextField(LastName.Field, PrayerStrings.CreatePrayer_LastNamePlaceholderText, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            ControlStyling.StyleBGLayer(LastName.Background);

            Email = new StyledTextField();
            ScrollView.AddSubview(Email.Background);
            Email.Field.AutocapitalizationType = UITextAutocapitalizationType.None;
            Email.Field.AutocorrectionType     = UITextAutocorrectionType.No;
            ControlStyling.StyleTextField(Email.Field, PrayerStrings.CreatePrayer_EmailPlaceholderText, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            ControlStyling.StyleBGLayer(Email.Background);


            PrayerRequestLayer = new UIView();
            ScrollView.AddSubview(PrayerRequestLayer);

            PrayerRequestPlaceholder = new UILabel();
            PrayerRequestLayer.AddSubview(PrayerRequestPlaceholder);

            PrayerRequest = new UITextView();
            PrayerRequestLayer.AddSubview(PrayerRequest);

            // setup the prayer request field, which requires a fake "placeholder" text field
            PrayerRequest.Delegate           = new KeyboardAdjustManager.TextViewDelegate( );
            PrayerRequest.TextColor          = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor);
            PrayerRequest.TextContainerInset = UIEdgeInsets.Zero;
            PrayerRequest.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            PrayerRequest.TextContainer.LineFragmentPadding = 0;
            PrayerRequest.BackgroundColor            = UIColor.Clear;
            PrayerRequest.Editable                   = true;
            PrayerRequest.KeyboardAppearance         = UIKeyboardAppearance.Dark;
            PrayerRequestPlaceholder.TextColor       = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor);
            PrayerRequestPlaceholder.BackgroundColor = UIColor.Clear;
            PrayerRequestPlaceholder.Text            = PrayerStrings.CreatePrayer_PrayerRequest;
            PrayerRequestPlaceholder.Font            = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            //PrayerRequestPlaceholder.SizeToFit( );
            ControlStyling.StyleBGLayer(PrayerRequestLayer);


            // category layer
            CategoryLayer = new UIView();
            ScrollView.AddSubview(CategoryLayer);

            CategoryButton = new UIButton();
            CategoryLayer.AddSubview(CategoryButton);

            // setup the category picker and selector button
            UILabel categoryLabel = new UILabel( );

            ControlStyling.StyleUILabel(categoryLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            categoryLabel.Text = PrayerStrings.CreatePrayer_SelectCategoryLabel;

            PickerAdjustManager = new PickerAdjustManager(View, ScrollView, categoryLabel, CategoryLayer);
            UIPickerView pickerView = new UIPickerView();

            pickerView.Model = new CategoryPickerModel()
            {
                Parent = this
            };
            pickerView.UserInteractionEnabled = true;
            PickerAdjustManager.SetPicker(pickerView);


            // setup a tap gesture for the picker
            Action action = () =>
            {
                OnToggleCategoryPicker(false);
            };
            UITapGestureRecognizer uiTap = new UITapGestureRecognizer(action);

            uiTap.NumberOfTapsRequired = 1;
            pickerView.AddGestureRecognizer(uiTap);
            uiTap.Delegate = this;


            CategoryButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                OnToggleCategoryPicker(true);
            };
            CategoryButton.SetTitle(PrayerStrings.CreatePrayer_CategoryButtonText, UIControlState.Normal);
            CategoryButton.SetTitleColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor), UIControlState.Normal);
            CategoryButton.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            CategoryButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;
            ControlStyling.StyleBGLayer(CategoryLayer);


            // preference switches
            SwitchBackground = new UIView();
            ScrollView.AddSubview(SwitchBackground);
            ControlStyling.StyleBGLayer(SwitchBackground);

            UIPublicSwitch = new UISwitch();
            SwitchBackground.AddSubview(UIPublicSwitch);

            MakePublicLabel = new UILabel();
            SwitchBackground.AddSubview(MakePublicLabel);
            //MakePublicLabel.TextColor = UIColor.White;


            UISwitchAnonymous = new UISwitch();
            SwitchBackground.AddSubview(UISwitchAnonymous);

            //PostAnonymouslyLabel = new UILabel();
            //SwitchBackground.AddSubview( PostAnonymouslyLabel );
            //PostAnonymouslyLabel.TextColor = UIColor.White;


            // Setup the anonymous switch

            /*PostAnonymouslyLabel.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize );
             * PostAnonymouslyLabel.Text = PrayerStrings.CreatePrayer_PostAnonymously;
             * PostAnonymouslyLabel.TextColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_ActiveTextColor );
             * UISwitchAnonymous.OnTintColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Switch_OnColor );
             * UISwitchAnonymous.TouchUpInside += (object sender, EventArgs e ) =>
             *  {
             *      OnToggleCategoryPicker( false );
             *
             *      if( UISwitchAnonymous.On == true )
             *      {
             *          FirstName.Field.Enabled = false;
             *          FirstName.Field.Text = PrayerStrings.CreatePrayer_Anonymous;
             *
             *          LastName.Field.Enabled = false;
             *          LastName.Field.Text = PrayerStrings.CreatePrayer_Anonymous;
             *      }
             *      else
             *      {
             *          FirstName.Field.Enabled = true;
             *          FirstName.Field.Text = string.Empty;
             *
             *          LastName.Field.Enabled = true;
             *          LastName.Field.Text = string.Empty;
             *      }
             *
             *      // reset the background colors
             *      Rock.Mobile.PlatformSpecific.iOS.UI.Util.AnimateViewColor( ControlStylingConfig.BG_Layer_Color, FirstName.Background );
             *      Rock.Mobile.PlatformSpecific.iOS.UI.Util.AnimateViewColor( ControlStylingConfig.BG_Layer_Color, LastName.Background );
             *  };*/

            // setup the public switch
            MakePublicLabel.Font       = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            MakePublicLabel.Text       = PrayerStrings.CreatePrayer_MakePublic;
            MakePublicLabel.TextColor  = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor);
            UIPublicSwitch.OnTintColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.Switch_OnColor);
            //UIPublicSwitch.ThumbTintColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_ActiveTextColor );


            // setup the submit button
            SubmitButton = UIButton.FromType(UIButtonType.Custom);
            ScrollView.AddSubview(SubmitButton);
            ControlStyling.StyleButton(SubmitButton, PrayerStrings.CreatePrayer_SubmitButtonText, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);
            SubmitButton.SizeToFit( );
            SubmitButton.TouchUpInside += SubmitPrayerRequest;
        }
Example #52
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            thisController = NavigationController;

            Title = "SIGN UP";

            NavigationItem.Customize(NavigationController);

            btnConfirmRegistration.SetCustomButton();

            edtFirstName.ShouldReturn      += TextFieldShouldReturn;
            edtLastName.ShouldReturn       += TextFieldShouldReturn;
            edtMobileNumber.ShouldReturn   += TextFieldShouldReturn;
            edtEmailAddress.ShouldReturn   += TextFieldShouldReturn;
            edtPassword.ShouldReturn       += TextFieldShouldReturn;
            edtRepeatPassword.ShouldReturn += TextFieldShouldReturn;

            var tap = new UITapGestureRecognizer(() => { View.EndEditing(true); });

            View.AddGestureRecognizer(tap);


                        #if DEBUG
            edtFirstName.Text      = "John";
            edtLastName.Text       = "Dow";
            edtMobileNumber.Text   = "8058081234";
            edtEmailAddress.Text   = "*****@*****.**";
            edtPassword.Text       = "123456";
            edtRepeatPassword.Text = "123456";
                        #endif

            if (AppSettings.LoginType > 0)
            {
                edtFirstName.Text      = AppSettings.UserFirstName;
                edtLastName.Text       = AppSettings.UserLastName;
                edtMobileNumber.Text   = AppSettings.UserPhone;
                edtEmailAddress.Text   = AppSettings.UserEmail;
                edtPassword.Text       = "";
                edtRepeatPassword.Text = "";
            }

            this.SetBinding(
                () => edtFirstName.Text,
                () => ViewModel.FirstName,
                BindingMode.TwoWay)
            .UpdateSourceTrigger("EditingChanged");

            this.SetBinding(
                () => edtLastName.Text,
                () => ViewModel.LastName,
                BindingMode.TwoWay)
            .UpdateSourceTrigger("EditingChanged");

            this.SetBinding(
                () => edtMobileNumber.Text,
                () => ViewModel.MobileNumber,
                BindingMode.TwoWay)
            .UpdateSourceTrigger("EditingChanged");

            this.SetBinding(
                () => edtEmailAddress.Text,
                () => ViewModel.EmailAdress,
                BindingMode.TwoWay)
            .UpdateSourceTrigger("EditingChanged");

            this.SetBinding(
                () => edtPassword.Text,
                () => ViewModel.Password,
                BindingMode.TwoWay)
            .UpdateSourceTrigger("EditingChanged");

            this.SetBinding(
                () => edtRepeatPassword.Text,
                () => ViewModel.RepeatPassword,
                BindingMode.TwoWay)
            .UpdateSourceTrigger("EditingChanged");

            this.SetBinding(
                () => chkIAgree.On,
                () => ViewModel.IsAgree,
                BindingMode.TwoWay)
            .UpdateSourceTrigger("ValueChanged");

            ViewModel.LoginType = AppSettings.LoginType.ToString();
            ViewModel.Token     = AppSettings.UserToken;

            btnConfirmRegistration.SetCommand("TouchUpInside", ViewModel.IncrementCommand);

            this.SetBinding(
                () => ViewModel.ValidaionError)
            .UpdateSourceTrigger("ValidaionErrorChanges")
            .WhenSourceChanges(
                () => {
                if (ViewModel.ValidaionError != null && ViewModel.ValidaionError.Count > 0)
                {
                    var delimeter = Environment.NewLine + "and" + Environment.NewLine;
                    var message   = String.Join(delimeter, ViewModel.ValidaionError.Select(r => r.ErrorMessage));
                    InvokeOnMainThread(() => new UIAlertView(
                                           "Just a couple things left:", message, null, "Ok", null).Show());
                }
            });

            this.SetBinding(
                () => ViewModel.CanMoveForward)
            .UpdateSourceTrigger("CanMoveForwardChanges")
            .WhenSourceChanges(
                () => {
                if (ViewModel.CanMoveForward)
                {
                    AppSettings.LoginType     = (int)LoginType.Email;
                    AppSettings.UserToken     = string.Empty;
                    AppSettings.UserEmail     = edtEmailAddress.Text;
                    AppSettings.UserPassword  = edtPassword.Text;
                    AppSettings.UserFirstName = edtFirstName.Text;
                    AppSettings.UserLastName  = edtLastName.Text;
                    AppSettings.UserPhone     = edtMobileNumber.Text;
                    AppSettings.UserPhoto     = string.Empty;

                    var dic = new Dictionary <String, String>
                    {
                        { Constant.LOGINAPI_USERNAME, edtEmailAddress.Text },
                        { Constant.LOGINAPI_PASSWORD, edtPassword.Text }
                    };

                    string result = String.Empty;

                    try
                    {
                        Task runSync = Task.Factory.StartNew(async() => {
                            result = await AppData.ApiCall(Constant.LOGINAPI, dic);
                            var tt = (LoginResponse)AppData.ParseResponse(Constant.LOGINAPI, result);

                            AppSettings.UserID = tt.Customerid;
                        }).Unwrap();
                        //runSync.Wait();
                    }
                    catch (Exception ex)
                    {
                    }
                    finally{
                        //HideLoadingView();
                    }

                    UIStoryboard sb = UIStoryboard.FromName("MainStoryboard", null);
                    AddCreditCardViewController pvc = (AddCreditCardViewController)sb.InstantiateViewController("AddCreditCardViewController");
                    pvc.fromWhere = "signup";
                    thisController.PushViewController(pvc, true);
                }
            });

            this.SetBinding(
                () => ViewModel.AppExceptions)
            .UpdateSourceTrigger("AppExceptionsChanges")
            .WhenSourceChanges(
                () => {
                if (ViewModel.AppExceptions != null && ViewModel.AppExceptions.Count > 0)
                {
                    var delimeter = Environment.NewLine + "and" + Environment.NewLine;
                    var message   = String.Join(delimeter, ViewModel.AppExceptions.Select(r => r.Message));
                    InvokeOnMainThread(() => new UIAlertView(
                                           "Errors:", message, null, "Ok", null).Show());
                }
            });
        }
 private void onTap(UITapGestureRecognizer gesture)
 {
     stopEditingCurrentCell();
     impactFeedback.ImpactOccurred();
 }
 void DimmingViewTapped(UITapGestureRecognizer sender)
 {
     PresentingViewController.DismissViewController(true, null);
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            var modelForm = new FormDinamicoModel()
            {
                Db        = new FormDinamicoDA(Sqlite_IOS.DB.dataBase),
                IdVisita  = IdPdv,
                IdProduto = IdProduto
            };

            controllerPCL = new FormDinamicoCon(IdPdv, IdProduto, false, modelForm);
            formDinamico  = new UIFormDinamico(controllerPCL, this, scrollViewFormDinamico);
            formDinamico.IniForm();

            backButton.TouchDown += (sender, e) =>
            {
                SaveForm();
            };

            gestureSaveForm.AddTarget((obj) => SaveForm());

            tabBarFormDinamico.ItemSelected += delegate
            {
                if (tabBarFormDinamico.SelectedItem.Title == tabFoto.Title)
                {
                    var actionSheetAlert = UIAlertController.Create("Tipo de foto", "Selecione a categoria da foto desejada", UIAlertControllerStyle.ActionSheet);
                    var fotos            = controllerPCL.GetTagsFoto();

                    foreach (string itemType in fotos)
                    {
                        actionSheetAlert.AddAction(UIAlertAction.Create(itemType, UIAlertActionStyle.Default, (action) => { TakePhoto(itemType); }));
                    }
                    actionSheetAlert.AddAction(UIAlertAction.Create("Outros", UIAlertActionStyle.Default, (action) => { TakePhoto("Outros"); }));
                    actionSheetAlert.AddAction(UIAlertAction.Create("Cancelar", UIAlertActionStyle.Cancel, (action) => { }));
                    var presentationPopover = actionSheetAlert.PopoverPresentationController;
                    if (presentationPopover != null)
                    {
                        presentationPopover.SourceView = View;
                        presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
                    }
                    actionSheetAlert.View.TintColor = UIColor.Black;
                    PresentViewController(actionSheetAlert, true, null);
                }
                else if (tabBarFormDinamico.SelectedItem.Title == tabConcluir.Title)
                {
                    var alert = UIAlertController.Create("Concluir", "Gostaria de concluir a tarefa ?", UIAlertControllerStyle.Alert);
                    alert.AddAction(UIAlertAction.Create("Nao", UIAlertActionStyle.Cancel, (actionCancel) =>
                    {
                        MetricsManager.TrackEvent("CancelConcluirTarefa");
                    }));
                    alert.AddAction(UIAlertAction.Create("Sim", UIAlertActionStyle.Default, (actionOK) =>
                    {
                        if (formDinamico.HasInvalidateFields())
                        {
                            var alertError = UIAlertController.Create("Existem campos obrigatorios ainda nao informados.", null, UIAlertControllerStyle.Alert);
                            alertError.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Cancel, (actionCancel) => { }));
                            alertError.View.TintColor = UIColor.FromRGB(10, 88, 90);
                            PresentViewController(alertError, true, null);
                        }
                        else
                        {
                            var gps = LocationHelper.UpdateLocation();
                            if (gps == null)
                            {
                                var alertGps = UIAlertController.Create("GPS Desativado",
                                                                        "Ligue o GPS ou tire do modo aviao para continuar utilizando o sistema", UIAlertControllerStyle.Alert);
                                alertGps.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, (defaults) => { }));
                                alertGps.View.TintColor = UIColor.FromRGB(10, 88, 90);
                                PresentViewController(alertGps, true, null);
                            }
                            else
                            {
                                var batery = ((int)(UIDevice.CurrentDevice.BatteryLevel * 100F));
                                if (gps.Location != null)
                                {
                                    controllerPCL.SetFormToTable(gps.Location.Coordinate.Latitude,
                                                                 gps.Location.Coordinate.Longitude,
                                                                 StatusAPI.CONCLUIDO, batery);
                                }
                                else
                                {
                                    controllerPCL.SetFormToTable(LocationHelper.LastLocation.Coordinate.Latitude,
                                                                 LocationHelper.LastLocation.Coordinate.Longitude,
                                                                 StatusAPI.CONCLUIDO, batery);
                                }
#if !DEBUG
                                HockeyApp.MetricsManager.TrackEvent("FormConcluido");
#endif
                                DismissViewController(true, null);
                            }
                        }
                    }));
                    alert.View.TintColor = UIColor.FromRGB(10, 88, 90);
                    PresentViewController(alert, true, null);
                }
            };


            var g = new UITapGestureRecognizer(() => View.EndEditing(true))
            {
                CancelsTouchesInView = false
            };
            scrollViewFormDinamico.AddGestureRecognizer(g);
        }
Example #56
0
        void OnTapped(UITapGestureRecognizer gr)
        {
            if (!_element.IsVisible)
            {
                return;
            }

            if (touchCount == 0)
            {
                _viewLocationAtOnDown = ViewLocationInWindow(gr.View);
            }

            _numberOfTaps++;
            _lastTap          = DateTime.Now;
            _lastTapEventArgs = new iOSTapEventArgs(gr, _numberOfTaps, _viewLocationAtOnDown);
            bool tappingHandled      = false;
            bool doubleTappedHandled = false;

            foreach (var listener in _listeners)
            {
                if (!tappingHandled && listener.HandlesTapping)
                {
                    var taskArgs = new TapEventArgs(_lastTapEventArgs, listener);
                    listener.OnTapping(taskArgs);
                    tappingHandled = taskArgs.Handled;
                }
                if (!doubleTappedHandled && _numberOfTaps % 2 == 0 && listener.HandlesDoubleTapped)
                {
                    var taskArgs = new TapEventArgs(_lastTapEventArgs, listener);
                    listener.OnDoubleTapped(taskArgs);
                    doubleTappedHandled = taskArgs.Handled;
                }
                if (tappingHandled && doubleTappedHandled)
                {
                    break;
                }
            }

            if (!_waitingForTapsToFinish && HandlesTapped)
            {
                _waitingForTapsToFinish = true;
                Device.StartTimer(TimeSpan.FromMilliseconds(50), () =>
                {
                    if (DateTime.Now - _lastTap < Settings.TappedThreshold)
                    {
                        return(true);
                    }
                    Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
                    {
                        if (_listeners == null)
                        {
                            _numberOfTaps           = 0;
                            _waitingForTapsToFinish = false;
                            return;
                        }

                        bool handled = false;
                        foreach (var listener in _listeners)
                        {
                            if (listener.HandlesTapped)
                            {
                                var taskArgs = new TapEventArgs(_lastTapEventArgs, listener);
                                listener.OnTapped(taskArgs);
                                handled = taskArgs.Handled;
                                if (handled)
                                {
                                    break;
                                }
                            }
                        }
                        _numberOfTaps           = 0;
                        _waitingForTapsToFinish = false;
                    });
                    return(false);
                });
            }
        }
Example #57
0
        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.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.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);
        }
        protected SliderFeedCollectionViewCell(IntPtr handle) : base(handle)
        {
            _contentView = ContentView;

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

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

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

            authorX = _avatarImage.Frame.Right + 10;

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

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

            _contentScroll       = new UIScrollView();
            _contentScroll.Frame = new CGRect(0, _avatarImage.Frame.Bottom + 20, _contentView.Frame.Width,
                                              _contentView.Frame.Height - (_avatarImage.Frame.Bottom + 20));
            _contentScroll.ShowsVerticalScrollIndicator = false;
            _contentScroll.Bounces = false;
            //_contentScroll.BackgroundColor = UIColor.LightGray;
            _contentView.AddSubview(_contentScroll);

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

            _likes                        = new UILabel();
            _likes.Font                   = Constants.Semibold14;
            _likes.LineBreakMode          = UILineBreakMode.TailTruncation;
            _likes.TextColor              = Constants.R15G24B30;
            _likes.UserInteractionEnabled = true;
            _contentScroll.AddSubview(_likes);
            //_likes.BackgroundColor = UIColor.Purple;

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

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

            _like             = new UIImageView();
            _like.ContentMode = UIViewContentMode.Center;
            //_like.BackgroundColor = UIColor.Orange;
            _contentScroll.AddSubview(_like);

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

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

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

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

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

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

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

            var liketap = new UITapGestureRecognizer(LikeTap);

            _like.AddGestureRecognizer(liketap);

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

            _photoScroll.AddGestureRecognizer(tap);

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

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

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

            _comments.AddGestureRecognizer(commentTap);

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

            _likersTapView.AddGestureRecognizer(netVotesTap);

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

            _flags.AddGestureRecognizer(flagersTap);

            _moreButton.TouchDown  += FlagButton_TouchDown;
            _closeButton.TouchDown += Close_TouchDown;
        }
 public TapWithPositionGestureEffect()
 {
     tapDetector = CreateTapRecognizer(() => tapWithPositionCommand);;
 }
        public void loadOptionView()
        {
            // adding animation types to array
            this.animationTypes.Add((NSString)"Ball");
            this.animationTypes.Add((NSString)"Battery");
            this.animationTypes.Add((NSString)"DoubleCircle");
            this.animationTypes.Add((NSString)"ECG");
            this.animationTypes.Add((NSString)"Globe");
            this.animationTypes.Add((NSString)"HorizontalPulsingBox");
            this.animationTypes.Add((NSString)"MovieTimer");
            this.animationTypes.Add((NSString)"Print");
            this.animationTypes.Add((NSString)"Rectangle");
            this.animationTypes.Add((NSString)"RollingBall");
            this.animationTypes.Add((NSString)"SingleCircle");
            this.animationTypes.Add((NSString)"SlicedCircle");
            this.animationTypes.Add((NSString)"ZoomingTarget");
            this.animationTypes.Add((NSString)"Gear");
            this.animationTypes.Add((NSString)"Box");

            //animationTypeLabel
            animationTypeLabel.Text      = "Animation Types";
            animationTypeLabel.TextColor = UIColor.Black;
            animationTypeLabel.Font      = UIFont.FromName("Helvetica", 14f);
            contentView.AddSubview(animationTypeLabel);

            //animationTextButton
            animationTextButton.SetTitle("Ball", UIControlState.Normal);
            animationTextButton.Font = UIFont.FromName("Helvetica", 14f);
            animationTextButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            animationTextButton.BackgroundColor     = UIColor.Clear;
            animationTextButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            animationTextButton.Hidden             = false;
            animationTextButton.Layer.BorderColor  = UIColor.FromRGB(246, 246, 246).CGColor;
            animationTextButton.Layer.BorderWidth  = 4;
            animationTextButton.Layer.CornerRadius = 8;
            animationTextButton.TouchUpInside     += ShowPicker;
            contentView.AddSubview(animationTextButton);

            //pickerModel
            PickerModel model = new PickerModel(this.animationTypes);

            model.PickerChanged += (sender, e) =>
            {
                this.selectedType = e.SelectedValue;
                animationTextButton.SetTitle(selectedType, UIControlState.Normal);
                if (selectedType == "Ball")
                {
                    busyIndicator.Duration      = 1;
                    busyIndicator.ViewBoxWidth  = 120;
                    busyIndicator.ViewBoxHeight = 120;
                    busyIndicator.Foreground    = UIColor.FromRGB(36, 63, 217);
                    busyIndicator.AnimationType = SFBusyIndicatorAnimationType.SFBusyIndicatorAnimationTypeBall;
                }
                else if (selectedType == "Battery")
                {
                    busyIndicator.Duration      = 1;
                    busyIndicator.ViewBoxWidth  = 120;
                    busyIndicator.ViewBoxHeight = 120;
                    busyIndicator.Foreground    = UIColor.FromRGB(167, 0, 21);
                    busyIndicator.AnimationType = SFBusyIndicatorAnimationType.SFBusyIndicatorAnimationTypeBattery;
                }
                else if (selectedType == "DoubleCircle")
                {
                    busyIndicator.Duration      = 0.6f;
                    busyIndicator.ViewBoxWidth  = 120;
                    busyIndicator.ViewBoxHeight = 120;
                    busyIndicator.Foreground    = UIColor.FromRGB(149, 140, 123);
                    busyIndicator.AnimationType = SFBusyIndicatorAnimationType.SFBusyIndicatorAnimationTypeDoubleCircle;
                }
                else if (selectedType == "ECG")
                {
                    busyIndicator.Duration      = 1;
                    busyIndicator.ViewBoxWidth  = 120;
                    busyIndicator.ViewBoxHeight = 120;
                    busyIndicator.Foreground    = UIColor.FromRGB(218, 144, 26);
                    busyIndicator.AnimationType = SFBusyIndicatorAnimationType.SFBusyIndicatorAnimationTypeECG;
                }
                else if (selectedType == "Globe")
                {
                    busyIndicator.Duration      = 0.5f;
                    busyIndicator.ViewBoxWidth  = 150;
                    busyIndicator.ViewBoxHeight = 150;
                    busyIndicator.Foreground    = UIColor.FromRGB(158, 168, 238);
                    busyIndicator.AnimationType = SFBusyIndicatorAnimationType.SFBusyIndicatorAnimationTypeGlobe;
                }
                else if (selectedType == "HorizontalPulsingBox")
                {
                    busyIndicator.Duration      = 0.2f;
                    busyIndicator.ViewBoxWidth  = 150;
                    busyIndicator.ViewBoxHeight = 150;
                    busyIndicator.Foreground    = UIColor.FromRGB(228, 46, 6);
                    busyIndicator.AnimationType = SFBusyIndicatorAnimationType.SFBusyIndicatorAnimationTypeHorizontalPulsingBox;
                }
                else if (selectedType == "MovieTimer")
                {
                    busyIndicator.Duration       = 1;
                    busyIndicator.ViewBoxWidth   = 150;
                    busyIndicator.ViewBoxHeight  = 150;
                    busyIndicator.Foreground     = UIColor.FromRGB(45, 45, 45);
                    busyIndicator.SecondaryColor = UIColor.FromRGB(155, 155, 155);
                    busyIndicator.AnimationType  = SFBusyIndicatorAnimationType.SFBusyIndicatorAnimationTypeMovieTimer;
                }
                else if (selectedType == "Print")
                {
                    busyIndicator.Duration      = 0.5f;
                    busyIndicator.ViewBoxWidth  = 120;
                    busyIndicator.ViewBoxHeight = 120;
                    busyIndicator.Foreground    = UIColor.FromRGB(94, 111, 248);
                    busyIndicator.AnimationType = SFBusyIndicatorAnimationType.SFBusyIndicatorAnimationTypePrint;
                }
                else if (selectedType == "Rectangle")
                {
                    busyIndicator.Duration      = 0.1f;
                    busyIndicator.ViewBoxWidth  = 150;
                    busyIndicator.ViewBoxHeight = 150;
                    busyIndicator.Foreground    = UIColor.FromRGB(39, 170, 158);
                    busyIndicator.AnimationType = SFBusyIndicatorAnimationType.SFBusyIndicatorAnimationTypeRectangle;
                }
                else if (selectedType == "RollingBall")
                {
                    busyIndicator.Duration       = 1;
                    busyIndicator.ViewBoxWidth   = 120;
                    busyIndicator.ViewBoxHeight  = 120;
                    busyIndicator.Foreground     = UIColor.FromRGB(45, 45, 45);
                    busyIndicator.SecondaryColor = UIColor.White;
                    busyIndicator.AnimationType  = SFBusyIndicatorAnimationType.SFBusyIndicatorAnimationTypeRollingBall;
                }
                else if (selectedType == "SingleCircle")
                {
                    busyIndicator.Duration      = 1;
                    busyIndicator.ViewBoxWidth  = 120;
                    busyIndicator.ViewBoxHeight = 120;
                    busyIndicator.Foreground    = UIColor.FromRGB(175, 37, 65);
                    busyIndicator.AnimationType = SFBusyIndicatorAnimationType.SFBusyIndicatorAnimationTypeSingleCircle;
                }
                else if (selectedType == "SlicedCircle")
                {
                    busyIndicator.Duration      = 1;
                    busyIndicator.ViewBoxWidth  = 120;
                    busyIndicator.ViewBoxHeight = 120;
                    busyIndicator.Foreground    = UIColor.FromRGB(119, 151, 114);
                    busyIndicator.AnimationType = SFBusyIndicatorAnimationType.SFBusyIndicatorAnimationTypeSlicedCircle;
                }
                else if (selectedType == "ZoomingTarget")
                {
                    busyIndicator.Duration      = 1;
                    busyIndicator.ViewBoxWidth  = 120;
                    busyIndicator.ViewBoxHeight = 120;
                    busyIndicator.Foreground    = UIColor.FromRGB(237, 143, 60);
                    busyIndicator.AnimationType = SFBusyIndicatorAnimationType.SFBusyIndicatorAnimationTypeZoomingTarget;
                }
                else if (selectedType == "Gear")
                {
                    busyIndicator.Duration      = 1.5f;
                    busyIndicator.ViewBoxWidth  = 70;
                    busyIndicator.ViewBoxHeight = 70;
                    busyIndicator.Foreground    = UIColor.Gray;
                    busyIndicator.AnimationType = SFBusyIndicatorAnimationType.SFBusyIndicatorAnimationTypeGear;
                }
                else if (selectedType == "Box")
                {
                    busyIndicator.Duration      = 0.1f;
                    busyIndicator.ViewBoxWidth  = 70;
                    busyIndicator.ViewBoxHeight = 70;
                    busyIndicator.Foreground    = UIColor.FromRGB(36, 63, 217);
                    busyIndicator.AnimationType = SFBusyIndicatorAnimationType.SFBusyIndicatorAnimationTypeBox;
                }
            };


            //animationPicker
            animationPicker.ShowSelectionIndicator = true;
            animationPicker.Hidden          = true;
            animationPicker.Model           = model;
            animationPicker.BackgroundColor = UIColor.Gray;
            contentView.AddSubview(animationPicker);

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

            //subView
            propertiesLabel.Text = "OPTIONS";
            subView.AddSubview(closeButton);
            subView.AddSubview(contentView);
            subView.AddSubview(propertiesLabel);
            subView.BackgroundColor = UIColor.FromRGB(230, 230, 230);
            this.AddSubview(subView);

            //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) =>
            {
                subView.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) =>
            {
                subView.Hidden            = true;
                showPropertyButton.Hidden = false;
            };

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

            propertiesLabel.UserInteractionEnabled = true;
            propertiesLabel.AddGestureRecognizer(tapgesture);
            // Perform any additional setup after loading the view, typically from a nib.
        }