public void SetDetails(PlanBlock block) { List <string[]> tuples = new List <string[]>(); string notes = null; // get inof that needs to be set if (block != null) { tuples.Add(new string[] { "title", block.Title }); tuples.Add(new string[] { "start", block.StartTime.ToLocalTime().ToString("D") }); tuples.Add(new string[] { "finish", block.EndTime.ToLocalTime().ToString("D") }); tuples.Add(new string[] { "notes", block.Description.Replace("\r\n", "<br>") }); notes = block.Description; } // set details button DetailsButton.ForeColor = Color.Black; if (MainSplit.Panel2Collapsed && notes != null && notes != "") { DetailsButton.ForeColor = Color.Red; } if (LastBlock != block) { Details.Length = 0; if (block != null) { Details.Append(BlockPage); } else { Details.Append(DefaultPage); } foreach (string[] tuple in tuples) { Details.Replace("<?=" + tuple[0] + "?>", tuple[1]); } SetDisplay(Details.ToString()); } else { foreach (string[] tuple in tuples) { DetailsBrowser.SafeInvokeScript("SetElement", new String[] { tuple[0], tuple[1] }); } } LastBlock = block; }
public void SetDetails(PlanGoal goal, PlanItem item) { LastGoal = goal; LastItem = item; List <string[]> tuples = new List <string[]>(); string notes = null; DetailsModeType mode = DetailsModeType.None; // get inof that needs to be set if (goal != null) { tuples.Add(new string[] { "title", goal.Title }); tuples.Add(new string[] { "due", goal.End.ToLocalTime().ToString("D") }); tuples.Add(new string[] { "person", Core.GetName(goal.Person) }); tuples.Add(new string[] { "notes", goal.Description.Replace("\r\n", "<br>") }); notes = goal.Description; mode = DetailsModeType.Goal; } else if (item != null) { tuples.Add(new string[] { "title", item.Title }); tuples.Add(new string[] { "progress", item.HoursCompleted.ToString() + " of " + item.HoursTotal.ToString() + " Hours Completed" }); tuples.Add(new string[] { "notes", item.Description.Replace("\r\n", "<br>") }); notes = item.Description; mode = DetailsModeType.Item; } // set details button DetailsButton.ForeColor = Color.Black; if (splitContainer1.Panel2Collapsed && notes != null && notes != "") { DetailsButton.ForeColor = Color.Red; } if (mode != DetailsMode) { DetailsMode = mode; Details.Length = 0; if (mode == DetailsModeType.Goal) { Details.Append(GoalPage); } else if (mode == DetailsModeType.Item) { Details.Append(ItemPage); } else { Details.Append(DefaultPage); } foreach (string[] tuple in tuples) { Details.Replace("<?=" + tuple[0] + "?>", tuple[1]); } SetDisplay(Details.ToString()); } else { foreach (string[] tuple in tuples) { DetailsBrowser.SafeInvokeScript("SetElement", new String[] { tuple[0], tuple[1] }); } } }