Beispiel #1
0
        public override void Read(KanbanItem kanban, WtTaskProperty property, ValueElement task, TaskState state, ShowSetting setting, ApiMissionVnextKanbanContent data)
        {
            var kbp = new KanbanItemProperty
            {
                Name = "实际工时"
            };

            SetColor(kbp, setting.Color);

            JObject jObj     = JObject.FromObject(task);
            var     workload = JTokenHelper.GetPropertyValue <WorkloadValue>(jObj, property.Key);

            if (workload.Actual != 0)
            {
                kbp.Value = workload.Actual.ToString();
                kanban.Properties.Add(kbp);
            }
        }
Beispiel #2
0
        public override void Read(KanbanItem kanban, WtTaskProperty property, ValueElement task, TaskState state, ShowSetting setting, ApiMissionVnextKanbanContent data)
        {
            var kbp = new KanbanItemProperty
            {
                Name = property.Name
            };

            SetColor(kbp, setting.Color);

            JObject jObj = JObject.FromObject(task);
            var     span = JTokenHelper.GetPropertyValue <DateSpan>(jObj, property.Key);

            if (span.Begin.Date.HasValue && span.End.Date.HasValue)
            {
                kbp.Value = WtDateTimeHelper.ToWtKanbanDate(span.Begin.Date.Value)
                            + " ~ "
                            + WtDateTimeHelper.ToWtKanbanDate(span.End.Date.Value);
                kanban.Properties.Add(kbp);
            }
        }
Beispiel #3
0
        public override void Read(KanbanItem kanban, WtTaskProperty property, ValueElement task, TaskState state, ShowSetting setting, ApiMissionVnextKanbanContent data)
        {
            var kbp = new KanbanItemProperty
            {
                Name = property.Name
            };

            SetColor(kbp, setting.Color);

            JObject jObj = JObject.FromObject(task);
            string  uid  = JTokenHelper.GetPropertyValue <string>(jObj, property.Key);

            if (!string.IsNullOrEmpty(uid))
            {
                var avatar = AvatarHelper.GetAvatar(uid, AvatarSize.X40);
                if (property.RawKey == "assignee")
                {
                    kanban.Due = avatar;
                }
                else
                {
                    kbp.Value = avatar.DisplayName;
                    kanban.Properties.Add(kbp);
                }
            }
        }
Beispiel #4
0
        public override void Read(KanbanItem kanban, WtTaskProperty property, ValueElement task, TaskState state, ShowSetting setting, ApiMissionVnextKanbanContent data)
        {
            var kbp = new KanbanItemProperty
            {
                Name = property.Name
            };

            SetColor(kbp, setting.Color);

            JObject jObj = JObject.FromObject(task);
            WtDate  date = null;

            if (property.Key.Count(k => k == '.') > 0)
            {
                date = JTokenHelper.GetPropertyValue <WtDate>(jObj, property.Key);
            }
            else
            {
                date = new WtDate();
                string timestamp = jObj[property.Key].Value <string>();
                if (timestamp != null)
                {
                    date.Date = WtDateTimeHelper.GetDateTime(timestamp);
                }
            }

            if (date.Date.HasValue)
            {
                kbp.Value = date.Date.Value.ToWtKanbanDate();
                if (property.RawKey == "due" && date.Date.Value < DateTime.Now)
                {
                    kbp.Foreground = WtColorHelper.DangerColor;
                    kbp.Background = WtColorHelper.DangerColor1A;
                }
                kanban.Properties.Add(kbp);
            }
        }
Beispiel #5
0
        public override void Read(KanbanItem kanban, WtTaskProperty property, ValueElement task, TaskState state, ShowSetting setting, ApiMissionVnextKanbanContent data)
        {
            JObject jObj = JObject.FromObject(task);

            string[] tagIds = JTokenHelper.GetPropertyValue <string[]>(jObj, property.Key);
            if (tagIds.Length > 0)
            {
                foreach (var id in tagIds)
                {
                    var tag = data.Data.References.Lookups.Tags.Single(t => t.Id == id);
                    var kbp = new KanbanItemProperty
                    {
                        Value      = tag.Name,
                        Foreground = new SolidColorBrush(Colors.White),
                        Background = WtColorHelper.GetNewBrush(tag.Color)
                    };
                    kanban.Properties.Add(kbp);
                }
            }
        }
Beispiel #6
0
        public override void Read(KanbanItem kanban, WtTaskProperty property, ValueElement task, TaskState state, ShowSetting setting, ApiMissionVnextKanbanContent data)
        {
            JObject jObj  = JObject.FromObject(task);
            var     value = JTokenHelper.GetPropertyValue <string>(jObj, property.Key);

            if (value != null)
            {
                var priority = data.Data.References.Lookups.Priorities.Single(p => p.Id == value);
                kanban.Priority = WtColorHelper.GetNewBrush(priority.Color);
            }
        }
Beispiel #7
0
        public override void Read(KanbanItem kanban, WtTaskProperty property, ValueElement task, TaskState state, ShowSetting setting, ApiMissionVnextKanbanContent data)
        {
            var kbp = new KanbanItemProperty
            {
                Name = property.Name
            };

            SetColor(kbp, setting.Color);

            JObject jObj  = JObject.FromObject(task);
            string  value = JTokenHelper.GetPropertyValue <string>(jObj, property.Key);

            if (value != null)
            {
                if (property.Lookup == null)
                {
                    kbp.Value = value;
                }
                else
                {
                    JObject lookup = JObject.FromObject(data.Data.References.Lookups);
                    var     jItem  = lookup[property.Lookup].Single(item => item["_id"].Value <string>() == value);
                    if (jItem is JObject obj)
                    {
                        if (obj.ContainsKey("name"))
                        {
                            kbp.Value = jItem["name"].Value <string>();
                            kanban.Properties.Add(kbp);
                        }
                        else if (obj.ContainsKey("text"))
                        {
                            kbp.Value = jItem["text"].Value <string>();
                            kanban.Properties.Add(kbp);
                        }
                    }
                }
            }
        }