Пример #1
0
        private void comboBoxParcours_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListItem li = comboBoxParcours.SelectedItem as ListItem;

            if (li != null)
            {
                ParcourSet   p  = li.getParcour();
                MapSet       m  = p.MapSet;
                MemoryStream ms = new MemoryStream(m.PictureSet.Data);
                PictureBox1.Image = System.Drawing.Image.FromStream(ms);
                c = new Converter(m);
                PictureBox1.SetConverter(c);
                CurrentMap = m;
                List <Line> toDelete = p.Line.Where(pp => pp.Type == (int)LineType.START || pp.Type == (int)LineType.END).ToList();
                foreach (Line l in toDelete)
                {
                    p.Line.Remove(l);
                }
                activeParcour = p;
                PictureBox1.SetParcour(activeParcour);
                bool generatedParcour = activeParcour.Line.Count(pp => pp.Type == (int)LineType.Point) > 0;
                btnRecalc.Enabled   = generatedParcour;
                chkAutocalc.Enabled = generatedParcour;
                chkAutocalc.Checked = generatedParcour;
            }
        }
        private void loadParcours()
        {
            deleteToolStripMenuItem.Enabled = false;
            PictureBox1.SetConverter(c);
            PictureBox1.Image = null;
            activeParcour     = new ParcourSet();
            PictureBox1.SetParcour(activeParcour);
            PictureBox1.Invalidate();

            listBox1.Items.Clear();
            List <ParcourSet> parcours = Client.SelectedCompetition.ParcourSet.ToList();

            foreach (ParcourSet p in parcours)
            {
                listBox1.Items.Add(new ListItem(p));
            }
        }
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listBox1.SelectedItems.Count == 1)
            {
                ListItem li = listBox1.SelectedItems[0] as ListItem;
                activeParcour = li.getParcour();
                deleteToolStripMenuItem.Enabled = true;
                MapSet map = li.getParcour().MapSet;

                MemoryStream ms = new MemoryStream(map.PictureSet.Data);
                PictureBox1.Image = System.Drawing.Image.FromStream(ms);
                c = new Converter(map);
                PictureBox1.SetConverter(c);


                //PictureBox1.Invalidate();

                numericUpDownAlpha.Value    = activeParcour.Alpha;
                btnColorGates.BackColor     = activeParcour.ColorGates;
                btnColorPROH.BackColor      = activeParcour.ColorPROH;
                checkBoxCircle.Checked      = activeParcour.HasCircleOnGates;
                numericUpDownPenGates.Value = activeParcour.PenWidthGates;

                //PictureBox1.ColorGates = activeParcour.ColorGates;
                //PictureBox1.PenWidthGates = (float)activeParcour.PenWidthGates;
                PictureBox1.HasCircleOnGates = activeParcour.HasCircleOnGates;

                radioButtonParcourTypePROH.Checked    = (activeParcour.PenaltyCalcType == 0) ? true : false;
                radioButtonParcourTypeChannel.Checked = (!radioButtonParcourTypePROH.Checked);
                btnChannelColor.BackColor             = activeParcour.ColorChannel;
                btnChannelFillColor.BackColor         = activeParcour.ColorChannelFill;
                numericUpDownChannelAlpha.Value       = activeParcour.Alpha;
                numericUpDownChannelPen.Value         = activeParcour.PenWidthChannel;

                chkIntersectionPointsShow.Checked           = activeParcour.HasIntersectionCircles;
                btnIntersectColor.BackColor                 = activeParcour.ColorIntersection;
                numericUpDownIntersectionCircleRadius.Value = activeParcour.IntersectionCircleRadius;
                numericUpDownPenWidthIntersect.Value        = activeParcour.PenWidthIntersection;

                PictureBox1.SetParcour(activeParcour);
                SetHoverLine(null);
                SetSelectedLine(null);
                PictureBox1.Invalidate();
            }
        }
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListItem li = listBox1.SelectedItem as ListItem;

            if (li != null)
            {
                deleteToolStripMenuItem.Enabled = true;
                MapSet map = li.getParcour().MapSet;

                MemoryStream ms = new MemoryStream(map.PictureSet.Data);
                PictureBox1.Image = System.Drawing.Image.FromStream(ms);
                c = new Converter(map);
                PictureBox1.SetConverter(c);

                PictureBox1.SetParcour(li.getParcour());
                activeParcour = li.getParcour();
                PictureBox1.Invalidate();
            }
        }
        private void comboBoxMaps_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListItem li = comboBoxMaps.SelectedItem as ListItem;

            if (li != null)
            {
                MemoryStream ms = new MemoryStream(li.getMap().PictureSet.Data);
                PictureBox1.Image = System.Drawing.Image.FromStream(ms);
                c = new Converter(li.getMap());
                PictureBox1.SetConverter(c);
                activeParcour = new ParcourSet();
                PictureBox1.SetParcour(activeParcour);
                SetHoverLine(null);
                SetSelectedLine(null);
                CurrentMap = li.getMap();
                PictureBox1.Invalidate();
                checkValidationErrors();
            }
        }
        private void loadParcours()
        {
            lblCompetition.Text             = Client.SelectedCompetition.Name + " - parcours";
            deleteToolStripMenuItem.Enabled = false;
            PictureBox1.SetConverter(c);
            PictureBox1.Image = null;
            activeParcour     = new ParcourSet();
            PictureBox1.SetParcour(activeParcour);
            SetHoverLine(null);
            SetSelectedLine(null);
            PictureBox1.Invalidate();

            listBox1.Items.Clear();
            //CompetitionSet cs = Client.SelectedCompetition;
            //List<ParcourSet> ods = cs.ParcourSet.ToList<ParcourSet>();
            List <ParcourSet> parcours = Client.SelectedCompetition.ParcourSet.ToList <ParcourSet>();

            foreach (ParcourSet p in parcours)
            {
                listBox1.Items.Add(new ListItem(p));
            }
        }