Example #1
0
        public static void Show(CoreAccessRequestedEventArgs e)
        {
            var frm = new FormAccessRequest(e);

            DialogResult res = frm.ShowDialog();

            if (res == DialogResult.Yes)
            {
                e.Allow = true;
            }
            else if (res == DialogResult.No)
            {
                e.Allow = false;
            }
            else if (res == DialogResult.OK) //Create rule.
            {
                e.CreateRule   = true;
                e.CategoryName = "User Created Rules";
                e.ItemName     = "User Created Rules";
                e.RuleName     = Path.GetFileName(e.ProtectedPath) + " for " +
                                 Path.GetFileName(e.ProcessPath);

                if (frm.radioAllow.Checked)
                {
                    e.Allow = true;
                }
                else if (frm.radioBlock.Checked)
                {
                    e.Allow = false;
                }
            }
        }
Example #2
0
 private static void AccessRequested(object sender, CoreAccessRequestedEventArgs ea)
 {
     FormAccessRequest.Show(ea);
 }