Bend.Settings.EnableContextMenu_Click C# (CSharp) Method

EnableContextMenu_Click() private method

private EnableContextMenu_Click ( object sender, RoutedEventArgs e ) : void
sender object
e System.Windows.RoutedEventArgs
return void
        private void EnableContextMenu_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                RegistryKey HKCU = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64);
                RegistryKey HKCU_STAR_SHELL = HKCU.CreateSubKey("Software");
                HKCU_STAR_SHELL = HKCU_STAR_SHELL.CreateSubKey("Classes");

                // Attempt to write the class id that describes bend
                {
                    RegistryKey HKCR_CLSID_UNIQUE = HKCU_STAR_SHELL.CreateSubKey("CLSID");
                    HKCR_CLSID_UNIQUE = HKCR_CLSID_UNIQUE.CreateSubKey("{29C436A6-392B-4069-8DF7-760271B08F67}");
                    HKCR_CLSID_UNIQUE.SetValue("", "Bend - A modern text editor (Explorer right click menu integration)");
                    string applicationId = "Bend.application, Culture = neutral, PublicKeyToken = 0000000000000000, processorArchitecture = x86";
                    HKCR_CLSID_UNIQUE.SetValue("AppId", applicationId);
                    HKCR_CLSID_UNIQUE.SetValue("DeploymentProviderUrl", "http://bend.codeplex.com/releases/clickonce/Bend.application");
                }

                // Write the registry entries that add bend to the right click menu
                HKCU_STAR_SHELL = HKCU_STAR_SHELL.CreateSubKey("*");
                HKCU_STAR_SHELL = HKCU_STAR_SHELL.CreateSubKey("Shell");
                RegistryKey BendShortcutKey = HKCU_STAR_SHELL.CreateSubKey("Bend");
                BendShortcutKey.SetValue("", "Bend file");
                string BendExePath = System.Reflection.Assembly.GetExecutingAssembly().Location;
                BendShortcutKey.SetValue("Icon", BendExePath + ",0");
                BendShortcutKey.CreateSubKey("Command").SetValue("", "rundll32.exe dfshim.dll, ShOpenVerbExtension {29C436A6-392B-4069-8DF7-760271B08F67} %1");
            }
            catch
            {
            }
            this.UpdateButtons();
        }