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); } } }
protected void SetColor(KanbanItemProperty kbp, string color) { if (color == null) { kbp.Foreground = WtColorHelper.GetSolidColorBrush("#aaaaaa"); kbp.Background = WtColorHelper.GetSolidColorBrush("#33aaaaaa"); } else { string newColor = WtColorHelper.GetNewColor(color); kbp.Foreground = WtColorHelper.GetSolidColorBrush(newColor); kbp.Background = WtColorHelper.GetSolidColorBrush(newColor.Insert(1, "33")); } }
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); } }
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); } }
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); } } }
public override void Read(KanbanItem kanban, WtTaskProperty property, ValueElement task, TaskState state, ShowSetting setting, ApiMissionVnextKanbanContent data) { if (property.RawKey == "title") { kanban.Title = task.Title; } else { JObject jObj = JObject.FromObject(task); string value = JTokenHelper.GetPropertyValue <string>(jObj, property.Key); if (value != null) { var kbp = new KanbanItemProperty { Name = property.Name, Value = value }; SetColor(kbp, setting.Color); kanban.Properties.Add(kbp); } } }
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); } } } } }
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); } }