示例#1
0
        private void Browse_Click(object sender, EventArgs e)
        {
            DialogResult result = openFileDialog.ShowDialog(); // Show the dialog.

            if (result == DialogResult.OK)                     // Test result.
            {
                appPath.Text          = openFileDialog.FileName;
                grantAppAuth.Enabled  = !firewall.HasAuthorization(openFileDialog.FileName);
                removeAppAuth.Enabled = firewall.HasAuthorization(openFileDialog.FileName);
                port.Enabled          = true;
            }
            else if (appPath.Text.Trim().Length == 0)
            {
                grantAppAuth.Enabled  = false;
                removeAppAuth.Enabled = false;
                port.Enabled          = false;
            }
        }