SalContext
Namespace: PPJ.Runtime.Windows
Assembly: PPJ.Runtime.50 (5.0.0.0)
Scopes the SAL window system variables and SQL binding context to a control on the current thread.
- C#
- VB.NET
public class SalContext : IDisposable
Public Class SalContext
Inherits IDisposable
Dispose nested contexts in reverse creation order on the same thread. A null control pushes an empty window context. A control without a created handle does not switch the window context, but still establishes the associated SQL context.
Example:
void RunInContext(System.Windows.Forms.Control control)
{
using (new PPJ.Runtime.Windows.SalContext(control))
{
System.Diagnostics.Debug.WriteLine(PPJ.Runtime.Sys.hWndItem);
}
// The previous window context has been restored.
}
Constructors
SalContext(ctrl)
Enters a non-root SAL context for the specified control.
| Name | Type | Description |
|---|---|---|
| ctrl | Control | The target control, or null to enter an empty window context. |
SalContext(ctrl, root)
Enters a SAL context with an explicit message-dispatch root setting.
| Name | Type | Description |
|---|---|---|
| ctrl | Control | The target control, or null to enter an empty window context. |
| root | Boolean | True to establish a root message-dispatch context; false for a nested context. |
SalContext(ctrl, locals)
Enters a non-root SAL context with local variables available for SQL binding.
| Name | Type | Description |
|---|---|---|
| ctrl | Control | The target control, or null to enter an empty window context. |
| locals | Object | The object exposing local SQL bind variables. |
Properties
Disposed
Boolean: Gets whether this context has already been disposed.
Methods
Dispose()
Restores the previous window context and disposes the associated SQL context.
Throws:
- InvalidOperationException This context has already been disposed.