示例#1
0
            public HomeMasterPage(HomeViewModel viewModel)
            {
                BackgroundImage = "back.png";
                this.Icon = "slideout.png";
                Title = "test";
                var layout = new StackLayout { Spacing = 0 };

                var listView = new iiListView
                {
                    ClassId="1",
                };// Listview created for menu items
                var cell = new DataTemplate(typeof(ListImageCell));
                cell.SetBinding(TextCell.TextProperty, HomeViewModel.TitlePropertyName);
                listView.ItemTemplate = cell;


                //BackgroundImage = "iiListBack.";
                listView.ItemsSource = viewModel.MenuItems;
                listView.BackgroundColor= Xamarin.Forms.Color.Transparent;
                if (DashBoard == null)   //Making First view page selection
                    DashBoard = new DashboardViewPage( );
                PageSelection = DashBoard;

                listView.ItemSelected += (sender, args) =>
                {
                    
                    var menuItem = listView.SelectedItem as HomeMenuItem;
                    menuType = menuItem.MenuType;
                    switch (menuItem.MenuType)
                    {
                        case MenuType.Dashboard:
                            if (DashBoard == null)
                                DashBoard = new DashboardViewPage();

                            PageSelection = DashBoard;
                            break;
                        case MenuType.EmployeeAccount:
                            if (EmployeeAccount == null)
                                EmployeeAccount = new AddEmployeeViewPage();
                            PageSelection = EmployeeAccount;
                            break;

                        case MenuType.Logout:
                            if (Logout == null)
                                Logout = new LoginPageView();

                            PageSelection = Logout;
                            break;
                    }
                };
                layout.Children.Add(listView);
                Content = layout;
            }
示例#2
0
        //LoginViewModel loginViewModel;
        public HomeViewPage(LoginViewModel loginViewModel)
        {
            pages = new Dictionary<MenuType, iiNavigationPage>();
            BindingContext = new HomeViewModel();
            ViewModel.LogViewModel = loginViewModel;
            Master = _master = new HomeMasterPage(ViewModel);
            var homeNav = new iiNavigationPage(_master.PageSelection)
            {
                // BackgroundColor = Helper.Color.Pink.ToFormsColor(),
                // BarTextColor = Helper.Color.White.ToFormsColor(),
                //BarBackgroundColor= Helper.Color.iiGreen.ToFormsColor()
            };
            Detail = homeNav;
            pages.Add(MenuType.Dashboard, homeNav);
            _master.PageSelectionChanged = async (menuType) =>
            {

                if (Detail != null && Device.OS == TargetPlatform.WinPhone)
                {
                    await Detail.Navigation.PopToRootAsync();
                }

                iiNavigationPage newPage;
                if (pages.ContainsKey(menuType))
                {
                    newPage = pages[menuType];
                }
                else
                {
                    newPage = new iiNavigationPage(_master.PageSelection)
                    {
                        // BarBackgroundColor = Helper.Color.iiPurple.ToFormsColor(),
                        //BarTextColor = Xamarin.Forms.Color.White
                        //GO inside iiNavigaton Constructor
                    };
                    pages.Add(menuType, newPage);
                }
                Detail = newPage;
                Detail.Title = _master.PageSelection.Title;
                IsPresented = false;
            };
            this.Icon = "slideout.png";
        }
示例#3
0
 public DashboardViewPage()
 {
     BindingContext = new HomeViewModel();
     GenerateView();
 }