示例#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;
            }
        }
示例#2
0
        public void ExecuteDeleteItemCommand(Item item)
        {
            for (var i = ChecklistGroups.Count - 1; i >= 0; i--)
            {
                ChecklistGroups[i].Remove(item);
                if (ChecklistGroups[i].Count == 0)
                {
                    ChecklistGroups.Remove(ChecklistGroups[i]);
                }
            }

            SaveTemplate();
        }
示例#3
0
        private async Task ExecuteAddCategoryCommand()
        {
            var categoryName = await Application.Current
                               .MainPage.DisplayPromptAsync("Add Category", "Enter name of category:");

            if (!string.IsNullOrEmpty(categoryName))
            {
                ChecklistGroups.Insert(0, new GroupedList
                {
                    GroupName = categoryName,
                    Icon      = "\uf4ff",
                    Items     = new ObservableCollection <Item>()
                });
                SaveTemplate();
            }
        }