public static void GetTrainColors(Train train, out Color clrLo, out Color clrHi) { if (train.Locomotive) { clrLo = Color.FromArgb(0xff, 0xc0, 0xc0, 0xc0); clrHi = Color.FromArgb(0xff, 0x80, 0x80, 0x80); } else if (!train.TimeTableAssigned()) { AssignBlack(out clrLo, out clrHi); } else if (train.ID.IndexOf('?') >= 0) { AssignBlack(out clrLo, out clrHi); } else { TrainBase.GetDelayColor(TimeSpan.FromSeconds(train.Delay.TotalSeconds), out clrLo, out clrHi); } }
private void Layout_OnTrainProperties(Train t) { List<string> possibleTrainIds = this.GetPossibleTrainIds(); if (!possibleTrainIds.Contains(t.ID)) { possibleTrainIds.Insert(0, t.ID); } Uri u = new Uri(string.Format("/TrainRoute.aspx?TrainId={0}", HttpUtility.UrlEncode(t.ID)), UriKind.Relative); TimeSpan span = (TimeSpan) (DateTime.Now - this.m_LastShiftPressed); bool enable = (span.TotalSeconds < 2.0) || (this.m_strUserName.Length > 0); TrainPropertiesDlg dlg = new TrainPropertiesDlg(t, possibleTrainIds, u, enable); dlg.Closed += new EventHandler(this.TrainPropertiesDlg_Closed); dlg.Show(); }