コード例 #1
0
        protected override void CellSelected(BaseTimetableDataElement data, Station sta, bool arrival)
        {
            trapeztafelToggle.Checked = data.ArrDeps[sta].TrapeztafelHalt;
            requestToggle.Checked     = data.ArrDeps[sta].RequestStop || sta.RequestStop;

            trapeztafelToggle.Enabled = requestToggle.Enabled = arrival && !data.IsFirst(sta) && !sta.RequestStop;
            zlmButton.Enabled         = arrival ^ data.IsFirst(sta);
        }
コード例 #2
0
        public TimetableCellRenderProperties(Func <ArrDep, TimeEntry> time, Station sta, bool arrival, BaseTimetableDataElement data)
        {
            if (!initialized)
            {
                fb  = SystemFonts.Bold();
                fn  = SystemFonts.Default();
                fc  = SystemFonts.Cached(SystemFont.Default, null, FontDecoration.Underline);
                fbc = SystemFonts.Cached(SystemFont.Bold, null, FontDecoration.Underline);
                var errorHsl = Colors.Red.ToHSL();
                errorHsl.L *= 0.8f;
                errorColor  = errorHsl.ToColor();
                bgColor     = SystemColors.ControlBackground;
                textColor   = SystemColors.ControlText;
                initialized = true;
            }

            Background = bgColor;
            Font       = fn;

            var ardp = data.ArrDeps[sta];

            if (!data.HasError(sta, arrival))
            {
                Text = time(ardp) != default ? time(ardp).ToTimeString() : "";
            }
            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(T._("Die erste Station darf keinen Trapeztafelhalt beinhalten!"));
                }

                Background = ardp.TrapeztafelHalt ? Colors.LightGrey : bgColor;
                if (ardp.RequestStop)
                {
                    Font = fc;
                }
                if (!string.IsNullOrEmpty(ardp.Zuglaufmeldung) && !ardp.RequestStop)
                {
                    Font = fb;
                }
                if (!string.IsNullOrEmpty(ardp.Zuglaufmeldung) && ardp.RequestStop)
                {
                    Font = fbc;
                }
            }

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