Beispiel #1
0
        private TabPage GetTab(SliderCategory g)
        {
            TabPage     tabPage;
            IEnumerator enumerator = this.tabControl.TabPages.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    TabPage current = (TabPage)enumerator.Current;
                    if (!current.Text.Equals(g.Description))
                    {
                        continue;
                    }
                    tabPage = current;
                    return(tabPage);
                }
                return(null);
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            return(tabPage);
        }
Beispiel #2
0
        private SliderCategory GetGroup(Slider s)
        {
            SliderCategory sliderCategory;

            List <SliderCategory> .Enumerator enumerator = this.config.SliderGroups.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    SliderCategory current = enumerator.Current;
                    if (!current.Ids.Contains(s.Id))
                    {
                        continue;
                    }
                    sliderCategory = current;
                    return(sliderCategory);
                }
                return(null);
            }
            finally
            {
                ((IDisposable)enumerator).Dispose();
            }
            return(sliderCategory);
        }
Beispiel #3
0
        private void PopulatePanel()
        {
            this.ClearPanel();
            if (this.selectBodyTypeBox.SelectedIndex == -1)
            {
                return;
            }
            Record selectedItem = (Record)this.selectBodyTypeBox.SelectedItem;
            Label  label        = null;

            for (int i = 0; i < selectedItem.Sliders.Count; i++)
            {
                SliderCategory group = this.GetGroup(selectedItem.Sliders[i]);
                TabPage        tab   = this.GetTab(group);
                int            num   = group.Ids.IndexOf(selectedItem.Sliders[i].Id);
                label = new Label()
                {
                    Text     = selectedItem.Sliders[i].Description,
                    Location = new Point(tab.Left, 10 + (num + 1) * 30)
                };
                TextBox textBox = new TextBox()
                {
                    Location = new Point(label.Right, label.Top - 3)
                };
                float?min = selectedItem.Sliders[i].Min;
                textBox.Text = min.ToString();
                TextBox str = new TextBox()
                {
                    Location = new Point(textBox.Right, label.Top - 3)
                };
                min      = selectedItem.Sliders[i].Max;
                str.Text = min.ToString();

                AddTextBoxEventHandlers(textBox, selectedItem, selectedItem.Sliders[i], new UserValueChange(ChangeMinDelegate));
                AddTextBoxEventHandlers(str, selectedItem, selectedItem.Sliders[i], new UserValueChange(ChangeMaxDelegate));
                tab.Controls.Add(label);
                tab.Controls.Add(textBox);
                tab.Controls.Add(str);
            }
            if (label != null)
            {
                foreach (TabPage tabPage in this.tabControl.TabPages)
                {
                    Label point = new Label()
                    {
                        Text = "Min"
                    };
                    Label label1 = new Label()
                    {
                        Text = "Max"
                    };
                    point.Location  = new Point(label.Right, 10);
                    label1.Location = new Point(point.Right, point.Top);
                    tabPage.Controls.Add(point);
                    tabPage.Controls.Add(label1);
                }
            }
        }
Beispiel #4
0
 private void LoadSliderGroups(XElement xelem)
 {
     SliderGroups = new List <SliderCategory>();
     foreach (XElement xElement in xelem.Element("Groups").Elements("Group"))
     {
         SliderCategory sliderCategory = new SliderCategory(xElement.Attribute("description").Value)
         {
             Ids = new List <int>()
         };
         foreach (XElement xElement1 in xElement.Elements("Value"))
         {
             sliderCategory.Ids.Add(int.Parse(xElement1.Attribute("id").Value));
         }
         SliderGroups.Add(sliderCategory);
     }
 }