-
Notifications
You must be signed in to change notification settings - Fork 2
/
CustomApplicationWindowTemplate.cs
80 lines (71 loc) · 4.12 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using DevExpress.CodeParser.VB;
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 dxTestSolution.Module.Controllers;
using Microsoft.AspNetCore.Components;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace InfoPanelEF.Blazor.Server.Templates {
public class CustomApplicationWindowTemplate : WindowTemplateBase, ISupportActionsToolbarVisibility, ISelectionDependencyToolbar, ICustomTemplate, INotifyPropertyChanged {
private string customString;
public CustomApplicationWindowTemplate() {
NavigateBackActionControl = new NavigateBackActionControl();
AddActionControl(NavigateBackActionControl);
AccountComponent = new AccountComponentAdapter();
AddActionControls(AccountComponent.ActionControls);
ShowNavigationItemActionControl = new ShowNavigationItemActionControl();
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 ShowNavigationItemActionControl ShowNavigationItemActionControl { get; }
public DxToolbarAdapter Toolbar { get; }
public string AboutInfoString { get; set; }
public string CustomString { get => customString; set { customString = value; OnPropertyChanged(); } }
void ISupportActionsToolbarVisibility.SetVisible(bool isVisible) => IsActionsToolbarVisible = isVisible;
public event PropertyChangedEventHandler PropertyChanged;
void OnPropertyChanged([CallerMemberName] string propertyName = null) {
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public void SetCustomString(string _customString) {
CustomString = _customString;
}
}
}