Ejemplo n.º 1
0
        public UserVariableListControl()
        {
            this.InitializeComponent();

            this.collection = new UserVariableCollection();
            this.uniqueVariables = new List<string>();
        }
Ejemplo n.º 2
0
        public UserVariableListControl()
        {
            this.InitializeComponent();

            this.collection      = new UserVariableCollection();
            this.uniqueVariables = new List <string>();
        }
Ejemplo n.º 3
0
        private void btnIncludeDelete_Click(object sender, EventArgs e)
        {
            if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
            {
                var lvi = this.listView2.SelectedItems[0];
                if (lvi != null)
                {
                    var rule          = lvi.Tag as UserVariable;
                    var inheritedRule = lvi.Tag as InheritedVariableContainer;

                    if (rule != null)
                    {
                        var dialogResult = MessageBox.Show(
                            this,
                            "Are you sure you want to delete this rule?",
                            "Delete rule",
                            MessageBoxButtons.YesNo,
                            MessageBoxIcon.Exclamation,
                            MessageBoxDefaultButton.Button2);

                        if (dialogResult == DialogResult.Yes)
                        {
                            this.collection.Remove(rule.Name);
                            this.listView2.Items.Remove(lvi);
                        }
                    }
                    else if (inheritedRule != null)
                    {
                        var message = "The variable you have selected is inherited from a parent or the " +
                                      "global profile and cannot be deleted from this profile.";

                        MessageBox.Show(
                            this,
                            message,
                            this.btnIncludeDelete.Text);

                        return;
                    }
                    else
                    {
                        this.listView2.Items.Remove(lvi);
                    }

                    this.Items = this.Items;
                }
            }
        }
Ejemplo n.º 4
0
 private void AddVariables(Dictionary<string, UserVariable> variables, UserVariableCollection collection)
 {
     this.AddVariables(variables, collection.Values);
 }
Ejemplo n.º 5
0
        private void Add(UserVariable rule)
        {
            this.collection.Add(rule);

            this.Items = this.Items;
        }
Ejemplo n.º 6
0
        private void btnIncludeDelete_Click(object sender, EventArgs e)
        {
            if (this.listView2.SelectedItems != null && this.listView2.SelectedItems.Count > 0)
            {
                var lvi = this.listView2.SelectedItems[0];
                if (lvi != null)
                {
                    var rule = lvi.Tag as UserVariable;
                    var inheritedRule = lvi.Tag as InheritedVariableContainer;

                    if (rule != null)
                    {
                        var dialogResult = MessageBox.Show(
                            this,
                            "Are you sure you want to delete this rule?",
                            "Delete rule",
                            MessageBoxButtons.YesNo,
                            MessageBoxIcon.Exclamation,
                            MessageBoxDefaultButton.Button2);

                        if (dialogResult == DialogResult.Yes)
                        {
                            this.collection.Remove(rule.Name);
                            this.listView2.Items.Remove(lvi);
                        }
                    }
                    else if (inheritedRule != null)
                    {
                        var message = "The variable you have selected is inherited from a parent or the " +
                            "global profile and cannot be deleted from this profile.";

                        MessageBox.Show(
                            this,
                            message,
                            this.btnIncludeDelete.Text);

                        return;
                    }
                    else
                    {
                        this.listView2.Items.Remove(lvi);
                    }

                    this.Items = this.Items;
                }
            }
        }
Ejemplo n.º 7
0
 private void AddUserVariables(Dictionary<string, string> collection, UserVariableCollection variables)
 {
     this.AddUserVariables(collection, variables.Values);
 }
Ejemplo n.º 8
0
        private void Add(UserVariable rule)
        {
            this.collection.Add(rule);

            this.Items = this.Items;
        }