예제 #1
0
        private void BindControlsToDataSource()
        {
            List <Control> listBoxes = new List <Control>();

            listBoxes.AddRange(groupBoxConditions.Controls.Cast <Control>());
            listBoxes.AddRange(groupBoxActions.Controls.Cast <Control>());
            foreach (Control c in listBoxes)
            {
                if (c is BetterListBox)
                {
                    BetterListBox lbox = (BetterListBox)c;
                    if (c.Name.Contains("Condition"))
                    {
                        lbox.DataSource    = dal.GetEnumValues("listBoxConditionType");
                        lbox.DisplayMember = "";
                    }
                    else
                    if (c.Name.Contains("Notify"))
                    {
                        lbox.DataSource    = dal.GetEnumValues("listBoxActionNotifyMethod");
                        lbox.DisplayMember = "";
                    }
                    else
                    if (c.Name.Contains("Action"))
                    {
                        lbox.DataSource    = dal.GetEnumValues("listBoxActionType");
                        lbox.DisplayMember = "";
                    }
                }
            }
        }
예제 #2
0
        private void BindStepConditions(int step_id)
        {
            var stepConditions = dal.GetStepConditions(step_id);
            int countDB        = stepConditions.Count();
            int countGUI       = 0;

            while (groupBoxConditions.Controls.ContainsKey("listBoxConditionType" + (++countGUI).ToString()))
            {
                ;
            }
            for (int i = 1; i < countGUI; i++)
            {
                if (countDB >= i)
                {
                    BetterListBox lbox = ((BetterListBox)groupBoxConditions.Controls["listBoxConditionType" + i.ToString()]);
                    lbox.SelectedItem = stepConditions.ElementAt(i - 1).Type;
                    int index = lbox.Items.IndexOf(lbox.SelectedItem);
                    lbox.SetSelected(index, true);
                    ((TextBox)groupBoxConditions.Controls["textBoxConditionSource" + i.ToString()]).Text          = stepConditions.ElementAt(i - 1).Source;
                    ((TextBox)groupBoxConditions.Controls["textBoxConditionTarget" + i.ToString()]).Text          = stepConditions.ElementAt(i - 1).TargetValue;
                    ((TextBox)groupBoxConditions.Controls["textBoxConditionSourceAttribute" + i.ToString()]).Text = stepConditions.ElementAt(i - 1).SourceAttribute;
                    ((TextBox)groupBoxConditions.Controls["textBoxConditionTargetAttribute" + i.ToString()]).Text = stepConditions.ElementAt(i - 1).TargetAttribute;
                }
                else
                {
                    ((BetterListBox)groupBoxConditions.Controls["listBoxConditionType" + i.ToString()]).SelectedItem = 0;
                    ((BetterListBox)groupBoxConditions.Controls["listBoxConditionType" + i.ToString()]).SetSelected(0, true);
                    ((TextBox)groupBoxConditions.Controls["textBoxConditionSource" + i.ToString()]).Text          = "";
                    ((TextBox)groupBoxConditions.Controls["textBoxConditionTarget" + i.ToString()]).Text          = "";
                    ((TextBox)groupBoxConditions.Controls["textBoxConditionSourceAttribute" + i.ToString()]).Text = "";
                    ((TextBox)groupBoxConditions.Controls["textBoxConditionTargetAttribute" + i.ToString()]).Text = "";
                }
            }
        }
예제 #3
0
        private void listBox_Scroll(object Sender, BetterListBox.BetterListBoxScrollArgs e)
        {
            BetterListBox listBox = (BetterListBox)Sender;

            if (listBox.SelectedIndex != -1)
            {
                listBox.SetSelected(listBox.SelectedIndex, false);
            }
            listBox.SetSelected(e.Top, true);
        }