Beispiel #1
1
	public override void ViewDidLoad ()
	{
		base.ViewDidLoad ();

		Title = "Text View";
		textView = new UITextView (View.Frame){
			TextColor = UIColor.Black,
			Font = UIFont.FromName ("Arial", 18f),
			BackgroundColor = UIColor.White,
			Text = "This code brought to you by ECMA 334, ECMA 335 and the Mono Team at Novell\n\n\nEmbrace the CIL!",
			ReturnKeyType = UIReturnKeyType.Default,
			KeyboardType = UIKeyboardType.Default,
			ScrollEnabled = true,
			AutoresizingMask = UIViewAutoresizing.FlexibleHeight,
		};

		// Provide our own save button to dismiss the keyboard
		textView.Started += delegate {
			var saveItem = new UIBarButtonItem (UIBarButtonSystemItem.Done, delegate {
				textView.ResignFirstResponder ();
				NavigationItem.RightBarButtonItem = null;
				});
			NavigationItem.RightBarButtonItem = saveItem;
		};

		View.AddSubview (textView);
	}
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.White;

            var gameNameLabel = new UILabel(new RectangleF(10, 80, View.Frame.Width - 20, 20));
            gameNameLabel.Text = "Spartakiade Quiz";

            View.AddSubview(gameNameLabel);

            var playname = new UITextView(new RectangleF(10, 110, View.Frame.Width - 20, 20));
            playname.BackgroundColor = UIColor.Brown;

            View.AddSubview(playname);

            var btnStartGame = new UIButton(new RectangleF(10, 140, View.Frame.Width - 20, 20));
            btnStartGame.SetTitle("Start game", UIControlState.Normal);
            btnStartGame.BackgroundColor = UIColor.Blue;
            btnStartGame.TouchUpInside += delegate
            {
                NavigationController.PushViewController(new PlayGameController(playname.Text), true);
            };

            View.AddSubview(btnStartGame);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Figure out where the SQLite database will be.
            var documents = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            _pathToDatabase = Path.Combine(documents, "db_sqlite-net.db");

            // Create the buttons and TextView to run the sample code
            _btnCreateDatabase = UIButton.FromType(UIButtonType.RoundedRect);
            _btnCreateDatabase.Frame = new CGRect(10, 10, 145, 50);
            _btnCreateDatabase.SetTitle("Create Database", UIControlState.Normal);

            _btnInsertUser = UIButton.FromType(UIButtonType.RoundedRect);
            _btnInsertUser.Frame = new CGRect(165, 10, 145, 50);
            _btnInsertUser.SetTitle("Insert User", UIControlState.Normal);
            _btnInsertUser.Enabled = false;  // Disable the button. It will be enabled when the database is created.

            _txtView = new UITextView(new CGRect(10, 90, 300, 350));
            _txtView.Editable = false;
            _txtView.ScrollEnabled = true;

            _btnCreateDatabase.TouchUpInside += HandleTouchUpInsideForCreateDatabase;

            Add(_btnCreateDatabase);
            Add(_btnInsertUser);
            Add(_txtView);
        }
Beispiel #4
0
		public override bool FinishedLaunching(UIApplication app, NSDictionary options)
		{
			window = new UIWindow(UIScreen.MainScreen.Bounds);

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

			controller.NavigationItem.Title = "SignalR Client";

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


			navController = new UINavigationController (controller);

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

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

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

			return true;
		}
Beispiel #5
0
 void ReleaseDesignerOutlets()
 {
     if (TitleTextView != null) {
         TitleTextView.Dispose ();
         TitleTextView = null;
     }
 }
        public void Binding_Test1_Error()
        {
            Vm = new AccountViewModel();

#if ANDROID
            Operation = new EditText(Application.Context);
            ChildName = new EditText(Application.Context);
#elif __IOS__
            Operation = new UITextView();
            ChildName = new UITextView();
#endif

            _binding1 = this.SetBinding(
                () => Vm.FormattedOperation,
                () => Operation.Text);

            _binding2 = this.SetBinding(
                () => Vm.AccountDetails.Name,
                () => ChildName.Text,
                fallbackValue: "Fallback",
                targetNullValue: "TargetNull");

            Assert.AreEqual(AccountViewModel.EmptyText, Operation.Text);
            Assert.AreEqual(_binding2.FallbackValue, ChildName.Text);

            Vm.SetAccount();

            Assert.AreEqual(
                AccountViewModel.NotEmptyText + Vm.AccountDetails.Balance + Vm.Amount,
                Operation.Text);
            Assert.AreEqual(Vm.AccountDetails.Name, ChildName.Text);
        }
		public void PrintResult (UITextView textView, string message)
		{
			DispatchQueue.MainQueue.DispatchAsync (() => {
				textView.Text = string.Format ("{0}\n{1}", textView.Text, message);
				textView.ScrollRangeToVisible (new NSRange (0, textView.Text.Length));
			});
		}
		public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			if (IsReadonly) {
				base.Selected (dvc, tableView, path);
				return;
			}

			var controller = new UIViewController ();

			UITextView disclaimerView = new UITextView (controller.View.Frame);
//			disclaimerView.BackgroundColor = UIColor.FromWhiteAlpha (0, 0);
//			disclaimerView.TextColor = UIColor.White;
//			disclaimerView.TextAlignment = UITextAlignment.Left;
			if (!string.IsNullOrWhiteSpace (Value))
				disclaimerView.Text = Value;
			else
				disclaimerView.Text = string.Empty;
			
			disclaimerView.Font = UIFont.SystemFontOfSize (16f);
			disclaimerView.Editable = true;

			controller.View.AddSubview (disclaimerView);
			controller.NavigationItem.Title = Caption;
			controller.NavigationItem.RightBarButtonItem = new UIBarButtonItem (string.IsNullOrEmpty (_saveLabel) ? "Save" : _saveLabel, UIBarButtonItemStyle.Done, (object sender, EventArgs e) => {
				if (OnSave != null)
					OnSave (this, EventArgs.Empty);
				controller.NavigationController.PopViewControllerAnimated (true);
				Value = disclaimerView.Text;
			});	

			dvc.ActivateController (controller);
		}
		public void RenderStream (Stream stream)
		{
			var reader = new StreamReader (stream);

			InvokeOnMainThread (delegate {
				button1.Enabled = true;
				var view = new UIViewController ();
				var handler = new UILabel (new CGRect (20, 20, 300, 40)) {
					Text = "HttpClient is using " + HandlerType?.Name
				};
				var label = new UILabel (new CGRect (20, 20, 300, 80)) {
					Text = "The HTML returned by the server:"
				};
				var tv = new UITextView (new CGRect (20, 100, 300, 400)) {
					Text = reader.ReadToEnd ()
				};
				if (HandlerType != null)
					view.Add (handler);
				view.Add (label);
				view.Add (tv);

				if (UIDevice.CurrentDevice.CheckSystemVersion (7, 0)) {
					view.EdgesForExtendedLayout = UIRectEdge.None;
				}

				navigationController.PushViewController (view, true);
			});
		}
        protected override void OnElementChanged(ElementChangedEventArgs<Editor> e)
        {
            base.OnElementChanged(e);

            base.OnElementChanged(e);
            UITextView textView = (UITextView)Control;



            //Color
            textView.BackgroundColor = UIColor.White;
            textView.TextColor = UIColor.Gray;

            //font
            //textField.Font = UIFont.FromName("Ubuntu-light", 13);

            replacingControl = new UITextView(Control.Bounds);
            var adelegate = new CustomTextViewDelegate();
            var element = this.Element as PurposeColor.CustomControls.CustomEditor;

            adelegate.Placeholder = element.Placeholder;
			adelegate.formsEditor = element;
            replacingControl.Delegate = adelegate;
            replacingControl.TextColor = UIColor.LightGray;
            replacingControl.Text = adelegate.Placeholder;

            this.SetNativeControl(replacingControl);

        }//OnElementChanged()
		void ReleaseDesignerOutlets ()
		{
			if (textViewMarkDown != null) {
				textViewMarkDown.Dispose ();
				textViewMarkDown = null;
			}
		}
Beispiel #12
0
        public static void UiSetKeyboardEditorWithCloseButton(this UITextField txt, UIKeyboardType keyboardType)
        {
            var toolbar = new UIToolbar
            {
                BarStyle = UIBarStyle.Black,
                Translucent = true,
            };
            txt.KeyboardType = keyboardType;
            toolbar.SizeToFit();

            var text = new UITextView(new CGRect(0, 0, 200, 32))
            {
                ContentInset = UIEdgeInsets.Zero,
                KeyboardType = keyboardType,
                Text = txt.Text,
                UserInteractionEnabled = true
            };
            text.Layer.CornerRadius = 4f;
            text.BecomeFirstResponder();

            var doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done,
                                 (s, e) =>
                {
                    text.ResignFirstResponder();
                    txt.ResignFirstResponder();
                });

            toolbar.UserInteractionEnabled = true;
            toolbar.SetItems(new UIBarButtonItem[] { doneButton }, true);

            txt.InputAccessoryView = toolbar;
        }
		void ReleaseDesignerOutlets ()
		{
			if (textView != null) {
				textView.Dispose ();
				textView = null;
			}
		}
Beispiel #14
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            _loadDataButton = UIButton.FromType(UIButtonType.RoundedRect);
            _loadDataButton.SetTitle("Hent sanntidsdata", UIControlState.Normal);
            _loadDataButton.Frame = new RectangleF(10, 10, View.Bounds.Width - 20, 50);

            _result = new UITextView(new RectangleF(10, 70, View.Bounds.Width - 20, View.Bounds.Height - 80));
            _result.Font = UIFont.FromName("Arial", 14);
            _result.Editable = false;

            _activityIndicator = new UIActivityIndicatorView(new RectangleF(View.Bounds.Width / 2 - 20, View.Bounds.Height / 2 - 20, 40, 40));
            _activityIndicator.AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin;
            _activityIndicator.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge;

            View.AddSubview(_activityIndicator);
            View.AddSubview(_loadDataButton);
            View.AddSubview(_result);

            View.BackgroundColor = UIColor.DarkGray;

            _loadDataButton.TouchUpInside += delegate(object sender, EventArgs e) {
                if(_location != null)
                {
                    _activityIndicator.StartAnimating();
                    _result.Text = "Jobber..." + Environment.NewLine + Environment.NewLine;
                    var coordinate = new GeographicCoordinate(_location.Latitude, _location.Longtitude);
                    ThreadPool.QueueUserWorkItem(o => _sanntid.GetNearbyStops(coordinate, BusStopsLoaded));
                }
            };

            _gpsService.LocationChanged = location => _location = location;
            _gpsService.Start();
        }
        public override void ViewDidLoad()
        {
            View.BackgroundColor = UIColor.White;
            nameLabel = new UILabel () {
                TextAlignment = UITextAlignment.Left,
                Font = UIFont.FromName ("Helvetica-Light", AppDelegate.Font16pt),
                BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f)
            };
            descriptionTextView = new UITextView () {
                TextAlignment = UITextAlignment.Left,
                Font = UIFont.FromName ("Helvetica-Light", AppDelegate.Font10_5pt),
                BackgroundColor = UIColor.FromWhiteAlpha (0f, 0f),
                Editable = false
            };
            image = new UIImageView () { ContentMode = UIViewContentMode.ScaleAspectFit };

            if (AppDelegate.IsPad) {
                View.AddSubview (nameLabel);

                View.AddSubview (descriptionTextView);
                View.AddSubview (image);
            } else {
                scrollView = new UIScrollView();

                scrollView.AddSubview (nameLabel);

                scrollView.AddSubview (descriptionTextView);
                scrollView.AddSubview (image);

                Add (scrollView);
            }
        }
Beispiel #16
0
		public NewMessageController ()
		{
			Title = "New Post";

			NavigationItem.LeftBarButtonItem = new UIBarButtonItem (
				UIBarButtonSystemItem.Cancel,
				delegate {
					DismissModalViewControllerAnimated (true); 
				});

			NavigationItem.RightBarButtonItem = new UIBarButtonItem (
				UIBarButtonSystemItem.Save,
				delegate {
					DismissModalViewControllerAnimated (true);
					Saved (new Message {
						Id = Guid.NewGuid (),
						From = UIDevice.CurrentDevice.Name,
						Text = _text.Text,
						Time = DateTime.UtcNow,
					});
				});

			var b = View.Bounds;
			_text = new UITextView (new RectangleF (0, 0, b.Width, 200)) {
				Font = UIFont.SystemFontOfSize (20),
			};
			_text.BecomeFirstResponder ();
			View.AddSubview (_text);
		}
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			textStorage = new InteractiveTextColoringTextStorage ();
			CGRect newTextViewRect = View.Bounds;
			newTextViewRect.X += 8;
			newTextViewRect.Width -= 16;

			var layoutManager = new NSLayoutManager ();
			var container = new NSTextContainer (new CGSize (newTextViewRect.Size.Width, float.MaxValue));
			container.WidthTracksTextView = true;

			layoutManager.AddTextContainer (container);
			textStorage.AddLayoutManager (layoutManager);

			var newTextView = new UITextView (newTextViewRect, container);
			newTextView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
			newTextView.ScrollEnabled  = true;
			newTextView.KeyboardDismissMode = UIScrollViewKeyboardDismissMode.OnDrag;

			View.Add (newTextView);

			var tokens = new Dictionary<string, NSDictionary> ();
			tokens.Add ("Alice", new NSDictionary (UIStringAttributeKey.ForegroundColor, UIColor.Red));
			tokens.Add ("Rabbit", new NSDictionary (UIStringAttributeKey.ForegroundColor, UIColor.Orange));
			tokens.Add ("DefaultTokenName", new NSDictionary (UIStringAttributeKey.ForegroundColor, UIColor.Black));
			textStorage.Tokens = tokens;

			SetText ();
		}
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			_statusTextView = new UITextView ();
			_emailTextView = new UITextView ();
			_createTopicButton = UIButton.FromType (UIButtonType.RoundedRect);
			_subscribeButton = UIButton.FromType (UIButtonType.RoundedRect);
			_deleteTopicButton = UIButton.FromType (UIButtonType.RoundedRect);

			_createTopicButton.SetTitle ("Create Topic", UIControlState.Normal);
			_subscribeButton.SetTitle ("Subscribe", UIControlState.Normal);
			_deleteTopicButton.SetTitle ("Delete Topic", UIControlState.Normal);

			_createTopicButton.TouchUpInside += createTopic_Click;
			_subscribeButton.TouchUpInside += subscribe_Click;
			_deleteTopicButton.TouchUpInside += deleteTopic_Click;

			_emailTextView.Delegate = new EmailTextViewDelegate ();

			_statusTextView.Frame = new RectangleF (0, 256, 256, 64);
			_emailTextView.Frame = new RectangleF (0, 0, 256, 64);
			_createTopicButton.Frame = new RectangleF (0, 64, 256, 64);
			_subscribeButton.Frame = new RectangleF (0, 128, 256, 64);
			_deleteTopicButton.Frame = new RectangleF (0, 192, 256, 64);

			this.View.AddSubview (_emailTextView);
			this.View.AddSubview (_createTopicButton);
			this.View.AddSubview (_subscribeButton);
			this.View.AddSubview (_deleteTopicButton);
			this.View.AddSubview (_statusTextView);
		}
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            NavigationItem.Title = "Update Status";

            BarButton = new UIBarButtonItem(UIBarButtonSystemItem.Save);
            BarButton.Clicked += delegate
            {
                Console.WriteLine("Sharing status...");
                AppDelegate.Current.UpdateStatus(TextBox.Text);
                this.NavigationController.PopViewControllerAnimated(true);
            };
            NavigationItem.SetRightBarButtonItem (BarButton, false);

            Label = new UILabel();
            Label.Frame = new System.Drawing.RectangleF(10, 5, 300, 30);
            Label.Text = "What's happening?";

            TextBox = new UITextView();
            TextBox.Frame = new System.Drawing.RectangleF(10,35, 300, 150);

            TextBox.Font = UIFont.FromName ("Helvetica", 14f);
            TextBox.TextAlignment = UITextAlignment.Left;
            TextBox.ScrollsToTop = true;
            TextBox.BackgroundColor = UIColor.LightGray;

            TextBox.AutocapitalizationType = UITextAutocapitalizationType.None;
            TextBox.AutocorrectionType = UITextAutocorrectionType.Default;
            TextBox.KeyboardAppearance = UIKeyboardAppearance.Default;
            TextBox.KeyboardType = UIKeyboardType.Default;

            Add(Label);
            Add(TextBox);
        }
		void ReleaseDesignerOutlets ()
		{
			if (AddressText != null) {
				AddressText.Dispose ();
				AddressText = null;
			}
			if (HoursText != null) {
				HoursText.Dispose ();
				HoursText = null;
			}
			if (LinkText != null) {
				LinkText.Dispose ();
				LinkText = null;
			}
			if (LocationImage != null) {
				LocationImage.Dispose ();
				LocationImage = null;
			}
			if (MapItButton != null) {
				MapItButton.Dispose ();
				MapItButton = null;
			}
			if (PhoneText != null) {
				PhoneText.Dispose ();
				PhoneText = null;
			}
		}
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			View.BackgroundColor = UIColor.White;

			float statusBarHeight = float.Parse(UIDevice.CurrentDevice.SystemVersion) >= 7 ?
				UIApplication.SharedApplication.StatusBarFrame.Height : 0f;
			button = new GlossyButton (new RectangleF (30, 30 + statusBarHeight, 130, 38));
			button.SetTitle ("Stop!", UIControlState.Normal);
			
			button.Tapped += (obj) => {
				new UIAlertView ("Tapped", "Button tapped", null, "OK", null).Show ();
			};
			
			View.AddSubview (button);
			
			
			text = new UITextView (new RectangleF (10, 100 + statusBarHeight , 300, 300 - statusBarHeight));
			text.Font = UIFont.SystemFontOfSize (14f);
			text.Editable = false;
			text.Text = "PaintCode GlossyButton Example\n\n"
				+"After the button is drawn in PaintCode then added to a UIButton subclass "
				+"Draw() method override, some color/style properties are tweaked in code "
				+"to create the TouchDown effect.\n\n"
				+"The button is sized exactly so that the 'built-in' UIButton.Title "
				+"is displayed in the center of the PaintCode-generated design.";
			View.AddSubview (text);
		}
Beispiel #22
0
        public Composer () : base (null, null)
        {
            Title = "New Comment";
            EdgesForExtendedLayout = UIRectEdge.None;

            var close = new UIBarButtonItem { Image = Images.Buttons.Cancel };
            NavigationItem.LeftBarButtonItem = close;
            SendItem = new UIBarButtonItem { Image = Images.Buttons.Save };
            NavigationItem.RightBarButtonItem = SendItem;

            TextView = new UITextView(ComputeComposerSize(CGRect.Empty));
            TextView.Font = UIFont.PreferredBody;
            TextView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;

            // Work around an Apple bug in the UITextView that crashes
            if (ObjCRuntime.Runtime.Arch == ObjCRuntime.Arch.SIMULATOR)
                TextView.AutocorrectionType = UITextAutocorrectionType.No;

            View.AddSubview (TextView);

            _normalButtonImage = ImageFromColor(UIColor.White);
            _pressedButtonImage = ImageFromColor(UIColor.FromWhiteAlpha(0.0f, 0.4f));

            OnActivation(d =>
            {
                d(close.GetClickedObservable().Subscribe(_ => CloseComposer()));
                d(SendItem.GetClickedObservable().Subscribe(_ => PostCallback()));
            });
        }
Beispiel #23
0
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear (animated);

            this.View.BackgroundColor = UIColor.LightGray;

            txtQR = new UITextView (new RectangleF (20, 100, this.View.Bounds.Width - 40, 100));
            txtQR.Text = "Xamarin rocks!";
            this.View.AddSubview (txtQR);

            btnQR = new UIButton (UIButtonType.RoundedRect);
            btnQR.Frame = new RectangleF (100, 225, this.View.Bounds.Width - 200, 30);
            btnQR.SetTitle ("Create Code", UIControlState.Normal);

            qrImageView = new UIImageView (new RectangleF (20, 275, 100, 100));
            this.View.AddSubview (qrImageView);

            btnQR.TouchDown += (object sender, EventArgs e) => {

                var gen = new CIQRCodeGenerator ()
                {
                    Message = NSData.FromString (txtQR.Text),
                    CorrectionLevel = "M"
                };

                var context = CIContext.FromOptions (null);

                var cgimage = context.CreateCGImage (gen.OutputImage, gen.OutputImage.Extent);
                qrImageView.Image = UIImage.FromImage (cgimage);
            };

            this.View.AddSubview (btnQR);
        }
		private void SetupUserInterface ()
		{
			scrollView = new UIScrollView {
				BackgroundColor = UIColor.Clear.FromHexString ("#336699", 1.0f),
				Frame = new CGRect (0, 0, Frame.Width, Frame.Height)
			};

			licensureLabel = new UILabel {
				Font = UIFont.FromName ("SegoeUI-Light", 30f),
				Frame = new CGRect (0, 20, Frame.Width, 35),
				Text = "Terms of Service",
				TextAlignment = UITextAlignment.Center,
				TextColor = UIColor.White
			};

			textView = new UITextView {
				BackgroundColor = UIColor.Clear,
				Font = UIFont.FromName ("SegoeUI-Light", 15f), 
				Frame = new CGRect (20, 50, Frame.Width - 40, Frame.Height * 1.75),
				Text = "Willie’s Cycle will assume no damage liability from the sales of used or new parts. This damage includes personal injury, property, vehicle, monetary, punitive, emotional, and mental damage. All risk and liability is assumed by the purchaser or the installer of any product sold by Willie’s Cycle. Willie’s Cycle cannot be held liable for any of the following reasons: damage to person or property, including damage or injury to driver, passenger, or any other person, animal or property damage that may occur have occurred after purchasing any product from Willie’s Cycle. Willie’s Cycle will only accept returns for parts to be used in store credit or, at our discretion. Willie’s Cycle will give refunds due to applications not being as described. Willie’s Cycle will only give credit or refund up to full purchase amount of the product. Willie’s Cycle may charge a restock fee for returned parts. This restock fee is a minimum of 20% of the purchase price. All parts are expected to have normal wear, and in no way do we consider used parts to be in any condition other than used functional parts with wear, unless otherwise noted. Any returns must be sent with return authorization. RA# may be granted by providing the following: Date of purchase, transaction number, year, model, make, and VIN number of vehicle. Returns can be rejected if purchase was made on account of buyer error. Amount of refund or credit is determined solely by Willie’s Cycle. Returned item must be received by Willie’s Cycle within 30 days of original purchase date. All returned items must be returned in the same condition as they were received.",
				TextColor = UIColor.White,
				UserInteractionEnabled = false
			};

			scrollView.ContentSize = new CGSize (Frame.Width, Frame.Height * 1.75);

			scrollView.Add (licensureLabel);
			scrollView.Add (textView);
			Add (scrollView);
		}
Beispiel #25
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)
		{
			window = new UIWindow(UIScreen.MainScreen.Bounds);

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

			controller.NavigationItem.Title = "SignalR Client";

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


			navController = new UINavigationController (controller);

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

			var traceWriter = new TextViewWriter(SynchronizationContext.Current, textView);

			var client = new CommonClient(traceWriter);
			client.RunAsync("http://signalr-test1.cloudapp.net:82/");

			return true;
		}
        public void RenderStream(System.IO.Stream stream)
        {
            var reader = new System.IO.StreamReader(stream);

            ad.InvokeOnMainThread(delegate
            {
                var view = new UIViewController();
                var label = new UILabel(new RectangleF(20, 20, 300, 80))
                {
                    Text = "The HTML returned by the server:"
                };
                var tv = new UITextView(new RectangleF(20, 100, 300, 400))
                {
                    Text = reader.ReadToEnd()
                };
                view.Add(label);
                view.Add(tv);

                Console.WriteLine(tv.Text);

                if (UIDevice.CurrentDevice.CheckSystemVersion(7, 0))
                {
                    view.EdgesForExtendedLayout = UIRectEdge.None;
                }

                ad.NavigationController.PushViewController(view, true);
            });
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // 建立所需的控制項
            _btnCreateDatabase = UIButton.FromType(UIButtonType.RoundedRect);
            _btnCreateDatabase.Frame = new RectangleF(10, 10, 80, 50);
            _btnCreateDatabase.SetTitle("建立数据库", UIControlState.Normal);

            _btnCreateCipherDB = UIButton.FromType(UIButtonType.RoundedRect);
            _btnCreateCipherDB.Frame = new RectangleF(100, 10, 115, 50);
            _btnCreateCipherDB.SetTitle("建立加密数据库", UIControlState.Normal);

            _btnRead = UIButton.FromType(UIButtonType.RoundedRect);
            _btnRead.Frame = new RectangleF(225, 10, 80, 50);
            _btnRead.SetTitle("读取", UIControlState.Normal);

            _txtView = new UITextView(new RectangleF(10, 90, 300, 350));
            _txtView.Editable = false;
            _txtView.ScrollEnabled = true;

            _btnCreateDatabase.TouchUpInside += HandleTouchUpInside;
            _btnCreateCipherDB.TouchUpInside += _btnCreateCipherDB_TouchUpInside;
            _btnRead.TouchUpInside += _btnRead_TouchUpInside;
            Add(_btnCreateDatabase);
            Add(_btnCreateCipherDB);
            Add(_btnRead);
            Add(_txtView);
        }
        public SpeakerCollectionCell(System.Drawing.RectangleF frame)
            : base(frame)
        {
            BackgroundView = new UIView{BackgroundColor = UIColor.White};
            //SelectedBackgroundView = new UIView{BackgroundColor = UIColor.Green};

            ContentView.Frame = new RectangleF (0, 0, 100, 130);

            //ContentView.Layer.BorderColor = UIColor.LightGray.CGColor;
            //ContentView.Layer.BorderWidth = 2.0f;
            ContentView.BackgroundColor = UIColor.White;
            //ContentView.Transform = CGAffineTransform.MakeScale (0.8f, 0.8f);

            var image = UIImage.FromBundle ("/Images/avatar.png");  // default blank avatar image

            imageView = new UIImageView (image);
            imageView.Frame = new RectangleF (0,0,100,100);

            name = new UITextView(new RectangleF (0, 95, 100, 50));
            name.Font = AppDelegate.Current.FontCellSmall;
            name.BackgroundColor = UIColor.Clear;
            name.Editable = false;
            name.ScrollEnabled = false;

            ContentView.Add (imageView);
            ContentView.Add (name);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            Title = "Export";
            View.BackgroundColor = UIColor.GroupTableViewBackgroundColor;

            // Export textbox
            _textFieldExport = new UITextView();
            _textFieldExport.Frame = new RectangleF(10, 15, 300, 200);
            View.AddSubview(_textFieldExport);

            // Help label
            _labelHelp = new UILabel();
            _labelHelp.Text = "The questions are exported in comma separated format (CSV), e.g.:" +
                "\n\n" +
                "category name,question,answer\n\n" +
                "A tilde is used (~) as a replacement for any comma. Use the standard iPhone/iTouch clipboard copy " +
                "feature to save the list.";
            _labelHelp.Font = UIFont.SystemFontOfSize(14f);
            _labelHelp.TextColor = UIColor.DarkGray;
            _labelHelp.Frame = new RectangleF(15, 235, 295, 150);
            _labelHelp.BackgroundColor = UIColor.Clear;
            _labelHelp.Lines = 10;
            View.AddSubview(_labelHelp);

            // Hide the toolbar.
            NavigationController.SetToolbarHidden(true, true);
            NavigationItem.HidesBackButton = false;
        }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			View.BackgroundColor = UIColor.White;

			float statusBarHeight = float.Parse(UIDevice.CurrentDevice.SystemVersion) >= 7 ?
				UIApplication.SharedApplication.StatusBarFrame.Height : 0f;
			button = new BlueButton (new RectangleF (10, 10 + statusBarHeight, 120, 120 - statusBarHeight));
			
			button.Tapped += (obj) => {
				new UIAlertView ("Tapped", "Button tapped", null, "OK", null).Show ();
			};
			
			View.AddSubview (button);
			
			
			text = new UITextView (new RectangleF (10, 100 + statusBarHeight, 300, 300 - statusBarHeight));
			text.Font = UIFont.SystemFontOfSize (14f);
			text.Editable = false;
			text.Text = "PaintCode BlueButton Example\n\n"
				+ "After the button is drawn in PaintCode then added to a UIButton subclass "
				+ "Draw() method override, some color/style properties are tweaked in code "
				+ "to create the TouchDown effect.";
			View.AddSubview (text);
			
		}
Beispiel #31
0
 public void Include(UITextView textView)
 {
     textView.Text = textView.Text + "";
     textView.TextStorage.DidProcessEditing += (sender, e) => textView.Text = "";
     textView.Changed += (sender, args) => { textView.Text = ""; };
 }
Beispiel #32
0
        protected virtual bool ShouldChangeText(UITextView textView, NSRange range, string text)
        {
            var newLength = textView.Text.Length + text.Length - range.Length;

            return(newLength <= Element.MaxLength);
        }
        public void loadOptionView()
        {
            //offsetLabel
            offsetLabel.Text          = "Offset";
            offsetLabel.TextColor     = UIColor.Black;
            offsetLabel.TextAlignment = UITextAlignment.Left;
            offsetLabel.Font          = UIFont.FromName("Helvetica", 14f);

            //scaleOffsetLabel
            scaleOffsetLabel.Text          = "Scale Offset";
            scaleOffsetLabel.TextColor     = UIColor.Black;
            scaleOffsetLabel.TextAlignment = UITextAlignment.Left;
            scaleOffsetLabel.Font          = UIFont.FromName("Helvetica", 14f);

            //rotatingAngleLabel
            rotationAngleLabel.Text          = "Rotation Angle";
            rotationAngleLabel.TextColor     = UIColor.Black;
            rotationAngleLabel.TextAlignment = UITextAlignment.Left;
            rotationAngleLabel.Font          = UIFont.FromName("Helvetica", 14f);

            //offsetTextField
            offsetTextfield = new UITextView();
            offsetTextfield.TextAlignment     = UITextAlignment.Center;
            offsetTextfield.Layer.BorderColor = UIColor.Black.CGColor;
            offsetTextfield.KeyboardType      = UIKeyboardType.NumberPad;
            offsetTextfield.BackgroundColor   = UIColor.FromRGB(246, 246, 246);
            offsetTextfield.Text     = "60";
            offsetTextfield.Changed += (object sender, EventArgs e) =>
            {
                if (offsetTextfield.Text.Length > 0)
                {
                    carousel.Offset = nfloat.Parse(offsetTextfield.Text);
                }
                else
                {
                    carousel.Offset = 60;
                }
                if (offsetTextfield.Text.Length > 0)
                {
                    if (((nfloat)0) <= (nfloat.Parse(offsetTextfield.Text)))
                    {
                        if ((nfloat.Parse(offsetTextfield.Text)) <= (nfloat)100)
                        {
                            carousel.Offset = nfloat.Parse(offsetTextfield.Text);
                        }
                        else
                        {
                            carousel.Offset      = (nfloat)60;
                            offsetTextfield.Text = "60";
                        }
                    }
                    else
                    {
                        carousel.Offset      = (nfloat)60;
                        offsetTextfield.Text = "60";
                    }
                }
            };

            //scaleOffsetTextField
            scaleOffsetTextfield = new UITextView();
            scaleOffsetTextfield.TextAlignment     = UITextAlignment.Center;
            scaleOffsetTextfield.Layer.BorderColor = UIColor.Black.CGColor;
            scaleOffsetTextfield.BackgroundColor   = UIColor.FromRGB(246, 246, 246);
            scaleOffsetTextfield.KeyboardType      = UIKeyboardType.NumberPad;
            scaleOffsetTextfield.Text     = "0.8";
            scaleOffsetTextfield.Changed += (object sender, EventArgs e) =>
            {
                if (scaleOffsetTextfield.Text.Length > 0)
                {
                    carousel.ScaleOffset = nfloat.Parse(scaleOffsetTextfield.Text);
                }
                else
                {
                    carousel.ScaleOffset = (nfloat)0.8;
                }
                if (scaleOffsetTextfield.Text.Length > 0)
                {
                    if (((nfloat)0) <= (nfloat.Parse(scaleOffsetTextfield.Text)))
                    {
                        if ((nfloat.Parse(scaleOffsetTextfield.Text)) <= (nfloat)1)
                        {
                            carousel.ScaleOffset = nfloat.Parse(scaleOffsetTextfield.Text);
                        }
                        else
                        {
                            carousel.ScaleOffset      = (nfloat)0.8;
                            scaleOffsetTextfield.Text = "0.8";
                        }
                    }
                    else
                    {
                        carousel.ScaleOffset      = (nfloat)0.8;
                        scaleOffsetTextfield.Text = "0.8";
                    }
                }
            };

            //rotationAngleTextfield
            rotationAngleTextfield = new UITextView();
            rotationAngleTextfield.TextAlignment     = UITextAlignment.Center;
            rotationAngleTextfield.Layer.BorderColor = UIColor.Black.CGColor;
            rotationAngleTextfield.BackgroundColor   = UIColor.FromRGB(246, 246, 246);
            rotationAngleTextfield.KeyboardType      = UIKeyboardType.NumberPad;
            rotationAngleTextfield.Text     = "45";
            rotationAngleTextfield.Changed += (object sender, EventArgs e) =>
            {
                if (rotationAngleTextfield.Text.Length > 0)
                {
                    carousel.RotationAngle = int.Parse(rotationAngleTextfield.Text);
                }
                else
                {
                    carousel.RotationAngle = 45;
                }
                if (rotationAngleTextfield.Text.Length > 0)
                {
                    if (((nfloat)0) <= (nfloat.Parse(rotationAngleTextfield.Text)))
                    {
                        if ((nfloat.Parse(rotationAngleTextfield.Text)) <= (nfloat)360)
                        {
                            carousel.RotationAngle = nfloat.Parse(rotationAngleTextfield.Text);
                        }
                        else
                        {
                            carousel.RotationAngle      = (nfloat)45;
                            rotationAngleTextfield.Text = "45";
                        }
                    }
                    else
                    {
                        carousel.RotationAngle      = (nfloat)45;
                        rotationAngleTextfield.Text = "45";
                    }
                }
            };

            //viewModeLabel
            viewModeLabel.Text          = "View Mode";
            viewModeLabel.Font          = UIFont.FromName("Helvetica", 14f);
            viewModeLabel.TextColor     = UIColor.Black;
            viewModeLabel.TextAlignment = UITextAlignment.Left;

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

            //viewDoneButton
            viewDoneButton.SetTitle("Done\t", UIControlState.Normal);
            viewDoneButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            viewDoneButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
            viewDoneButton.TouchUpInside      += HidePicker;
            viewDoneButton.Hidden                 = true;
            viewDoneButton.BackgroundColor        = UIColor.FromRGB(230, 230, 230);
            viewModel.PickerChanged              += viewSelectedIndexChanged;
            viewModePicker.ShowSelectionIndicator = true;
            viewModePicker.Hidden                 = true;
            viewModePicker.BackgroundColor        = UIColor.Gray;

            //adding to contentView
            subView = new UIView();
            contentView.AddSubview(rotationAngleLabel);
            contentView.AddSubview(offsetTextfield);
            contentView.AddSubview(scaleOffsetTextfield);
            contentView.AddSubview(rotationAngleTextfield);
            contentView.AddSubview(offsetLabel);
            contentView.AddSubview(scaleOffsetLabel);
            contentView.AddSubview(viewModeLabel);
            contentView.AddSubview(viewButton);
            contentView.AddSubview(viewModePicker);
            contentView.AddSubview(viewDoneButton);
            contentView.BackgroundColor = UIColor.FromRGB(230, 230, 230);
            subView.AddSubview(closeButton);

            //adding to subView
            propertiesLabel.Text = "OPTIONS";
            subView.AddSubview(propertiesLabel);
            subView.BackgroundColor = UIColor.FromRGB(240, 240, 240);
            subView.AddSubview(contentView);
            this.AddSubview(subView);
            this.AddSubview(showPropertyButton);

            //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;
            };

            //closeButton
            closeButton.SetTitle("X\t", UIControlState.Normal);
            closeButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;
            closeButton.BackgroundColor     = UIColor.FromRGB(240, 240, 240);
            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);
        }
Beispiel #34
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            NavigationController.NavigationBar.Translucent = false;
            var bounds = View.Bounds;

            var backgroundColor = new UIColor(0.859f, 0.866f, 0.929f, 1);

            View.BackgroundColor = backgroundColor;
            //
            // Add the bubble chat interface
            //
            discussionHost = new UIView(new CGRect(bounds.X, bounds.Y, bounds.Width, bounds.Height - entryHeight))
            {
                AutoresizingMask       = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth,
                AutosizesSubviews      = true,
                UserInteractionEnabled = true
            };
            View.AddSubview(discussionHost);

            discussion = new DialogViewController(UITableViewStyle.Plain, root, true);
            discussionHost.AddSubview(discussion.View);
            discussion.View.BackgroundColor = backgroundColor;

            //
            // Add styled entry
            //
            chatBar = new UIImageView(new CGRect(0, bounds.Height - entryHeight, bounds.Width, entryHeight))
            {
                ClearsContextBeforeDrawing = false,
                AutoresizingMask           = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleWidth,
                Image = UIImage.FromFile("ChatBar.png").StretchableImage(18, 20),
                UserInteractionEnabled = true
            };
            View.AddSubview(chatBar);

            entry = new UITextView(new CGRect(10, 9, 234, 22))
            {
                ContentSize                = new CGSize(234, 22),
                AutoresizingMask           = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight,
                ScrollEnabled              = true,
                ScrollIndicatorInsets      = new UIEdgeInsets(5, 0, 4, -2),
                ClearsContextBeforeDrawing = false,
                Font = UIFont.SystemFontOfSize(messageFontSize),
                DataDetectorTypes = UIDataDetectorType.All,
                BackgroundColor   = UIColor.Clear,
            };

            // Fix a scrolling glitch
            entry.ShouldChangeText = (textView, range, text) => {
                entry.ContentInset = new UIEdgeInsets(0, 0, 3, 0);
                return(true);
            };
            previousContentHeight = entry.ContentSize.Height;
            chatBar.AddSubview(entry);

            //
            // The send button
            //
            sendButton = UIButton.FromType(UIButtonType.Custom);
            sendButton.ClearsContextBeforeDrawing = false;
            sendButton.Frame            = new CGRect(chatBar.Frame.Width - 70, 8, 64, 26);
            sendButton.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin;

            var sendBackground = UIImage.FromFile("SendButton.png");

            sendButton.SetBackgroundImage(sendBackground, UIControlState.Normal);
            sendButton.SetBackgroundImage(sendBackground, UIControlState.Disabled);
            sendButton.TitleLabel.Font         = UIFont.BoldSystemFontOfSize(16);
            sendButton.TitleLabel.ShadowOffset = new CGSize(0, -1);
            sendButton.SetTitle("Send", UIControlState.Normal);
            sendButton.SetTitleShadowColor(new UIColor(0.325f, 0.463f, 0.675f, 1), UIControlState.Normal);
            sendButton.AddTarget(SendMessage, UIControlEvent.TouchUpInside);
            DisableSend();
            chatBar.AddSubview(sendButton);

            //
            // Listen to keyboard notifications to animate
            //
            showObserver = UIKeyboard.Notifications.ObserveWillShow(PlaceKeyboard);
            hideObserver = UIKeyboard.Notifications.ObserveWillHide(PlaceKeyboard);

            ScrollToBottom(false);
            // Track changes in the entry to resize the view accordingly
            entry.Changed += HandleEntryChanged;
        }
Beispiel #35
0
 public static void UpdateText(this UITextView textView, InputView inputView)
 {
     textView.Text = TextTransformUtilites.GetTransformedText(inputView.Text, inputView.TextTransform);
 }
Beispiel #36
0
        public TicketBooking()
        {
            maps         = new SFMap();
            view         = new UIView();
            container    = new UIView();
            subcontainer = new UIView();
            LayoutA      = new UIView();
            LayoutB      = new UIView();
            LayoutC      = new UIView();
            LayoutD      = new UIView();

            button1    = new UIButton();
            button2    = new UIButton();
            button3    = new UIButton();
            button4    = new UIButton();
            label1     = new UILabel();
            label2     = new UILabel();
            label3     = new UILabel();
            label4     = new UILabel();
            label5     = new UILabel();
            text1      = new UITextView();
            scrollView = new UIScrollView();


            view.BackgroundColor = UIColor.White;

            NSTimer.CreateScheduledTimer(TimeSpan.FromSeconds(0.3), delegate
            {
                container.AddSubview(maps);
            });



            view.Frame          = new CGRect(0, 0, 300, 400);
            label               = new UILabel();
            label.TextAlignment = UITextAlignment.Center;
            label.Text          = "Ticketing System";
            label.Font          = UIFont.SystemFontOfSize(18);
            label.Frame         = new CGRect(0, 0, 300, 40);
            label.TextColor     = UIColor.Black;
            view.AddSubview(label);

            //container.BackgroundColor = UIColor.Red;
            container.Layer.CornerRadius = 5;
            container.Layer.BorderWidth  = 3;
            container.Layer.BorderColor  = UIColor.Gray.CGColor;


            layer = new SFShapeFileLayer();
            layer.ShapeSettings.SelectedShapeColor = UIColor.FromRGB(98, 170, 95);
            layer.Uri             = (NSString)NSBundle.MainBundle.PathForResource("Custom", "shp");
            layer.EnableSelection = true;
            layer.ShapeSettings.SelectedShapeStrokeThickness = 0;
            layer.DataSource = GetDataSource();

            SetColorMapping(layer.ShapeSettings);
            layer.GeometryType  = SFGeometryType.SFGeometryTypePoints;
            layer.SelectionMode = SFSelectionMode.SFSelectionModeMultiple;
            layer.ShapeIDPath   = (NSString)"SeatNumber";
            layer.ShapeSettings.ColorValuePath = (NSString)"SeatNumber";

            layer.ShapeSettings.ValuePath = (NSString)"SeatNumber";
            layer.ShapeSettings.Fill      = UIColor.Gray;
            layer.ShapeIDTableField       = (NSString)"seatno";

            layer.ShapeSelectionChanged += BookingSelectionChanged;

            maps.Layers.Add(layer);
            container.Add(maps);

            view.Add(container);



            subcontainer.BackgroundColor    = UIColor.White;
            subcontainer.Layer.CornerRadius = 5;

            //LayoutA.BackgroundColor = UIColor.Green;
            LayoutA.Layer.CornerRadius = 5;
            button1.BackgroundColor    = UIColor.Gray;
            button1.Layer.CornerRadius = 5;


            LayoutA.Add(button1);
            label1.Text      = "Available";
            label1.Font      = UIFont.SystemFontOfSize(12);
            label1.TextColor = UIColor.Black;

            LayoutA.Add(label1);
            subcontainer.Add(LayoutA);



            //LayoutB.BackgroundColor = UIColor.Purple;
            LayoutB.Layer.CornerRadius = 5;
            button2.BackgroundColor    = UIColor.FromRGB(98, 170, 95);
            button2.Layer.CornerRadius = 5;
            LayoutB.Add(button2);
            label2.Text      = "Selected";
            label2.TextColor = UIColor.Black;
            label2.Font      = UIFont.SystemFontOfSize(12);
            LayoutB.Add(label2);
            subcontainer.Add(LayoutB);



            LayoutC.Layer.CornerRadius = 5;
            button3.BackgroundColor    = UIColor.FromRGB(255, 165, 0);
            button3.Layer.CornerRadius = 5;
            LayoutC.Add(button3);
            label3.Text      = "Booked";
            label3.TextColor = UIColor.Black;
            label3.Font      = UIFont.SystemFontOfSize(12);
            LayoutC.Add(label3);
            subcontainer.Add(LayoutC);


            LayoutD.BackgroundColor    = UIColor.Gray;
            LayoutD.Layer.CornerRadius = 5;
            subcontainer.Add(LayoutD);

            label4.Text          = "Seats Selected";
            label4.TextAlignment = UITextAlignment.Center;
            label4.TextColor     = UIColor.Blue;
            label4.Font          = UIFont.SystemFontOfSize(12);
            subcontainer.Add(label4);

            label5.Text          = "";
            label5.TextAlignment = UITextAlignment.Left;
            label5.TextColor     = UIColor.Black;
            label5.Font          = UIFont.SystemFontOfSize(20);
            subcontainer.Add(label5);



            text1.Text = "";
            //text1.BackgroundColor = UIColor.Blue;
            text1.TextAlignment = UITextAlignment.Center;
            text1.TextColor     = UIColor.Black;
            text1.Font          = UIFont.SystemFontOfSize(12);

            subcontainer.Add(text1);



            button4.BackgroundColor    = UIColor.Clear;
            button4.Enabled            = false;
            button4.Alpha              = (float)0.5;
            button4.Layer.CornerRadius = 5;
            button4.Layer.BorderColor  = UIColor.Gray.CGColor;
            button4.Layer.BorderWidth  = 2;
            button4.SetTitle("Clear Selection", UIControlState.Normal);
            button4.SetTitleColor(UIColor.Red, UIControlState.Normal);
            button4.TouchDown += (sender, e) => {
                layer.SelectedItems.Clear();
                button4.Enabled = false;
                button4.Alpha   = (float)0.5;
                label5.Text     = " ";
                text1.Text      = " ";
            };
            subcontainer.Add(button4);


            view.Add(subcontainer);



            AddSubview(view);
        }
 public void EditingEnded(UITextView textView)
 {
     AdjustTextViewSelection(textView);
 }
        public void mainPageDesign()
        {
            customView = new UIView();
            customView.BackgroundColor = UIColor.FromRGB(165, 165, 165);
            this.OptionView            = new UIView();
            image1          = new UIImageView();
            precisionPicker = new UIPickerView();
            toolTipPicker   = new UIPickerView();
            PickerModel model = new PickerModel(precisionList);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            this.AddSubview(movieRateLabel);
            this.AddSubview(walkLabel);
            this.AddSubview(timeLabel);
            this.AddSubview(descriptionLabel);
            this.AddSubview(rateLabel);
            this.AddSubview(valueLabel);
            this.AddSubview(image1);
            this.AddSubview(itemCountTextfield);
        }
Beispiel #39
0
 public void loadTextView()
 {
     this.textView          = new UITextView(RectangleF.Empty);
     this.textView.Editable = false;
     this.View.AddSubview(this.textView);
 }
Beispiel #40
0
        public void loadOptionView()
        {
            //isEditableLabell
            isEditableLabel.Text           = "IsEditable";
            isEditableLabel.TextColor      = UIColor.Black;
            isEditableLabel.TextAlignment  = UITextAlignment.Left;
            isEditableLabel.Font           = UIFont.FromName("Helvetica", 14f);
            isEditableSwitch.ValueChanged += IsEditableSwitch_ValueChanged;

            diacriticModeLabel.Text          = "Enable Diacritics";
            diacriticModeLabel.TextColor     = UIColor.Black;
            diacriticModeLabel.TextAlignment = UITextAlignment.Left;
            diacriticModeLabel.Font          = UIFont.FromName("Helvetica", 14f);
            diacriticsSwitch.ValueChanged   += DiacriticsSwitch_ValueChanged;

            isEditableSwitch.ValueChanged  += IsEditableSwitch_ValueChanged;
            comboBoxModeLabel.Text          = "ComboBox Mode";
            comboBoxModeLabel.TextColor     = UIColor.Black;
            comboBoxModeLabel.TextAlignment = UITextAlignment.Left;
            comboBoxModeLabel.Font          = UIFont.FromName("Helvetica", 14f);

            //sizeLabell
            sizeLabel.Text          = "Size";
            sizeLabel.TextColor     = UIColor.Black;
            sizeLabel.TextAlignment = UITextAlignment.Left;
            sizeLabel.Font          = UIFont.FromName("Helvetica", 14f);

            //textColorLabell
            textColorLabel.Text          = "Text Color";
            textColorLabel.TextColor     = UIColor.Black;
            textColorLabel.TextAlignment = UITextAlignment.Left;
            textColorLabel.Font          = UIFont.FromName("Helvetica", 14f);

            //backColorLabel
            backColorLabel.Text          = "Back Color";
            backColorLabel.TextColor     = UIColor.Black;
            backColorLabel.TextAlignment = UITextAlignment.Left;
            backColorLabel.Font          = UIFont.FromName("Helvetica", 14f);

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

            spaceLabel.Text = "";

            //Text

            waterMarkText = new UITextView();

            waterMarkText.Layer.BorderColor = UIColor.Black.CGColor;

            waterMarkText.BackgroundColor = UIColor.FromRGB(246, 246, 246);

            waterMarkText.KeyboardType = UIKeyboardType.Default;

            waterMarkText.Text     = "Search Here";
            waterMarkText.Changed += (object sender, EventArgs e) =>
            {
                if (waterMarkText.Text.Length > 0)
                {
                    sizeComboBox.Watermark        = (NSString)waterMarkText.Text;
                    resolutionComboBox.Watermark  = (NSString)waterMarkText.Text;
                    orientationComboBox.Watermark = (NSString)waterMarkText.Text;
                }
                else
                {
                    sizeComboBox.Watermark        = (NSString)"";
                    resolutionComboBox.Watermark  = (NSString)"";
                    orientationComboBox.Watermark = (NSString)"";
                }
            };

            //comboBoxButton
            comboBoxButton.SetTitle("Suggest", UIControlState.Normal);
            comboBoxButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            comboBoxButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            comboBoxButton.Layer.CornerRadius  = 8;
            comboBoxButton.Layer.BorderWidth   = 2;
            comboBoxButton.TouchUpInside      += ShowcomboBoxModePicker;
            comboBoxButton.Layer.BorderColor   = UIColor.FromRGB(246, 246, 246).CGColor;

            //SizeButton
            sizeButton.SetTitle("Large", UIControlState.Normal);
            sizeButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            sizeButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            sizeButton.Layer.CornerRadius  = 8;
            sizeButton.Layer.BorderWidth   = 2;
            sizeButton.TouchUpInside      += ShowsizePicker;
            sizeButton.Layer.BorderColor   = UIColor.FromRGB(246, 246, 246).CGColor;

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

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


            comboBoxModel.PickerChanged  += comboBoxSelectedIndexChanged;
            sizeModel.PickerChanged      += sizeSelectedIndexChanged;
            textColorModel.PickerChanged += textColorSelectedIndexChanged;
            backColorModel.PickerChanged += backColorSelectedIndexChanged;
            suggestionModePicker.ShowSelectionIndicator = true;
            suggestionModePicker.Hidden               = true;
            suggestionModePicker.BackgroundColor      = UIColor.Gray;
            comboBoxModePicker.BackgroundColor        = UIColor.Gray;
            comboBoxModePicker.ShowSelectionIndicator = true;
            comboBoxModePicker.Hidden = true;

            sizePicker.BackgroundColor        = UIColor.Gray;
            sizePicker.ShowSelectionIndicator = true;
            sizePicker.Hidden = true;

            textColorPicker.BackgroundColor        = UIColor.Gray;
            textColorPicker.ShowSelectionIndicator = true;
            textColorPicker.Hidden = true;

            backColorPicker.BackgroundColor        = UIColor.Gray;
            backColorPicker.ShowSelectionIndicator = true;
            backColorPicker.Hidden = true;
        }
Beispiel #41
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Create the buttons and TextView to run the sample code
            btnFiles       = UIButton.FromType(UIButtonType.RoundedRect);
            btnFiles.Frame = new CGRect(10, 10, 145, 50);
            btnFiles.SetTitle("Open 'ReadMe.txt'", UIControlState.Normal);

            btnDirectories       = UIButton.FromType(UIButtonType.RoundedRect);
            btnDirectories.Frame = new CGRect(10, 70, 145, 50);
            btnDirectories.SetTitle("List Directories", UIControlState.Normal);

            btnXml       = UIButton.FromType(UIButtonType.RoundedRect);
            btnXml.Frame = new CGRect(165, 10, 145, 50);
            btnXml.SetTitle("Open 'Test.xml'", UIControlState.Normal);

            btnAll       = UIButton.FromType(UIButtonType.RoundedRect);
            btnAll.Frame = new CGRect(165, 70, 145, 50);
            btnAll.SetTitle("List All", UIControlState.Normal);

            btnWrite       = UIButton.FromType(UIButtonType.RoundedRect);
            btnWrite.Frame = new CGRect(10, 130, 145, 50);
            btnWrite.SetTitle("Write File", UIControlState.Normal);

            btnDirectory       = UIButton.FromType(UIButtonType.RoundedRect);
            btnDirectory.Frame = new CGRect(165, 130, 145, 50);
            btnDirectory.SetTitle("Create Directory", UIControlState.Normal);

            txtView               = new UITextView(new CGRect(10, 190, 300, 250));
            txtView.Editable      = false;
            txtView.ScrollEnabled = true;

            // Wire up the buttons to the SamplCode class methods
            btnFiles.TouchUpInside += (sender, e) => {
                SampleCode.ReadText(txtView);
            };

            btnDirectories.TouchUpInside += (sender, e) => {
                SampleCode.ReadDirectories(txtView);
            };

            btnAll.TouchUpInside += (sender, e) => {
                SampleCode.ReadAll(txtView);
            };

            btnXml.TouchUpInside += (sender, e) => {
                SampleCode.ReadXml(txtView);
            };

            btnWrite.TouchUpInside += (sender, e) => {
                if (writeJson)
                {
                    SampleCode.WriteJson(txtView);
                }
                else
                {
                    SampleCode.WriteFile(txtView);
                }
            };

            btnDirectory.TouchUpInside += (sender, e) => {
                SampleCode.CreateDirectory(txtView);
            };

            // Add the controls to the view
            this.Add(btnFiles);
            this.Add(btnDirectories);
            this.Add(btnXml);
            this.Add(btnAll);
            this.Add(btnWrite);
            this.Add(btnDirectory);
            this.Add(txtView);

            // Write out this special folder, just for curiousity's sake
            Console.WriteLine("MyDocuments:" + Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor);

            // setup the news title
            NewsTitle = new UILabel( );
            NewsTitle.Layer.AnchorPoint = CGPoint.Empty;
            View.AddSubview(NewsTitle);
            ControlStyling.StyleUILabel(NewsTitle, ControlStylingConfig.Font_Bold, ControlStylingConfig.Large_FontSize);
            NewsTitle.Text = NewsItem.Title;
            NewsTitle.SizeToFit( );

            // populate the details view with this news item.
            NewsDescription = new UITextView( );
            NewsDescription.Layer.AnchorPoint = CGPoint.Empty;
            View.AddSubview(NewsDescription);
            NewsDescription.Text               = NewsItem.Description;
            NewsDescription.BackgroundColor    = UIColor.Clear;
            NewsDescription.TextColor          = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.Label_TextColor);
            NewsDescription.Font               = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Small_FontSize);
            NewsDescription.TextContainerInset = UIEdgeInsets.Zero;
            NewsDescription.TextContainer.LineFragmentPadding = 0;
            NewsDescription.Editable = false;

            // we should always assume images are in cache. If they aren't, show a placeholder.
            // It is not our job to download them.
            ImageBanner = new UIImageView( );
            ImageBanner.Layer.AnchorPoint = CGPoint.Empty;

            // scale the image down to fit the contents of the window, but allow cropping.
            ImageBanner.BackgroundColor = UIColor.Clear;
            ImageBanner.ContentMode     = UIViewContentMode.ScaleAspectFill;
            ImageBanner.ClipsToBounds   = true;

            View.AddSubview(ImageBanner);

            // do we have the real image?
            if (TryLoadHeaderImage(NewsItem.ImageName) == false)
            {
                // no, so use a placeholder and request the actual image
                ImageBanner.Image = new UIImage(NSBundle.MainBundle.BundlePath + "/" + PrivateGeneralConfig.NewsDetailsPlaceholder);

                // resize the image to fit the width of the device
                nfloat imageAspect = PrivateNewsConfig.NewsMainAspectRatio;
                ImageBanner.Frame = new CGRect(0, 0, View.Bounds.Width, View.Bounds.Width * imageAspect);

                // request!
                string widthParam = string.Format("&width={0}", View.Bounds.Width * UIScreen.MainScreen.Scale);
                string requestUrl = Rock.Mobile.Util.Strings.Parsers.AddParamToURL(NewsItem.ImageURL, widthParam);

                FileCache.Instance.DownloadFileToCache(requestUrl, NewsItem.ImageName, null,
                                                       delegate
                {
                    Rock.Mobile.Threading.Util.PerformOnUIThread(delegate {
                        if (IsVisible == true)
                        {
                            TryLoadHeaderImage(NewsItem.ImageName);
                        }
                    });
                });
            }

            DetailsBannerButton = new UIButton( );
            View.AddSubview(DetailsBannerButton);

            DetailsBannerButton.Frame = ImageBanner.Frame;

            DetailsBannerButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                Handle_LearnMore( );
            };

            // if we're in developer mode, add the start / end times for this promotion
            if (MobileApp.Shared.Network.RockLaunchData.Instance.Data.DeveloperModeEnabled == true)
            {
                NewsDescription.Text += NewsItem.GetDeveloperInfo( );
            }


            // finally setup the Learn More button
            LearnMoreButton = UIButton.FromType(UIButtonType.System);
            View.AddSubview(LearnMoreButton);
            LearnMoreButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                Handle_LearnMore( );
            };

            // if there's no URL associated with this news item, hide the learn more button.
            if (string.IsNullOrWhiteSpace(NewsItem.ReferenceURL) == true)
            {
                LearnMoreButton.Hidden = true;
            }
            ControlStyling.StyleButton(LearnMoreButton, NewsStrings.LearnMore, ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);
            LearnMoreButton.SizeToFit( );
        }
Beispiel #43
0
 public static void UpdateIsReadOnly(this UITextView textView, IEditor editor)
 {
     textView.UserInteractionEnabled = !(editor.IsReadOnly || editor.InputTransparent);
 }
Beispiel #44
0
        private void centerTextVertically(UITextView textView)
        {
            var topOffset = (textView.Bounds.Height - textView.ContentSize.Height) / 2;

            textView.ContentInset = new UIEdgeInsets(topOffset, 0, 0, 0);
        }
 private void TextViewDidChangeSelection(UITextView textView)
 {
     AdjustTextViewSelection(textView);
 }
Beispiel #46
0
 public static string BindText(this UITextView uiTextView)
 => MvxIosPropertyBinding.UITextView_Text;
Beispiel #47
0
        public override void LoadView()
        {
            // Create the views.
            View = new UIView {
                BackgroundColor = UIColor.White
            };

            _outerStackView = new UIStackView();
            _outerStackView.TranslatesAutoresizingMaskIntoConstraints = false;
            _outerStackView.Axis         = UILayoutConstraintAxis.Vertical;
            _outerStackView.Distribution = UIStackViewDistribution.FillEqually;

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

            _transformToolsView = new UIStackView();
            _transformToolsView.TranslatesAutoresizingMaskIntoConstraints = false;
            _transformToolsView.Axis    = UILayoutConstraintAxis.Vertical;
            _transformToolsView.Spacing = 8;
            _transformToolsView.LayoutMarginsRelativeArrangement = true;
            _transformToolsView.LayoutMargins = new UIEdgeInsets(8, 8, 8, 8);

            _inWkidLabel = new UILabel();
            _inWkidLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            _outWkidLabel = new UILabel();
            _outWkidLabel.TranslatesAutoresizingMaskIntoConstraints = false;

            UIStackView labelsRow = new UIStackView(new[] { _inWkidLabel, _outWkidLabel });

            labelsRow.TranslatesAutoresizingMaskIntoConstraints = false;
            labelsRow.Axis         = UILayoutConstraintAxis.Horizontal;
            labelsRow.Distribution = UIStackViewDistribution.FillEqually;
            _transformToolsView.AddArrangedSubview(labelsRow);

            _useExtentSwitch = new UISwitch();
            _useExtentSwitch.TranslatesAutoresizingMaskIntoConstraints = false;
            UILabel useExtentSwitchLabel = new UILabel();

            useExtentSwitchLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            useExtentSwitchLabel.Text = "Use extent";

            UIStackView switchRow = new UIStackView(new UIView[] { _useExtentSwitch, useExtentSwitchLabel });

            switchRow.TranslatesAutoresizingMaskIntoConstraints = false;
            switchRow.Axis    = UILayoutConstraintAxis.Horizontal;
            switchRow.Spacing = 8;
            _transformToolsView.AddArrangedSubview(switchRow);

            _transformationsPicker = new UIPickerView();
            _transformationsPicker.TranslatesAutoresizingMaskIntoConstraints = false;
            _transformationsPicker.SetContentCompressionResistancePriority((float)UILayoutPriority.DefaultLow, UILayoutConstraintAxis.Vertical);
            _transformToolsView.AddArrangedSubview(_transformationsPicker);

            _messagesTextView = new UITextView();
            _messagesTextView.TranslatesAutoresizingMaskIntoConstraints = false;
            _messagesTextView.SetContentCompressionResistancePriority((float)UILayoutPriority.Required, UILayoutConstraintAxis.Vertical);
            _messagesTextView.ScrollEnabled = false;
            _transformToolsView.AddArrangedSubview(_messagesTextView);

            _outerStackView.AddArrangedSubview(_myMapView);
            _outerStackView.AddArrangedSubview(_transformToolsView);

            // Add the views.
            View.AddSubviews(_outerStackView);

            // Lay out the views.
            NSLayoutConstraint.ActivateConstraints(new[]
            {
                _outerStackView.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor),
                _outerStackView.LeadingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.LeadingAnchor),
                _outerStackView.TrailingAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TrailingAnchor),
                _outerStackView.BottomAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.BottomAnchor)
            });
        }
Beispiel #48
0
 public static void UpdateHorizontalTextAlignment(this UITextView textView, IEditor editor)
 {
     textView.TextAlignment = editor.HorizontalTextAlignment.ToPlatformHorizontal().AdjustForFlowDirection(editor);
 }
 public bool ShouldEndEditing(UITextView textView)
 {
     // Removes a button to resign TextView
     NavigationItem.RightBarButtonItem = null;
     return(true);
 }
Beispiel #50
0
 public TextViewWriter(SynchronizationContext context, UITextView textView)
 {
     _context  = context;
     _textView = textView;
 }
Beispiel #51
0
 public static string BindTags(this UITextView self)
 => TextViewTagListTargetBinding.BindingName;
Beispiel #52
0
 public override bool ShouldInteractWithUrl(UITextView textView, NSUrl url, NSRange characterRange, UITextItemInteraction interaction)
 {
     return(base.ShouldInteractWithUrl(textView, url, characterRange, interaction));
 }
Beispiel #53
0
        // This is a sample method that handles the FinishedPickingMediaEvent
        protected void Handle_FinishedPickingMedia(object sender, UIImagePickerMediaPickedEventArgs e)
        {
            // determine what was selected, video or image
            bool isImage = false;

            switch (e.Info[UIImagePickerController.MediaType].ToString())
            {
            case "public.image":
                Console.WriteLine("Image selected");
                isImage = true;
                break;

            case "public.video":
                Console.WriteLine("Video selected");
                break;
            }

            Console.Write("Reference URL: [" + UIImagePickerController.ReferenceUrl + "]");

            // get common info (shared between images and video)
            NSUrl referenceURL = e.Info[new NSString("UIImagePickerControllerReferenceUrl")] as NSUrl;

            if (referenceURL != null)
            {
                Console.WriteLine(referenceURL.ToString());
            }

            // if it was an image, get the other image info
            if (isImage)
            {
                // get the original image
                UIImage originalImage = e.Info[UIImagePickerController.OriginalImage] as UIImage;
                if (originalImage != null)
                {
                    // do something with the image
                    Console.WriteLine("got the original image");
                    imageView.Image = originalImage;
                }

                // get the edited image
                UIImage editedImage = e.Info[UIImagePickerController.EditedImage] as UIImage;
                if (editedImage != null)
                {
                    // do something with the image
                    Console.WriteLine("got the edited image");
                    imageView.Image = editedImage;
                }

                //- get the image metadata
                NSDictionary imageMetadata = e.Info[UIImagePickerController.MediaMetadata] as NSDictionary;
                if (imageMetadata != null)
                {
                    // do something with the metadata
                    Console.WriteLine("got image metadata");
                }
            }
            // if it's a video
            else
            {
                // get video url
                NSUrl mediaURL = e.Info[UIImagePickerController.MediaURL] as NSUrl;
                if (mediaURL != null)
                {
                    //
                    Console.WriteLine(mediaURL.ToString());
                }
            }

            // dismiss the picker
            imagePicker.DismissModalViewController(true);
            UITextView lblScore = new UITextView();

            lblScore.Frame           = new CoreGraphics.CGRect(1, 500, 370, 70);
            lblScore.BackgroundColor = UIColor.FromRGB(246, 246, 246);
            lblScore.TextAlignment   = UITextAlignment.Center;
            UIImage imagenT      = imageView.Image;
            NSData  imageData    = imagenT.AsPNG();
            var     btnFavorite2 = new UIButton(UIButtonType.Custom);

            btnFavorite2.Frame = new CoreGraphics.CGRect(10, 400, 40, 40);
            string image = "twitter.png";

            byte[] myArr = new Byte[imageData.Length];
            System.Runtime.InteropServices.Marshal.Copy(imageData.Bytes, myArr, 0, Convert.ToInt32(imageData.Length));
            MSCognitiveService cognser           = new MSCognitiveService();
            string             descripcionImagen = cognser.PeticionImagenDescripcion(myArr);

            lblScore.Text = descripcionImagen;
            View.Add(lblScore);
            btnFavorite2.SetImage(UIImage.FromBundle(image), UIControlState.Normal);
            btnFavorite2.TouchUpInside += delegate
            {
                try
                {
                    TWPublicarTweet twtwit  = new TWPublicarTweet();
                    string          MediaId = twtwit.ObtenerIdImagen(myArr);
                    if (!twtwit.PeticionPublicarTweet("Proyecto PDMII ISSC,MSCognitiveService.Descripción obtenida: " + descripcionImagen, MediaId))
                    {
                        new UIAlertView("ERROR", "no se compartio", null, "ok", null).Show();
                    }
                }
                catch (Exception ex)
                {
                    new UIAlertView("ERROR", ex.Message, null, "ok", null).Show();
                }
            };
            View.Add(btnFavorite2);
        }
 public bool ShouldBeginEditing(UITextView textView)
 {
     // Adds a button to resign TextView
     NavigationItem.RightBarButtonItem = btnDone;
     return(true);
 }
Beispiel #55
0
 protected virtual void BindText(UITextView textView, MvxFluentBindingDescriptionSet <InformationTextContentViewController, IInformationTextContentViewModel> set)
 {
     set.Bind(textView).To(vm => vm.Text).For(v => v.Text);
 }
Beispiel #56
0
        void InitUI()
        {
            View.ContentMode      = UIViewContentMode.ScaleToFill;
            View.LayoutMargins    = new UIEdgeInsets(0, 16, 0, 16);
            View.Frame            = new CGRect(0, 0, 375, 667);
            View.BackgroundColor  = UIColor.White;
            View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;

            inputLabel = new UILabel
            {
                Frame  = new CGRect(0, 0, 375, 20),
                Opaque = false,
                UserInteractionEnabled = false,
                ContentMode            = UIViewContentMode.Left,
                Text                      = "翻訳したい日本語",
                TextAlignment             = UITextAlignment.Left,
                LineBreakMode             = UILineBreakMode.TailTruncation,
                Lines                     = 0,
                BaselineAdjustment        = UIBaselineAdjustment.AlignBaselines,
                AdjustsFontSizeToFitWidth = false,
                TranslatesAutoresizingMaskIntoConstraints = false,
                Font = UIFont.SystemFontOfSize(fontSize),
            };
            View.AddSubview(inputLabel);

            inputLabel.HeightAnchor.ConstraintEqualTo(20).Active = true;
            inputLabel.CenterXAnchor.ConstraintEqualTo(View.CenterXAnchor).Active = true;

            inputLabel.TopAnchor.ConstraintEqualTo(View.TopAnchor, 70).Active = true;
            inputLabel.LeftAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.LeftAnchor).Active   = true;
            inputLabel.RightAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.RightAnchor).Active = true;

            inputText = new UITextView
            {
                Frame       = new CGRect(0, 0, 375, 200),
                ContentMode = UIViewContentMode.ScaleToFill,
                TranslatesAutoresizingMaskIntoConstraints = false,
                KeyboardType            = UIKeyboardType.Twitter,
                Font                    = UIFont.SystemFontOfSize(fontSize),
                AccessibilityIdentifier = "inputText",
            };

            inputText.Layer.BorderWidth = 1;
            inputText.Layer.BorderColor = UIColor.LightGray.CGColor;

            View.AddSubview(inputText);

            inputText.HeightAnchor.ConstraintEqualTo(View.HeightAnchor, 0.3f).Active = true;
            inputText.CenterXAnchor.ConstraintEqualTo(View.CenterXAnchor).Active     = true;

            inputText.TopAnchor.ConstraintEqualTo(inputLabel.BottomAnchor, 5).Active            = true;
            inputText.LeftAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.LeftAnchor).Active   = true;
            inputText.RightAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.RightAnchor).Active = true;

            var toolBar = new UIToolbar
            {
                BarStyle = UIBarStyle.Default,
                TranslatesAutoresizingMaskIntoConstraints = false,
            };

            toolBar.HeightAnchor.ConstraintEqualTo(40).Active = true;
            toolBar.WidthAnchor.ConstraintEqualTo(View.Frame.Width).Active = true;

            var spacer       = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
            var commitButton = new UIBarButtonItem(UIBarButtonSystemItem.Done);

            commitButton.Clicked += (s, e) => View.EndEditing(true);
            toolBar.SetItems(new UIBarButtonItem[] { spacer, commitButton }, false);
            inputText.InputAccessoryView = toolBar;

            translateButton = new UIButton(UIButtonType.RoundedRect)
            {
                Frame               = new CGRect(0, 0, 375, 20),
                Opaque              = false,
                ContentMode         = UIViewContentMode.ScaleToFill,
                HorizontalAlignment = UIControlContentHorizontalAlignment.Center,
                VerticalAlignment   = UIControlContentVerticalAlignment.Center,
                LineBreakMode       = UILineBreakMode.MiddleTruncation,
                TranslatesAutoresizingMaskIntoConstraints = false,
                Font = UIFont.SystemFontOfSize(fontSize),
                AccessibilityIdentifier = "translateButton",
            };

            translateButton.SetTitle("英語に翻訳する", UIControlState.Normal);
            View.AddSubview(translateButton);

            translateButton.HeightAnchor.ConstraintEqualTo(40f).Active = true;
            translateButton.CenterXAnchor.ConstraintEqualTo(View.CenterXAnchor).Active = true;

            translateButton.TopAnchor.ConstraintEqualTo(inputText.BottomAnchor, 20).Active            = true;
            translateButton.LeftAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.LeftAnchor).Active   = true;
            translateButton.RightAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.RightAnchor).Active = true;

            translatedLabel = new UILabel
            {
                Frame  = new CGRect(0, 0, 375, 20),
                Opaque = false,
                UserInteractionEnabled = false,
                ContentMode            = UIViewContentMode.Left,
                Text                      = "翻訳された英語",
                TextAlignment             = UITextAlignment.Left,
                LineBreakMode             = UILineBreakMode.TailTruncation,
                Lines                     = 0,
                BaselineAdjustment        = UIBaselineAdjustment.AlignBaselines,
                AdjustsFontSizeToFitWidth = false,
                TranslatesAutoresizingMaskIntoConstraints = false,
                Font = UIFont.SystemFontOfSize(fontSize),
            };
            View.AddSubview(translatedLabel);

            translatedLabel.HeightAnchor.ConstraintEqualTo(20).Active = true;
            translatedLabel.CenterXAnchor.ConstraintEqualTo(View.CenterXAnchor).Active = true;

            translatedLabel.TopAnchor.ConstraintEqualTo(translateButton.BottomAnchor, 20).Active      = true;
            translatedLabel.LeftAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.LeftAnchor).Active   = true;
            translatedLabel.RightAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.RightAnchor).Active = true;

            translatedText = new UITextView
            {
                Frame       = new CGRect(0, 0, 375, 200),
                ContentMode = UIViewContentMode.ScaleToFill,
                TranslatesAutoresizingMaskIntoConstraints = false,
                Font = UIFont.SystemFontOfSize(fontSize),
                AccessibilityIdentifier = "translatedText",
                Editable = false,
            };

            translatedText.Layer.BorderWidth = 1;
            translatedText.Layer.BorderColor = UIColor.LightGray.CGColor;

            View.AddSubview(translatedText);

            translatedText.HeightAnchor.ConstraintEqualTo(View.HeightAnchor, 0.3f).Active = true;
            translatedText.CenterXAnchor.ConstraintEqualTo(View.CenterXAnchor).Active     = true;

            translatedText.TopAnchor.ConstraintEqualTo(translatedLabel.BottomAnchor, 5).Active       = true;
            translatedText.LeftAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.LeftAnchor).Active   = true;
            translatedText.RightAnchor.ConstraintEqualTo(View.LayoutMarginsGuide.RightAnchor).Active = true;
        }
Beispiel #57
0
 /// <summary>
 /// Dummy method to ensure classes are included for the Linker
 /// </summary>
 /// <param name="injector">Injector.</param>
 /// <param name="textView">Text view.</param>
 /// <param name="textField">Text field.</param>
 private void LinkerInclude(UILabel injector, UITextView textView, UITextField textField)
 {
     injector  = new UILabel();
     textView  = new UITextView();
     textField = new UITextField();
 }
Beispiel #58
0
 public void Include(UITextView textView)
 {
     textView.Text     = textView.Text + "";
     textView.Changed += (sender, args) => { textView.Text = ""; };
 }
 public MvxUITextViewTextTargetBinding(UITextView target)
     : base(target)
 {
 }
        public void goToBadge()
        {
            //Creates badge detail image -- need assets
            UIImageView image = new UIImageView(UIImage.FromFile("defaultBadge.png"));

            UIViewController badgeDetailView = new UIViewController();

            badgeDetailView.EdgesForExtendedLayout = UIRectEdge.None;
            badgeDetailView.Add(image);

            //Create badge title bar
            UILabel label               = new UILabel(new System.Drawing.RectangleF(0, 230, (float)UIScreen.MainScreen.Bounds.Width, 60));
            var     documents           = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            var     dbPath              = Path.Combine(documents, "db_sqlite-net.db");
            var     db                  = new SQLiteConnection(dbPath);
            var     table               = db.Table <MagpieBadge>();
            CLLocationCoordinate2D anno = annotationScrollList[currentAnno];
            var query = db.Query <MagpieBadge>("SELECT * FROM MagpieBadge WHERE lon = " + anno.Longitude);

            label.Text = query[0].bname;
            if (label.Text.Length < 30)
            {
                label.Font = UIFont.FromName("Montserrat-Light", 24f);
            }
            else
            {
                label.Font = UIFont.FromName("Montserrat-Light", 18f);
            }
            label.TextColor       = UIColor.White;
            label.BackgroundColor = UIColor.LightGray;
            label.TextAlignment   = UITextAlignment.Center;
            badgeDetailView.Add(label);
            //end badge title bar

            //Holds the view map button and share button
            UIView buttonBar = new UIView(new System.Drawing.RectangleF(0, 290, (float)UIScreen.MainScreen.Bounds.Width, 90));

            buttonBar.BackgroundColor = UIColor.DarkGray;

            //Build map button
            UIButton viewInMapBtn = new UIButton(new System.Drawing.RectangleF(50, 15, 40, 40));

            viewInMapBtn.SetImage(UIImage.FromFile("mapIcon.png"), UIControlState.Normal);

            UILabel mapBtnLabel = new UILabel(new System.Drawing.RectangleF(20, 60, 100, 20));

            mapBtnLabel.Text          = "VIEW IN MAP";
            mapBtnLabel.TextAlignment = UITextAlignment.Center;
            mapBtnLabel.Font          = UIFont.FromName("Montserrat-Bold", 12f);
            mapBtnLabel.TextColor     = UIColor.White;
            buttonBar.Add(mapBtnLabel);

            viewInMapBtn.TouchUpInside += (object sender, EventArgs e) =>
            {
                this.selected = query[0].bid;
                NavigationController.PopViewController(true);
            };


            buttonBar.Add(viewInMapBtn);
            //end map button

            //Build share button
            UIButton shareBtn = new UIButton(new System.Drawing.RectangleF((float)(UIScreen.MainScreen.Bounds.Width - 90), 15, 40, 40));

            shareBtn.SetImage(UIImage.FromFile("shareIcon.png"), UIControlState.Normal);

            UILabel shareBtnLabel = new UILabel(new System.Drawing.RectangleF((float)(UIScreen.MainScreen.Bounds.Width - 100), 60, 60, 20));

            shareBtnLabel.Text          = "SHARE";
            shareBtnLabel.TextAlignment = UITextAlignment.Center;
            shareBtnLabel.Font          = UIFont.FromName("Montserrat-Bold", 12f);
            shareBtnLabel.TextColor     = UIColor.White;
            buttonBar.Add(shareBtnLabel);

            buttonBar.Add(shareBtn);
            //end share button

            //Create badge icon
            string parsed = Regex.Replace(query[0].bname, "[^a-zA-Z0-9_.]+", "", RegexOptions.Compiled);


            String q = "SELECT * FROM MagpieUser WHERE bid = " + query[0].bid;

            System.Collections.Generic.List <MagpieUser> userTuple = db.Query <MagpieUser>(q);


            UIButton badgeBtn   = new UIButton(new CoreGraphics.CGRect((float)(UIScreen.MainScreen.Bounds.Width / 2) - 75, 270, 150, 128.89221556886));
            UILabel  badgeLabel = new UILabel(new CGRect(0, 50, badgeBtn.Bounds.Width, badgeBtn.Bounds.Height / 4));

            badgeLabel.UserInteractionEnabled = false;

            if (userTuple.ElementAt(0).isClaimed.Equals("")) //user does not have badge
            {
                if (checkDistance(new CLLocation(query[0].lat, query[0].lon), new CLLocation(map.UserLocation.Location.Coordinate.Latitude, map.UserLocation.Location.Coordinate.Longitude)))
                {
                    //user is within collection distance

                    parsed          = "badges/SSW_" + parsed + ".png";
                    badgeLabel.Text = "COLLECT";
                }
                else
                {
                    parsed          = "graybadges/SSW_" + parsed + ".png";
                    badgeLabel.Text = "MOVE CLOSER";
                }
                badgeLabel.Font            = UIFont.FromName("Montserrat-Bold", 14f);
                badgeLabel.TextColor       = UIColor.White;
                badgeLabel.TextAlignment   = UITextAlignment.Center;
                badgeLabel.BackgroundColor = UIColor.DarkGray.ColorWithAlpha(0.5f);
            }
            else //user has badge
            {
                parsed = "badges/SSW_" + parsed + ".png";
                badgeBtn.UserInteractionEnabled = false;
            }

            UIImageView icon = new UIImageView(UIImage.FromFile(parsed));

            icon.Frame = new CoreGraphics.CGRect((float)(UIScreen.MainScreen.Bounds.Width / 2) - 75, 270, 150, 128.89221556886);
            icon.UserInteractionEnabled = false;

            icon.AddSubview(badgeLabel);

            badgeDetailView.Add(buttonBar);

            badgeBtn.TouchUpInside += (object sender, EventArgs e) =>
            {
                //Collect badge event

                if (checkDistance(new CLLocation(query[0].lat, query[0].lon), new CLLocation(map.UserLocation.Location.Coordinate.Latitude, map.UserLocation.Location.Coordinate.Longitude)))
                {
                    //user can collect
                    badgeLabel.Text            = "";
                    badgeLabel.BackgroundColor = UIColor.Clear;
                    ClaimBadge claim = new ClaimBadge();
                    claim.claimLocalBadge(new CLLocationCoordinate2D(query[0].lat, query[0].lon));
                }
            };

            badgeDetailView.Add(icon);
            badgeDetailView.Add(badgeBtn);
            //Controls the scroll view of the description and artist
            UIScrollView textScroll = new UIScrollView(new System.Drawing.RectangleF(0, 380, (float)UIScreen.MainScreen.Bounds.Width, (float)UIScreen.MainScreen.Bounds.Height - 440));

            textScroll.ScrollEnabled   = true;
            textScroll.BackgroundColor = UIColor.White;

            //Build artist and year description
            UILabel subLabel = new UILabel(new System.Drawing.RectangleF(5, 0, (float)textScroll.Bounds.Width, 40));

            subLabel.Text      = "ARTIST: " + query[0].art.ToUpper();
            subLabel.TextColor = UIColor.LightGray;
            subLabel.Font      = UIFont.FromName("Montserrat-Bold", 16f);

            //Builds the badge description
            UITextView description = new UITextView(new System.Drawing.RectangleF(20, 20, (float)(textScroll.Bounds.Width - 40), (float)textScroll.Bounds.Height));

            description.Add(subLabel);
            description.Text = "\n\n" + query[0].desc;

            description.TextColor = UIColor.Black;
            description.Font      = UIFont.FromName("Montserrat-Regular", 16f);

            textScroll.AddSubview(description);

            badgeDetailView.Add(textScroll);
            //End badge description build


            //show badge detail view controller
            this.NavigationController.PushViewController(badgeDetailView, true);
        }