Ejemplo n.º 1
0
        private void listBox1_DrawItem(object sender, DrawItemEventArgs e)
        {
            if (e.Index >= 0 && e.Index < listBox1.Items.Count)
            {
                ListBoxRichItem lbi = listBox1.Items[e.Index] as ListBoxRichItem;
                lbi.DrawItem(e, 1);

                if (lbi.Tag != null && lbi.Tag is GCConfigRatedEntry)
                {
                    GCConfigRatedEntry ge = lbi.Tag as GCConfigRatedEntry;
                    string             s  = ge.Rating.ToString();
                    SizeF ss = e.Graphics.MeasureString(s, ListBoxRichItem.H1Font);
                    Brush b  = Brushes.Gray;
                    if (ge.Rating > 0.0)
                    {
                        b = Brushes.DarkGreen;
                    }
                    else if (ge.Rating < 0.0)
                    {
                        b = Brushes.DarkRed;
                    }
                    e.Graphics.DrawString(s, ListBoxRichItem.H1Font, b, e.Bounds.Right - 8 - ss.Width, e.Bounds.Top + 8);
                }
            }
        }
Ejemplo n.º 2
0
 private void InitListConfigs()
 {
     listBox1.Items.Clear();
     foreach (GCConfigRatedEvents ge in GCConfigRatedManager.Configurations)
     {
         ListBoxRichItem lb = new ListBoxRichItem();
         lb.Title    = ge.Title;
         lb.Subtitle = ge.Description;
         lb.Tag      = ge;
         listBox1.Items.Add(lb);
     }
 }
Ejemplo n.º 3
0
        private void toolStripButtonEdit_Click(object sender, EventArgs e)
        {
            ListBoxRichItem lbi = listBox1.Items[listBox1.SelectedIndex] as ListBoxRichItem;

            if (lbi.Tag != null && lbi.Tag is GCConfigRatedEntry)
            {
                GCConfigRatedEntry     ge = lbi.Tag as GCConfigRatedEntry;
                RatedEventDetailsPanel d  = new RatedEventDetailsPanel();
                d.OnValueSaved += new TBButtonPressed(OnRatedEntryEdited);
                d.RatedEvent    = ge;
                RatedEventDetailsPanelController dc = new RatedEventDetailsPanelController(d);
                dc.ShowInContainer(Controller.ViewContainer, GVControlAlign.Fill);
            }
        }
 private void InitListbox(GCConfigRatedEntry ge)
 {
     listBox1.BeginUpdate();
     listBox1.Items.Clear();
     for (int i = 0; i < ge.MarginsCount; i++)
     {
         ListBoxRichItem lbi = new ListBoxRichItem();
         lbi.Tag      = ge[i];
         lbi.Title    = ge[i].Title;
         lbi.Subtitle = string.Format("Period {0} min - {1} min rel to starting time",
                                      ge[i].OffsetMinutesStart, ge[i].OffsetMinutesEnd);
         listBox1.Items.Add(lbi);
     }
     listBox1.EndUpdate();
 }
Ejemplo n.º 5
0
        private void InitListBoxEntries(GCConfigRatedEvents.ParameterDescriptor p, int index)
        {
            GCConfigRatedEvents ev = SelectedConfiguration;

            if (ev == null)
            {
                return;
            }

            List <GCConfigRatedEvents.ParameterDescriptor> pars = ev.ParameterDescriptions;
            ListBoxRichItem lbi;

            listBox1.BeginUpdate();
            listBox1.Items.Clear();
            if (p.Array != null)
            {
                for (int i = p.Min; i < p.Max; i++)
                {
                    lbi            = new ListBoxRichItem();
                    lbi.Title      = p.Array[i].Title;
                    lbi.Subtitle   = string.Format("{0}, {1} subratings", p.Key, p.Array[i].MarginsCount);
                    lbi.Tag        = p.Array[i];
                    lbi.TitleLevel = 0;
                    listBox1.Items.Add(lbi);
                }
            }
            else if (p.Array2 != null)
            {
                int i = index;
                for (int j = p.Min2; j < p.Max2; j++)
                {
                    lbi            = new ListBoxRichItem();
                    lbi.Title      = p.Array2[i, j].Title;
                    lbi.Subtitle   = string.Format("{0}, {1} subratings", p.Key, p.Array2[i, j].MarginsCount);
                    lbi.Tag        = p.Array2[i, j];
                    lbi.TitleLevel = 0;
                    listBox1.Items.Add(lbi);
                }
            }
            listBox1.EndUpdate();
        }