コード例 #1
0
        private void AddEvent()
        {
            var eventsModel = new EventsModel
            {
                Id        = _eventsId,
                Title     = entryTitle.Text,
                EventDate = dpEventDate.Date + tpEventTime.Time,
                Location  = entryLocation.Text,
                IsDone    = switchDone.IsToggled
            };

            var eventsData = new EventsData();

            eventsData.AddItems(eventsModel);

            if (_isUpdate)
            {
                DisplayAlert("Event", "Successfully updated!", "OK");
            }

            else
            {
                DisplayAlert("Event", "Successfully created!", "OK");
            }

            Navigation.PopAsync();
        }
コード例 #2
0
        private void LoadItems()
        {
            var eventsData = new EventsData();
            var result     = eventsData.GetItemsList().Result;

            listViewEvent.ItemsSource    = result;
            stackActionButtons.IsEnabled = false;
        }
コード例 #3
0
        private async void btnDelete_Clicked(object sender, EventArgs e)
        {
            var action = await DisplayAlert("Confirm", "Delete this item?", "Yes", "No");

            if (action)
            {
                var eventsData = new EventsData();
                await eventsData.DeleteItem(_selectedItemIndex);

                LoadItems();
            }
        }
コード例 #4
0
        private void LoadEventsDetails()
        {
            var eventsData   = new EventsData();
            var eventDetails = eventsData.GetItemDetails(_eventsId).Result;

            foreach (var items in eventDetails)
            {
                entryTitle.Text      = items.Title;
                dpEventDate.Date     = items.EventDate.Date;
                tpEventTime.Time     = items.EventDate.TimeOfDay;
                entryLocation.Text   = items.Location;
                switchDone.IsToggled = items.IsDone;
            }
        }
コード例 #5
0
        private void EditEvent()
        {
            var eventsModel = new EventsModel
            {
                Title     = entryTitle.Text,
                EventDate = dpEventDate.Date + tpEventTime.Time,
                Location  = entryLocation.Text,
                IsDone    = switchDone.IsToggled
            };

            var eventsData = new EventsData();

            eventsData.AddItems(eventsModel);
            DisplayAlert("Event", "Successfull updated!", "OK");
            Navigation.PopAsync();
        }