void UpdateMasterDetailContainers()
        {
            ((MasterDetailPage)Element).Master.PropertyChanged -= HandleMasterPropertyChanged;

            EmptyContainers();

            if (Platform.GetRenderer(((MasterDetailPage)Element).Master) == null)
            {
                Platform.SetRenderer(((MasterDetailPage)Element).Master, Platform.CreateRenderer(((MasterDetailPage)Element).Master));
            }
            if (Platform.GetRenderer(((MasterDetailPage)Element).Detail) == null)
            {
                Platform.SetRenderer(((MasterDetailPage)Element).Detail, Platform.CreateRenderer(((MasterDetailPage)Element).Detail));
            }

            var masterRenderer = Platform.GetRenderer(((MasterDetailPage)Element).Master);
            var detailRenderer = Platform.GetRenderer(((MasterDetailPage)Element).Detail);

            ((MasterDetailPage)Element).Master.PropertyChanged += HandleMasterPropertyChanged;

            UIView masterView = masterRenderer.NativeView;

            _masterController.View.AddSubview(masterView);
            _masterController.AddChildViewController(masterRenderer.ViewController);

            UIView detailView = detailRenderer.NativeView;

            _detailController.View.AddSubview(detailView);
            _detailController.AddChildViewController(detailRenderer.ViewController);

            SetNeedsStatusBarAppearanceUpdate();
            SetNeedsUpdateOfHomeIndicatorAutoHidden();
        }
示例#2
0
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			window = new UIWindow (UIScreen.MainScreen.Bounds);

			root = new UIViewController ();
			vc1 = new ViewController1 ();
			root.View.AddSubview (vc1.View);

			vc1.InitialActionCompleted += (object sender, EventArgs e) => {

				vc1.View.RemoveFromSuperview ();

				tabController = new UITabBarController ();

				vc2 = new ViewController2 ();
				vc3 = new ViewController3 ();

				tabController.ViewControllers = new UIViewController[] {
					vc1,
					vc2,
					vc3
				};
				tabController.ViewControllers [0].TabBarItem.Title = "One";
				tabController.ViewControllers [1].TabBarItem.Title = "Two";
				tabController.ViewControllers [2].TabBarItem.Title = "Three";

				root.AddChildViewController (tabController);
				root.Add (tabController.View);
			};

			window.RootViewController = root;
			window.MakeKeyAndVisible ();
            
			return true;
		}
示例#3
0
        public static IDisposable ShowPrivateView(this UIViewController @this)
        {
            var vc = new PrivateRepositoryViewController();

            vc.View.Frame            = new CoreGraphics.CGRect(0, 0, @this.View.Bounds.Width, @this.View.Bounds.Height);
            vc.View.AutoresizingMask = UIViewAutoresizing.All;

            vc.View.Alpha = 0;
            @this.View.Add(vc.View);
            UIView.Animate(0.4, 0, UIViewAnimationOptions.CurveEaseIn, () => vc.View.Alpha = 1, null);
            @this.AddChildViewController(vc);

            vc.View.BackgroundColor = Theme.CurrentTheme.PrimaryColor;

            if (@this.NavigationItem.RightBarButtonItem != null)
            {
                @this.NavigationItem.RightBarButtonItem.Enabled = false;
            }

            return(Disposable.Create(() =>
            {
                vc.View.RemoveFromSuperview();
                vc.RemoveFromParentViewController();
            }));
        }
        void UpdateControllers()
        {
            MasterDetailPage.Master.PropertyChanged -= HandleMasterPropertyChanged;

            if (Platform.GetRenderer(MasterDetailPage.Master) == null)
            {
                Platform.SetRenderer(MasterDetailPage.Master, Platform.CreateRenderer(MasterDetailPage.Master));
            }
            if (Platform.GetRenderer(MasterDetailPage.Detail) == null)
            {
                Platform.SetRenderer(MasterDetailPage.Detail, Platform.CreateRenderer(MasterDetailPage.Detail));
            }

            ClearControllers();

            MasterDetailPage.Master.PropertyChanged += HandleMasterPropertyChanged;

            var master = Platform.GetRenderer(MasterDetailPage.Master).ViewController;
            var detail = Platform.GetRenderer(MasterDetailPage.Detail).ViewController;

            _masterController.View.AddSubview(master.View);
            _masterController.AddChildViewController(master);

            _detailController.View.AddSubview(detail.View);
            _detailController.AddChildViewController(detail);
        }
示例#5
0
        public void Show()
        {
            RootViewController = TopViewController();
            RootViewController.AddChildViewController(this);

            View.TranslatesAutoresizingMaskIntoConstraints = false;
            View.Alpha = 0;
            RootViewController.View.AddSubview(View);

            DidMoveToParentViewController(RootViewController);

            if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
            {
                View.LeadingAnchor.ConstraintEqualTo(RootViewController.View.SafeAreaLayoutGuide.LeadingAnchor).Active   = true;
                View.TopAnchor.ConstraintEqualTo(RootViewController.View.SafeAreaLayoutGuide.TopAnchor).Active           = true;
                View.TrailingAnchor.ConstraintEqualTo(RootViewController.View.SafeAreaLayoutGuide.TrailingAnchor).Active = true;
                View.BottomAnchor.ConstraintEqualTo(RootViewController.View.SafeAreaLayoutGuide.BottomAnchor).Active     = true;
            }
            else
            {
                View.LeadingAnchor.ConstraintEqualTo(RootViewController.View.LeadingAnchor).Active   = true;
                View.TopAnchor.ConstraintEqualTo(RootViewController.View.TopAnchor).Active           = true;
                View.TrailingAnchor.ConstraintEqualTo(RootViewController.View.TrailingAnchor).Active = true;
                View.BottomAnchor.ConstraintEqualTo(RootViewController.View.BottomAnchor).Active     = true;
            }

            UIView.Animate(0.2, 0, UIViewAnimationOptions.CurveEaseInOut, () => {
                View.Alpha = 1;
            }, null);
        }
示例#6
0
 public InvoiceBottomView(UIViewController parent)
 {
     BackgroundColor = UIColor.LightGray;
     tabbar = new UITabBarController () {
         ViewControllers = new UIViewController[] {
             coupons = new QuickItemsViewController{
                 TabBarItem = new UITabBarItem ("Offers", UIImage.FromBundle ("coupon"), 0),
                 ItemBackgroundColor = Color.Red,
                 AlternateItemBackgroundColor = Color.Olive,
                 Title = "Offers",
                 Sections = 2,
                 GetItems = WebService.Main.GetGroupedCoupons,
                 AddItem = (i) =>{
                     if(AddItem != null)
                         AddItem(i);
                 },
             },
             newProduct = new QuickItemsViewController{
                 TabBarItem = new UITabBarItem ("New Product", UIImage.FromBundle ("newProduct"), 1),
                 ItemBackgroundColor = Color.Orange,
                 AlternateItemBackgroundColor = Color.Orange,
                 Title = "New Product",
                 GetItems = (s) => WebService.Main.GetNewProducts(),
                 AddItem = (i) =>{
                     if(AddItem != null)
                         AddItem(i);
                 },
             },
         },
     };
     NotificationCenter.Shared.CouponsChanged += () => coupons.ReloadData ();
     NotificationCenter.Shared.NewProductChanged += () => newProduct.ReloadData ();
     AddSubview (tabbar.View);
     parent.AddChildViewController (tabbar);
 }
        private void UpdateMasterDetailContainers()
        {
            ((MasterDetailPage)Element).Master.PropertyChanged -= HandleMasterPropertyChanged;

            EmptyContainers();

            if (Platform.GetRenderer(((MasterDetailPage)Element).Master) == null)
            {
                Platform.SetRenderer(((MasterDetailPage)Element).Master,
                                     Platform.CreateRenderer(((MasterDetailPage)Element).Master));
            }
            if (Platform.GetRenderer(((MasterDetailPage)Element).Detail) == null)
            {
                Platform.SetRenderer(((MasterDetailPage)Element).Detail,
                                     Platform.CreateRenderer(((MasterDetailPage)Element).Detail));
            }

            var masterRenderer = Platform.GetRenderer(((MasterDetailPage)Element).Master);
            var detailRenderer = Platform.GetRenderer(((MasterDetailPage)Element).Detail);

            ((MasterDetailPage)Element).Master.PropertyChanged += HandleMasterPropertyChanged;

            _masterController.View.AddSubview(masterRenderer.NativeView);
            _masterController.AddChildViewController(masterRenderer.ViewController);

            _detailController.View.AddSubview(detailRenderer.NativeView);
            _detailController.AddChildViewController(detailRenderer.ViewController);
        }
示例#8
0
		public void Show(UIViewController parentView)
		{

			parentView.View.AddSubview(View);
			parentView.AddChildViewController(this);
			view.Show();
		}
示例#9
0
        public override void OpenCamera()
        {
            if (UIImagePickerController.IsSourceTypeAvailable(UIImagePickerControllerSourceType.Camera))
            {
                // Define the camera parameters.
                UIImagePickerController imagePicker = new UIImagePickerController();
                imagePicker.MediaTypes    = new string[] { UTType.Image.ToString() };
                imagePicker.AllowsEditing = true;
                imagePicker.SourceType    = UIImagePickerControllerSourceType.Camera;

                imagePicker.Canceled += (sender, e) => this.closeCamera(imagePicker);

                imagePicker.FinishedPickingMedia += (sender, e) =>
                {
                    // Save the image taken locally and trigger the event to save the receipt.
                    string  filepath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Expense.jpg");
                    UIImage image    = (UIImage)e.Info.ObjectForKey(new NSString("UIImagePickerControllerOriginalImage"));

                    // Arbitrarily resize according to the defined compression quality to reduce filesize and save memory.
                    image.AsJPEG(new nfloat(compressionQuality / 100)).Save(filepath, false);
                    CameraUtil.Current.ImageStream = image.AsJPEG().AsStream();

                    this.closeCamera(imagePicker);
                };

                // Load the camera app on the current page.
                UIViewController currentController = this.getCurrentViewController();
                currentController.AddChildViewController(imagePicker);
                imagePicker.DidMoveToParentViewController(currentController);
                currentController.View.AddSubview(imagePicker.View);
            }
        }
示例#10
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            window = new UIWindow(UIScreen.MainScreen.Bounds);

            root = new UIViewController();
            vc1  = new ViewController1();
            root.View.AddSubview(vc1.View);

            vc1.InitialActionCompleted += (object sender, EventArgs e) => {
                vc1.View.RemoveFromSuperview();

                tabController = new UITabBarController();

                vc2 = new ViewController2();
                vc3 = new ViewController3();

                tabController.ViewControllers = new UIViewController[] {
                    vc1,
                    vc2,
                    vc3
                };
                tabController.ViewControllers [0].TabBarItem.Title = "One";
                tabController.ViewControllers [1].TabBarItem.Title = "Two";
                tabController.ViewControllers [2].TabBarItem.Title = "Three";

                root.AddChildViewController(tabController);
                root.Add(tabController.View);
            };

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

            return(true);
        }
示例#11
0
        void UpdateFlyoutPageContainers()
        {
            ((FlyoutPage)Element).Flyout.PropertyChanged -= HandleFlyoutPropertyChanged;

            EmptyContainers();

            var flyoutRenderer = ((FlyoutPage)Element).Flyout.ToHandler(MauiContext);
            var detailRenderer = ((FlyoutPage)Element).Detail.ToHandler(MauiContext);

            ((FlyoutPage)Element).Flyout.PropertyChanged += HandleFlyoutPropertyChanged;

            UIView flyoutView = flyoutRenderer.ViewController.View;

            _flyoutController.View.AddSubview(flyoutView);
            _flyoutController.AddChildViewController(flyoutRenderer.ViewController);

            UIView detailView = detailRenderer.ViewController.View;

            _detailController.View.AddSubview(detailView);
            _detailController.AddChildViewController(detailRenderer.ViewController);

            SetNeedsStatusBarAppearanceUpdate();
            if (OperatingSystem.IsIOSVersionAtLeast(11))
            {
                SetNeedsUpdateOfHomeIndicatorAutoHidden();
            }

            if (detailRenderer.ViewController.View.Superview != null)
            {
                detailRenderer.ViewController.View.Superview.BackgroundColor = Microsoft.Maui.Graphics.Colors.Black.ToPlatform();
            }

            ToggleAccessibilityElementsHidden();
        }
示例#12
0
        //private static REFrostedViewController _FrostedViewController;
        #endregion

        #region Methods

        /// <summary>
        /// Redisplays the controller.
        /// </summary>
        /// <param name="target">Target.</param>
        /// <param name="controller">Controller.</param>
        /// <param name="frame">Frame.</param>
        public static void DisplayController(this UIViewController target, UIViewController controller, CGRect frame)
        {
            target.AddChildViewController(controller);
            controller.View.Frame = frame;
            target.View.Add(controller.View);
            controller.DidMoveToParentViewController(target);
        }
示例#13
0
        void UpdateControllers()
        {
            FlyoutPage.Flyout.PropertyChanged -= HandleFlyoutPropertyChanged;

            if (Platform.GetRenderer(FlyoutPage.Flyout) == null)
            {
                Platform.SetRenderer(FlyoutPage.Flyout, Platform.CreateRenderer(FlyoutPage.Flyout));
            }
            if (Platform.GetRenderer(FlyoutPage.Detail) == null)
            {
                Platform.SetRenderer(FlyoutPage.Detail, Platform.CreateRenderer(FlyoutPage.Detail));
            }

            ClearControllers();

            FlyoutPage.Flyout.PropertyChanged += HandleFlyoutPropertyChanged;

            var flyout = Platform.GetRenderer(FlyoutPage.Flyout).ViewController;
            var detail = Platform.GetRenderer(FlyoutPage.Detail).ViewController;

            _flyoutController.View.AddSubview(flyout.View);
            _flyoutController.AddChildViewController(flyout);

            _detailController.View.AddSubview(detail.View);
            _detailController.AddChildViewController(detail);
        }
示例#14
0
        /// <summary>
        /// Add child view controller to parent controller. This controller will be the subview of
        /// provided <b>superView</b>. If <b>superView</b> is null, it will default to parent controller's view.
        /// </summary>
        public static void AddChild(this UIViewController that, UIViewController viewController, UIView superView)
        {
            var view = superView ?? viewController.View;

            that.AddChildViewController(viewController);
            that.View.AddSubview(view);
            viewController.DidMoveToParentViewController(that);
        }
示例#15
0
        public void EmbedView(UIView container, UIViewController containerViewController, UIViewController viewController)
        {
            containerViewController.AddChildViewController(viewController);
            container.AddSubview(viewController.View);

            viewController.View.AllEdgesToView(container);
            viewController.DidMoveToParentViewController(containerViewController);
        }
 /// <summary>
 ///      Adds the specified view controller as a child to parent with add constraints to view.
 /// </summary>
 /// <param name="child">Target child view controller.</param>
 /// <param name="parent">Parent view controller to add child.</param>
 /// <param name="parentView">Custom target view of parent view controller. By default <c>parent.View</c>.</param>
 public static void AddAsChildWithConstraints(
     this UIViewController child,
     UIViewController parent,
     UIView?parentView = null)
 {
     parent.AddChildViewController(child);
     child.View.AddAsSubviewWithParentSize(parentView ?? parent.View);
     child.DidMoveToParentViewController(parent);
 }
示例#17
0
        /// <summary>
        /// Contructor.
        /// </summary>
        /// <param name="contentAreaController">
        /// The view controller for the content area.
        /// </param>
        /// <param name="navigationAreaController">
        /// The view controller for the side menu.
        /// </param>
        public SidebarController(UIViewController rootViewController, UIViewController contentAreaController, UIViewController navigationAreaController)
        {
            Initialize(contentAreaController, navigationAreaController);

            // handle wiring things up so events propogate properly
            rootViewController.AddChildViewController(this);
            rootViewController.View.AddSubview(this.View);
            this.DidMoveToParentViewController(rootViewController);
        }
示例#18
0
        /// <summary>
        /// Contructor.
        /// </summary>
        /// <param name="contentAreaController">
        /// The view controller for the content area.
        /// </param>
        /// <param name="navigationAreaController">
        /// The view controller for the side menu.
        /// </param>
        public SidebarController(UIViewController rootViewController, UIViewController contentAreaController, UIViewController navigationAreaController)
        {
            Initialize(contentAreaController, navigationAreaController);

            // handle wiring things up so events propogate properly
            rootViewController.AddChildViewController(this);
            rootViewController.View.AddSubview(this.View);
            this.DidMoveToParentViewController(rootViewController);
        }
示例#19
0
 /// <summary>
 /// Contructor.
 /// </summary>
 /// <param name="contentAreaController">
 /// The view controller for the content area.
 /// </param>
 /// <param name="navigationAreaController">
 /// The view controller for the side menu.
 /// </param>
 public SidebarController(UIViewController rootViewController, UIViewController contentAreaController, UIViewController navigationAreaController, LocationEnum location)
 {
     this.Location  = location;
     this.MenuWidth = DefaultMenuWidth;
     Initialize(contentAreaController, navigationAreaController);
     // handle wiring things up so events propogate properly
     rootViewController.AddChildViewController(this);
     rootViewController.View.AddSubview(this.View);
     this.DidMoveToParentViewController(rootViewController);
 }
示例#20
0
 public static void AddChildViewControllerToPlaceHolderView(this UIViewController parentViewController, UIViewController childViewController, UIView starter_appView)
 {
     if (childViewController != null && starter_appView != null)
     {
         parentViewController.AddChildViewController(childViewController);
         starter_appView.AddSubview(childViewController.View);
         childViewController.View.AddConstraintsToFillSuperview();
         childViewController.DidMoveToParentViewController(parentViewController);
     }
 }
示例#21
0
        public static void MoveTo(this UIViewController current, UIViewController parent, UIView containerView = null)
        {
            parent.AddChildViewController(current);
            containerView = containerView ?? parent.View;
            containerView.Layer.MasksToBounds = true;
            current.View.Frame            = containerView.Bounds;
            current.View.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            current.View.TranslatesAutoresizingMaskIntoConstraints = true;
            containerView.AddSubview(current.View);

            current.DidMoveToParentViewController(parent);
        }
示例#22
0
        /// <summary>
        /// Adding FragmentController to the container in UIViewController
        /// </summary>
        /// <param name="fragmentController">Fragment to add.</param>
        /// <param name="containerViewHolder">Container: a placeholder to fragment.</param>
        public static void AddFragmentView(this UIViewController thisController, UIViewController fragmentController, UIView containerViewHolder)
        {
            thisController.AddChildViewController(fragmentController);
            fragmentController.View.TranslatesAutoresizingMaskIntoConstraints = false;
            containerViewHolder.AddSubview(fragmentController.View);

            NSLayoutConstraint.ActivateConstraints(new[] {
                fragmentController.View.LeadingAnchor.ConstraintEqualTo(containerViewHolder.LeadingAnchor, 0),
                fragmentController.View.TrailingAnchor.ConstraintEqualTo(containerViewHolder.TrailingAnchor, 0),
                fragmentController.View.TopAnchor.ConstraintEqualTo(containerViewHolder.TopAnchor, 0),
                fragmentController.View.HeightAnchor.ConstraintEqualTo(containerViewHolder.HeightAnchor)
            });

            fragmentController.DidMoveToParentViewController(thisController);
        }
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

            // Override point for customization after application launch.
            // If not required for your application you can safely delete this method

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

            var pagesToTest = PagesToTest.TransitionPages;

            switch (pagesToTest)
            {
            case PagesToTest.TransitionPages:
                var navigationController = new UINavigationController();
                var mainViewController   = new OuterViewController1();
                navigationController.PushViewController(mainViewController, true);

                var masterViewController = new UIViewController();
                masterViewController.AddChildViewController(navigationController);
                masterViewController.View.AddSubview(navigationController.View);
                navigationController.DidMoveToParentViewController(masterViewController);
                Window.RootViewController = masterViewController;
                break;

            case PagesToTest.TranslucentPages:
                var translucentNavController       = new TranslucentNavigationController();
                var translucentStartViewController = new Page1Translucent();
                translucentNavController.PushViewController(translucentStartViewController, true);
                Window.RootViewController = translucentNavController;

                NavigationBarStyles.SetDefaultAppearance();
                break;

            case PagesToTest.FakeTranslucency:
                var fakeTransController    = new FakeTranslucentNavigationBar();
                var fakeTransNavController = new UINavigationController(fakeTransController);
                Window.RootViewController = fakeTransNavController;
                break;
            }

            Window.MakeKeyAndVisible();

            return(true);
        }
示例#24
0
        protected override void ShowFirstView(UIViewController viewController)
        {
            base.ShowFirstView(viewController);

            _slidingPanelsController = (SlidingPanelsNavigationViewController)MasterNavigationController;

            _rootViewController.AddChildViewController(_slidingPanelsController);
            _rootViewController.View.AddSubview(_slidingPanelsController.View);

            var menuRequest = new MvxViewModelRequest <MenuViewModel>(new MvxBundle(null), null, MvxRequestedBy.UserAction);
            var menuView    = (UIViewController)ViewCreator.CreateView(menuRequest);

            _menuPanelContainer = new LeftPanelContainer(menuView)
            {
                EdgeTolerance = 100f
            };
            _slidingPanelsController.InsertPanel(_menuPanelContainer);
        }
示例#25
0
        public static UIRefreshControlDelayed InjectRefreshControl(this UIViewController viewController, UITableView tableView, EventHandler handler)
        {
            return(CoreUtility.ExecuteFunction("InjectRefreshControl", delegate()
            {
                UITableViewController tableViewController = new UITableViewController();
                viewController.AddChildViewController(tableViewController);
                tableViewController.TableView = tableView;

                UIRefreshControlDelayed refreshControl = new UIRefreshControlDelayed();
                refreshControl.ScrollView = tableView;
                refreshControl.AddTarget(handler, UIControlEvent.ValueChanged);

                tableViewController.RefreshControl = refreshControl;

                refreshControl.TintColor = UIColor.Black;
                refreshControl.TintColorDidChange();
                return refreshControl;
            }));
        }
示例#26
0
		//
		// This method is invoked when the application has loaded and is ready to run. In this 
		// method you should instantiate the window, load the UI into it and then make the window
		// visible.
		//
		// You have 17 seconds to return from this method, or iOS will terminate your application.
		//
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			window = new UIWindow (UIScreen.MainScreen.Bounds);

			SlidingPanelsNavigationViewController navController = new SlidingPanelsNavigationViewController(new ExampleContentA ());

			UIViewController rootController = new UIViewController ();
			rootController.AddChildViewController (navController);
			rootController.View.AddSubview (navController.View);

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

			navController.InsertPanel (new LeftPanelContainer(new LeftPanelViewController (navController)));
			navController.InsertPanel (new RightPanelContainer(new RightPanelViewController (navController)));
			navController.InsertPanel (new BottomPanelContainer(new BottomPanelViewController (navController)));

			return true;
		}
示例#27
0
        void UpdateFlyoutPageContainers()
        {
            ((FlyoutPage)Element).Flyout.PropertyChanged -= HandleFlyoutPropertyChanged;

            EmptyContainers();

            if (Platform.GetRenderer(((FlyoutPage)Element).Flyout) == null)
            {
                Platform.SetRenderer(((FlyoutPage)Element).Flyout, Platform.CreateRenderer(((FlyoutPage)Element).Flyout));
            }
            if (Platform.GetRenderer(((FlyoutPage)Element).Detail) == null)
            {
                Platform.SetRenderer(((FlyoutPage)Element).Detail, Platform.CreateRenderer(((FlyoutPage)Element).Detail));
            }

            var flyoutRenderer = Platform.GetRenderer(((FlyoutPage)Element).Flyout);
            var detailRenderer = Platform.GetRenderer(((FlyoutPage)Element).Detail);

            ((FlyoutPage)Element).Flyout.PropertyChanged += HandleFlyoutPropertyChanged;

            UIView flyoutView = flyoutRenderer.NativeView;

            _flyoutController.View.AddSubview(flyoutView);
            _flyoutController.AddChildViewController(flyoutRenderer.ViewController);

            UIView detailView = detailRenderer.NativeView;

            _detailController.View.AddSubview(detailView);
            _detailController.AddChildViewController(detailRenderer.ViewController);

            SetNeedsStatusBarAppearanceUpdate();
            if (Forms.RespondsToSetNeedsUpdateOfHomeIndicatorAutoHidden)
            {
                SetNeedsUpdateOfHomeIndicatorAutoHidden();
            }

            if (detailRenderer.ViewController.View.Superview != null)
            {
                detailRenderer.ViewController.View.Superview.BackgroundColor = Microsoft.Maui.Graphics.Colors.Black.ToUIColor();
            }

            ToggleAccessibilityElementsHidden();
        }
示例#28
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            window = new UIWindow(UIScreen.MainScreen.Bounds);

            SlidingPanelsNavigationViewController navController = new SlidingPanelsNavigationViewController(new ExampleContentA());

            UIViewController rootController = new UIViewController();

            rootController.AddChildViewController(navController);
            rootController.View.AddSubview(navController.View);

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

            navController.InsertPanel(new LeftPanelContainer(new LeftPanelViewController(navController)));
            navController.InsertPanel(new RightPanelContainer(new RightPanelViewController(navController)));
            navController.InsertPanel(new BottomPanelContainer(new BottomPanelViewController(navController)));

            return(true);
        }
示例#29
0
        public void Show()
        {
            RootViewController = ViewControllerHelper.TopViewController();
            RootViewController.AddChildViewController(this);

            View.TranslatesAutoresizingMaskIntoConstraints = false;
            View.Alpha = 0;
            RootViewController.View.AddSubview(View);

            DidMoveToParentViewController(RootViewController);

            View.LeadingAnchor.ConstraintEqualTo(RootViewController.View.LeadingAnchor).Active = true;
            View.TopAnchor.ConstraintEqualTo(RootViewController.View.TopAnchor).Active = true;
            View.TrailingAnchor.ConstraintEqualTo(RootViewController.View.TrailingAnchor).Active = true;
            View.BottomAnchor.ConstraintEqualTo(RootViewController.View.BottomAnchor).Active = true;

            UIView.Animate(0.2, 0, UIViewAnimationOptions.CurveEaseInOut, () => {
                View.Alpha = 1;
            }, null);
        }
示例#30
0
        partial void startPassportImageCapture(UIButton sender)
        {
            scannedImage.Image = null;

            mrzScannerController = new MRZScannerController();

            // Options: [Mrz, DocumentImage, DocumentImagePassport]. Default: Mrz.
            mrzScannerController.SetScannerType(MRZScannerType.DocumentImagePassport);
            // Enable/disable the ID document type. Default: true.
            MRZScannerController.SetIDActive(true);
            // Enable/disable the Passport document type. Default: true.
            MRZScannerController.SetPassportActive(true);
            // Enable/disable the Visa document type. Default: true.
            MRZScannerController.SetVisaActive(true);
            // Set the max CPU threads that the scanner can use. Default: 2.
            mrzScannerController.SetMaxCPUCores(2);
            // Set license key
            MRZScannerController.RegisterLicenseWithKey("License_key", (result, error) =>
            {
                if (error != null)
                {
                    Console.WriteLine("Result code: " + result + ". " + error);
                }
                else
                {
                    Console.WriteLine("Result code: " + result + ". Registration successful.");
                }
            });

            mrzScannerController.WeakDelegate = this;

            UIViewController currentViewController = NavigationController;

            if (currentViewController == null)
            {
                currentViewController = this;
            }

            currentViewController.AddChildViewController(mrzScannerController);
            mrzScannerController.InitUI(currentViewController);
        }
示例#31
0
 public InvoiceBottomView(UIViewController parent)
 {
     BackgroundColor = UIColor.LightGray;
     tabbar          = new UITabBarController()
     {
         ViewControllers = new UIViewController[] {
             coupons = new QuickItemsViewController {
                 TabBarItem                   = new UITabBarItem("Offers", UIImage.FromBundle("coupon"), 0),
                 ItemBackgroundColor          = Color.Red,
                 AlternateItemBackgroundColor = Color.Olive,
                 Title    = "Offers",
                 Sections = 2,
                 GetItems = WebService.Main.GetGroupedCoupons,
                 AddItem  = (i) => {
                     if (AddItem != null)
                     {
                         AddItem(i);
                     }
                 },
             },
             newProduct = new QuickItemsViewController {
                 TabBarItem                   = new UITabBarItem("New Product", UIImage.FromBundle("newProduct"), 1),
                 ItemBackgroundColor          = Color.Orange,
                 AlternateItemBackgroundColor = Color.Orange,
                 Title    = "New Product",
                 GetItems = (s) => WebService.Main.GetNewProducts(),
                 AddItem  = (i) => {
                     if (AddItem != null)
                     {
                         AddItem(i);
                     }
                 },
             },
         },
     };
     NotificationCenter.Shared.CouponsChanged    += () => coupons.ReloadData();
     NotificationCenter.Shared.NewProductChanged += () => newProduct.ReloadData();
     AddSubview(tabbar.View);
     parent.AddChildViewController(tabbar);
 }
示例#32
0
        void UpdateMasterDetailContainers()
        {
            ((MasterDetailPage)Element).Master.PropertyChanged -= HandleMasterPropertyChanged;

            EmptyContainers();

            if (Platform.GetRenderer(((MasterDetailPage)Element).Master) == null)
            {
                Platform.SetRenderer(((MasterDetailPage)Element).Master, Platform.CreateRenderer(((MasterDetailPage)Element).Master));
            }
            if (Platform.GetRenderer(((MasterDetailPage)Element).Detail) == null)
            {
                Platform.SetRenderer(((MasterDetailPage)Element).Detail, Platform.CreateRenderer(((MasterDetailPage)Element).Detail));
            }

            var masterRenderer = Platform.GetRenderer(((MasterDetailPage)Element).Master);
            var detailRenderer = Platform.GetRenderer(((MasterDetailPage)Element).Detail);

            ((MasterDetailPage)Element).Master.PropertyChanged += HandleMasterPropertyChanged;

            UIView masterView = masterRenderer.NativeView;

            _masterController.View.AddSubview(masterView);
            _masterController.AddChildViewController(masterRenderer.ViewController);

            UIView detailView = detailRenderer.NativeView;

            _detailController.View.AddSubview(detailView);
            _detailController.AddChildViewController(detailRenderer.ViewController);

            SetNeedsStatusBarAppearanceUpdate();
            if (System.Maui.Maui.RespondsToSetNeedsUpdateOfHomeIndicatorAutoHidden)
            {
                SetNeedsUpdateOfHomeIndicatorAutoHidden();
            }

            detailRenderer.ViewController.View.Superview.BackgroundColor = System.Maui.Color.Black.ToUIColor();

            ToggleAccessibilityElementsHidden();
        }
示例#33
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            MenuViewController = new UIViewController();
            MenuViewController.View.BackgroundColor = UIColor.White;

            var c = new CustomMenuNavigationController((UIViewController)this.CreateView <ProjectsViewModel>(), this);

            MenuViewController.AddChildViewController(c);
            c.View.Frame            = new RectangleF(0, 0, MenuViewController.View.Bounds.Width, MenuViewController.View.Bounds.Height - 44f);
            c.View.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
            MenuViewController.View.Add(c.View);

            var toolbar = new MenuToolbar();

            toolbar.AccountsButton.TouchUpInside += (s, e) => ViewModel.GoToAccountsCommand.ExecuteIfCan();
            toolbar.SettingsButton.TouchUpInside += (s, e) => ViewModel.GoToSettingsCommand.ExecuteIfCan();
            toolbar.Frame            = new RectangleF(0, MenuViewController.View.Bounds.Height - 44f, MenuViewController.View.Bounds.Width, 44f);
            toolbar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;
            MenuViewController.View.Add(toolbar);
        }
 private void SetController(OrientationController controller)
 {
     if (controller == OrientationController.Sensor)
     {
         // restore the normal controler whioch supports rotation
         foreach (UIViewController viewController in UIApplication.SharedApplication.KeyWindow.RootViewController.ChildViewControllers)
         {
             normalController.AddChildViewController(viewController);
             normalController.View.Add(viewController.View);
         }
         UIApplication.SharedApplication.KeyWindow.RootViewController = normalController;
     }
     else
     {
         if (controller == OrientationController.PortraitConstant)
         {
             UIDevice.CurrentDevice.SetValueForKey(new NSNumber((int)UIInterfaceOrientation.Portrait), new NSString("orientation"));
         }
         // disable rotation
         UIApplication.SharedApplication.KeyWindow.RootViewController = new OrientationViewController(controller,
                                                                                                      UIApplication.SharedApplication.KeyWindow.RootViewController
                                                                                                      .ChildViewControllers);
     }
 }
        public static void AddChildViewControllerAndView(
            [NotNull] this UIViewController parentViewController,
            [CanBeNull] UIViewController childViewController,
            [NotNull] UIView parentView)
        {
            if (parentViewController == null)
            {
                throw new ArgumentNullException(nameof(parentViewController));
            }
            if (parentView == null)
            {
                throw new ArgumentNullException(nameof(parentView));
            }

            if (childViewController != null)
            {
                parentViewController.AddChildViewController(childViewController);
                childViewController.View.NotNull().Frame = parentView.Bounds;
                parentView.AddSubview(childViewController.View);
                parentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
                parentView.AddConstraints(childViewController.View.FullSizeOf(parentView));
                childViewController.DidMoveToParentViewController(parentViewController);
            }
        }
 private void AttachSidebarControllerToRootController(UIViewController rootViewController)
 {
     rootViewController.AddChildViewController(this);
     rootViewController.View.AddSubview(this.View);
     this.DidMoveToParentViewController(rootViewController);
 }