示例#1
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            Properties.Add(new PropertyItem
            {
                Header     = "项目名称",
                Value      = _task.References.Project.Name,
                Glyph      = WtIconHelper.GetGlyph(_task.References.Project.Visibility),
                IsReadonly = true,
                Color      = new SolidColorBrush((Color)Resources["SystemAccentColor"])
            });

            string taskTypeId = _task.Value.TaskTypeId;
            var    taskType   = _task.References.TaskTypes.Single(t => t.Id == taskTypeId);

            Properties.Add(new PropertyItem
            {
                Header     = "任务类型",
                Value      = taskType.Name,
                Glyph      = WtIconHelper.GetGlyph("wtf-type-" + taskType.Icon),
                IsReadonly = true,
                Color      = WtColorHelper.GetSolidColorBrush(WtColorHelper.GetColorByClass(taskType.Icon))
            });

            var reader = new PropertiesReader();
            var props  = reader.Read(_task);

            foreach (var item in props)
            {
                Properties.Add(item);
            }

            reader.LoadOptions(_task.Value.Id, Properties, Dispatcher);
        }
示例#2
0
        private void ReadKanbanItem(ApiMissionVnextKanbanContent data, KanbanGroup kbGroup, string taskId)
        {
            var task  = data.Data.Value.Single(v => v.Id == taskId);
            var type  = data.Data.References.TaskTypes.Single(t => t.Id == task.TaskTypeId);
            var state = data.Data.References.Lookups.TaskStates.Single(t => t.Id == task.TaskStateId);

            KanbanPageHelper.ReadForProgressBar(kbGroup, state.Type);

            var kanban = new KanbanItem
            {
                Id       = task.Id,
                TaskType = new Models.TaskType
                {
                    Name  = type.Name,
                    Color = WtColorHelper.GetColorByClass(type.Icon),
                    Glyph = WtIconHelper.GetGlyph("wtf-type-" + type.Icon),
                },
                Properties = new List <KanbanItemProperty>()
            };

            foreach (var item in type.ShowSettings)
            {
                var            property = data.Data.References.Properties.Single(p => p.Id == item.TaskPropertyId);
                PropertyReader reader   = null;
                switch (property.Type)
                {
                case WtTaskPropertyType.Text:
                    reader = new TextReader();
                    break;

                case WtTaskPropertyType.DateTime:
                    reader = new DateTimeReader();
                    break;

                case WtTaskPropertyType.DateSpan:
                    reader = new DateSpanReader();
                    break;

                case WtTaskPropertyType.Member:
                    reader = new MemberReader();
                    break;

                case WtTaskPropertyType.Workload:
                    reader = new WorkloadReader();
                    break;

                case WtTaskPropertyType.State:
                    reader = new TaskStateReader();
                    break;

                case WtTaskPropertyType.Tag:
                    reader = new TagReader();
                    break;

                case WtTaskPropertyType.Priority:
                    reader = new PriorityReader();
                    break;

                case WtTaskPropertyType.File:
                    reader = new AttachmentReader();
                    break;

                case WtTaskPropertyType.TaskType:
                    continue;

                default:
                    reader = new DefaultReader();
                    break;
                }
                reader.Read(kanban, property, task, state, item, data);
            }

            kbGroup.Items.Add(kanban);
        }