RequestContextExtensionsSetPreferenceAsync Method |
Version 130.1.90
Set the value associated with preference name. If value is null the
preference will be restored to its default value. If setting the preference
fails then error will be populated with a detailed description of the
problem. This method must be called on the CEF UI thread.
Preferences set via the command-line usually cannot be modified.
Namespace: CefSharpAssembly: CefSharp (in CefSharp.dll) Version: 129.0.110.0 (129.0.110.0)
Syntax public static Task<SetPreferenceResponse> SetPreferenceAsync(
this IRequestContext requestContext,
string name,
Object value
)
public:
[ExtensionAttribute]
static Task<SetPreferenceResponse^>^ SetPreferenceAsync(
IRequestContext^ requestContext,
String^ name,
Object^ value
)
Parameters
- requestContext IRequestContext
- request context
- name String
- preference key
- value Object
- preference value
Return Value
TaskSetPreferenceResponsereturns
Success true if successfull, false otherwise.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IRequestContext. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Remarks Use Cef.UIThreadTaskFactory to execute this method if required,
OnContextInitialized and ChromiumWebBrowser.IsBrowserInitializedChanged are both
executed on the CEF UI thread, so can be called directly.
When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main
application thread will be the CEF UI thread.
See Also