示例#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;
                }
            }
        }
示例#2
0
文件: Program.cs 项目: y11en/FileWall
 private static void AccessRequested(object sender, CoreAccessRequestedEventArgs ea)
 {
     FormAccessRequest.Show(ea);
 }