コード例 #1
1
ファイル: CommitView.cs プロジェクト: xNUTs/CodeBucket
        public CommitView()
        {
			_viewSegment = new UISegmentedControl(new [] { "Changes", "Comments", "Approvals" });
			_viewSegment.SelectedSegment = 0;
			_viewSegment.ValueChanged += (sender, e) => Render();
			_segmentBarButton = new UIBarButtonItem(_viewSegment);
        }
コード例 #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            View.BackgroundColor = CashflowTheme.SharedTheme.ViewBackground;

            RCSwitchOnOff onSwitch = new RCSwitchOnOff (new RectangleF(72, 50, 76, 33));
            onSwitch.IsOn = true;
            scrollView.AddSubview (onSwitch);

            RCSwitchOnOff offSwitch = new RCSwitchOnOff (new RectangleF(176, 50, 76, 33));
            offSwitch.IsOn = false;
            scrollView.AddSubview (offSwitch);

            progressBar = new ADVPopoverProgressBar (new RectangleF(20, 135, 280, 23));
            progressBar.SetProgress (0.5f);
            scrollView.AddSubview (progressBar);

            UISegmentedControl segment = new UISegmentedControl (new object[] {"Yes", "No"});
            segment.Frame = new RectangleF (85, 245, 150, 42);
            segment.SelectedSegment = 0;

            scrollView.AddSubview (segment);

            imageViewBg.Image = UIImage.FromFile ("Images/iPhone/black/revisions-bg.png").CreateResizableImage (
                new UIEdgeInsets (50, 10, 200, 10));
        }
コード例 #3
0
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear (animated);

            this.View.BackgroundColor = UIColor.LightGray;

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

            segAccent = new UISegmentedControl (new string[] {"US", "UK", "AUS" });
            segAccent.Frame = new RectangleF(20,160,this.View.Bounds.Width - 40, 50);
            segAccent.SelectedSegment = 0;
            this.View.AddSubview (segAccent);

            lblRate = new UILabel (new RectangleF (20, 230, 200, 20));
            lblRate.Text = "Rate";
            this.View.AddSubview (lblRate);

            sldRate = new UISlider(new RectangleF(20,250,this.View.Bounds.Width - 40, 50));
            sldRate.MinValue = 0;
            sldRate.MaxValue = 100;
            sldRate.Value = 75;

            this.View.AddSubview (sldRate);

            lblPitch = new UILabel (new RectangleF (20, 305, 200, 20));
            lblPitch.Text = "Pitch";
            this.View.AddSubview (lblPitch);

            sldPitch = new UISlider(new RectangleF(20,325,this.View.Bounds.Width - 40, 50));

            sldPitch.MinValue = 0;
            sldPitch.MaxValue = 100;
            sldPitch.Value = 75;

            this.View.AddSubview (sldPitch);

            btnSpeak = new UIButton (UIButtonType.RoundedRect);
            btnSpeak.Frame = new RectangleF (100, 375, this.View.Bounds.Width - 200, 30);
            btnSpeak.SetTitle ("Speak", UIControlState.Normal);

            btnSpeak.TouchDown += (object sender, EventArgs e) => {
                var speechSynthesizer = new AVSpeechSynthesizer ();
                var speechUtterance =
                    new AVSpeechUtterance (txtSpeak.Text);
                string lang = "en-US";

                if (segAccent.SelectedSegment == 1) lang = "en-GB";
                if (segAccent.SelectedSegment == 2) lang = "en-AU";

                speechUtterance.Voice = AVSpeechSynthesisVoice.FromLanguage (lang);
                speechUtterance.Rate = AVSpeechUtterance.MaximumSpeechRate * (sldRate.Value / 100);
                speechUtterance.PitchMultiplier = 2.0f * (sldPitch.Value / 100);

                speechSynthesizer.SpeakUtterance (speechUtterance);
            };

            this.View.AddSubview (btnSpeak);
        }
コード例 #4
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			var camera = CameraPosition.FromCamera (37.78318, -122.403874, 18);
			mapView = MapView.FromCamera (CGRect.Empty, camera);
			mapView.BuildingsEnabled = false;
			View = mapView;

			// The possible floors that might be shown.
			var types = new [] { "1", "2", "3" };

			// Create a UISegmentedControl that is the navigationItem's titleView.
			switcher = new UISegmentedControl (types) {
				SelectedSegment = 0,
				ControlStyle = UISegmentedControlStyle.Bar,
				AutoresizingMask = UIViewAutoresizing.FlexibleWidth,
			};

			NavigationItem.TitleView = switcher;

			// Listen to touch events on the UISegmentedControl, force initial update.
			switcher.ValueChanged += DidChangeSwitcher;

			DidChangeSwitcher ();
		}
コード例 #5
0
ファイル: MyIssuesView.cs プロジェクト: ryanseys/CodeHub
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

			_viewSegment = new UISegmentedControl(new object[] { "Open".t(), "Closed".t(), "Custom".t() });
			_segmentBarButton = new UIBarButtonItem(_viewSegment);
            _segmentBarButton.Width = View.Frame.Width - 10f;
			ToolbarItems = new [] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _segmentBarButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) };
			var vm = (MyIssuesViewModel)ViewModel;
			vm.Bind(x => x.SelectedFilter, x =>
			{
				if (x == 2)
				{
					ShowFilterController(new CodeHub.iOS.Views.Filters.MyIssuesFilterViewController(vm.Issues));
				}

                // If there is searching going on. Finish it.
                FinishSearch();
			});

			BindCollection(vm.Issues, CreateElement);
			var set = this.CreateBindingSet<MyIssuesView, MyIssuesViewModel>();
			set.Bind(_viewSegment).To(x => x.SelectedFilter);
			set.Apply();
        }
コード例 #6
0
		public UIBarButtonItem ToolbarConfigurationItem()
		{
			var current = model.Ordering;
			
			toolbarControl = new UISegmentedControl();
			toolbarControl.InsertSegment("name", 0, false);
			toolbarControl.InsertSegment("time", 1, false);
			toolbarControl.SelectedSegment = (current == BuildOrder.BuildName) ? 0 : 1;
			toolbarControl.ControlStyle = UISegmentedControlStyle.Bar;
			toolbarControl.Frame = new System.Drawing.RectangleF(0, 10, 100, 30);
			toolbarControl.UserInteractionEnabled = true;
			
			toolbarControl.ValueChanged += delegate {
				switch (toolbarControl.SelectedSegment) {
				case 0:
					model.Ordering = BuildOrder.BuildName;
					break;
				default:
					model.Ordering = BuildOrder.BuildTime;
					break;
				}
				InvokeOnMainThread(UpdateUI);
			};
			
			return new UIBarButtonItem(toolbarControl);
		}
コード例 #7
0
		public UIBarButtonItem ToolbarConfigurationItem()
		{
			var current = model.TimePeriod;
			
			toolbarControl = new UISegmentedControl();
			toolbarControl.InsertSegment("24h", 0, false);
			toolbarControl.InsertSegment("week", 1, false);
			toolbarControl.InsertSegment("month", 2, false);
			toolbarControl.SelectedSegment = (current == TimePeriod.PastDay) ? 0 : (current == TimePeriod.PastWeek) ? 1 : 2;
			toolbarControl.ControlStyle = UISegmentedControlStyle.Bar;
			toolbarControl.Frame = new System.Drawing.RectangleF(0, 10, 130, 30);
			toolbarControl.UserInteractionEnabled = true;
			
			toolbarControl.ValueChanged += delegate {
				switch (toolbarControl.SelectedSegment) {
				case 0:
					model.TimePeriod = TimePeriod.PastDay;
					break;
				case 1:
					model.TimePeriod = TimePeriod.PastWeek;
					break;
				default:
					model.TimePeriod = TimePeriod.PastMonth;
					break;
				}
				ViewWillAppear(true);
			};
			
			return new UIBarButtonItem(toolbarControl);
		}
コード例 #8
0
		void ReleaseDesignerOutlets ()
		{
			if (Bias != null) {
				Bias.Dispose ();
				Bias = null;
			}
			if (CameraView != null) {
				CameraView.Dispose ();
				CameraView = null;
			}
			if (Duration != null) {
				Duration.Dispose ();
				Duration = null;
			}
			if (ISO != null) {
				ISO.Dispose ();
				ISO = null;
			}
			if (NoCamera != null) {
				NoCamera.Dispose ();
				NoCamera = null;
			}
			if (Offset != null) {
				Offset.Dispose ();
				Offset = null;
			}
			if (Segments != null) {
				Segments.Dispose ();
				Segments = null;
			}
		}
コード例 #9
0
		public Styles()
		{
			this.SfGrid = new SfDataGrid ();
			viewmodel = new GridGettingStartedViewModel ();
			this.SfGrid.AutoGeneratingColumn += GridAutoGenerateColumns;
			this.SfGrid.ItemsSource = viewmodel.OrdersInfo;
			this.SfGrid.ShowRowHeader = false;
			this.SfGrid.HeaderRowHeight = 45;
			this.SfGrid.RowHeight = 45;
			this.SfGrid.SelectionMode = SelectionMode.Multiple;
			this.SfGrid.GridViewCreated += SfGrid_GridViewCreated;
			this.SfGrid.GroupColumnDescriptions.Add (new GroupColumnDescription(){ColumnName ="CustomerID"});
			this.SfGrid.AlternatingRowColor = UIColor.FromRGB (25, 25, 25);
			segmentControl = new UISegmentedControl();
			segmentControl.ControlStyle = UISegmentedControlStyle.Bezeled;
			segmentControl.InsertSegment("Dark", 0,true);
			segmentControl.InsertSegment("Blue", 1, true);
			segmentControl.InsertSegment("Red", 2, true);
			segmentControl.InsertSegment("Green", 3, true);
			segmentControl.SelectedSegment = 0;
			segmentControl.ValueChanged += SegmentControl_ValueChanged;
			this.control = this;
			this.AddSubview (segmentControl);
			this.AddSubview (SfGrid);
		}
コード例 #10
0
ファイル: LbkMapViewController.cs プロジェクト: bpug/LbkIos
		private void Initialize ()
		{
			Title = Locale.GetText ("");
			_mapView = new MKMapView ();
			_mapView.AutoresizingMask = UIViewAutoresizing.All;
			_mapView.MapType = MKMapType.Standard;
			_mapView.ShowsUserLocation = true;
			
			_sgMapType = new UISegmentedControl ();
			_sgMapType.AutoresizingMask = UIViewAutoresizing.FlexibleMargins;
			_sgMapType.Opaque = true;
			_sgMapType.Alpha = 0.75f;
			_sgMapType.ControlStyle = UISegmentedControlStyle.Bar;
			_sgMapType.InsertSegment ("Map", 0, true);
			_sgMapType.InsertSegment ("Satellite", 1, true);
			_sgMapType.InsertSegment ("Hybrid", 2, true);
			_sgMapType.SelectedSegment = 0;
			_sgMapType.ValueChanged += (s, e) => {
				switch (_sgMapType.SelectedSegment) {
				case 0:
					_mapView.MapType = MKMapType.Standard;
					break;
				case 1:
					_mapView.MapType = MKMapType.Satellite;
					break;
				case 2:
					_mapView.MapType = MKMapType.Hybrid;
					break;
				}
			};
		}
コード例 #11
0
        void CreateSegmentedControl ()
        {
//            _segmentedControl = new UISegmentedControl (new object[] { "one", "two", "three", "four" });
//            _segmentedControl.ControlStyle = UISegmentedControlStyle.Bezeled;
//            _segmentedControl.TintColor = UIColor.Black;
//            _segmentedControl.SetImage (UIImage.FromFile ("Star.png"), 0);
//            _segmentedControl.SelectedSegment = 0;
//            _segmentedControl.Frame = new RectangleF (10, 10, View.Frame.Width - 20, 50);
            
            _testLabel = new UILabel { Frame = new RectangleF (10, 200, 100, 50) };
            
            _segmentedControl = new UISegmentedControl (new object[] { UIImage.FromFile ("Star.png"), "two", "three", "four" });
            _segmentedControl.ControlStyle = UISegmentedControlStyle.Bezeled;
            _segmentedControl.TintColor = UIColor.Black;
            _segmentedControl.Frame = new RectangleF (10, 10, View.Frame.Width - 20, 50);
            
            _segmentedControl.ValueChanged += (o, e) =>
            {
                _text = _segmentedControl.TitleAt (_segmentedControl.SelectedSegment) ?? "title not set";
                _testLabel.Text = _text;
            };
            
            _segmentedControl.SelectedSegment = 0;
            _segmentedControl.AddSubview (_testLabel);
            
            View.AddSubview (_segmentedControl);
        }
コード例 #12
0
ファイル: AppDelegate.cs プロジェクト: rmawani/themesystem
        DialogViewController BuildControlsDialogViewController()
        {
            var segmentControl = new UISegmentedControl (new string[] {
                "One", "Two", "Three"
            });
            segmentControl.Frame = new RectangleF (5, 5, 280, 35);

            segmentControl.SetEnabled (true, 1);

            var root = new BTRootElement ("Controls Dialog View Controller") {
                new BTBackgroundImageSection("Controls")
                {
                    new FloatElement(Resources.TempIcon, Resources.TempIcon, 0.5f),
                    WrapInView(new UIProgressView (new RectangleF (10, 20, 280, 18)) { Progress = 0.75f }),
                    new ActivityElement(),
                    //new BadgeElement("")
                    new BooleanElement("Boolean Element", true),
                    //new BTBooleanElement("BTBooleanElement", true),
                    //new BooleanImageElement("BoolImage", true, //)

                    WrapInView (segmentControl),

                }
            };

            return new BTDialogViewController (root, false);
        }
コード例 #13
0
		void ReleaseDesignerOutlets ()
		{
			if (NavBarMode != null) {
				NavBarMode.Dispose ();
				NavBarMode = null;
			}
		}
コード例 #14
0
ファイル: Main.cs プロジェクト: g7steve/monotouch-samples
		// This method is invoked when the application has loaded its UI and its ready to run
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			CGRect rect = UIScreen.MainScreen.ApplicationFrame;

			//Create the OpenGL drawing view and add it to the window
			drawingView = new PaintingView (new CGRect (rect.Location, rect.Size));
			window.AddSubview (drawingView);

			// Create a segmented control so that the user can choose the brush color.
			var images = new[] {
				UIImage.FromFile ("Images/Red.png"),
				UIImage.FromFile ("Images/Yellow.png"),
				UIImage.FromFile ("Images/Green.png"),
				UIImage.FromFile ("Images/Blue.png"),
				UIImage.FromFile ("Images/Purple.png")
			};
			if (UIDevice.CurrentDevice.CheckSystemVersion (7, 0)) {
				// we want the original colors, which is not the default iOS7 behaviour, so we need to
				// replace them with ones having the right UIImageRenderingMode
				for (int i = 0; i < images.Length; i++)
					images [i] = images [i].ImageWithRenderingMode (UIImageRenderingMode.AlwaysOriginal);
			}
			var segmentedControl = new UISegmentedControl (images);

			// Compute a rectangle that is positioned correctly for the segmented control you'll use as a brush color palette
			var frame = new CGRect (rect.X + LeftMarginPadding, rect.Height - PaletteHeight - TopMarginPadding,
				rect.Width - (LeftMarginPadding + RightMarginPadding), PaletteHeight);
			segmentedControl.Frame = frame;
			// When the user chooses a color, the method changeBrushColor: is called.
			segmentedControl.ValueChanged += ChangeBrushColor;
			// Make sure the color of the color complements the black background
			segmentedControl.TintColor = UIColor.DarkGray;
			// Set the third color (index values start at 0)
			segmentedControl.SelectedSegment = 2;

			// Add the control to the window
			window.AddSubview (segmentedControl);
			// Now that the control is added, you can release it
			// [segmentedControl release];

			float r, g, b;
			// Define a starting color
			HslToRgb (2.0f / PaletteSize, PaintingView.Saturation, PaintingView.Luminosity, out r, out g, out b);
			// Set the color using OpenGL
			GL.Color4 (r, g, b, PaintingView.BrushOpacity);

			// Look in the Info.plist file and you'll see the status bar is hidden
			// Set the style to black so it matches the background of the application
			app.SetStatusBarStyle (UIStatusBarStyle.BlackTranslucent, false);
			// Now show the status bar, but animate to the style.
			app.SetStatusBarHidden (false, true);

			//Configure and enable the accelerometer
			UIAccelerometer.SharedAccelerometer.UpdateInterval = 1.0f / AccelerometerFrequency;
			UIAccelerometer.SharedAccelerometer.Acceleration += OnAccelerated;

			window.MakeKeyAndVisible ();

			return true;
		}
コード例 #15
0
		public override UITableViewCell GetCell (UITableView tv)
		{
			sc = new UISegmentedControl () {
				BackgroundColor = UIColor.Clear,
				Tag = 1,
			};
			sc.Selected = true;

			sc.InsertSegment (choices [0].Text, 0, false);
			sc.InsertSegment (choices [1].Text, 1, false);
			sc.Frame = new RectangleF (570f, 8f, 150f, 26f);

			sc.SelectedSegment = choices.FindIndex (e => e.Id == val.Id);
			sc.AddTarget (delegate {
				Value = choices [sc.SelectedSegment];
			}, UIControlEvent.ValueChanged);

			var cell = tv.DequeueReusableCell (CellKey);
//			if (cell == null) {
				cell = new UITableViewCell (UITableViewCellStyle.Default, CellKey);
				cell.SelectionStyle = UITableViewCellSelectionStyle.None;
				cell.AddSubview (sc);
//			} 
//			else
//				RemoveTag (cell, 1);
			cell.TextLabel.Font = UIFont.BoldSystemFontOfSize (17);
			//cell.Frame.Height = 44;
			cell.TextLabel.Text = Caption;
			if (this.IsMandatory)
				cell.TextLabel.Text += "*";
			

			return cell;
		}
コード例 #16
0
ファイル: BeaconController.cs プロジェクト: jawbrey/Code-ios7
        public override void ViewDidLoad()
        {
            this.View.BackgroundColor = UIColor.LightGray;

            guid = new NSUuid ("c5cf54e0-6dd8-45e9-91a3-a8cda2f41120");
            bRegion = new CLBeaconRegion (guid, "beacon");

            bRegion.NotifyEntryStateOnDisplay = true;
            bRegion.NotifyOnEntry = true;
            bRegion.NotifyOnExit = true;

            base.ViewDidLoad ();

            segBeacon = new UISegmentedControl (new string[] { "Beacon", "Finder" });
            segBeacon.Frame = new RectangleF (20, 50, this.View.Bounds.Width - 40, 50);
            segBeacon.SelectedSegment = 0;

            button = new UIButton (UIButtonType.RoundedRect);
            button.SetTitle ("Start!", UIControlState.Normal);
            button.Frame = new RectangleF (50, 150, this.View.Bounds.Width - 100, 30);

            button.TouchDown += HandleTouchDown;
            this.View.AddSubview (segBeacon);
            this.View.AddSubview (button);
        }
コード例 #17
0
ファイル: HomeScreenVC.cs プロジェクト: ppkdo/sipper
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			refreshControl = new UIRefreshControl ();
			refreshControl.BackgroundColor = UIColor.White;
			refreshControl.TintColor = UIColor.Black;
			refreshControl.AddTarget(refreshTableHandler, UIControlEvent.ValueChanged);
			tableView.AddSubview (refreshControl);

			if (!isFromePeekViewController) {
				this.NavigationController.NavigationBar.Hidden =  false;
				this.NavigationController.NavigationBar.TintColor = UIColor.White;
				this.NavigationController.NavigationBar.BarTintColor = UIColor.FromRGB(44/255f,146/255f,208/255f);
				this.NavigationController.NavigationBar.BarStyle = UIBarStyle.Black;

				this.NavigationController.NavigationBar.TitleTextAttributes = new UIStringAttributes (){
					ForegroundColor = UIColor.White,
					Font = UIFont.FromName("System Bold",20.0f)
				};
				this.NavigationItem.SetRightBarButtonItem (new UIBarButtonItem(
					UIImage.FromFile("btn_nav_edit.png"), UIBarButtonItemStyle.Plain, (sender, args) => {
						sendSipperViewController sendSipperVC = new sendSipperViewController();
						sendSipperVC.HidesBottomBarWhenPushed =  true;
						this.NavigationController.PushViewController(sendSipperVC,true );
					}), true);
			}

			string[] tab = new string[]{"New","Hot"};
			segmentControll = new UISegmentedControl(tab);
			segmentControll.Frame = new CGRect (0,0,123,29);
			segmentControll.ControlStyle = UISegmentedControlStyle.Bordered;
			segmentControll.SelectedSegment = 0;
			segmentControll.ValueChanged += (sender, e) => {
				var selectedSegmentId = (sender as UISegmentedControl).SelectedSegment;
				Console.WriteLine("selectedSegmentId : {0}",segmentControll.SelectedSegment);
				if (isFromePeekViewController) {
					GetSippsByPeekAsync (peekId);
				} else {
					getSippList();
				}
			};
			this.NavigationItem.TitleView = segmentControll;
			tableView.SeparatorInset =  new UIEdgeInsets(0,0,0,20);

			SwitchImageView.Image = UIImage.FromFile ("img_seg_new.png");
			btn_New.TouchUpInside += (object sender, EventArgs e) => {
				SwitchImageView.Image = UIImage.FromFile ("img_seg_new.png");
			};

			btn_Hot.TouchUpInside += (object sender, EventArgs e) => {
				SwitchImageView.Image = UIImage.FromFile ("img_seg_hot.png");
			};


			btn_sendSipper.TouchUpInside += (object sender, EventArgs e) => {

			};

		}
コード例 #18
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            Title = "Mi Ubicacion";

            mapView = new MKMapView(View.Bounds);
            mapView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;
            //mapView.MapType = MKMapType.Standard;	// this is the default
            //mapView.MapType = MKMapType.Satellite;
            mapView.MapType = MKMapType.Hybrid;
            mapView.ZoomEnabled = true;
            View.AddSubview(mapView);

            // this is all that's required to show the blue dot indicating user-location
            mapView.ShowsUserLocation = true;

            Console.WriteLine ("initial loc:"+mapView.UserLocation.Coordinate.Latitude + "," + mapView.UserLocation.Coordinate.Longitude);

            mapView.DidUpdateUserLocation += (sender, e) => {
                if (mapView.UserLocation != null) {
                    Console.WriteLine ("userloc:"+mapView.UserLocation.Coordinate.Latitude + "," + mapView.UserLocation.Coordinate.Longitude);
                    CLLocationCoordinate2D coords = mapView.UserLocation.Coordinate;
                    MKCoordinateSpan span = new MKCoordinateSpan(MilesToLatitudeDegrees(1), MilesToLongitudeDegrees(1, coords.Latitude));
                    mapView.Region = new MKCoordinateRegion(coords, span);
                }
            };

            if (!mapView.UserLocationVisible) {
                // user denied permission, or device doesn't have GPS/location ability
                Console.WriteLine ("userloc not visible, show cupertino");
                CLLocationCoordinate2D coords = new CLLocationCoordinate2D(37.33233141,-122.0312186); // cupertino
                MKCoordinateSpan span = new MKCoordinateSpan(MilesToLatitudeDegrees(20), MilesToLongitudeDegrees(20, coords.Latitude));
                mapView.Region = new MKCoordinateRegion(coords, span);
            }

            int typesWidth=260, typesHeight=30, distanceFromBottom=60;
            mapTypes = new UISegmentedControl(new RectangleF((View.Bounds.Width-typesWidth)/2, View.Bounds.Height-distanceFromBottom, typesWidth, typesHeight));
            mapTypes.InsertSegment("Mapa", 0, false);
            mapTypes.InsertSegment("Satelite", 1, false);
            mapTypes.InsertSegment("Hibrido", 2, false);
            mapTypes.SelectedSegment = 0; // Road is the default
            mapTypes.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin;
            mapTypes.ValueChanged += (s, e) => {
                switch(mapTypes.SelectedSegment) {
                case 0:
                    mapView.MapType = MKMapType.Standard;
                    break;
                case 1:
                    mapView.MapType = MKMapType.Satellite;
                    break;
                case 2:
                    mapView.MapType = MKMapType.Hybrid;
                    break;
                }
            };

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

            _tipLabel = new UILabel ();
            _calculateButton = new UIButton (UIButtonType.Custom);
            _priceField = new UITextField ();
            _tipPercentages = new UISegmentedControl ();

            View.AddSubview (_priceField);
            View.AddSubview (_calculateButton);
            View.AddSubview (_tipLabel);
            View.AddSubview (_tipPercentages);

            _priceField.TranslatesAutoresizingMaskIntoConstraints = false;
            _priceField.KeyboardType = UIKeyboardType.DecimalPad;
            _priceField.BorderStyle = UITextBorderStyle.RoundedRect;
            _priceField.Placeholder = "Enter Total Amount:";

            View.AddConstraint (NSLayoutConstraint.Create (View, NSLayoutAttribute.Top, NSLayoutRelation.Equal, _priceField, NSLayoutAttribute.TopMargin, 1, -28));
            View.AddConstraint (NSLayoutConstraint.Create (View, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, _priceField, NSLayoutAttribute.CenterX, 1, 0));
            View.AddConstraint (NSLayoutConstraint.Create (View, NSLayoutAttribute.Width, NSLayoutRelation.Equal, _priceField, NSLayoutAttribute.Width, 1, 40));
            View.AddConstraint (NSLayoutConstraint.Create (_priceField, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1, 35));

            _calculateButton.TranslatesAutoresizingMaskIntoConstraints = false;
            _calculateButton.SetTitle ("Calculate", UIControlState.Normal);
            _calculateButton.SetTitleColor (UIColor.White, UIControlState.Normal);
            _calculateButton.SetTitleColor (UIColor.Blue, UIControlState.Highlighted);
            _calculateButton.BackgroundColor = UIColor.Green;
            _calculateButton.TouchUpInside += (sender, e) => CalculateCurrentTip();

            View.AddConstraint(NSLayoutConstraint.Create(_priceField, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, _calculateButton, NSLayoutAttribute.Top, 1, -8));
            View.AddConstraint (NSLayoutConstraint.Create (_calculateButton, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, View, NSLayoutAttribute.CenterX, 1, 0));
            View.AddConstraint (NSLayoutConstraint.Create (_calculateButton, NSLayoutAttribute.Width, NSLayoutRelation.Equal, View, NSLayoutAttribute.Width, 1, -40));

            _tipPercentages.TranslatesAutoresizingMaskIntoConstraints = false;
            _tipPercentages.InsertSegment ("10%", 0, false);
            _tipPercentages.InsertSegment ("15%", 1, false);
            _tipPercentages.InsertSegment ("20%", 2, false);
            _tipPercentages.InsertSegment ("25%", 3, false);
            _tipPercentages.SelectedSegment = 2;
            _tipPercentages.ValueChanged += (sender, e) => CalculateCurrentTip();

            View.AddConstraint (NSLayoutConstraint.Create (_calculateButton, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, _tipPercentages, NSLayoutAttribute.Top, 1, -8));
            View.AddConstraint (NSLayoutConstraint.Create (_tipPercentages, NSLayoutAttribute.Width, NSLayoutRelation.Equal, View, NSLayoutAttribute.Width, 1, -40));
            View.AddConstraint (NSLayoutConstraint.Create (_tipPercentages, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, View, NSLayoutAttribute.CenterX, 1, 0));

            _tipLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            _tipLabel.TextColor = UIColor.Blue;
            _tipLabel.Text = string.Format (TipFormat, 0);
            _tipLabel.TextAlignment = UITextAlignment.Center;

            View.AddConstraint (NSLayoutConstraint.Create (_tipLabel, NSLayoutAttribute.Top, NSLayoutRelation.Equal, _tipPercentages, NSLayoutAttribute.Bottom, 1, 8));
            View.AddConstraint (NSLayoutConstraint.Create (_tipLabel, NSLayoutAttribute.Width, NSLayoutRelation.Equal, View, NSLayoutAttribute.Width, 1, -40));
            View.AddConstraint (NSLayoutConstraint.Create (_tipLabel, NSLayoutAttribute.CenterX, NSLayoutRelation.Equal, View, NSLayoutAttribute.CenterX, 1, 0));

            View.BackgroundColor = UIColor.Yellow;
            View.AddGestureRecognizer (new UITapGestureRecognizer (() => _priceField.ResignFirstResponder ()));
        }
コード例 #20
0
        public NotificationsView()
        {
            _viewSegment = new UISegmentedControl(new object[] { "Unread", "Participating", "All" });
            _segmentBarButton = new UIBarButtonItem(_viewSegment);

            EmptyView = new Lazy<UIView>(() =>
                new EmptyListView(Octicon.Inbox.ToEmptyListImage(), "No new notifications."));
        }
コード例 #21
0
		partial void SegmentedControlDidChanged (UISegmentedControl sender)
		{
			GraphView newView = graphs [(int)sender.SelectedSegment];
			primaryGraph.RemoveFromSuperview ();
			View.AddSubview (newView);
			primaryGraph = newView;
			primaryGraphLabel.Text = graphTitles [(int)sender.SelectedSegment];
		}
コード例 #22
0
		public override void ViewDidLoad ()
		{
			// Applies style on specified element
			GunmetalTheme.Apply (View, UIDeviceOrientation.LandscapeLeft);
			GunmetalTheme.Apply (textInputView);
			GunmetalTheme.Apply (UISegmentedControl.Appearance);
			
			slider.Frame = new RectangleF (218, 410, 327, 24);

			var shadowLayer = this.CreateShadowWithFrame (new RectangleF (0, 0, 768, 5));
			View.Layer.AddSublayer (shadowLayer);

			bool showSwitchText = !UIDevice.CurrentDevice.CheckSystemVersion (7, 0);

			var onRect = new RectangleF (300, 280, 80, 36);
			var offRect = new RectangleF (390, 280, 80, 36);

			if (!showSwitchText) {
				onRect.X += 20;
				onRect.Width -= 20;
				offRect.Width -= 20;
			}
			
			var onSwitch = new SwitchOnOff (onRect);
			var offSwitch = new SwitchOnOff (offRect);

			onSwitch.ShowText (showSwitchText);
			offSwitch.ShowText (showSwitchText);

			onSwitch.SetOn (true);			
			offSwitch.SetOn (false);    
			
			progressBar = new PopoverProgressBar (new RectangleF (218, 340, 327, 24), ProgressBarColor.Blue);
			progressBar.SetProgress (0.5f);			

			var data = new [] { "Yes", "No", "Maybe" };
			var segment = new UISegmentedControl (data);
			segment.Frame = new RectangleF (250, 460, 250, 45);
			segment.SelectedSegment = 0;

			scrollView.AddSubviews (segment, onSwitch, offSwitch, progressBar);

			slider.ExclusiveTouch = true;

			greenButton.SetBackgroundImage (GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Confirm, UIControlState.Normal), UIControlState.Normal);
			greenButtonPressed.SetBackgroundImage (GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Confirm, UIControlState.Highlighted), UIControlState.Normal);

			blackButton.SetBackgroundImage (GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Black, UIControlState.Normal), UIControlState.Normal);
			blackButtonPressed.SetBackgroundImage (GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Black, UIControlState.Highlighted), UIControlState.Normal);

			redButton.SetBackgroundImage (GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Cancel, UIControlState.Normal), UIControlState.Normal);
			redButtonPressed.SetBackgroundImage (GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Cancel, UIControlState.Highlighted), UIControlState.Normal);

			grayButton.SetBackgroundImage (GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Aluminium, UIControlState.Normal), UIControlState.Normal);
			grayButtonPressed.SetBackgroundImage (GunmetalTheme.SharedTheme.ButtonImage(ButtonType.Aluminium, UIControlState.Highlighted), UIControlState.Normal);

			base.ViewDidLoad ();
		}
コード例 #23
0
ファイル: Main.cs プロジェクト: rojepp/monotouch-samples
		// This method is invoked when the application has loaded its UI and its ready to run
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			RectangleF rect = UIScreen.MainScreen.ApplicationFrame;

			window.BackgroundColor = UIColor.Black;

			//Create the OpenGL drawing view and add it to the window
			drawingView = new PaintingView (new RectangleF (rect.Location, rect.Size));
			window.AddSubview (drawingView);

			// Create a segmented control so that the user can choose the brush color.
			UISegmentedControl segmentedControl = new UISegmentedControl (new[]{
					UIImage.FromFile ("Images/Red.png"),
					UIImage.FromFile ("Images/Yellow.png"),
					UIImage.FromFile ("Images/Green.png"),
					UIImage.FromFile ("Images/Blue.png"),
					UIImage.FromFile ("Images/Purple.png"),
			});

			// Compute a rectangle that is positioned correctly for the segmented control you'll use as a brush color palette
			RectangleF frame = new RectangleF (rect.X + LeftMarginPadding, rect.Height - PaletteHeight - TopMarginPadding,
				rect.Width - (LeftMarginPadding + RightMarginPadding), PaletteHeight);
			segmentedControl.Frame = frame;
			// When the user chooses a color, the method changeBrushColor: is called.
			segmentedControl.ValueChanged += ChangeBrushColor;
			segmentedControl.ControlStyle = UISegmentedControlStyle.Bar;
			// Make sure the color of the color complements the black background
			segmentedControl.TintColor = UIColor.DarkGray;
			// Set the third color (index values start at 0)
			segmentedControl.SelectedSegment = 2;

			// Add the control to the window
			window.AddSubview (segmentedControl);
			// Now that the control is added, you can release it
			// [segmentedControl release];

			float r, g, b;
			// Define a starting color
			HslToRgb (2.0f / PaletteSize, PaintingView.Saturation, PaintingView.Luminosity, out r, out g, out b);
			// Set the color using OpenGL
			GL.Color4 (r, g, b, PaintingView.BrushOpacity);

			
			// Look in the Info.plist file and you'll see the status bar is hidden
			// Set the style to black so it matches the background of the application
			app.SetStatusBarStyle (UIStatusBarStyle.BlackTranslucent, false);
			// Now show the status bar, but animate to the style.
			app.SetStatusBarHidden (false, true);

			//Configure and enable the accelerometer
			UIAccelerometer.SharedAccelerometer.UpdateInterval = 1.0f / AccelerometerFrequency;
			UIAccelerometer.SharedAccelerometer.Acceleration += OnAccelerated;
			
			//Show the window
			window.MakeKeyAndVisible ();
	
			return true;
		}
コード例 #24
0
		partial void modeSelected (UISegmentedControl sender)
		{
			switch(sender.SelectedSegment)
			{
			case 0: flexGrid.DetailProvider.DetailVisibilityMode = GridDetailVisibilityMode.ExpandSingle; break;
			case 1: flexGrid.DetailProvider.DetailVisibilityMode = GridDetailVisibilityMode.ExpandMultiple; break;
			case 2: flexGrid.DetailProvider.DetailVisibilityMode = GridDetailVisibilityMode.Selection; break;	
			}
		}
 public ProductViewControllerThemeTintColorTableViewCell(IntPtr handle)
     : base(handle)
 {
     SelectionStyle = UITableViewCellSelectionStyle.None;
     TextLabel.Text = @"Theme Tint Color";
     segmentedControl = new UISegmentedControl (new[]{ "Shopify", "Red", "Blue" });
     segmentedControl.SelectedSegment = 0;
     AccessoryView = segmentedControl;
 }
 public ProductViewControllerThemeStyleTableViewCell(IntPtr handle)
     : base(handle)
 {
     SelectionStyle = UITableViewCellSelectionStyle.None;
     TextLabel.Text = @"Theme Style";
     segmentedControl = new UISegmentedControl (new[]{ "Light", "Dark" });
     segmentedControl.SelectedSegment = 0;
     AccessoryView = segmentedControl;
 }
コード例 #27
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			try{
				this.Title = "Ubicación de la tienda";

				mapView = new MKMapView(View.Bounds);	
				mapView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;
				View.AddSubview(mapView);
			
				//Mostramos la ubicacion del usuario.
				mapView.ShowsUserLocation = true;
				MKUserLocation usr = mapView.UserLocation;
				usr.Title = "Tú estas aqui";

				var annotation = new BasicMapAnnotation (new CLLocationCoordinate2D (Double.Parse(tienda.tienda_latitud), Double.Parse(tienda.tienda_longitud)), tienda.tienda_nombre,tienda.tienda_direccion);
				mapView.AddAnnotation (annotation);	

				// establecemos la region a mostrar, poniendo a Chihuahua como region
				var coords = new CLLocationCoordinate2D(28.6352778, -106.08888890000003); // Chihuahua
				var span = new MKCoordinateSpan(MilesToLatitudeDegrees (10), MilesToLongitudeDegrees (10, coords.Latitude));

				// se establece la region.
				mapView.Region = new MKCoordinateRegion (coords, span);

				//Mostrar los diferentes tipos de mapas
				int typesWidth=260, typesHeight=30, distanceFromBottom=60;
				mapTypes = new UISegmentedControl(new CGRect((View.Bounds.Width-typesWidth)/2, View.Bounds.Height-distanceFromBottom, typesWidth, typesHeight));
				mapTypes.InsertSegment("Mapa", 0, false);
				mapTypes.InsertSegment("Satelite", 1, false);
				mapTypes.InsertSegment("Ambos", 2, false);
				mapTypes.SelectedSegment = 0; // Road is the default
				mapTypes.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin;
				mapTypes.ValueChanged += (s, e) => {
					switch(mapTypes.SelectedSegment) {
					case 0:
						mapView.MapType = MKMapType.Standard;
						break;
					case 1:
						mapView.MapType = MKMapType.Satellite;
						break;
					case 2:
						mapView.MapType = MKMapType.Hybrid;
						break;
					}
				};
				View.AddSubview(mapTypes);
			} catch(Exception e){
				Console.WriteLine (e.ToString());
				UIAlertView alert = new UIAlertView () { 
					Title = "Ups =(", Message = "Algo salio mal, verifica tu conexión a internet e intentalo de nuevo."
				};
				alert.AddButton("Aceptar");
				alert.Show ();
			}
		}
コード例 #28
0
		partial void SecureSwitchChanged (UISegmentedControl sender)
		{
			var uri = new UriBuilder (locationTextField.Text);
			if (sender.SelectedSegment == 1) {
				uri.Scheme = "wss";
			} else {
				uri.Scheme = "ws";
			}
			locationTextField.Text = uri.ToString ();
		}
コード例 #29
0
		public PullRequestsView()
		{
			Root.UnevenRows = true;
			Title = "Pull Requests".t();
			NoItemsText = "No Pull Requests".t();

			_viewSegment = new UISegmentedControl(new object[] { "Open".t(), "Merged".t(), "Declined".t() });
			_segmentBarButton = new UIBarButtonItem(_viewSegment);
			ToolbarItems = new [] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _segmentBarButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) };
		}
コード例 #30
0
ファイル: PullRequestsView.cs プロジェクト: xNUTs/CodeBucket
		public PullRequestsView()
		{
			Title = "Pull Requests";
            EmptyView = new Lazy<UIView>(() =>
                new EmptyListView(AtlassianIcon.Devtoolspullrequest.ToImage(64f), "There are no pull requests.")); 

			_viewSegment = new UISegmentedControl(new object[] { "Open", "Merged", "Declined" });
			_segmentBarButton = new UIBarButtonItem(_viewSegment);
			ToolbarItems = new [] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _segmentBarButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) };
		}
コード例 #31
0
        public static void ConfigureSegmentedControllerForPayload(UISegmentedControl payloadSelectionView)
        {
            if (PayloadSelectorViewHelper.PAYLOAD_SEGMENTS_COUNT != payloadSelectionView.NumberOfSegments)
            {
                throw new Exception("[PAYLOAD] Unexpected segments count");
            }

            payloadSelectionView.SetTitle(PayloadSelectorViewHelper.MinPayloadButtonName(), PayloadSelectorViewHelper.PAYLOAD_MIN_BUTTON_INDEX);
            payloadSelectionView.SetTitle(PayloadSelectorViewHelper.ContentPayloadButtonName(), PayloadSelectorViewHelper.PAYLOAD_CONTENT_BUTTON_INDEX);
            payloadSelectionView.SetTitle(PayloadSelectorViewHelper.FullPayloadButtonName(), PayloadSelectorViewHelper.PAYLOAD_FULL_BUTTON_INDEX);

            payloadSelectionView.SelectedSegment = PayloadSelectorViewHelper.DEFAULT_PAYLOAD_BUTTON_INDEX;
        }
コード例 #32
0
        partial void handleModeSelection(UISegmentedControl sender)
        {
            switch (sender.SelectedSegment)
            {
            case 0:
                this.visionProcessor.TrackingLevel = VNRequestTrackingLevel.Fast;
                break;

            case 1:
                this.visionProcessor.TrackingLevel = VNRequestTrackingLevel.Accurate;
                break;
            }
        }
 void ReleaseDesignerOutlets()
 {
     if (FilmDetailsContainer != null)
     {
         FilmDetailsContainer.Dispose();
         FilmDetailsContainer = null;
     }
     if (FilmSegments != null)
     {
         FilmSegments.Dispose();
         FilmSegments = null;
     }
 }
コード例 #34
0
 void ReleaseDesignerOutlets()
 {
     if (chart != null)
     {
         chart.Dispose();
         chart = null;
     }
     if (switcher != null)
     {
         switcher.Dispose();
         switcher = null;
     }
 }
コード例 #35
0
 void ReleaseDesignerOutlets()
 {
     if (chart != null)
     {
         chart.Dispose();
         chart = null;
     }
     if (modeSelector != null)
     {
         modeSelector.Dispose();
         modeSelector = null;
     }
 }
コード例 #36
0
ファイル: GaugeAnimations.cs プロジェクト: mr-kg/xamarin-sdk
        public void SegmentTouched(UISegmentedControl source)
        {
            nfloat value = nfloat.Parse(this.segments[source.SelectedSegment]);

            TKGaugeNeedle needle = this.radialGauge.ScaleAtIndex(0).IndicatorAtIndex(0) as TKGaugeNeedle;

            needle.SetValue(value,
                            0.5f,
                            CAMediaTimingFunction.EaseInEaseOut);

            needle = this.linearGauge.ScaleAtIndex(0).IndicatorAtIndex(0) as TKGaugeNeedle;
            needle.SetValue((value / 180) * 7.0f, 0.5f, CAMediaTimingFunction.EaseInEaseOut);
        }
コード例 #37
0
        partial void modeSwitched(UISegmentedControl sender)
        {
            switch (sender.SelectedSegment)
            {
            case 0:
                chart.ChartType = Xuni.iOS.FlexChart.ChartType.Candlestick;
                break;

            case 1:
                chart.ChartType = Xuni.iOS.FlexChart.ChartType.HighLowOpenClose;
                break;
            }
        }
コード例 #38
0
        private UISegmentedControl createSegmentControl(RectangleF cellRect, string[] values, int width)
        {
            var seg = new UISegmentedControl(new RectangleF(cellRect.Width - DefaultLabelLeft - width, 5, width, 30))
            {
                AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin
            };

            for (int i = 0; i < values.Length; i++)
            {
                seg.InsertSegment(values [i], i, false);
            }
            return(seg);
        }
 void ReleaseDesignerOutlets()
 {
     if (flexGrid != null)
     {
         flexGrid.Dispose();
         flexGrid = null;
     }
     if (modeSelect != null)
     {
         modeSelect.Dispose();
         modeSelect = null;
     }
 }
コード例 #40
0
        partial void AfterMarketSegmentValue_Changed(UISegmentedControl sender)
        {
            string segmentID = AdditionSegment.SelectedSegment.ToString();

            if (segmentID == "1")
            {
                AdditionAMFO.Hidden = true;
            }
            else
            {
                AdditionAMFO.Hidden = false;
            }
        }
コード例 #41
0
 void ReleaseDesignerOutlets()
 {
     if (AllFilmsTable != null)
     {
         AllFilmsTable.Dispose();
         AllFilmsTable = null;
     }
     if (FilmSegments != null)
     {
         FilmSegments.Dispose();
         FilmSegments = null;
     }
 }
コード例 #42
0
 void ReleaseDesignerOutlets()
 {
     if (imageView != null)
     {
         imageView.Dispose();
         imageView = null;
     }
     if (resampleSelector != null)
     {
         resampleSelector.Dispose();
         resampleSelector = null;
     }
 }
コード例 #43
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Title = "MapView";

            mapView = new MKMapView(View.Bounds);
            mapView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;
            //mapView.MapType = MKMapType.Standard;	// this is the default
            //mapView.MapType = MKMapType.Satellite;
            //mapView.MapType = MKMapType.Hybrid;
            View.AddSubview(mapView);

            int typesWidth = 260, typesHeight = 30, distanceFromBottom = 60;

            mapTypes = new UISegmentedControl(new CGRect((View.Bounds.Width - typesWidth) / 2, View.Bounds.Height - distanceFromBottom, typesWidth, typesHeight));
            mapTypes.InsertSegment("Road", 0, false);
            mapTypes.InsertSegment("Satellite", 1, false);
            mapTypes.InsertSegment("Hybrid", 2, false);
            mapTypes.SelectedSegment  = 0;            // Road is the default
            mapTypes.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin;
            mapTypes.ValueChanged    += (s, e) => {
                switch (mapTypes.SelectedSegment)
                {
                case 0:
                    mapView.MapType = MKMapType.Standard;
                    break;

                case 1:
                    mapView.MapType = MKMapType.Satellite;
                    break;

                case 2:
                    mapView.MapType = MKMapType.Hybrid;
                    break;
                }
            };

            View.AddSubview(mapTypes);

            // create our location and zoom
            //CLLocationCoordinate2D coords = new CLLocationCoordinate2D(40.77, -73.98); // new york
            //CLLocationCoordinate2D coords = new CLLocationCoordinate2D(33.93, -118.40); // los angeles
            //CLLocationCoordinate2D coords = new CLLocationCoordinate2D(51.509, -0.1); // london
            CLLocationCoordinate2D coords = new CLLocationCoordinate2D(48.857, 2.351);             // paris

            MKCoordinateSpan span         = new MKCoordinateSpan(MilesToLatitudeDegrees(20), MilesToLongitudeDegrees(20, coords.Latitude));

            // set the coords and zoom on the map
            mapView.Region = new MKCoordinateRegion(coords, span);
        }
コード例 #44
0
        public static void Setup()
        {
            UIGraphics.BeginImageContext(new CoreGraphics.CGSize(1, 64f));
            Theme.PrimaryNavigationBarColor.SetFill();
            UIGraphics.RectFill(new CoreGraphics.CGRect(0, 0, 1, 64));
            var img = UIGraphics.GetImageFromCurrentImageContext();

            UIGraphics.EndImageContext();

            UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;

            var navBarContainers = new [] { typeof(MenuNavigationController), typeof(ThemedNavigationController), typeof(MainNavigationController) };

            foreach (var navbarAppearance in navBarContainers.Select(x => UINavigationBar.AppearanceWhenContainedIn(x)))
            {
                navbarAppearance.TintColor       = Theme.PrimaryNavigationBarTextColor;
                navbarAppearance.BarTintColor    = Theme.PrimaryNavigationBarColor;
                navbarAppearance.BackgroundColor = Theme.PrimaryNavigationBarColor;
                navbarAppearance.SetTitleTextAttributes(new UITextAttributes {
                    TextColor = Theme.PrimaryNavigationBarTextColor, Font = UIFont.SystemFontOfSize(18f)
                });
                navbarAppearance.SetBackgroundImage(img, UIBarPosition.Any, UIBarMetrics.Default);
                navbarAppearance.BackIndicatorImage = Images.BackButton;
                navbarAppearance.BackIndicatorTransitionMaskImage = Images.BackButton;
            }

            UISegmentedControl.Appearance.TintColor = UIColor.FromRGB(110, 110, 117);
            UISegmentedControl.AppearanceWhenContainedIn(typeof(UINavigationBar)).TintColor = UIColor.White;

            UISwitch.Appearance.OnTintColor = UIColor.FromRGB(0x41, 0x83, 0xc4);

            // Composer Input Accessory Buttons
            UIButton.AppearanceWhenContainedIn(typeof(UIScrollView)).TintColor = Theme.PrimaryNavigationBarColor;

            //UITableViewHeaderFooterView.Appearance.TintColor = UIColor.FromRGB(228, 228, 228);
            var headerFooterContainers = new [] { typeof(UITableViewHeaderFooterView) };

            foreach (var navbarAppearance in headerFooterContainers)
            {
                UILabel.AppearanceWhenContainedIn(navbarAppearance).TextColor = UIColor.FromRGB(110, 110, 117);
                UILabel.AppearanceWhenContainedIn(navbarAppearance).Font      = UIFont.SystemFontOfSize(14f);
            }

            StringElement.DefaultTintColor = Theme.PrimaryNavigationBarColor;

            UIToolbar.Appearance.BarTintColor = UIColor.FromRGB(245, 245, 245);

            UIBarButtonItem.AppearanceWhenContainedIn(typeof(UISearchBar)).SetTitleTextAttributes(new UITextAttributes {
                TextColor = UIColor.White
            }, UIControlState.Normal);
        }
コード例 #45
0
        protected override void SetupSubviews()
        {
            base.SetupSubviews();

            ContentView = new UIView {
                BackgroundColor = AppColors.ContentPrimary
            };

            VacationsPager      = new UIView();
            VacationPageControl = new UIPageControl
            {
                Pages = Enum.GetValues(typeof(VacationType)).Length, PageIndicatorTintColor = AppColors.TextBody,
                CurrentPageIndicatorTintColor = AppColors.TextPrimary
            };

            AboveDateSeparator     = new UIView().SetSeparatorStyle();
            DateBeginView          = new LargeDateControl(AppColors.TextPrimary);
            DateEndView            = new LargeDateControl(AppColors.TextSecondary);
            BelowDateSeparator     = new UIView().SetSeparatorStyle();
            StatusSegmentedControl = new UISegmentedControl(Strings.Approved, Strings.Closed)
            {
                TintColor = AppColors.TextSecondary
            };

            StartDatePicker = new UIDatePicker {
                Mode = UIDatePickerMode.Date
            };

            EndDatePicker = new UIDatePicker {
                Mode = UIDatePickerMode.Date
            };

            DatePickerToolbar = new UIToolbar
            {
                BarStyle = UIBarStyle.Default, Translucent = true, TintColor = AppColors.TextPrimary
            };

            var doneButton = new UIBarButtonItem()
            {
                Title = Strings.Done,
                Style = UIBarButtonItemStyle.Plain,
            };

            doneButton.ClickedWeakSubscribe((sender, args) => HideDatePickers());
            var space = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);

            DatePickerToolbar.SetItems(new[] { space, doneButton }, false);
            DatePickerToolbar.UserInteractionEnabled = true;

            ActivityIndicator = new ActivityIndicatorView(80, 1);
        }
コード例 #46
0
        private void CreateLayout()
        {
            // Add a segmented button control
            _segmentButton = new UISegmentedControl();
            _segmentButton.BackgroundColor = UIColor.White;
            _segmentButton.InsertSegment("Search Maps", 0, false);
            _segmentButton.InsertSegment("My Maps", 1, false);

            // Handle the "click" for each segment (new segment is selected)
            _segmentButton.ValueChanged += SegmentButtonClicked;

            // Add the MapView and segmented button to the page
            View.AddSubviews(_myMapView, _segmentButton);
        }
コード例 #47
0
        private void SegmentButtonClicked(object sender, EventArgs e)
        {
            // Get the segmented button control that raised the event.
            UISegmentedControl buttonControl = (UISegmentedControl)sender;

            // Get the type of stretch inputs to show (title of the selected button).
            string stretchType = buttonControl.TitleAt(buttonControl.SelectedSegment);

            // Show the UI and pass the type of parameter inputs to show.
            ShowRendererParamsUi(stretchType);

            // Deselect all segments (user might want to click the same control twice)
            buttonControl.SelectedSegment = -1;
        }
コード例 #48
0
        partial void SecureSwitchChanged(UISegmentedControl sender)
        {
            var uri = new UriBuilder(locationTextField.Text);

            if (sender.SelectedSegment == 1)
            {
                uri.Scheme = "wss";
            }
            else
            {
                uri.Scheme = "ws";
            }
            locationTextField.Text = uri.ToString();
        }
コード例 #49
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var viewSegment = new UISegmentedControl(new object[] { "Open", "Closed" });

            this.WhenAnyValue(x => x.ViewModel.SelectedFilter).Subscribe(x => viewSegment.SelectedSegment = x);
            viewSegment.ValueChanged += (sender, args) => ViewModel.SelectedFilter = (int)viewSegment.SelectedSegment;
            NavigationItem.TitleView  = viewSegment;

            this.WhenAnyValue(x => x.ViewModel.PullRequests)
            .Select(x => new PullRequestTableViewSource(TableView, x))
            .BindTo(TableView, x => x.Source);
        }
コード例 #50
0
 private void Initialize()
 {
     segmentedControl = new UISegmentedControl(new object[] { "Name", "Date" });
     segmentedControl.SizeToFit();
     segmentedControl.Frame = new CGRect(segmentedControl.Frame.X, segmentedControl.Frame.Y,
                                         160, segmentedControl.Bounds.Size.Height);
     segmentedControl.AutoresizingMask = UIViewAutoresizing.None;
     segmentedControl.ValueChanged    += (sender, args) =>
     {
         sortModeChangeAction(sortMode);
     };
     AddSubview(segmentedControl);
     sortMode = SortMode.Name;
 }
コード例 #51
0
        private void InitializeSection()
        {
            UIView v = new UIView(new RectangleF(0, 0, UIScreen.MainScreen.ApplicationFrame.Width, 50));

            v.AutosizesSubviews = false;

            SegmentedControl        = new UISegmentedControl(new RectangleF(0, 0, 180, 30));
            SegmentedControl.Center = v.Center;
            // initialize _SegmenentedControl here...
            // make sure to set Frame appropriate relative to HeaderView bounds.
            SegmentedControl.AutoresizingMask = UIViewAutoresizing.None;
            v.AddSubview(SegmentedControl);
            this.HeaderView = v;
        }
コード例 #52
0
 void ValueChanged(UISegmentedControl sender)
 {
     MessagingCenter.Send <Object, int>(this, "ClickSegmentedControl", (int)sender.SelectedSegment);
     // switch((int)sender.SelectedSegment){
     //  case 0:
     //      break;
     //  case 1:
     //      break;
     //  case 2:
     //      break;
     //  default:
     //      break;
     //}
 }
コード例 #53
0
        public static ISourceItemBindingBuilder <TSourceItem, nint> BindDefault <TSourceItem>(
            [NotNull] this BindingSet <TSourceItem> bindingSet,
            [CanBeNull] UISegmentedControl segmentedControl,
            bool trackCanExecuteCommandChanged = false)
            where TSourceItem : class
        {
            if (bindingSet == null)
            {
                throw new ArgumentNullException(nameof(bindingSet));
            }

            return(bindingSet.Bind(segmentedControl)
                   .For(v => v.NotNull().SelectedSegmentAndValueChangedBinding(trackCanExecuteCommandChanged)));
        }
コード例 #54
0
        private void ViewSampleReadme(SampleInfo sample, UIViewController parentController)
        {
            var switcher = new UISegmentedControl(new string[] { "About", "Source code" })
            {
                SelectedSegment = 0
            };
            var control = new SampleInfoViewController(sample, switcher);

            control.NavigationItem.RightBarButtonItem = new UIBarButtonItem()
            {
                CustomView = switcher
            };
            parentController.NavigationController.PushViewController(control, true);
        }
コード例 #55
0
        public NotificationsViewController()
        {
            SearchPlaceholder = "Search Notifications".t();
            NoItemsText       = "No Notifications".t();
            Title             = "Notifications".t();
            ViewModel         = new NotificationsViewModel();

            _viewSegment = new UISegmentedControl(new string[] { "Unread".t(), "Participating".t(), "All".t() });
            _viewSegment.ControlStyle = UISegmentedControlStyle.Bar;
            _segmentBarButton         = new UIBarButtonItem(_viewSegment);

            BindCollection(ViewModel.Notifications, CreateElement);
            ViewModel.Bind(x => x.IsLoading, Loading);
        }
コード例 #56
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Title = "MapView Annotation";

            mapView = new MKMapView(View.Bounds);
            mapView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;
            View.AddSubview(mapView);

            // create our location and zoom for los angeles
            var coords = new CLLocationCoordinate2D(48.857, 2.351);             // paris
            var span   = new MKCoordinateSpan(MilesToLatitudeDegrees(2), MilesToLongitudeDegrees(2, coords.Latitude));

            // set the coords and zoom on the map
            mapView.Region = new MKCoordinateRegion(coords, span);

            // add a basic annotation
            var annotation = new BasicMapAnnotation(new CLLocationCoordinate2D(48.857, 2.351), "Paris", "City of Light");

            mapView.AddAnnotation(annotation);


            #region Not related to this sample
            int typesWidth = 260, typesHeight = 30, distanceFromBottom = 60;
            mapTypes = new UISegmentedControl(new RectangleF((View.Bounds.Width - typesWidth) / 2, View.Bounds.Height - distanceFromBottom, typesWidth, typesHeight));
            mapTypes.InsertSegment("Road", 0, false);
            mapTypes.InsertSegment("Satellite", 1, false);
            mapTypes.InsertSegment("Hybrid", 2, false);
            mapTypes.SelectedSegment  = 0;            // Road is the default
            mapTypes.AutoresizingMask = UIViewAutoresizing.FlexibleTopMargin;
            mapTypes.ValueChanged    += (s, e) => {
                switch (mapTypes.SelectedSegment)
                {
                case 0:
                    mapView.MapType = MKMapType.Standard;
                    break;

                case 1:
                    mapView.MapType = MKMapType.Satellite;
                    break;

                case 2:
                    mapView.MapType = MKMapType.Hybrid;
                    break;
                }
            };
            View.AddSubview(mapTypes);
            #endregion
        }
コード例 #57
0
        private void CreateLayout()
        {
            // Create label that displays the Altitude.
            _altitudeLabel = new UILabel
            {
                Text = "Altitude:",
                AdjustsFontSizeToFitWidth = true
            };

            // Create slider that the user can modify Altitude .
            _altitudeSlider = new UISlider();

            // Create label that displays the Azimuth.
            _azimuthLabel = new UILabel
            {
                Text = "Azimuth:",
                AdjustsFontSizeToFitWidth = true
            };

            // Create slider that the user can modify Azimuth.
            _azimuthSlider = new UISlider();

            // Get all the SlopeType names from the PresetColorRampType Enumeration and put them
            // in an array of strings, then set the UITableView.Source to the array.
            _slopeTypesPicker = new UISegmentedControl(Enum.GetNames(typeof(SlopeType)))
            {
                SelectedSegment = 0
            };

            // Get all the ColorRamp names from the PresetColorRampType Enumeration and put them
            // in an array of strings, then set the UITableView.Source to the array.
            _colorRampsPicker = new UISegmentedControl(Enum.GetNames(typeof(PresetColorRampType)))
            {
                SelectedSegment = 0
            };

            // Create button to change stretch renderer of the raster.
            _updateRendererButton = new UIButton(UIButtonType.RoundedRect);
            _updateRendererButton.SetTitle("Update renderer", UIControlState.Normal);
            _updateRendererButton.SetTitleColor(View.TintColor, UIControlState.Normal);

            // Hook to touch/click event of the button.
            _updateRendererButton.TouchUpInside += UpdateRendererButton_Clicked;
            _updateRendererButton.Enabled        = false;

            // Add all of the UI controls to the page.
            View.AddSubviews(_myMapView, _toolbar, _altitudeLabel, _altitudeSlider, _azimuthLabel,
                             _azimuthSlider, _slopeTypesPicker, _colorRampsPicker, _updateRendererButton);
        }
コード例 #58
0
ファイル: mapsTab_.cs プロジェクト: LouisCapelle/Nurses-App
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            Title = "User Location";

            mapView = new MKMapView(View.Bounds);
            mapView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;
            //mapView.MapType = MKMapType.Standard; // this is the default
            //mapView.MapType = MKMapType.Satellite;
            //mapView.MapType = MKMapType.Hybrid;
            View.AddSubview(mapView);

            //Request permission to access device location - necessary on iOS 8.0 and above
            //Don't forget to set NSLocationWhenInUseUsageDescription in Info.plist
            locationManager.RequestWhenInUseAuthorization();

            // this is required to show the blue dot indicating user-location
            mapView.ShowsUserLocation = true;

            Console.WriteLine("initial loc:" + mapView.UserLocation.Coordinate.Latitude + "," + mapView.UserLocation.Coordinate.Longitude);

            mapView.DidUpdateUserLocation += (sender, e) => {
                if (mapView.UserLocation != null)
                {
                    Console.WriteLine("userloc:" + mapView.UserLocation.Coordinate.Latitude + "," + mapView.UserLocation.Coordinate.Longitude);
                    CLLocationCoordinate2D coords = mapView.UserLocation.Coordinate;
                    MKCoordinateSpan       span   = new MKCoordinateSpan(MilesToLatitudeDegrees(2), MilesToLongitudeDegrees(2, coords.Latitude));
                    mapView.Region = new MKCoordinateRegion(coords, span);
                }
            };

            if (!mapView.UserLocationVisible)
            {
                // user denied permission, or device doesn't have GPS/location ability
                Console.WriteLine("userloc not visible, show cupertino");
                CLLocationCoordinate2D coords = new CLLocationCoordinate2D(37.33233141, -122.0312186); // cupertino
                MKCoordinateSpan       span   = new MKCoordinateSpan(MilesToLatitudeDegrees(20), MilesToLongitudeDegrees(20, coords.Latitude));
                mapView.Region = new MKCoordinateRegion(coords, span);
            }

            int typesWidth = 260, typesHeight = 30, distanceFromBottom = 60;

            mapTypes = new UISegmentedControl(new CGRect((View.Bounds.Width - typesWidth) / 2, View.Bounds.Height - distanceFromBottom, typesWidth, typesHeight));
            mapTypes.BackgroundColor    = UIColor.White;
            mapTypes.Layer.CornerRadius = 5;
            mapTypes.ClipsToBounds      = true;

            View.AddSubview(mapTypes);
        }
コード例 #59
0
        public void CtorNSArray()
        {
            Assert.Throws <ArgumentNullException> (() => new UISegmentedControl((NSArray)null), "null");

            using (UISegmentedControl sc = new UISegmentedControl(new NSArray())) {
                Assert.That(sc.NumberOfSegments, Is.EqualTo(0), "Empty");
            }

            using (var ns = new NSString("NSString"))
                using (var img = UIImage.FromFile("basn3p08.png"))
                    using (var a = NSArray.FromObjects("string", ns, img))
                        using (UISegmentedControl sc = new UISegmentedControl(a)) {
                            Assert.That(sc.NumberOfSegments, Is.EqualTo(3), "NumberOfSegments");
                        }
        }
コード例 #60
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _viewSegment      = new UISegmentedControl(new object[] { "Branches", "Tags" });
            _segmentBarButton = new UIBarButtonItem(_viewSegment)
            {
                Width = View.Frame.Width - 10f
            };
            _viewSegment.ValueChanged += (sender, args) => ViewModel.SelectedFilter = (BranchesAndTagsViewModel.ShowIndex)_viewSegment.SelectedSegment;
            ViewModel.WhenAnyValue(x => x.SelectedFilter).Subscribe(x => _viewSegment.SelectedSegment = (int)x);
            this.BindList(ViewModel.Items, x => new StyledStringElement(x.Name, () => ViewModel.GoToSourceCommand.Execute(x.Object)));

            ToolbarItems = new[] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _segmentBarButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) };
        }