Пример #1
0
        void ReleaseDesignerOutlets()
        {
            if (AddExerciseButton != null)
            {
                AddExerciseButton.Dispose();
                AddExerciseButton = null;
            }

            if (ExerciseList != null)
            {
                ExerciseList.Dispose();
                ExerciseList = null;
            }

            if (MenuButton != null)
            {
                MenuButton.Dispose();
                MenuButton = null;
            }

            if (NavBar != null)
            {
                NavBar.Dispose();
                NavBar = null;
            }
        }
Пример #2
0
        public static void ApplyTheme(this UINavigationBar navigationBar, NavigationTheme theme)
        {
            navigationBar.PrefersLargeTitles = theme.PrefersLargeTitles;

            var regularNavigationAppearance = new UINavigationBarAppearance();

            regularNavigationAppearance.BackgroundColor     = theme.BackgroundColor;
            regularNavigationAppearance.TitleTextAttributes = new UIStringAttributes()
            {
                ForegroundColor = theme.TextColor
            };
            navigationBar.StandardAppearance = regularNavigationAppearance;

            if (theme.PrefersLargeTitles)
            {
                var largeNavigationAppearance = new UINavigationBarAppearance();
                largeNavigationAppearance.BackgroundImageContentMode = UIViewContentMode.ScaleAspectFill;
                largeNavigationAppearance.BackgroundImage            = theme.BackgroundImage;
                largeNavigationAppearance.ShadowColor = UIColor.Clear;
                largeNavigationAppearance.LargeTitleTextAttributes = new UIStringAttributes()
                {
                    ForegroundColor = theme.TextColor
                };
                navigationBar.ScrollEdgeAppearance = largeNavigationAppearance;
            }

            navigationBar.TintColor = theme.TextColor;
        }
Пример #3
0
 void ReleaseDesignerOutlets()
 {
     if (NavigationBar != null)
     {
         NavigationBar.Dispose();
         NavigationBar = null;
     }
 }
        public void SetBadge(Page page, ToolbarItem item, string value, Color backgroundColor, Color textColor)
        {
            Device.BeginInvokeOnMainThread(() =>
            {
                var renderer = Platform.GetRenderer(page);
                if (renderer == null)
                {
                    renderer = Platform.CreateRenderer(page);
                    Platform.SetRenderer(page, renderer);
                }
                var vc = renderer.ViewController;

                var rightButtonItems = vc?.ParentViewController?.NavigationItem?.RightBarButtonItems;

                // If we can't find the button where it typically is check the child view controllers
                // as this is where MasterDetailPages are kept
                if (rightButtonItems == null && vc.ChildViewControllerForHomeIndicatorAutoHidden != null)
                {
                    foreach (var uiObject in vc.ChildViewControllerForHomeIndicatorAutoHidden)
                    {
                        string uiObjectType = uiObject.GetType().ToString();

                        if (uiObjectType.Contains("FormsNav"))
                        {
                            UIKit.UINavigationBar navobj = (UIKit.UINavigationBar)uiObject;

                            if (navobj.Items != null)
                            {
                                foreach (UIKit.UINavigationItem navitem in navobj.Items)
                                {
                                    if (navitem.RightBarButtonItems != null)
                                    {
                                        rightButtonItems = navitem.RightBarButtonItems;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }

                var idx = page.ToolbarItems.IndexOf(item);
                if (rightButtonItems != null && rightButtonItems.Length > idx)
                {
                    var barItem = rightButtonItems[idx];
                    if (barItem != null)
                    {
                        barItem.UpdateBadge(value, backgroundColor.ToUIColor(), textColor.ToUIColor());
                    }
                }
            });
        }
Пример #5
0
 internal static void SetNavigationBar(CommandBar commandBar, UIKit.UINavigationBar navigationBar)
 {
     commandBar.GetRenderer(() => new CommandBarRenderer(commandBar)).Native = navigationBar;
 }
Пример #6
0
 internal static void SetNavigationBar(CommandBar commandBar, UIKit.UINavigationBar navigationBar)
 {
     commandBar.GetRenderer(() => new CommandBarRenderer(commandBar)).Native = navigationBar ?? throw new ArgumentNullException(nameof(navigationBar));
 }
Пример #7
0
        void ReleaseDesignerOutlets()
        {
            if (buttonA != null)
            {
                buttonA.Dispose();
                buttonA = null;
            }

            if (buttonB != null)
            {
                buttonB.Dispose();
                buttonB = null;
            }

            if (buttonC != null)
            {
                buttonC.Dispose();
                buttonC = null;
            }

            if (buttonD != null)
            {
                buttonD.Dispose();
                buttonD = null;
            }

            if (buttonSubmit != null)
            {
                buttonSubmit.Dispose();
                buttonSubmit = null;
            }

            if (textOptionA != null)
            {
                textOptionA.Dispose();
                textOptionA = null;
            }

            if (textOptionB != null)
            {
                textOptionB.Dispose();
                textOptionB = null;
            }

            if (textOptionC != null)
            {
                textOptionC.Dispose();
                textOptionC = null;
            }

            if (textOptionD != null)
            {
                textOptionD.Dispose();
                textOptionD = null;
            }

            if (textQuestion != null)
            {
                textQuestion.Dispose();
                textQuestion = null;
            }

            if (titleSession != null)
            {
                titleSession.Dispose();
                titleSession = null;
            }

            if (toolbarSession != null)
            {
                toolbarSession.Dispose();
                toolbarSession = null;
            }
        }