示例#1
0
        public SalesDashboardPage()
        {
            _AuthenticationService = DependencyService.Get <IAuthenticationService>();

            // If this page is being presented by a NavigationPage, we don't want to show the navigation bar (top) in this particular app design.
            NavigationPage.SetHasNavigationBar(this, false);

            this.SetBinding(ContentPage.TitleProperty, new Binding()
            {
                Source = TextResources.Sales
            });

            #region sales chart view
            _SalesDashboardChartViewModel = new SalesDashboardChartViewModel();
            SalesDashboardChartView salesChartView = new SalesDashboardChartView()
            {
                BindingContext = _SalesDashboardChartViewModel
            };
            #endregion

            #region leads view
            _SalesDashboardLeadsViewModel = new SalesDashboardLeadsViewModel(new Command(PushTabbedLeadPageAction));
            LeadsView leadsView = new LeadsView()
            {
                BindingContext = _SalesDashboardLeadsViewModel
            };
            #endregion

            #region compose view hierarchy
            Content = new ScrollView()
            {
                Content = new UnspacedStackLayout()
                {
                    Children =
                    {
                        salesChartView,
                        leadsView
                    }
                },
                IsVisible = false     // this is set to false until successful authentication
            };
            #endregion

            #region wire up MessagingCenter
            // Catch the login success message from the MessagingCenter.
            // This is really only here for Android, which doesn't fire the OnAppearing() method in the same way that iOS does (every time the page appears on screen).
            Device.OnPlatform(Android: () => MessagingCenter.Subscribe <SplashPage>(this, MessagingServiceConstants.AUTHENTICATED, sender => OnAppearing()));
            #endregion
        }
示例#2
0
        public SalesDashboardPage()
        {
            _AuthenticationService = DependencyService.Get<IAuthenticationService>();

            // If this page is being presented by a NavigationPage, we don't want to show the navigation bar (top) in this particular app design.
            NavigationPage.SetHasNavigationBar(this, false);

            this.SetBinding(ContentPage.TitleProperty, new Binding() { Source = TextResources.Sales });

            #region sales chart view
            _SalesDashboardChartViewModel = new SalesDashboardChartViewModel();
            SalesDashboardChartView salesChartView = new SalesDashboardChartView() { BindingContext = _SalesDashboardChartViewModel };
            #endregion

            #region leads view
            _SalesDashboardLeadsViewModel = new SalesDashboardLeadsViewModel(new Command(PushTabbedLeadPageAction));
            LeadsView leadsView = new LeadsView() { BindingContext = _SalesDashboardLeadsViewModel };
            #endregion

            #region compose view hierarchy
            Content = new ScrollView() 
                { 
                    Content = new UnspacedStackLayout()
                    {
                        Children =
                            {
                                salesChartView,
                                leadsView
                            }
                        },
                    IsVisible = false // this is set to false until successful authentication
                };
            #endregion

            #region wire up MessagingCenter
            // Catch the login success message from the MessagingCenter.
            // This is really only here for Android, which doesn't fire the OnAppearing() method in the same way that iOS does (every time the page appears on screen).
            Device.OnPlatform(Android: () => MessagingCenter.Subscribe<SplashPage>(this, MessagingServiceConstants.AUTHENTICATED, sender => OnAppearing()));
            #endregion
        }
示例#3
0
        public SalesDashboardPage()
        {
            _AuthenticationService = DependencyService.Get <IAuthenticationService>();

            this.SetBinding(Page.TitleProperty, new Binding()
            {
                Source = TextResources.Sales
            });

            #region sales chart view
            var salesChartView = new SalesDashboardChartView()
            {
                BindingContext = _SalesDashboardChartViewModel = new SalesDashboardChartViewModel()
            };

            #endregion

            #region leads view
            var leadsView = new LeadsView {
                BindingContext = _SalesDashboardLeadsViewModel = new SalesDashboardLeadsViewModel(new Command(PushTabbedLeadPageAction))
            };
            #endregion

            _ScrollView = new ScrollView
            {
                Content = new StackLayout
                {
                    Spacing  = 0,
                    Children =
                    {
                        salesChartView,
                        leadsView
                    }
                }
            };

            #region compose view hierarchy
            if (Device.OS == TargetPlatform.Android)
            {
                _Fab = new FloatingActionButtonView
                {
                    ImageName    = "fab_add.png",
                    ColorNormal  = Palette._001,
                    ColorPressed = Palette._002,
                    ColorRipple  = Palette._001,
                    Clicked      = (sender, args) =>
                                   _SalesDashboardLeadsViewModel.PushTabbedLeadPageCommand.Execute(null),
                };

                var absolute = new AbsoluteLayout
                {
                    VerticalOptions   = LayoutOptions.FillAndExpand,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                };

                // Position the pageLayout to fill the entire screen.
                // Manage positioning of child elements on the page by editing the pageLayout.
                AbsoluteLayout.SetLayoutFlags(_ScrollView, AbsoluteLayoutFlags.All);
                AbsoluteLayout.SetLayoutBounds(_ScrollView, new Rectangle(0f, 0f, 1f, 1f));
                absolute.Children.Add(_ScrollView);

                // Overlay the FAB in the bottom-right corner
                AbsoluteLayout.SetLayoutFlags(_Fab, AbsoluteLayoutFlags.PositionProportional);
                AbsoluteLayout.SetLayoutBounds(_Fab, new Rectangle(1f, 1f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
                absolute.Children.Add(_Fab);

                Content = absolute;
            }
            else
            {
                ToolbarItems.Add(new ToolbarItem("Add", "add_ios_gray", () =>
                                                 _SalesDashboardLeadsViewModel.PushTabbedLeadPageCommand.Execute(null)));

                Content = _ScrollView;
            }
            #endregion

            #region wire up MessagingCenter
            // Catch the login success message from the MessagingCenter.
            // This is really only here for Android, which doesn't fire the OnAppearing() method in the same way that iOS does (every time the page appears on screen).
            Device.OnPlatform(Android: () => MessagingCenter.Subscribe <SplashPage>(this, MessagingServiceConstants.AUTHENTICATED, sender => OnAppearing()));
            #endregion
        }
示例#4
0
        public SalesDashboardPage()
        {
            _AuthenticationService = DependencyService.Get<IAuthenticationService>();

            this.SetBinding(Page.TitleProperty, new Binding() { Source = TextResources.Sales });

            #region sales chart view
            var salesChartView = new SalesDashboardChartView() { BindingContext = _SalesDashboardChartViewModel = new SalesDashboardChartViewModel() };

            #endregion

            #region leads view
            var leadsView = new LeadsView { BindingContext = _SalesDashboardLeadsViewModel = new SalesDashboardLeadsViewModel(new Command(PushTabbedLeadPageAction)) };
            #endregion

            _ScrollView = new ScrollView
            { 
                Content = new StackLayout
                {
                    Spacing = 0,
                    Children =
                    {
                        salesChartView,
                        leadsView
                    }
                }
            };
                        
            #region compose view hierarchy
            if (Device.OS == TargetPlatform.Android)
            {
                _Fab = new FloatingActionButtonView
                {
                    ImageName = "fab_add.png",
                    ColorNormal = Palette._001,
                    ColorPressed = Palette._002,
                    ColorRipple = Palette._001,
                    Clicked = (sender, args) => 
                            _SalesDashboardLeadsViewModel.PushTabbedLeadPageCommand.Execute(null),
                };

                var absolute = new AbsoluteLayout
                { 
                    VerticalOptions = LayoutOptions.FillAndExpand, 
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                };

                // Position the pageLayout to fill the entire screen.
                // Manage positioning of child elements on the page by editing the pageLayout.
                AbsoluteLayout.SetLayoutFlags(_ScrollView, AbsoluteLayoutFlags.All);
                AbsoluteLayout.SetLayoutBounds(_ScrollView, new Rectangle(0f, 0f, 1f, 1f));
                absolute.Children.Add(_ScrollView);

                // Overlay the FAB in the bottom-right corner
                AbsoluteLayout.SetLayoutFlags(_Fab, AbsoluteLayoutFlags.PositionProportional);
                AbsoluteLayout.SetLayoutBounds(_Fab, new Rectangle(1f, 1f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
                absolute.Children.Add(_Fab);

                Content = absolute;
            }
            else
            {
                ToolbarItems.Add(new ToolbarItem("Add", "add_ios_gray", () =>
                    _SalesDashboardLeadsViewModel.PushTabbedLeadPageCommand.Execute(null)));

                Content = _ScrollView;
            }
            #endregion

            #region wire up MessagingCenter
            // Catch the login success message from the MessagingCenter.
            // This is really only here for Android, which doesn't fire the OnAppearing() method in the same way that iOS does (every time the page appears on screen).
            Device.OnPlatform(Android: () => MessagingCenter.Subscribe<SplashPage>(this, MessagingServiceConstants.AUTHENTICATED, sender => OnAppearing()));
            #endregion
        }