public override string ToString() { var times = new string[_List.Count]; for (int i = 0; i < times.Length; i++) { times[i] = Schedules.FormatTime(_List[i]); } return(String.Join(", ", times)); }
protected override void CompileLayout(SuperGumpLayout layout) { base.CompileLayout(layout); layout.Replace( "label/header/title", () => AddLabelCropped(90, 15, 185, 20, GetTitleHue(), String.IsNullOrEmpty(Title) ? DefaultTitle : Title)); layout.Replace( "label/header/subtitle", () => AddLabelCropped(275, 15, 100, 20, HighlightHue, Schedules.FormatTime(DateTime.UtcNow.TimeOfDay, true))); }
public virtual string ToHtmlString(bool big = true) { DateTime now = DateTime.UtcNow; var html = new StringBuilder(); html.AppendFormat("Current Date: {0}\n", Schedules.FormatDate(now)); html.AppendFormat("Current Time: {0}\n", Schedules.FormatTime(now.TimeOfDay, true)); html.AppendLine("\nSchedule Overview:\n"); if (!_Enabled) { html.AppendLine("Schedule is currently disabled.".WrapUOHtmlColor(Color.OrangeRed)); return(html.ToString()); } bool print = false; string months = _Info.Months.ToString(), days = String.Empty, times = String.Empty; if (months == "All") { months = String.Join(" ", Enum.GetNames(typeof(ScheduleMonths))); months = months.Replace("All", String.Empty).Replace("None", String.Empty).Trim().Replace(" ", ", "); } if (months == "None") { html.AppendLine("Schedule requires at least one Month to be set.".WrapUOHtmlColor(Color.OrangeRed)); } else { days = _Info.Days.ToString(); if (days == "All") { days = String.Join(" ", Enum.GetNames(typeof(ScheduleDays))); days = days.Replace("All", String.Empty).Replace("None", String.Empty).Trim().Replace(" ", ", "); } if (days == "None") { html.AppendLine("Schedule requires at least one Day to be set.".WrapUOHtmlColor(Color.OrangeRed)); } else { times = _Info.Times.ToString(); if (String.IsNullOrWhiteSpace(times)) { html.AppendLine("Schedule requires at least one Time to be set.".WrapUOHtmlColor(Color.OrangeRed)); } else { int cc = 0; string wrap = String.Empty; foreach (char t in times) { if (t == ',') { cc++; wrap += ','; if (cc % 6 == 0) { wrap += '\n'; } else { wrap += ' '; } } else if (t != ' ') { wrap += t; } } times = wrap; print = true; } } } if (print) { html.AppendFormat("<BASEFONT COLOR=#{0:X6}>", Color.Cyan.ToArgb()); html.AppendLine("Schedule is set to perform an action:"); html.AppendLine("\n<B>In...</B>"); html.AppendLine(months); html.AppendLine("\n<B>On...</B>"); html.AppendLine(days); html.AppendLine("\n<B>At...</B>"); html.AppendLine(times); if (NextGlobalTick != null) { bool today = (NextGlobalTick.Value.Day == DateTime.UtcNow.Day); html.AppendLine( String.Format( "\n\nThe next tick will be at {0} {1}.", NextGlobalTick.Value.TimeOfDay.ToSimpleString("h:m:s"), today ? "today." : "on " + NextGlobalTick.Value.ToSimpleString("D, M d"))); } } return((big ? String.Format("<big>{0}</big>", html) : html.ToString()).WrapUOHtmlColor( SuperGump.DefaultHtmlColor, false)); }
protected override string GetLabelText(int index, int pageIndex, TimeSpan entry) { return(Schedules.FormatTime(entry, true)); }
public override string GetSearchKeyFor(TimeSpan key) { return(Schedules.FormatTime(key, true)); }