Exemplo n.º 1
0
        public MainMasterDetailPage()
        {
            InitializeComponent();

            MasterPage.ListView.ItemSelected += (sender, e) => { ((ListView)sender).SelectedItem = null; };
            MasterPage.ListView.ItemSelected += async(o, args) => await ListView_ItemSelected(o, args);

            // just for initialize the first time
            _lastSelectedItem = new MasterDetailMenuItem {
                Id = 0
            };
        }
Exemplo n.º 2
0
        async System.Threading.Tasks.Task OnSelectItemAsync(MasterDetailMenuItem MenuItem)
        {
            if (MenuItem.Title.Equals(NavMenu.Logout))
            {
                Logout();
            }
            if (MenuItem.Title.Equals(NavMenu.AddCoursePage))
            {
                Barrel.Current.Add <List <Course> >("AllCourseList", await _service.GetAllCourses(), TimeSpan.FromMinutes(20));
            }
            if (MenuItem.Title.Equals(NavMenu.PhoneNumbersPage))
            {
                Barrel.Current.Add <List <Directory> >("AllDirectoriesList", await _service.GetAllDirectories(), TimeSpan.FromMinutes(20));
            }


            await _navigationService.NavigateAsync($"{NavConstants.Navigation}/{MenuItem.TargetPage}");
        }
Exemplo n.º 3
0
        private async Task ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var item = e.SelectedItem as MasterDetailMenuItem;

            if (item == null)
            {
                return;
            }

            if (_lastSelectedItem.Id != item.Id)
            {
                var page = await Task.Run(() => item.NewPage());

                Detail            = new NavigationPage(page);
                _lastSelectedItem = item;
            }

            IsPresented = false;
        }