Ejemplo n.º 1
0
        private void ApplyRuleButton_Click(object sender, EventArgs e)
        {
            if (!CheckFolderExist())
            {
                return;
            }

            if (list.SelectedItems.Count <= 0)
            {
                return;
            }

            RuleListItem item = list.SelectedItems[0] as RuleListItem;

            if (item == null)
            {
                return;
            }

            PropertiesFolderRuleApplyDialog propertiesFolderRuleApplyDialog = new PropertiesFolderRuleApplyDialog(item.Rule.ID, item.Rule.Name, folderName);

            propertiesFolderRuleApplyDialog.DialogEvent += PropertiesFolderRuleApplyDialog_DialogEvent;
            propertiesFolderRuleApplyDialog.Show();
            Enabled = false;
        }
Ejemplo n.º 2
0
        private void FillList()
        {
            int MaxRowWidth = 0;

            if (folderRulesDT != null)
            {
                folderRulesDT.Dispose();
            }

            folderRulesDT = Environment.FolderRuleData.GetFolderRules(folderID);             //обновление информации

            list.Items.Clear();

            if (folderRulesDT != null)
            {
                foreach (DataRow row in folderRulesDT.Rows)
                {
                    Rule         rule = new Rule(row);
                    RuleListItem item = new RuleListItem(rule, rule.Name);
                    item.ToolTipText = item.Text;
                    list.Items.Add(item);
                    if (MaxRowWidth < rule.Name.Length)
                    {
                        MaxRowWidth = rule.Name.Length;
                    }
                }
            }
            if (list.Items.Count > 0)
            {
                list.Items[0].Selected = true;
                list.Columns[0].Width  = MaxRowWidth < 68 ? Convert.ToInt32(5.8 * 68) : Convert.ToInt32(5.7 * MaxRowWidth);
            }
            LockButtons();
        }