Ejemplo n.º 1
0
        private void GoToEventsPage()
        {
            var eventsVM = new EventsPageVM();

            eventsVM.DownloadData().ContinueWith((arg) => { eventsVM.UpdateVM(); });
            VM.Navigation = new NavigationPage(new EventsPage(eventsVM));
        }
Ejemplo n.º 2
0
        public App(AppViewModel vm = null)
        {
            VM = vm ?? new AppViewModel();

            // The root page of your application
            var button = new Button {
                Text            = "test",
                BackgroundColor = Color.Yellow,
                TextColor       = Color.Black
            };

            var casellaNome = new Entry {
                Placeholder = "inserisci qui il testo"
            };
            var introduzione = new Label
            {
                HorizontalTextAlignment = TextAlignment.Center,
                Text = "Welcome to Xamarin Forms!"
            };

            button.Clicked += async(sender, e) =>
            {
                var pageVM = new EventsPageVM {
                };
                pageVM.DownloadData().ContinueWith((arg) => { pageVM.UpdateVM(); });
                await App.Current.MainPage.Navigation.PushAsync(new EventsPage(pageVM));

                //await introduzione.RotateXTo(360, 1000);
                //await introduzione.RotateXTo(0, 1000);
            };
            var content = new ContentPage
            {
                Title   = "LuissLoft",
                Content = new StackLayout
                {
                    VerticalOptions = LayoutOptions.Center,
                    Children        =
                    {
                        button,
                        introduzione,
                        casellaNome
                    }
                }
            };

            MainPage = new HomePageMD();
            return;

            var pageVM0 = new EventsPageVM {
            };

            pageVM0.DownloadData().ContinueWith((arg) => { pageVM0.UpdateVM(); });
            var eventsPage = new EventsPage(pageVM0);

            var navigation = new NavigationPage(eventsPage);

            MainPage = navigation;
        }
Ejemplo n.º 3
0
        public HomePageMD()
        {
            var masterVM = new MasterPageVM {
                MD = this
            };

            masterVM.DownloadData().ContinueWith((arg) => { masterVM.UpdateVM(); });
            Master = new MasterPage(masterVM);

            var eventsVM = new EventsPageVM();

            eventsVM.DownloadData().ContinueWith((arg) => { eventsVM.UpdateVM(); });
            Detail = new NavigationPage(new EventsPage(eventsVM));

            this.IsPresented = true;
        }
Ejemplo n.º 4
0
        public EventsPage(EventsPageVM vm)
        {
            VM = vm; BindingContext = VM;
            var listPoints = new ListView(ListViewCachingStrategy.RecycleElement)
            {
                IsPullToRefreshEnabled = true,
                //RowHeight=250,
                HasUnevenRows   = true,
                BackgroundColor = EventsPageVM.ColoreSfondoLista
            };

            listPoints.ItemTemplate = new DataTemplate(typeof(EventCellView));
            listPoints.SetBinding(ListView.ItemsSourceProperty, new Binding(nameof(EventsPageVM.Events)));

            listPoints.SetBinding(ListView.IsRefreshingProperty, new Binding(nameof(EventsPageVM.IsLoadingData)));

            listPoints.ItemTapped += (sender, e) =>
            {
                var item = (EventCellVM)e.Item; if (item == null)
                {
                    return;
                }
                listPoints.SelectedItem = null;

                var pageViewModel = new EventDetailViewModel {
                    ObjEvent = item.Obj
                };
                pageViewModel.UpdateVM();
                Navigation.PushAsync(new EventDetailView(pageViewModel));
            };
            listPoints.Refreshing += async(sender, e) =>
            {
                await VM.DownloadData().ContinueWith(delegate {
                    VM.UpdateVM();
                });

                listPoints.IsRefreshing = false;
            };

            var loading = new ActivityIndicator {
                IsRunning = false, IsVisible = false
            };

            loading.Bind(nameof(ViewModelBase.IsLoadingData));
            loading.BindingContext = VM;

            var labelListaVuota = new Label {
                Text = "Non ci sono ancora elementi qui", FontAttributes = FontAttributes.Italic, HorizontalOptions = LayoutOptions.Center
            };

            labelListaVuota.SetBinding(View.IsVisibleProperty, new Binding(nameof(ViewModelBase.IsListEmpty)));
            Title = "Eventi";

            Content = new StackLayout
            {
                Children =
                {
                    loading,
                    labelListaVuota,
                    listPoints,
                }
            };
        }