/// <summary> /// Shows the time in the Distance buttons for the specified villages and speed /// </summary> public void ShowTime(Village start, Village end, ShowDistanceEnum speed) { if (start != null && end != null) { TimeSpan time = Village.TravelTime(start, end, Unit); switch (speed) { case ShowDistanceEnum.ArrivalTime: Text = Tools.Common.GetShortPrettyDate(World.Default.Settings.ServerTime.Add(time)); break; case ShowDistanceEnum.ReturnTime: Text = Tools.Common.GetShortPrettyDate(World.Default.Settings.ServerTime.Add(time + time)); break; case ShowDistanceEnum.TravelTime: Text = time.ToString(); break; case ShowDistanceEnum.TravelTime2: Text = (time + time).ToString(); break; } } else { Text = ""; } }
public DistanceContextMenuItem(string text, ShowDistanceEnum dist, DistanceCollectionControl parent) : base(text) { _distance = dist; _collection = parent; Click += DistanceContextMenuItem_Click; }