예제 #1
0
        internal static void DefaultPageProperties(Page page, MobileScreen Me)
        {
            Device.OnPlatform(
                Android: () =>
            {
                bool DisplayNav = OnPlatformBool.GetAndroidValue(Me.DisplayNavigationBar);
                NavigationPage.SetHasNavigationBar(page, DisplayNav);

                if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.Title)))
                {
                    page.Title = OnPlatformString.GetAndroidValue(Me.Title);
                }

                if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.BackgroundColor)))
                {
                    page.BackgroundColor = Color.FromHex(OnPlatformString.GetAndroidValue(Me.BackgroundColor));
                }
            },
                iOS: () =>
            {
                NavigationPage.SetHasNavigationBar(page, OnPlatformBool.GetiOSValue(Me.DisplayNavigationBar));

                if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.Title)))
                {
                    page.Title = OnPlatformString.GetiOSValue(Me.Title);
                }

                if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.BackgroundColor)))
                {
                    page.BackgroundColor = Color.FromHex(OnPlatformString.GetiOSValue(Me.BackgroundColor));
                }
            },
                WinPhone: () =>
            {
                NavigationPage.SetHasNavigationBar(page, OnPlatformBool.GetWinPhoneValue(Me.DisplayNavigationBar));

                if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.Title)))
                {
                    page.Title = OnPlatformString.GetWinPhoneValue(Me.Title);
                }

                if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.BackgroundColor)))
                {
                    page.BackgroundColor = Color.FromHex(OnPlatformString.GetWinPhoneValue(Me.BackgroundColor));
                }
            }
                );
        }
예제 #2
0
        public void Init()
        {
            CellHelper.DefaultViewProperties(this);

            Device.OnPlatform(
                Android: () =>
            {
                this.On = OnPlatformBool.GetAndroidValue(Me.On);

                if (!String.IsNullOrEmpty(OnPlatformString.GetAndroidValue(Me.Text)))
                {
                    this.Text = OnPlatformString.GetAndroidValue(Me.Text);
                }
            },
                iOS: () =>
            {
                this.On = OnPlatformBool.GetiOSValue(Me.On);

                if (!String.IsNullOrEmpty(OnPlatformString.GetiOSValue(Me.Text)))
                {
                    this.Text = OnPlatformString.GetiOSValue(Me.Text);
                }
            },
                WinPhone: () =>
            {
                this.On = OnPlatformBool.GetWinPhoneValue(Me.On);

                if (!String.IsNullOrEmpty(OnPlatformString.GetWinPhoneValue(Me.Text)))
                {
                    this.Text = OnPlatformString.GetWinPhoneValue(Me.Text);
                }
            }
                );

            this.OnChanged += SwitchCell_OnChanged;
        }