Example #1
0
        public void OnColorChoice(object sender, Event evt)
        {
            wx.Object        obj = evt.EventObject;
            SkinElementColor el  = null;

            if (obj == m_background.m_rgbSelector)
            {
                el = m_background;
            }
            else if (obj == m_freeTrack.m_rgbSelector)
            {
                el = m_freeTrack;
            }
            else if (obj == m_reservedTrack.m_rgbSelector)
            {
                el = m_reservedTrack;
            }
            else if (obj == m_reservedShunting.m_rgbSelector)
            {
                el = m_reservedShunting;
            }
            else if (obj == m_occupiedTrack.m_rgbSelector)
            {
                el = m_occupiedTrack;
            }
            else if (obj == m_workingTrack.m_rgbSelector)
            {
                el = m_workingTrack;
            }
            else if (obj == m_outline.m_rgbSelector)
            {
                el = m_outline;
            }
            else if (obj == m_text.m_rgbSelector)
            {
                el = m_text;
            }
            else
            {
                return;
            }

            byte   rv, gv, bv;
            String str;

            str = el.m_r.Value;
            rv  = Globals.wxStrtoul(str, 0, 0);
            str = el.m_g.Value;
            gv  = Globals.wxStrtoul(str, 0, 0);
            str = el.m_b.Value;
            bv  = Globals.wxStrtoul(str, 0, 0);
            Colour     elCol = new wx.Colour(rv, gv, bv);
            ColourData data  = new ColourData();

            data.ChooseFull = (true);
            data.Colour     = (elCol);

            ColourDialog dialog = new ColourDialog(this, data);

            if (dialog.ShowModal() == ShowModalResult.OK)
            {
                ColourData retData = dialog.ColourData;
                wx.Colour  col     = retData.Colour;
                byte       v       = col.Red;
                str          = String.Format(wxPorting.T("%d"), v);
                el.m_r.Value = (str);

                v            = col.Green;
                str          = String.Format(wxPorting.T("%d"), v);
                el.m_g.Value = (str);

                v            = col.Blue;
                str          = String.Format(wxPorting.T("%d"), v);
                el.m_b.Value = (str);
            }
        }