-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathLogonActionCustomizationController.cs
More file actions
40 lines (34 loc) · 1.75 KB
/
LogonActionCustomizationController.cs
File metadata and controls
40 lines (34 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using DevExpress.Blazor;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Blazor.Components.Models;
using DevExpress.ExpressApp.Blazor.Templates.ActionControls;
using DevExpress.ExpressApp.Blazor.Templates.Toolbar.ActionControls;
using DevExpress.ExpressApp.SystemModule;
namespace Security.Extensions.Controllers;
// A controller that highlights the accept button ("OK") and allows submitting the form by pressing the Enter key.
public class LogonActionCustomizationController : WindowController {
private ActionControlsSiteController actionControlsSiteController;
private void ActionControlsSiteController_CustomizeActionControl(object sender, ActionControlEventArgs e) {
if (e.ActionControl.ActionId is "AcceptLogonParameters" && e.ActionControl is DxActionItemActionControlBase<DxToolbarItemModel> toolbarItemAction) {
toolbarItemAction.Model.RenderStyle = ButtonRenderStyle.Primary;
}
}
protected override void OnFrameAssigned() {
base.OnFrameAssigned();
Active[ControllerActiveKey] = !Application.Security.IsAuthenticated;
}
protected override void OnActivated() {
base.OnActivated();
actionControlsSiteController = Frame.GetController<ActionControlsSiteController>();
if (actionControlsSiteController is not null) {
actionControlsSiteController.CustomizeActionControl += ActionControlsSiteController_CustomizeActionControl;
}
}
protected override void OnDeactivated() {
base.OnDeactivated();
if (actionControlsSiteController is not null) {
actionControlsSiteController.CustomizeActionControl -= ActionControlsSiteController_CustomizeActionControl;
actionControlsSiteController = null;
}
}
}