|
|
@ -24,18 +24,18 @@ public class Worker : IHostedService |
|
|
|
|
|
|
|
|
// Create the registry entries necessary to handle URI protocol activations.
|
|
|
// Create the registry entries necessary to handle URI protocol activations.
|
|
|
//
|
|
|
//
|
|
|
// Note: the application MUST be run once as an administrator for this to work,
|
|
|
|
|
|
// so this should typically be done by a dedicated installer or a setup script.
|
|
|
|
|
|
//
|
|
|
|
|
|
// Alternatively, the application can be packaged and use windows.protocol to
|
|
|
// Alternatively, the application can be packaged and use windows.protocol to
|
|
|
// register the protocol handler/custom URI scheme with the operation system.
|
|
|
// register the protocol handler/custom URI scheme with the operation system.
|
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
root = Registry.ClassesRoot.OpenSubKey("com.openiddict.sandbox.winforms.client"); |
|
|
// Note: this sample creates the entry under the current user account (as it doesn't
|
|
|
|
|
|
// require administrator rights), but the registration can also be added globally
|
|
|
|
|
|
// in HKEY_CLASSES_ROOT (in this case, it should be added by a dedicated installer).
|
|
|
|
|
|
root = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Classes\\com.openiddict.sandbox.winforms.client"); |
|
|
|
|
|
|
|
|
if (root is null) |
|
|
if (root is null) |
|
|
{ |
|
|
{ |
|
|
root = Registry.ClassesRoot.CreateSubKey("com.openiddict.sandbox.winforms.client"); |
|
|
root = Registry.CurrentUser.CreateSubKey("SOFTWARE\\Classes\\com.openiddict.sandbox.winforms.client"); |
|
|
root.SetValue(string.Empty, "URL:com.openiddict.sandbox.winforms.client"); |
|
|
root.SetValue(string.Empty, "URL:com.openiddict.sandbox.winforms.client"); |
|
|
root.SetValue("URL Protocol", string.Empty); |
|
|
root.SetValue("URL Protocol", string.Empty); |
|
|
|
|
|
|
|
|
|