Example #1
0
        private void button_EditFilterRule_Click(object sender, EventArgs e)
        {
            if (listView_FilterRules.SelectedItems.Count != 1)
            {
                MessageBoxHelper.PrepToCenterMessageBoxOnForm(this);
                MessageBox.Show("Please select one filter rule to edit.", "Edit Filter Rule", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            System.Windows.Forms.ListViewItem item = listView_FilterRules.SelectedItems[0];
            FilterRule filterRule = (FilterRule)item.Tag;

            FilterRuleForm filterRuleForm = new FilterRuleForm(filterRule);

            filterRuleForm.StartPosition = FormStartPosition.CenterParent;
            filterRuleForm.ShowDialog();

            InitListView();
        }
Example #2
0
        private void button_AddFilter_Click(object sender, EventArgs e)
        {
            string     defaultAccessFlags = ((uint)FilterAPI.ALLOW_MAX_RIGHT_ACCESS).ToString();
            FilterRule filterRule         = new FilterRule();

            filterRule.IncludeFileFilterMask = "c:\\test\\*";
            filterRule.EventType             = (uint)(FilterAPI.EVENTTYPE.CREATED | FilterAPI.EVENTTYPE.DELETED | FilterAPI.EVENTTYPE.RENAMED | FilterAPI.EVENTTYPE.WRITTEN | FilterAPI.EVENTTYPE.READ | FilterAPI.EVENTTYPE.SECURITY_CHANGED);

            filterRule.MonitorIO  = 2863311530;
            filterRule.ControlIO  = 2863311530;
            filterRule.AccessFlag = (uint)FilterAPI.ALLOW_MAX_RIGHT_ACCESS;

            FilterRuleForm filterRuleForm = new FilterRuleForm(filterRule);

            filterRuleForm.StartPosition = FormStartPosition.CenterParent;
            filterRuleForm.ShowDialog();

            InitListView();
        }