Esempio n. 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;
            }
Esempio n. 2
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;
            }