public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            webView.ShouldStartLoad = delegate(UIWebView webViewParam, NSUrlRequest request, UIWebViewNavigationType navigationType) {
                // view links in a new 'webbrowser' window like session & twitter
                if (navigationType == UIWebViewNavigationType.LinkClicked) {
                    this.NavigationController.PushViewController (new WebViewController (request), true);
                    return false;
                }
                return true;
            };

            navBar = new UINavigationBar (new RectangleF (0, 0, 320, 44));
            var bbi = new UIBarButtonItem(UIImage.FromBundle ("Images/slideout"), UIBarButtonItemStyle.Plain, (sender, e) => {
                AppDelegate.Current.FlyoutNavigation.ToggleMenu();
            });
            var item = new UINavigationItem ("About MonkeySpace");
            item.LeftBarButtonItem = bbi;
            var items = new UINavigationItem[] {
                item
            };
            navBar.SetItems (items, false);

            View.Add (navBar);
        }
예제 #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            DismissButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, (s, e) =>
            {
                ViewedPreviously = true;
                this.DismissViewControllerAsync(true);
            });
            NavBarItem.RightBarButtonItem = DismissButton;
            myNavBar.SetItems(new UINavigationItem[] { NavBarItem }, true);
            Console.WriteLine(Favorites.Count);
            FavoriteCatTableSource      = new FavoriteCategoryTableSource(this, Favorites);
            FavoriteCatTableView.Source = FavoriteCatTableSource;

            FavoriteCatTableSource.Selected += (object sender, FavoriteSelectedEventArgs e) => {
                if (this.FavoriteSelected != null)
                {
                    this.FavoriteSelected(this, e);
                }
            };

            sender.PageReloaded += (object sender, EventArgs e) => {
                Favorites = AppDelegate.databaseConnection.GetAllFavoriteCategoriesAsync().Result;
                Favorites.Sort((s1, s2) => s2.Updated.CompareTo(s1.Updated));
                this.InvokeOnMainThread(() => {
                    FavoriteCatTableView.ReloadData();
                    this.View.SetNeedsDisplay();
                });
            };
        }
예제 #3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            webView.ShouldStartLoad = delegate(UIWebView webViewParam, NSUrlRequest request, UIWebViewNavigationType navigationType) {
                // view links in a new 'webbrowser' window like session & twitter
                if (navigationType == UIWebViewNavigationType.LinkClicked)
                {
                    this.NavigationController.PushViewController(new WebViewController(request), true);
                    return(false);
                }
                return(true);
            };

            navBar = new UINavigationBar(new RectangleF(0, 0, 320, 44));
            var bbi = new UIBarButtonItem(UIImage.FromBundle("Images/slideout"), UIBarButtonItemStyle.Plain, (sender, e) => {
                AppDelegate.Current.FlyoutNavigation.ToggleMenu();
            });
            var item = new UINavigationItem("About MonkeySpace");

            item.LeftBarButtonItem = bbi;
            var items = new UINavigationItem[] {
                item
            };

            navBar.SetItems(items, false);

            View.Add(navBar);
        }
예제 #4
0
        private void InitNavBar()
        {
            _navBar = new UINavigationBar();
            _navBar.Frame = NavbarFrame;
            _navBar.ClipsToBounds = true;

            UIBarButtonItem _backBtnItem = new UIBarButtonItem("Сканировать еще", UIBarButtonItemStyle.Plain, OnBackPressed);

            _backNavItem = new UINavigationItem();
            _backNavItem.LeftBarButtonItem = _backBtnItem;

            _navBar.SetItems(new UINavigationItem[] { _backNavItem }, false);
        }
예제 #5
0
        private void InitNavBar()
        {
            _navBar               = new UINavigationBar();
            _navBar.Frame         = NavbarFrame;
            _navBar.ClipsToBounds = true;

            UIBarButtonItem _backBtnItem = new UIBarButtonItem("Сканировать еще", UIBarButtonItemStyle.Plain, OnBackPressed);

            _backNavItem = new UINavigationItem();
            _backNavItem.LeftBarButtonItem = _backBtnItem;

            _navBar.SetItems(new UINavigationItem[] { _backNavItem }, false);
        }
        public ImageCropperViewController(UIImage image)
            : base()
        {
            UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.BlackTranslucent, true);

            this.ImageView = new UIImageView(image)
            {
                Frame = new RectangleF(0.0f, 0.0f, image.Size.Width, image.Size.Height)
            };

            this.ScrollView = new UIScrollView(new RectangleF(0.0f, -20.0f, 320.0f, 480.0f))
            {
                BackgroundColor = UIColor.Black,
                Delegate        = new CustomUIScrollViewDelegate(this.ImageView),
                ShowsHorizontalScrollIndicator = false,
                ShowsVerticalScrollIndicator   = false,
                MaximumZoomScale = 2.0f,
                ContentSize      = this.ImageView.Frame.Size
            };

            this.ScrollView.MinimumZoomScale = this.ScrollView.Frame.Size.Width / this.ImageView.Frame.Size.Width;
            this.ScrollView.ZoomScale        = this.ScrollView.MinimumZoomScale;
            this.ScrollView.AddSubview(this.ImageView);

            this.View.AddSubview(this.ScrollView);

            var navigationBar = new UINavigationBar(new RectangleF(0.0f, 0.0f, 320.0f, 44.0f))
            {
                BarStyle    = UIBarStyle.Black,
                Translucent = true
            };

            var navigationItem = new UINavigationItem(@"Move and Scale");

            var cancelButton = new UIBarButtonItem(UIBarButtonSystemItem.Cancel);

            cancelButton.Clicked += CancelCropping;

            var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done);

            doneButton.Clicked += FinishCropping;

            navigationItem.LeftBarButtonItem  = cancelButton;
            navigationItem.RightBarButtonItem = doneButton;

            navigationBar.SetItems(new[] { navigationItem }, true);


            this.View.AddSubview(navigationBar);
        }
예제 #7
0
        // Custom Methods

        protected void StyleNavigationBar(UIColor primaryColor, UIColor primaryDarkColor, string title)
        {
            this.NavigationController.SetNavigationBarHidden(true, false);

            UINavigationBar newNavBar = new UINavigationBar(new CGRect(0, 0, this.View.Bounds.Width, 104.0));

            newNavBar.BarTintColor = primaryColor;
            newNavBar.TintColor    = UIColor.White;
            newNavBar.Translucent  = false;

            NavItem = new UINavigationItem();
            NavItem.HidesBackButton = true;

            var titleView  = new UIView(new CGRect(0, 0, this.View.Bounds.Width, 88.0f));
            var titleLabel = new UILabel(new CGRect(0, 0, this.View.Bounds.Width, 88.0f));

            titleLabel.Font      = UIFont.SystemFontOfSize(17, UIFontWeight.Semibold);
            titleLabel.TextColor = UIColor.White;
            titleLabel.AdjustsFontSizeToFitWidth = true;
            titleLabel.Text = title;
            titleView.AddSubview(titleLabel);

            titleView.AutoresizingMask = UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleRightMargin | UIViewAutoresizing.FlexibleBottomMargin;

            titleLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            NSLayoutConstraint trailing = NSLayoutConstraint.Create(titleLabel, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, titleView, NSLayoutAttribute.Trailing, 1.0f, 0.0f);
            NSLayoutConstraint leading  = NSLayoutConstraint.Create(titleLabel, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, titleView, NSLayoutAttribute.Leading, 1.0f, 0.0f);
            NSLayoutConstraint bottom   = NSLayoutConstraint.Create(titleLabel, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, titleView, NSLayoutAttribute.Bottom, 1.0f, 0.0f);
            NSLayoutConstraint top      = NSLayoutConstraint.Create(titleLabel, NSLayoutAttribute.Top, NSLayoutRelation.Equal, titleView, NSLayoutAttribute.Top, 1.0f, 0.0f);

            titleView.AddConstraint(trailing);
            titleView.AddConstraint(leading);
            titleView.AddConstraint(bottom);
            titleView.AddConstraint(top);

            NavItem.TitleView = titleView;

            var statusBarView = new UIView(new CGRect(0, 0, this.View.Bounds.Width, 20));

            statusBarView.BackgroundColor = primaryDarkColor;

            newNavBar.SetItems(new[] { NavItem }, false);
            newNavBar.AddSubview(statusBarView);

            this.View.AddSubview(newNavBar);
        }
예제 #8
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var navBar = new UINavigationBar(new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width, 120));

            View.AddSubview(navBar);
            var navItem  = new UINavigationItem(_productName);
            var doneItem = new UIBarButtonItem(UIBarButtonSystemItem.Cancel, null);

            doneItem.Clicked += async(sender, e) => await DismissViewControllerAsync(true);

            navItem.LeftBarButtonItem = doneItem;
            navBar.SetItems(new UINavigationItem[] { navItem }, false);

            product_name.Font  = UIFont.FromName("Helvetica", 30);
            product_name.Text  = "Lorem Ipsum";
            product_name.Text  = _productName;
            product_brand.Text = _productBrand;
        }
        //, UIViewController speakerView)
        public SpeakerSessionMasterDetail(int speakerID)
        {
            speakerId = speakerID;

            navBar = new UINavigationBar(new RectangleF(0,0,768, 44));
            navBar.SetItems(new UINavigationItem[]{new UINavigationItem("Speaker & Session Info")},false);

            View.BackgroundColor = UIColor.LightGray;
            View.Frame = new RectangleF(0,0,768,768);

            speakerView = new SpeakerView(-1);
            speakerView.Frame = new RectangleF(0,44,colWidth1,728);
            speakerView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight;

            sessionView = new SessionView(false);
            sessionView.Frame = new RectangleF(colWidth1+1,44,colWidth2,728);
            sessionView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;

            View.AddSubview (speakerView);
            View.AddSubview (sessionView);
            View.AddSubview (navBar);

            //			if (_speakerID > 1)
            //			{
            //				var speaker = BL.Managers.SpeakerManager.GetSpeaker (_speakerID);
            //				var _sessions = BL.Managers.SessionManager.GetSessions ();
            //				if (_sessions != null)
            //				{
            //					_session = (from session in _sessions
            //							where session.SpeakerNames.IndexOf(speaker.Name) >= 0
            //							select session).FirstOrDefault();
            //				}
            //
            //				_sessionView = new SessionView(_session);
            //				_ssv.Frame = new RectangleF(colWidth1+1,0,colWidth2,728);
            //
            //				this.View.AddSubview (_ssv);
            //			}
        }
        public SessionSpeakersMasterDetail(int speakerID)
        {
            speakerId = speakerID;

            navBar = new UINavigationBar(new RectangleF(0,0,768, 44));
            navBar.SetItems(new UINavigationItem[]{new UINavigationItem("Session & Speaker Info")},false);

            View.BackgroundColor = UIColor.LightGray;
            View.Frame = new RectangleF(0,0,768,768);

            sessionView = new SessionView(this);
            sessionView.Frame = new RectangleF(0,44,colWidth1,728);
            sessionView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight;

            speakerView = new SpeakerView(-1);
            speakerView.Frame = new RectangleF(colWidth1+1,44,colWidth2,728);
            speakerView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;

            View.AddSubview (speakerView);
            View.AddSubview (sessionView);
            View.AddSubview (navBar);
        }
        public SessionSpeakersMasterDetail(int speakerID)
        {
            speakerId = speakerID;

            navBar = new UINavigationBar(new RectangleF(0, 0, 768, 44));
            navBar.SetItems(new UINavigationItem[] { new UINavigationItem("Session & Speaker Info") }, false);

            View.BackgroundColor = UIColor.LightGray;
            View.Frame           = new RectangleF(0, 0, 768, 768);

            sessionView                  = new SessionView(this);
            sessionView.Frame            = new RectangleF(0, 44, colWidth1, 728);
            sessionView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight;

            speakerView                  = new SpeakerView(-1);
            speakerView.Frame            = new RectangleF(colWidth1 + 1, 44, colWidth2, 728);
            speakerView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;

            View.AddSubview(speakerView);
            View.AddSubview(sessionView);
            View.AddSubview(navBar);
        }
        public SpeakerSessionMasterDetail(int speakerID)          //, UIViewController speakerView)
        {
            speakerId = speakerID;

            navBar = new UINavigationBar(new CGRect(0, 0, 768, 44));
            navBar.SetItems(new UINavigationItem[] { new UINavigationItem("Speaker & Session Info") }, false);

            View.BackgroundColor = UIColor.LightGray;
            View.Frame           = new CGRect(0, 0, 768, 768);

            speakerView                  = new SpeakerView(-1);
            speakerView.Frame            = new CGRect(0, 44, colWidth1, 728);
            speakerView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight;

            sessionView                  = new SessionView(false);
            sessionView.Frame            = new CGRect(colWidth1 + 1, 44, colWidth2, 728);
            sessionView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;

            View.AddSubview(speakerView);
            View.AddSubview(sessionView);
            View.AddSubview(navBar);

//			if (_speakerID > 1)
//			{
//				var speaker = BL.Managers.SpeakerManager.GetSpeaker (_speakerID);
//				var _sessions = BL.Managers.SessionManager.GetSessions ();
//				if (_sessions != null)
//				{
//					_session = (from session in _sessions
//							where session.SpeakerNames.IndexOf(speaker.Name) >= 0
//							select session).FirstOrDefault();
//				}
//
//				_sessionView = new SessionView(_session);
//				_ssv.Frame = new CGRect(colWidth1+1,0,colWidth2,728);
//
//				this.View.AddSubview (_ssv);
//			}
        }
예제 #13
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            toolbar = new UINavigationBar(new RectangleF(0, 0, View.Frame.Width, toolbarHeight));
            toolbar.SetItems(new UINavigationItem[] {
                new UINavigationItem("Map")
            }, false);
            toolbar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
            toolbar.TintColor        = AppDelegate.ColorNavBarTint;

            Title            = Constants.MapPinSubtitle;  // "Fira de Barcelona";
            TabBarItem.Title = "Map";

            // create our location and zoom for los angeles
            CLLocationCoordinate2D coords = new CLLocationCoordinate2D(Constants.MapPinLatitude, Constants.MapPinLongitude);
            MKCoordinateSpan       span   = new MKCoordinateSpan(MilesToLatitudeDegrees(3), MilesToLongitudeDegrees(3, coords.Latitude));

            mapView = new MKMapView(new RectangleF(0, toolbarHeight, View.Frame.Width, UIScreen.MainScreen.ApplicationFrame.Height - toolbarHeight));
            mapView.ShowsUserLocation = true;
            mapView.Frame             = new RectangleF(0, 0, View.Frame.Width, View.Frame.Height);
            mapView.AutoresizingMask  = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            // set the coords and zoom on the map
            mapView.Region = new MKCoordinateRegion(coords, span);

            segmentedControl = new UISegmentedControl();
            segmentedControl.InsertSegment("Map", 0, false);
            segmentedControl.InsertSegment("Satellite", 1, false);
            segmentedControl.InsertSegment("Hybrid", 2, false);
            segmentedControl.SelectedSegment = 0;
            segmentedControl.ControlStyle    = UISegmentedControlStyle.Bar;
            segmentedControl.TintColor       = UIColor.DarkGray;
            if (AppDelegate.IsPhone)
            {
                var topOfSegement = View.Frame.Height - 120;
                segmentedControl.Frame = new RectangleF(20, topOfSegement, 282, 30);
                //segmentedControl.Frame = new RectangleF(20, 340, 282, 30);
            }
            else
            {
                // IsPad
                var left = (View.Frame.Width / 2) - (282 / 2);
                segmentedControl.Frame            = new RectangleF(left, View.Frame.Height - 70, 282, 30);
                segmentedControl.AutoresizingMask = UIViewAutoresizing.FlexibleMargins;
            }
            segmentedControl.ValueChanged += delegate {
                if (segmentedControl.SelectedSegment == 0)
                {
                    mapView.MapType = MonoTouch.MapKit.MKMapType.Standard;
                }
                else if (segmentedControl.SelectedSegment == 1)
                {
                    mapView.MapType = MonoTouch.MapKit.MKMapType.Satellite;
                }
                else if (segmentedControl.SelectedSegment == 2)
                {
                    mapView.MapType = MonoTouch.MapKit.MKMapType.Hybrid;
                }
            };

            try {
                // add a basic annotation, got a bug report about these lines of code
                mapView.AddAnnotation(
                    new BasicMapAnnotation(coords, Constants.MapPinTitle, Constants.MapPinSubtitle)
                    );
            } catch (Exception mapex) {
                ConsoleD.WriteLine("Not sure if happens " + mapex.Message);
            }

            View.AddSubview(mapView);
            View.AddSubview(toolbar);
            View.AddSubview(segmentedControl);
        }
예제 #14
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();



            navBar = new UINavigationBar(new RectangleF(0, 0, 320, 44));
            var bbi = new UIBarButtonItem(UIImage.FromBundle("Images/slideout"), UIBarButtonItemStyle.Plain, (sender, e) => {
                AppDelegate.Current.FlyoutNavigation.ToggleMenu();
            });
            var rbi = new UIBarButtonItem(UIImage.FromBundle("Images/113-navigation"), UIBarButtonItemStyle.Plain, (sender, e) => {
                mapFlipViewController.Flip();
            });

            var item = new UINavigationItem("Location Map");

            item.LeftBarButtonItem  = bbi;
            item.RightBarButtonItem = rbi;
            var items = new UINavigationItem[] {
                item
            };

            navBar.SetItems(items, false);



            mapView = new MKMapView()
            {
                ShowsUserLocation = true
            };

            labelDistance = new UILabel()
            {
                Frame           = new RectangleF(0, 44, 320, 49),
                Lines           = 2,
                BackgroundColor = UIColor.Black,
                TextColor       = UIColor.White
            };

            var segmentedControl = new UISegmentedControl();
            var topOfSegement    = View.Frame.Height - 60;

            segmentedControl.Frame = new RectangleF(20, topOfSegement, 282, 30);
            segmentedControl.InsertSegment("Map", 0, false);
            segmentedControl.InsertSegment("Satellite", 1, false);
            segmentedControl.InsertSegment("Hybrid", 2, false);
            segmentedControl.SelectedSegment = 0;
            segmentedControl.ControlStyle    = UISegmentedControlStyle.Bar;
            segmentedControl.TintColor       = UIColor.DarkGray;

            segmentedControl.ValueChanged += delegate {
                if (segmentedControl.SelectedSegment == 0)
                {
                    mapView.MapType = MonoTouch.MapKit.MKMapType.Standard;
                }
                else if (segmentedControl.SelectedSegment == 1)
                {
                    mapView.MapType = MonoTouch.MapKit.MKMapType.Satellite;
                }
                else if (segmentedControl.SelectedSegment == 2)
                {
                    mapView.MapType = MonoTouch.MapKit.MKMapType.Hybrid;
                }
            };

            mapView.Delegate = new MapViewDelegate(this);

            // Set the web view to fit the width of the app.
            mapView.SizeToFit();

            // Reposition and resize the receiver
            mapView.Frame = new RectangleF(0, 44 + 50, View.Frame.Width, View.Frame.Height - 93);

            MKCoordinateSpan   span   = new MKCoordinateSpan(0.01, 0.01);
            MKCoordinateRegion region = new MKCoordinateRegion(ConferenceLocation.Location.To2D(), span);

            mapView.SetRegion(region, true);

            ConferenceAnnotation a = new ConferenceAnnotation(ConferenceLocation.Location.To2D()
                                                              , ConferenceLocation.Title
                                                              , ConferenceLocation.Subtitle
                                                              );

            mapView.AddAnnotationObject(a);


            locationManager          = new CLLocationManager();
            locationManager.Delegate = new LocationManagerDelegate(mapView, this);
            locationManager.Purpose  = "Show distance on map";            // also Info.plist
            locationManager.StartUpdatingLocation();

            // Add the table view as a subview
            View.AddSubview(mapView);
            View.AddSubview(labelDistance);
            View.AddSubview(segmentedControl);

            // Add the 'info' button to flip
            var flipButton = UIButton.FromType(UIButtonType.InfoLight);

            flipButton.Frame = new RectangleF(290, 17, 20, 20);
            flipButton.Title(UIControlState.Normal);
            flipButton.TouchDown += delegate {
                mapFlipViewController.Flip();
            };
            View.AddSubview(flipButton);


            View.Add(navBar);
        }
예제 #15
0
		public override void ViewDidLoad () {
			base.ViewDidLoad ();

			toolbar = new UINavigationBar(new CGRect(0,0,View.Frame.Width,toolbarHeight));
			toolbar.SetItems (new UINavigationItem[]{
					new UINavigationItem("Map")
			}, false);
			toolbar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
			toolbar.TintColor = AppDelegate.ColorNavBarTint;

			Title = Constants.MapPinSubtitle; // "Fira de Barcelona";
			TabBarItem.Title = "Map";
			
			// create our location and zoom for los angeles
			CLLocationCoordinate2D coords = new CLLocationCoordinate2D (Constants.MapPinLatitude, Constants.MapPinLongitude);
			MKCoordinateSpan span = new MKCoordinateSpan(MilesToLatitudeDegrees (3), MilesToLongitudeDegrees (3, coords.Latitude));
			
			mapView = new MKMapView(new CGRect(0, toolbarHeight, View.Frame.Width, UIScreen.MainScreen.ApplicationFrame.Height - toolbarHeight ));
			mapView.ShowsUserLocation = true;
			mapView.Frame = new CGRect (0, 0, View.Frame.Width, View.Frame.Height);
			mapView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth|UIViewAutoresizing.FlexibleHeight;
			// set the coords and zoom on the map
			mapView.Region = new MKCoordinateRegion (coords, span);

			segmentedControl = new UISegmentedControl();
			segmentedControl.InsertSegment("Map", 0, false);
			segmentedControl.InsertSegment("Satellite", 1, false);
			segmentedControl.InsertSegment("Hybrid", 2, false);
			segmentedControl.SelectedSegment = 0;
			segmentedControl.ControlStyle = UISegmentedControlStyle.Bar;
			segmentedControl.TintColor = UIColor.DarkGray;
			if (AppDelegate.IsPhone) {
				var topOfSegement = View.Frame.Height - 120;
				segmentedControl.Frame = new CGRect(20, topOfSegement, 282, 30);
				//segmentedControl.Frame = new CGRect(20, 340, 282, 30);
			} else {
				// IsPad
				var left = (View.Frame.Width / 2) - (282 / 2);
				segmentedControl.Frame = new CGRect(left, View.Frame.Height - 130, 282, 30);
				segmentedControl.AutoresizingMask = UIViewAutoresizing.FlexibleMargins;
			}
			segmentedControl.ValueChanged += delegate {
				if (segmentedControl.SelectedSegment == 0)
					mapView.MapType = MapKit.MKMapType.Standard;
				else if (segmentedControl.SelectedSegment == 1)
					mapView.MapType = MapKit.MKMapType.Satellite;
				else if (segmentedControl.SelectedSegment == 2)
					mapView.MapType = MapKit.MKMapType.Hybrid;
			};
			
			try {
				// add a basic annotation, got a bug report about these lines of code
				mapView.AddAnnotation (
					new BasicMapAnnotation (coords, Constants.MapPinTitle, Constants.MapPinSubtitle )
				);
			} catch (Exception mapex) {
				ConsoleD.WriteLine ("Not sure if happens " + mapex.Message); 
			}

			View.AddSubview(mapView);
			View.AddSubview(toolbar);
			View.AddSubview(segmentedControl);
		}
예제 #16
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View.BackgroundColor = UIColor.DarkGray;

            passAvailable                 = new UITextView(new RectangleF(20, top + 100, 300, 200));
            passAvailable.Font            = UIFont.SystemFontOfSize(14f);
            passAvailable.BackgroundColor = UIColor.Clear;
            passAvailable.TextColor       = UIColor.White;
            passAvailable.Editable        = false;
            Add(passAvailable);

            var topOfButton = View.Frame.Height - 160 + top;

            showPass       = UIButton.FromType(UIButtonType.Custom);
            showPass.Frame = new RectangleF(60, topOfButton, 200, 40);
            showPass.Layer.CornerRadius  = 7f;
            showPass.Layer.MasksToBounds = true;
            showPass.Layer.BorderColor   = new MonoTouch.CoreGraphics.CGColor(0.8f, 1.0f);
            showPass.Layer.BorderWidth   = 1;
            showPass.SetTitle("Open in Passbook", UIControlState.Normal);
            showPass.BackgroundColor = UIColor.DarkGray;
            showPass.SetTitleColor(UIColor.White, UIControlState.Normal);
            showPass.SetTitleShadowColor(UIColor.Black, UIControlState.Normal);
            showPass.TitleShadowOffset = new SizeF(1, 1);
            showPass.SetTitleColor(UIColor.LightGray, UIControlState.Highlighted);

            showPass.TouchUpInside += (sender, e) => {
                UIApplication.SharedApplication.OpenUrl(currentPass.PassUrl);
            };
            Add(showPass);

            passHeading                 = new UILabel(new RectangleF(10, top + 40, 310, 80));
            passHeading.Text            = "No Event Ticket\nin Passbook";
            passHeading.Lines           = 2;
            passHeading.TextAlignment   = UITextAlignment.Center;
            passHeading.Font            = UIFont.SystemFontOfSize(24f);
            passHeading.BackgroundColor = UIColor.Clear;
            passHeading.TextColor       = UIColor.White;
            passHeading.ShadowColor     = UIColor.Black;
            passHeading.ShadowOffset    = new SizeF(1, 1);
            Add(passHeading);

            passImage       = new UIImageView(new RectangleF(90, top + 120, 147, 186));
            passImage.Image = UIImage.FromBundle("Images/NoTicketSlash");
            Add(passImage);



            navBar = new UINavigationBar(new RectangleF(0, 0, 320, 44));
            var bbi = new UIBarButtonItem(UIImage.FromBundle("Images/slideout"), UIBarButtonItemStyle.Plain, (sender, e) => {
                AppDelegate.Current.FlyoutNavigation.ToggleMenu();
            });
            var item = new UINavigationItem("Passbook");

            item.LeftBarButtonItem = bbi;
            var items = new UINavigationItem[] {
                item
            };

            navBar.SetItems(items, false);

            View.Add(navBar);



            library    = new PKPassLibrary();
            noteCenter = NSNotificationCenter.DefaultCenter.AddObserver(PKPassLibrary.DidChangeNotification, (not) => {
                BeginInvokeOnMainThread(() => {
                    // refresh the pass
                    passes = library.GetPasses();
                    RenderPass(passes);
                });
            }, library);              // IMPORTANT: must pass the library in

            passes = library.GetPasses();
            RenderPass(passes);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            View.BackgroundColor = UIColor.DarkGray;

            passAvailable = new UITextView (new RectangleF (20, top + 100, 300, 200));
            passAvailable.Font = UIFont.SystemFontOfSize(14f);
            passAvailable.BackgroundColor = UIColor.Clear;
            passAvailable.TextColor = UIColor.White;
            passAvailable.Editable = false;
            Add (passAvailable);

            var topOfButton = View.Frame.Height - 160 + top;
            showPass = UIButton.FromType (UIButtonType.Custom);
            showPass.Frame = new RectangleF(60, topOfButton, 200, 40);
            showPass.Layer.CornerRadius = 7f;
            showPass.Layer.MasksToBounds = true;
            showPass.Layer.BorderColor = new MonoTouch.CoreGraphics.CGColor(0.8f, 1.0f);
            showPass.Layer.BorderWidth = 1;
            showPass.SetTitle ("Open in Passbook", UIControlState.Normal);
            showPass.BackgroundColor = UIColor.DarkGray;
            showPass.SetTitleColor(UIColor.White, UIControlState.Normal);
            showPass.SetTitleShadowColor (UIColor.Black, UIControlState.Normal);
            showPass.TitleShadowOffset = new SizeF(1,1);
            showPass.SetTitleColor(UIColor.LightGray, UIControlState.Highlighted);

            showPass.TouchUpInside += (sender, e) => {
                UIApplication.SharedApplication.OpenUrl (currentPass.PassUrl);
            };
            Add (showPass);

            passHeading = new UILabel (new RectangleF (10, top + 40, 310, 80));
            passHeading.Text = "No Event Ticket\nin Passbook";
            passHeading.Lines = 2;
            passHeading.TextAlignment = UITextAlignment.Center;
            passHeading.Font = UIFont.SystemFontOfSize(24f);
            passHeading.BackgroundColor = UIColor.Clear;
            passHeading.TextColor = UIColor.White;
            passHeading.ShadowColor= UIColor.Black;
            passHeading.ShadowOffset = new SizeF(1,1);
            Add (passHeading);

            passImage = new UIImageView (new RectangleF(90,top + 120,147,186));
            passImage.Image = UIImage.FromBundle("Images/NoTicketSlash");
            Add (passImage);

            navBar = new UINavigationBar (new RectangleF (0, 0, 320, 44));
            var bbi = new UIBarButtonItem(UIImage.FromBundle ("Images/slideout"), UIBarButtonItemStyle.Plain, (sender, e) => {
                AppDelegate.Current.FlyoutNavigation.ToggleMenu();
            });
            var item = new UINavigationItem ("Passbook");
            item.LeftBarButtonItem = bbi;
            var items = new UINavigationItem[] {
                item
            };
            navBar.SetItems (items, false);

            View.Add (navBar);

            library = new PKPassLibrary ();
            noteCenter = NSNotificationCenter.DefaultCenter.AddObserver (PKPassLibrary.DidChangeNotification, (not) => {
                BeginInvokeOnMainThread (() => {
                    // refresh the pass
                    passes = library.GetPasses ();
                    RenderPass(passes);
                });
            }, library);  // IMPORTANT: must pass the library in

            passes = library.GetPasses ();
            RenderPass(passes);
        }
예제 #18
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            navBar = new UINavigationBar (new RectangleF (0, 0, 320, 44));
            var bbi = new UIBarButtonItem(UIImage.FromBundle ("Images/slideout"), UIBarButtonItemStyle.Plain, (sender, e) => {
                AppDelegate.Current.FlyoutNavigation.ToggleMenu();
            });
            var rbi = new UIBarButtonItem (UIImage.FromBundle ("Images/113-navigation"), UIBarButtonItemStyle.Plain, (sender,e) => {
                mapFlipViewController.Flip();
            });

            var item = new UINavigationItem ("Location Map");
            item.LeftBarButtonItem = bbi;
            item.RightBarButtonItem = rbi;
            var items = new UINavigationItem[] {
                item
            };
            navBar.SetItems (items, false);

            mapView = new MKMapView()
            {
                ShowsUserLocation = true
            };

            labelDistance = new UILabel()
            {
                Frame = new RectangleF (0, 44, 320, 49),
                Lines = 2,
                BackgroundColor = UIColor.Black,
                TextColor = UIColor.White
            };

            var segmentedControl = new UISegmentedControl();
            var topOfSegement = View.Frame.Height - 60;
            segmentedControl.Frame = new RectangleF(20, topOfSegement, 282, 30);
            segmentedControl.InsertSegment("Map", 0, false);
            segmentedControl.InsertSegment("Satellite", 1, false);
            segmentedControl.InsertSegment("Hybrid", 2, false);
            segmentedControl.SelectedSegment = 0;
            segmentedControl.ControlStyle = UISegmentedControlStyle.Bar;
            segmentedControl.TintColor = UIColor.DarkGray;

            segmentedControl.ValueChanged += delegate {
                if (segmentedControl.SelectedSegment == 0)
                    mapView.MapType = MonoTouch.MapKit.MKMapType.Standard;
                else if (segmentedControl.SelectedSegment == 1)
                    mapView.MapType = MonoTouch.MapKit.MKMapType.Satellite;
                else if (segmentedControl.SelectedSegment == 2)
                    mapView.MapType = MonoTouch.MapKit.MKMapType.Hybrid;
            };

            mapView.Delegate = new MapViewDelegate(this);

            // Set the web view to fit the width of the app.
            mapView.SizeToFit();

            // Reposition and resize the receiver
            mapView.Frame = new RectangleF (0, 44 + 50, View.Frame.Width, View.Frame.Height - 93);

            MKCoordinateSpan span = new MKCoordinateSpan(0.01,0.01);
            MKCoordinateRegion region = new MKCoordinateRegion(ConferenceLocation.Location.To2D(),span);
            mapView.SetRegion(region, true);

            ConferenceAnnotation a = new ConferenceAnnotation(ConferenceLocation.Location.To2D()
                                                              , ConferenceLocation.Title
                                                              , ConferenceLocation.Subtitle
                              );
            mapView.AddAnnotationObject(a);

            locationManager = new CLLocationManager();
            locationManager.Delegate = new LocationManagerDelegate(mapView, this);
            locationManager.Purpose = "Show distance on map"; // also Info.plist
            locationManager.StartUpdatingLocation();

            // Add the table view as a subview
            View.AddSubview(mapView);
            View.AddSubview(labelDistance);
            View.AddSubview(segmentedControl);

            // Add the 'info' button to flip
            var flipButton = UIButton.FromType(UIButtonType.InfoLight);
            flipButton.Frame = new RectangleF(290,17,20,20);
            flipButton.Title (UIControlState.Normal);
            flipButton.TouchDown += delegate {
                mapFlipViewController.Flip();
            };
            View.AddSubview(flipButton);

            View.Add (navBar);
        }
예제 #19
0
		/// <summary>
		/// Views the did load.
		/// </summary>
		/// 
		public override void ViewDidLoad ()
		{
			ECLSUIUtil.TryAction<ECLSPopover> ("ViewDidLoad", () => {
				base.ViewDidLoad ();

				// default frame size
				this.View.Frame = OnGetFrame ();

				if (_style == ECLSPopoverStyle.OkCancel) {
					_navigationBar = new UINavigationBar (
						CGRect.FromLTRB (0, 0, UIApplication.SharedApplication.Delegate.GetWindow ().Frame.Width, 44)

					);
					_navigationBar.BackgroundColor = UIColor.DarkGray; //UIColor.FromRGB (175,1,83); //magenta
					//	_navigationBar.TintColor = UIColor.FromRGB (175,1,83); // UIColor.White; 
					
					_leftBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Cancel);                    
					_rightBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Done);
					_leftBarButtonItem.SetTitlePositionAdjustment (new UIOffset (15f, 0), UIBarMetrics.Default);
					_rightBarButtonItem.SetTitlePositionAdjustment (new UIOffset (-15f, 0), UIBarMetrics.Default);
					UINavigationItem navItem = new UINavigationItem () {
						LeftBarButtonItem = _leftBarButtonItem,
						RightBarButtonItem = _rightBarButtonItem,
					};

                    
					_navigationBar.SetItems (
						new UINavigationItem[] { navItem }, false
					);
					_navigationBar.ClipsToBounds = false;
                    
					_buttonItemHandler = new ECLSPopoverButtonItemHandler (
						navItem.LeftBarButtonItem, navItem.RightBarButtonItem
					);
					_buttonItemHandler.NotifyComplete = this.NotifyComplete;

					this.View.AddSubview (_navigationBar);

					this.View.AddSubview (
						new UIView (CGRect.FromLTRB (0, _navigationBar.Frame.Height, this.View.Bounds.Right, this.View.Bounds.Bottom)) {

							BackgroundColor = UIColor.FromRGB (240, 232, 236),
							Alpha = .95f
						}
					);	
					/*this.View.AddSubview(
						new UIImageView(UIImage.FromFile(@"Images/Background_Calculating_Full.png").StretchableImage(0, 5)) {
							Frame = RectangleF.FromLTRB(0, _navigationBar.Frame.Height, this.View.Bounds.Right, this.View.Bounds.Bottom)
						}
					);	*/										
				} else if (_style == ECLSPopoverStyle.Activity) {
						
					/*this.View.AddSubview(
						new UIImageView(UIImage.FromFile(@"Images/Background_Calculating_Full.png").StretchableImage(0, 5)) {
							Frame = this.View.Bounds
						}
					);
					
*/
					this.View.AddSubview (new UIView (this.View.Bounds) {
						BackgroundColor = UIColor.Black, 
						//BackgroundColor =  UIColor.FromRGB (175,1,83),  //magenta
						Alpha = .75f
					});
					
					_activityLabel = new UILabel () {
						Frame = CGRect.FromLTRB (this.View.Frame.Left, (_frameHeight / 2), this.View.Frame.Width, (_frameHeight / 2) + 31 /* adjusted below */),
						TextAlignment = UITextAlignment.Center,
						Lines = 3,
						LineBreakMode = UILineBreakMode.WordWrap,
						BackgroundColor = UIColor.Clear,
						Opaque = true,
						TextColor = UIColor.White,
						Text = this.Title,
						ShadowColor = UIColor.Black,
						ShadowOffset = new CGSize (0f, -1.0f),
						Font = ECLSUIUtil.HelveticaNeueBold (24.0f)
					};					
					CGSize labelSize = ECLSUIUtil.LabelRequiredSize (_activityLabel, this.Title);
					_activityLabel.Frame = CGRect.FromLTRB (
						_activityLabel.Frame.Left, _activityLabel.Frame.Top, _activityLabel.Frame.Right, _activityLabel.Frame.Top + labelSize.Height
					);
					this.View.AddSubview (_activityLabel);
			
					_activityIndicator = new UIActivityIndicatorView () {
						HidesWhenStopped = true,
						Center = new CGPoint (
							this.View.Frame.Width / 2, (_frameHeight / 2) - 20
						)
					};
					this.View.AddSubview (_activityIndicator);

					_activityIndicator.StartAnimating ();
				} else if (_style == ECLSPopoverStyle.Plain) {
								
					_activityLabel = new UILabel () {
						Frame = CGRect.FromLTRB (this.View.Frame.Left, (_frameHeight / 2), this.View.Frame.Width, (_frameHeight / 2) + 31 /* adjusted below */),
						TextAlignment = UITextAlignment.Center,
						Lines = 3,
						LineBreakMode = UILineBreakMode.WordWrap,
						BackgroundColor = UIColor.Clear,
						Opaque = true,
						TextColor = UIColor.White,
						Text = this.Title,
						ShadowColor = UIColor.Black,
						ShadowOffset = new CGSize (0f, -1.0f),
						Font = ECLSUIUtil.HelveticaNeueBold (18.0f)
					};					
					CGSize labelSize = ECLSUIUtil.LabelRequiredSize (_activityLabel, this.Title);
					_activityLabel.Frame = CGRect.FromLTRB (
						_activityLabel.Frame.Left, _activityLabel.Frame.Top, _activityLabel.Frame.Right, _activityLabel.Frame.Top + labelSize.Height
					);
					this.View.AddSubview (_activityLabel);

					_activityIndicator = new UIActivityIndicatorView () {
						HidesWhenStopped = true,
						Center = new CGPoint (
							this.View.Frame.Width / 2, (_frameHeight / 2) - 20
						)
					};
					this.View.AddSubview (_activityIndicator);

					_activityIndicator.StartAnimating ();
				}
			});
		
		}