Beispiel #1
0
        private void ExecuteLoadChecklistsCommand()
        {
            IsBusy = true;
            ChecklistGroups.Clear();
            try
            {
                var checklists = TemplateProvider.GetChecklist();

                foreach (var category in checklists)
                {
                    var listGroup = new GroupedList
                    {
                        GroupName = category.Name,
                        Icon      = category.Icon
                    };
                    foreach (var item in category.Items)
                    {
                        listGroup.Add(item);
                    }
                    ChecklistGroups.Add(listGroup);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                Crashes.TrackError(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Beispiel #2
0
        public async Task ExecuteAddItemCommand(GroupedList groupedList)
        {
            var itemName = await Application.Current
                           .MainPage.DisplayPromptAsync("Add Item", "Enter name of item:");

            if (!string.IsNullOrEmpty(itemName))
            {
                var newItem = new Item {
                    Name = itemName
                };
                groupedList.Insert(0, newItem);
                SaveTemplate();
            }
        }