Пример #1
0
        protected void FormatCell(BaseTimetableDataElement data, Station sta, bool arrival, TextBox tb)
        {
            string val = tb.Text;

            if (val == null || val == "")
            {
                data.SetError(sta, arrival, null);
                data.SetTime(sta, arrival, "0");
                return;
            }

            val = normalizer.Normalize(val);
            bool error = true;

            if (val != null)
            {
                tb.Text = val;
                data.SetTime(sta, arrival, val);
                error = false;
            }
            data.SetError(sta, arrival, error ? tb.Text : null);
        }
Пример #2
0
 protected abstract void CellSelected(BaseTimetableDataElement data, Station sta, bool arrival);
Пример #3
0
 protected abstract Point GetNextEditingPosition(BaseTimetableDataElement data, GridView view, KeyEventArgs e);
        public TimetableCellRenderProperties(Func <ArrDep, TimeSpan> time, Station sta, bool arrival, BaseTimetableDataElement data)
        {
            if (fn == null || fb == null || errorColor == null)
            {
                fb         = SystemFonts.Bold();
                fn         = SystemFonts.Default();
                errorColor = new Color(Colors.Red, 0.4f);
            }

            Background = Colors.White;
            Font       = fn;

            var ardp = data.ArrDeps[sta];

            if (!data.HasError(sta, arrival))
            {
                Text = time(ardp) != default ? time(ardp).ToShortTimeString() : "";
            }
            else
            {
                Text = data.GetErrorText(sta, arrival);
            }

            var first = data.IsFirst(sta);

            if ((!arrival && data.IsLast(sta)) || (arrival && first))
            {
                ReadOnly   = true;
                Background = Colors.DarkGray;
            }
            else if (arrival ^ first)
            {
                if (first && ardp.TrapeztafelHalt)
                {
                    throw new Exception("Die erste Station darf keinen Trapeztafelhalt beinhalten!");
                }

                Background = ardp.TrapeztafelHalt ? Colors.LightGrey : Colors.White;
                if (ardp.Zuglaufmeldung != null && ardp.Zuglaufmeldung != "")
                {
                    Font = fb;
                }
            }

            if (data.HasError(sta, arrival))
            {
                Background = errorColor;
            }
        }