private string getRegValue(string keyName)
        {
            string keyValue = RegistryManagement.GetRegistryValue(keyName);

            return(keyValue);
        }
        private void bSave_Click(object sender, EventArgs e)
        {
            // get all of our values from the form components and save them using SetRegistryKey
            // TODO: we may want to confirm the settings with the user before proceeding
            bool confirmSave = true;
            // FIRST - if Permissions is blank, or ERROR, something likely went wrong so we should alert the user and NOT save
            string newPermString = permissionString.Text;

            if (newPermString == "" || newPermString == "KEYERROR")
            {
                MessageBox.Show("Issue with permission string. Not saving.");
                confirmSave = false;
            }
            else
            {
                RegistryManagement.SetRegistryValue("Permission", newPermString);
            }

            // encryption
            string wencSetting = comboEncryption.SelectedItem.ToString();

            if (confirmSave = true)
            {
                RegistryManagement.SetRegistryValue("Encryption", wencSetting);
            }
            ;

            // authentication
            string wauthSetting = comboAuthentication.SelectedItem.ToString();

            // if the user has select VncAuth we need to prompt them to set the password to be used
            if (wauthSetting == "VncAuth" && confirmSave == true)
            {
                MessageBox.Show("VNCAuth requires you to set a password. Hit OK to set a password...");
                System.Diagnostics.Process process = new System.Diagnostics.Process();
                process.StartInfo.UseShellExecute  = false;
                process.StartInfo.WorkingDirectory = @"C:\Program Files\RealVNC\vnc server\";
                process.StartInfo.FileName         = "cmd.exe";
                process.StartInfo.Arguments        = "/C vncpasswd.exe -service";
                process.Start();
                process.WaitForExit();
            }
            if (confirmSave == true)
            {
                RegistryManagement.SetRegistryValue("Authentication", wauthSetting);
            }

            // direct connections?
            bool wdirectSetting = cbDirect.Checked;

            switch (wdirectSetting)
            {
            case true:
                if (confirmSave == true)
                {
                    RegistryManagement.SetRegistryValue("AllowIpListenRfb", "1");
                }
                break;

            case false:
                if (confirmSave == true)
                {
                    RegistryManagement.SetRegistryValue("AllowIpListenRfb", "0");
                }

                break;
            }
            // cloud connections?
            bool wcloudSetting = cbCloudRfb.Checked;

            switch (wcloudSetting)
            {
            case true:
                if (confirmSave == true)
                {
                    RegistryManagement.SetRegistryValue("AllowCloudRfb", "1");
                }
                break;

            case false:
                if (confirmSave == true)
                {
                    RegistryManagement.SetRegistryValue("AllowCloudRfb", "0");
                }
                break;
            }
            // cloud relay?
            bool wcloudRelay = cbCloudRelay.Checked;

            switch (wcloudRelay)
            {
            case true:
                if (confirmSave == true)
                {
                    RegistryManagement.SetRegistryValue("AllowCloudRelay", "1");
                }
                break;

            case false:
                if (confirmSave == true)
                {
                    RegistryManagement.SetRegistryValue("AllowCloudRelay", "0");
                }
                break;
            }
            // query connect
            bool wqueryConnect = cbQryConn.Checked;

            switch (wqueryConnect)
            {
            case true:
                if (confirmSave == true)
                {
                    RegistryManagement.SetRegistryValue("QueryConnect", "1");
                }
                // as we're keeping it simple, we'll also set QueryOnlyIfLoggedOn
                if (confirmSave == true)
                {
                    RegistryManagement.SetRegistryValue("QueryOnlyIfLoggedOn", "1");
                }
                break;

            case false:
                if (confirmSave == true)
                {
                    RegistryManagement.SetRegistryValue("QueryConnect", "0");
                }
                // as we're keeping it simple, we'll also set QueryOnlyIfLoggedOn
                if (confirmSave == true)
                {
                    RegistryManagement.SetRegistryValue("QueryOnlyIfLoggedOn", "0");
                }
                break;
            }

            if (confirmSave == true)
            {
                MessageBox.Show("Now you've done the basic setup of VNC Server, install VNC Viewer and connect :)");
            }
            // do we really need to quit the app?
            // Application.Exit();
        }