Skip to content

Commit 6d6b93e

Browse files
committed
update cs solution
1 parent 82be442 commit 6d6b93e

File tree

66 files changed

+49
-105444
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+49
-105444
lines changed

CS/.gitattributes

-2
This file was deleted.

CS/Pages/Index.cshtml

+1-46
Original file line numberDiff line numberDiff line change
@@ -11,54 +11,9 @@
1111
<!DOCTYPE html>
1212
<html lang="en">
1313
<head>
14-
<!-- Add bundled resources. -->
1514
<link href="~/css/site.min.css" rel="stylesheet" />
1615
<script src="~/js/site.min.js"></script>
17-
<script type="text/javascript">
18-
//<![CDATA[
19-
function onBeforeRender(sender) {
20-
let dashboardControl = sender;
21-
22-
dashboardControl.registerExtension(new DevExpress.Dashboard.DashboardPanelExtension(dashboardControl));
23-
24-
let toolbarExtension = dashboardControl.findExtension("designerToolbar");
25-
26-
if (toolbarExtension) {
27-
toolbarExtension.on("preparing", customizeDesignerToolbar);
28-
}
29-
}
30-
31-
function customizeDesignerToolbar(e) {
32-
let dashboardControl = e.component;
33-
34-
e.items.unshift({
35-
widget: 'dxButton',
36-
location: 'before',
37-
cssClass: 'dx-refresh-custom-button',
38-
options: {
39-
text: 'DB1',
40-
type: 'default'
41-
},
42-
onClick: () => {
43-
dashboardControl.remoteService.headers = { "database": "nwind" };
44-
dashboardControl.reloadData();
45-
}
46-
}, {
47-
widget: 'dxButton',
48-
location: 'before',
49-
cssClass: 'dx-refresh-custom-button',
50-
options: {
51-
text: 'DB2',
52-
type: 'default'
53-
},
54-
onClick: () => {
55-
dashboardControl.remoteService.headers = { "database": "nwind2" };
56-
dashboardControl.reloadData();
57-
}
58-
});
59-
}
60-
//]]>
61-
</script>
16+
<script src="~/js/customizeToolbar.js"></script>
6217
</head>
6318
<body>
6419
<!-- Add the Web Dashboard with the "clientDashboardControl1" name to a View, specify its size, and set the Working Mode to Designer. -->

CS/Program.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,12 @@
3636
if (e.ConnectionName == "nwind") {
3737
IHttpContextAccessor httpContextAccessor = serviceProvider.GetService<IHttpContextAccessor>();
3838
IHeaderDictionary headers = httpContextAccessor.HttpContext.Request.Headers;
39-
string connectionString = string.Format(
40-
"XpoProvider=InMemoryDataStore;Read Only=true;Data Source=Data\\{0}.xml",
41-
headers.ContainsKey("database") ? headers["database"] : "nwind");
39+
string dbKey = headers.ContainsKey("database") ? headers["database"] : "nwind";
40+
string connectionString = dbKey switch {
41+
"nwind" => "XpoProvider=InMemoryDataStore;Read Only=true;Data Source=Data\\nwind.xml",
42+
"nwind2" => "XpoProvider=InMemoryDataStore;Read Only=true;Data Source=Data\\nwind2.xml",
43+
_ => throw new ArgumentOutOfRangeException("Incorrect database name")
44+
};
4245

4346
e.ConnectionParameters = new CustomStringConnectionParameters(connectionString);
4447
}

CS/WebDashboardAspNetCore.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
<ItemGroup>
1515
<Folder Include="Data\Dashboards\" />
16+
<Folder Include="wwwroot\css\" />
1617
</ItemGroup>
1718

1819
</Project>

CS/wwwroot/css/site.css

-18
This file was deleted.

0 commit comments

Comments
 (0)