Class Form
Represents a form that contains a list of ControlBase objects.
Inherited Members
Namespace: DataWeb.Data
Assembly: DataWeb.Core.dll
Syntax
public sealed class Form
Remarks
Initializes a new instance of the Form class with the specified dependencies.
Constructors
Form(IReflectionService, IAppErrorService, IFormStore, IServiceProvider)
Represents a form that contains a list of ControlBase objects.
Declaration
public Form(IReflectionService reflectionService, IAppErrorService appErrorService, IFormStore formStore, IServiceProvider serviceProvider)
Parameters
Type | Name | Description |
---|---|---|
IReflectionService | reflectionService | The IReflectionService instance used for reflection operations. |
IAppErrorService | appErrorService | The IAppErrorService instance used for error handling. |
IFormStore | formStore | The IFormStore instance used for storing and retrieving forms. |
IServiceProvider | serviceProvider | The IServiceProvider instance used for dependency injection. |
Remarks
Initializes a new instance of the Form class with the specified dependencies.
Properties
Controls
Gets or sets the list of controls that belong to the form.
Declaration
public List<Control> Controls { get; set; }
Property Value
Type | Description |
---|---|
List<Control> |
IdMaster
Gets or sets the unique identifier.
Declaration
public string IdMaster { get; set; }
Property Value
Type | Description |
---|---|
string |
Name
Gets or sets the name of the form.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
InitAsync(FormData, CancellationToken)
Initializes the Form object with the specified FormData object.
Declaration
public Task InitAsync(FormData formData, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
FormData | formData | The FormData object. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
InitAsync(string, string, CancellationToken)
Initializes the Form object with the specified name and culture.
Declaration
public Task InitAsync(string name, string culture = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the form. |
string | culture | The culture of the form. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task | A Task representing the asynchronous operation. |
Exceptions
Type | Condition |
---|---|
Exception | Thrown when name or culture is null or empty. |
IsUserControl(Control, IUser)
Checks whether the specified ControlBase object is visible to the specified IUser object.
Declaration
public static bool IsUserControl(Control control, IUser user)
Parameters
Type | Name | Description |
---|---|---|
Control | control | The Control object. |
IUser | user | The IUser object. |
Returns
Type | Description |
---|---|
bool | True if the control is visible to the user; otherwise false. |
SetControlAsync(ControlData, CancellationToken)
Creates a new ControlBase object based on the specified ControlData object.
Declaration
public Task<Control> SetControlAsync(ControlData controlData, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
ControlData | controlData | The ControlData object. |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<Control> | A new ControlBase object. |
SetControlEvents(Control, ProvidedValue)
Sets the events for the specified ControlBase object based on the specified ProvidedValue object.
Declaration
public void SetControlEvents(Control control, Form.ProvidedValue providedValue)
Parameters
Type | Name | Description |
---|---|---|
Control | control | The Control object. |
Form.ProvidedValue | providedValue | The Form.ProvidedValue object. |