Ejemplo n.º 1
0
        public MobileContentPage(MobileScreen screen)
        {
            Screen = screen;
            Me     = (MobileContentScreen)Screen;

            InitializeScreen();
        }
Ejemplo n.º 2
0
        public MobileNavigationPage(MobileScreen screen, Page root) : base(root)
        {
            Screen = screen;
            Me     = (MobileNavigationScreen)Screen;

            InitializeScreen();
        }
Ejemplo n.º 3
0
        public MobileContentPage(string pageName)
        {
            Screen = MobileScreen.GetByName(pageName);
            Me     = (MobileContentScreen)Screen;

            InitializeScreen();
        }
Ejemplo n.º 4
0
        public MobileTabbedPage(MobileScreen screen)
        {
            Screen = screen;
            Me = (MobileTabbedScreen)Screen;

            InitializeScreen();
        }
Ejemplo n.º 5
0
        public MobileNavigationPage(string pageName, Page root) : base(root)
        {
            Screen = MobileScreen.GetByName(pageName);
            Me     = (MobileNavigationScreen)Screen;

            InitializeScreen();
        }
Ejemplo n.º 6
0
        public MobileTabbedPage(string pageName)
        {
            Screen = MobileScreen.GetByName(pageName);
            Me = (MobileTabbedScreen)Screen;

            InitializeScreen();
        }
Ejemplo n.º 7
0
        internal static void SetupView(IMobilePage page, MobileScreen screen, BaseControl control, IView view)
        {
            if (!String.IsNullOrEmpty(control.Name))
            {
                if (page.Elements.ContainsKey(control.Name))
                {
                    throw new Exception(String.Format("Screen {0} - cannot have controls with duplicate names - {1}", screen.Name, control.Name));
                }

                page.Elements.Add(control.Name, view.GetView());
            }
        }
Ejemplo n.º 8
0
        public static IView GetView(Page page, MobileScreen screen, BaseControl control)
        {
            IView retVal = null;

            switch (control.Type.ToLower().ToString())
            {
            case "boxview":
                retVal = new CodeTorch.Mobile.BoxView();
                break;

            case "button":
                retVal = new CodeTorch.Mobile.Button();
                break;

            case "entry":
                retVal = new CodeTorch.Mobile.Entry();
                break;

            case "image":
                retVal = new CodeTorch.Mobile.Image();
                break;

            case "label":
                retVal = new CodeTorch.Mobile.Label();
                break;

            case "listview":
                retVal = new CodeTorch.Mobile.ListView();
                break;

            case "stacklayout":
                retVal = new CodeTorch.Mobile.StackLayout();

                break;

            case "scrollview":
                retVal = new CodeTorch.Mobile.ScrollView();
                break;

            case "tableview":
                retVal = new CodeTorch.Mobile.TableView();
                break;
            }

            retVal.Page        = page;
            retVal.BaseControl = control;
            retVal.Screen      = screen;

            return(retVal);
        }
Ejemplo n.º 9
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));
                }
            }
                );
        }
Ejemplo n.º 10
0
        public static IMobilePage    GetPage(string pageName)
        {
            IMobilePage retVal = null;

            MobileScreen screen = MobileScreen.GetByName(pageName);

            switch (screen.Type.ToLower())
            {
            case "mobilecontent":
                retVal = new MobileContentPage(screen);
                break;

            case "mobiletabbed":
                retVal = new MobileTabbedPage(screen);
                break;

            case "mobilenavigation":
                Page root = GetPage(((MobileNavigationScreen)screen).GetRootScreen()).GetPage();
                retVal = new MobileNavigationPage(screen, root);
                break;
            }

            if (retVal != null)
            {
                string loginScreen = Configuration.GetInstance().App.LoginScreen;

                if (!String.IsNullOrEmpty(loginScreen))
                {
                    if (retVal.Screen != null)
                    {
                        if (retVal.Screen.RequireAuthentication)
                        {
                            UserIdentityService identity = UserIdentityService.GetInstance();
                            string userName = identity.IdentityProvider.GetUserName();

                            if (String.IsNullOrEmpty(userName))
                            {
                                retVal = GetPage(loginScreen);
                            }
                        }
                    }
                }
            }

            return(retVal);
        }
Ejemplo n.º 11
0
 private IView GetView(Page page, MobileScreen screen, BaseControl control)
 {
     return(ViewHelper.GetView(page, screen, control));
 }