コード例 #1
0
        public MiniHacksPage()
        {
            InitializeComponent();
            BindingContext = vm = new MiniHacksViewModel();
            if (Device.OS == TargetPlatform.Android)
            {
                ListViewMiniHacks.Effects.Add(Effect.Resolve("Xamarin.ListViewSelectionOnTopEffect"));
            }

            if (Device.OS == TargetPlatform.Windows || Device.OS == TargetPlatform.WinPhone)
            {
                ToolbarItems.Add(new ToolbarItem
                {
                    Text    = "Refresh",
                    Icon    = "toolbar_refresh.png",
                    Command = vm.ForceRefreshCommand
                });
            }

            ListViewMiniHacks.ItemTapped   += (sender, e) => ListViewMiniHacks.SelectedItem = null;
            ListViewMiniHacks.ItemSelected += async(sender, e) =>
            {
                var hack = ListViewMiniHacks.SelectedItem as MiniHack;
                if (hack == null)
                {
                    return;
                }

                await NavigationService.PushAsync(Navigation, new MiniHacksDetailsPage(hack));


                ListViewMiniHacks.SelectedItem = null;
            };
        }
コード例 #2
0
        public MiniHacksPage()
        {
            InitializeComponent();
            BindingContext = vm = new MiniHacksViewModel();
            if (Device.OS == TargetPlatform.Android)
            {
                ListViewMiniHacks.Effects.Add(Effect.Resolve("Xamarin.ListViewSelectionOnTopEffect"));
            }

            if (Device.OS == TargetPlatform.Windows || Device.OS == TargetPlatform.WinPhone)
            {
                ToolbarItems.Add(new ToolbarItem
                {
                    Text    = "Refresh",
                    Icon    = "toolbar_refresh.png",
                    Command = vm.ForceRefreshCommand
                });
            }

            filterItem = new ToolbarItem
            {
                Text = "Filter"
            };

            if (Device.OS != TargetPlatform.iOS)
            {
                filterItem.Icon = "toolbar_filter.png";
            }

            filterItem.Command = new Command(async() =>
            {
                if (vm.IsBusy)
                {
                    return;
                }
                App.Logger.TrackPage(AppPage.Filter.ToString());
                await NavigationService.PushModalAsync(Navigation, new EvolveNavigationPage(new FilterSessionsPage()));
            });

            ListViewMiniHacks.ItemTapped   += (sender, e) => ListViewMiniHacks.SelectedItem = null;
            ListViewMiniHacks.ItemSelected += async(sender, e) =>
            {
                var hack = ListViewMiniHacks.SelectedItem as MiniHack;
                if (hack == null)
                {
                    return;
                }

                await NavigationService.PushAsync(Navigation, new FloorMapsPage());


                ListViewMiniHacks.SelectedItem = null;
            };
        }
コード例 #3
0
ファイル: Hacks.xaml.cs プロジェクト: Peruzal/app-evolve
        public Hacks()
        {
            InitializeComponent();
            BindingContext = vm = new MiniHacksViewModel(this);
            ListViewMiniHacks.Effects.Add(Effect.Resolve("XamarinHacks.ListViewSelectionOnTopEffect"));

            ListViewMiniHacks.ItemTapped += (sender, e) => ListViewMiniHacks.SelectedItem = null;

            ListViewMiniHacks.ItemSelected += async(sender, e) =>
            {
                var hack = e.SelectedItem as MiniHack;

                if (hack == null)
                {
                    return;
                }

                await Navigation.PushAsync(new HackDetail(hack));

                ListViewMiniHacks.SelectedItem = null;
            };
        }