-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomApplicationWindowTemplate.cs
65 lines (63 loc) · 3.5 KB
/
CustomApplicationWindowTemplate.cs
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Blazor.Components.Models;
using DevExpress.ExpressApp.Blazor.Templates;
using DevExpress.ExpressApp.Blazor.Templates.Navigation.ActionControls;
using DevExpress.ExpressApp.Blazor.Templates.Security.ActionControls;
using DevExpress.ExpressApp.Blazor.Templates.Toolbar.ActionControls;
using DevExpress.ExpressApp.Templates;
using DevExpress.ExpressApp.Templates.ActionControls;
using DevExpress.Persistent.Base;
using Microsoft.AspNetCore.Components;
using System.Collections.Generic;
namespace XafBlazorCustomTemplateSample.Blazor.Server.Templates
{
public class CustomApplicationWindowTemplate : WindowTemplateBase, ISupportActionsToolbarVisibility, ISelectionDependencyToolbar
{
public CustomApplicationWindowTemplate()
{
NavigateBackActionControl = new NavigateBackActionControl();
AddActionControl(NavigateBackActionControl);
AccountComponent = new AccountComponentAdapter();
AddActionControls(AccountComponent.ActionControls);
ShowNavigationItemActionControl = new CustomShowNavigationItemActionControl();
AddActionControl(ShowNavigationItemActionControl);
IsActionsToolbarVisible = true;
Toolbar = new DxToolbarAdapter(new DxToolbarModel());
Toolbar.AddActionContainer(nameof(PredefinedCategory.ObjectsCreation));
Toolbar.AddActionContainer(nameof(PredefinedCategory.Save));
Toolbar.AddActionContainer("Close");
Toolbar.AddActionContainer(nameof(PredefinedCategory.Export));
Toolbar.AddActionContainer(nameof(PredefinedCategory.UndoRedo));
Toolbar.AddActionContainer(nameof(PredefinedCategory.Edit));
Toolbar.AddActionContainer(nameof(PredefinedCategory.RecordEdit));
Toolbar.AddActionContainer(nameof(PredefinedCategory.RecordsNavigation));
Toolbar.AddActionContainer(nameof(PredefinedCategory.View));
Toolbar.AddActionContainer(nameof(PredefinedCategory.Reports));
Toolbar.AddActionContainer(nameof(PredefinedCategory.Search));
Toolbar.AddActionContainer(nameof(PredefinedCategory.Filters));
Toolbar.AddActionContainer(nameof(PredefinedCategory.FullTextSearch));
Toolbar.AddActionContainer(nameof(PredefinedCategory.Tools));
Toolbar.AddActionContainer("Diagnostic");
Toolbar.AddActionContainer(nameof(PredefinedCategory.Unspecified));
}
protected override IEnumerable<IActionControlContainer> GetActionControlContainers() => Toolbar.ActionContainers;
protected override RenderFragment CreateComponent() => CustomApplicationWindowTemplateComponent.Create(this);
protected override void BeginUpdate()
{
base.BeginUpdate();
((ISupportUpdate)Toolbar).BeginUpdate();
}
protected override void EndUpdate()
{
((ISupportUpdate)Toolbar).EndUpdate();
base.EndUpdate();
}
public bool IsActionsToolbarVisible { get; private set; }
public NavigateBackActionControl NavigateBackActionControl { get; }
public AccountComponentAdapter AccountComponent { get; }
public CustomShowNavigationItemActionControl ShowNavigationItemActionControl { get; }
public DxToolbarAdapter Toolbar { get; }
public string AboutInfoString { get; set; }
void ISupportActionsToolbarVisibility.SetVisible(bool isVisible) => IsActionsToolbarVisible = isVisible;
}
}