Skip to content

Commit a9d8fff

Browse files
Update example
1 parent 145d767 commit a9d8fff

Some content is hidden

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

48 files changed

+13395
-10830
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.30413.136
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.1.32210.238
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorApp_WordProcessing", "BlazorApp_WordProcessing\BlazorApp_WordProcessing.csproj", "{CCF14068-8A84-4EE3-B1C1-E0F9C5C8DC8E}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorApp_WordDocumentAPI", "BlazorApp_WordDocumentAPI\BlazorApp_WordDocumentAPI.csproj", "{0C963550-107E-4F1E-9B55-942AF9658D1E}"
77
EndProject
88
Global
99
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1010
Debug|Any CPU = Debug|Any CPU
1111
Release|Any CPU = Release|Any CPU
1212
EndGlobalSection
1313
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14-
{CCF14068-8A84-4EE3-B1C1-E0F9C5C8DC8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15-
{CCF14068-8A84-4EE3-B1C1-E0F9C5C8DC8E}.Debug|Any CPU.Build.0 = Debug|Any CPU
16-
{CCF14068-8A84-4EE3-B1C1-E0F9C5C8DC8E}.Release|Any CPU.ActiveCfg = Release|Any CPU
17-
{CCF14068-8A84-4EE3-B1C1-E0F9C5C8DC8E}.Release|Any CPU.Build.0 = Release|Any CPU
14+
{0C963550-107E-4F1E-9B55-942AF9658D1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{0C963550-107E-4F1E-9B55-942AF9658D1E}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{0C963550-107E-4F1E-9B55-942AF9658D1E}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{0C963550-107E-4F1E-9B55-942AF9658D1E}.Release|Any CPU.Build.0 = Release|Any CPU
1818
EndGlobalSection
1919
GlobalSection(SolutionProperties) = preSolution
2020
HideSolutionNode = FALSE
2121
EndGlobalSection
2222
GlobalSection(ExtensibilityGlobals) = postSolution
23-
SolutionGuid = {0677011F-A5CF-433F-AEC6-1731770C7FCD}
23+
SolutionGuid = {A3684369-2C12-41B2-9529-F776B1CAFC0A}
2424
EndGlobalSection
2525
EndGlobal
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
2-
<Router AppAssembly="@typeof(Program).Assembly">
1+
<Router AppAssembly="@typeof(App).Assembly">
32
<Found Context="routeData">
43
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
4+
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
55
</Found>
66
<NotFound>
7+
<PageTitle>Not found</PageTitle>
78
<LayoutView Layout="@typeof(MainLayout)">
8-
<p>Sorry, there's nothing at this address.</p>
9+
<p role="alert">Sorry, there's nothing at this address.</p>
910
</LayoutView>
1011
</NotFound>
1112
</Router>
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
23
<PropertyGroup>
3-
<TargetFramework>net5.0</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
47
</PropertyGroup>
8+
59
<ItemGroup>
6-
<PackageReference Include="DevExpress.Blazor" Version="21.1.6" />
7-
<PackageReference Include="DevExpress.Document.Processor" Version="21.1.6" />
8-
<PackageReference Include="MailKit" Version="2.9.0" />
10+
<PackageReference Include="DevExpress.Blazor" Version="21.2.6" />
11+
<PackageReference Include="DevExpress.Document.Processor" Version="21.2.6" />
12+
<PackageReference Include="MailKit" Version="3.1.1" />
913
</ItemGroup>
14+
1015
<ItemGroup>
1116
<None Update="Data\MailMerge.rtf">
1217
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
1318
</None>
1419
</ItemGroup>
20+
1521
</Project>

CS/BlazorApp_WordProcessing/Data/SampleData.cs renamed to CS/BlazorApp_WordDocumentAPI/Data/SampleData.cs

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Data;
1+
using System.Data;
42

5-
namespace BlazorApp_WordProcessing
3+
namespace BlazorApp_WordDocumentAPI
64
{
7-
class SampleData
5+
6+
public class SampleData
87
{
98
DataTable dataTable;
9+
public List<Recipient> RecipientList { get; }
10+
public List<Sender> SenderList { get; }
1011

1112
public SampleData()
1213
{
13-
dataTable = new DataTable();
14-
CreateDataTableColumns(dataTable);
1514
RecipientList = CreateRecipientList();
1615
SenderList = CreateSenderList();
16+
dataTable = new DataTable();
17+
CreateDataTableColumns(dataTable);
1718
}
1819

19-
public List<Recipient> RecipientList { get; }
20-
public List<Sender> SenderList { get; }
21-
2220
void CreateDataTableColumns(DataTable dataTable)
2321
{
2422
dataTable.Columns.Add("FirstName", typeof(string));
@@ -33,32 +31,34 @@ void CreateDataTableColumns(DataTable dataTable)
3331
dataTable.Columns.Add("Email", typeof(string));
3432
}
3533

36-
List<Recipient> CreateRecipientList()
37-
{
38-
return new List<Recipient>() {
39-
new Recipient("Alfreds Futterkiste", "Maria Anders", "Sales Representative",
40-
"Obere Str. 57", "Berlin", "12209", "mariaanders@example.com"),
41-
new Recipient("Ana Trujillo Emparedados y helados", "Ana Trujillo", "Owner", "Avda. de la Constitucion, 2222", "Mexico D.F.", "5021", "anatrujillo@example.com"),
42-
new Recipient("Antonio Moreno Taqueria", "Antonio Moreno", "Owner", "Mataderos 2312", "Mexico D.F.", "5023", "antoniomoreno@example.com"),
43-
new Recipient("Around the Horn", "Thomas Hardy", "Sales Representative", "120 Hanover Sq.", "London", "WA1 1DP", "thomashardy@example.com"),
44-
new Recipient("Berglunds snabbkop", "Christina Berglund", "Order Administrator", "Berguvsvegen 8", "Luleе", "S-958 22", "christinaberglund@example.com"),
45-
new Recipient("Blauer See Delikatessen", "Hanna Moos", "Sales Representative", "Forsterstr. 57", "Mannheim", "68306", "hannamoos@example.com"),
46-
new Recipient("Blondel pure et fils", "Frederique Citeaux", "Marketing Manager", "24 Place Kleber", "Strasbourg", "67000", "frederiqueciteaux@example.com"),
47-
new Recipient("Bolido Comidas preparadas", "Martin Sommer", "Owner", "C-Araquil, 67", "Madrid", "28023", "martinsommer@example.com"),
48-
new Recipient("Bon app'", "Laurence Lebihan", "Owner", "12, rue des Bouchers", "Marseille", "13008", "laurencelebihan@example.com")
49-
};
50-
}
34+
List<Recipient> CreateRecipientList() => new List<Recipient>() {
35+
new Recipient("Alfreds Futterkiste", "Maria Anders", "Sales Representative",
36+
"Obere Str. 57", "Berlin", "12209", "mariaanders@example.com"),
37+
new Recipient("Ana Trujillo Emparedados y helados", "Ana Trujillo", "Owner",
38+
"Avda. de la Constitucion, 2222", "Mexico D.F.", "5021", "anatrujillo@example.com"),
39+
new Recipient("Antonio Moreno Taqueria", "Antonio Moreno", "Owner",
40+
"Mataderos 2312", "Mexico D.F.", "5023", "antoniomoreno@example.com"),
41+
new Recipient("Around the Horn", "Thomas Hardy", "Sales Representative",
42+
"120 Hanover Sq.", "London", "WA1 1DP", "thomashardy@example.com"),
43+
new Recipient("Berglunds snabbkop", "Christina Berglund", "Order Administrator",
44+
"Berguvsvegen 8", "Lulee", "S-958 22", "christinaberglund@example.com"),
45+
new Recipient("Blauer See Delikatessen", "Hanna Moos", "Sales Representative",
46+
"Forsterstr. 57", "Mannheim", "68306", "hannamoos@example.com"),
47+
new Recipient("Blondel pure et fils", "Frederique Citeaux", "Marketing Manager",
48+
"24 Place Kleber", "Strasbourg", "67000", "frederiqueciteaux@example.com"),
49+
new Recipient("Bolido Comidas preparadas", "Martin Sommer", "Owner",
50+
"C-Araquil, 67", "Madrid", "28023", "martinsommer@example.com"),
51+
new Recipient("Bon app'", "Laurence Lebihan", "Owner", "12, rue des Bouchers",
52+
"Marseille", "13008", "laurencelebihan@example.com")
53+
};
5154

52-
List<Sender> CreateSenderList()
53-
{
54-
return new List<Sender>() {
55-
new Sender("Nancy", "Davolio", "Sales Representative"),
56-
new Sender("Andrew", "Fuller", "Vice President, Sales"),
57-
new Sender("Janet", "Leverling", "Sales Representative"),
58-
new Sender("Margaret", "Peacock", "Sales Representative"),
59-
new Sender("Steven", "Buchanan", "Sales Manager")
60-
};
61-
}
55+
List<Sender> CreateSenderList() => new List<Sender>() {
56+
new Sender("Nancy", "Davolio", "Sales Representative"),
57+
new Sender("Andrew", "Fuller", "Vice President, Sales"),
58+
new Sender("Janet", "Leverling", "Sales Representative"),
59+
new Sender("Margaret", "Peacock", "Sales Representative"),
60+
new Sender("Steven", "Buchanan", "Sales Manager")
61+
};
6262

6363
public DataTable GetDataSource(Sender sender, Recipient recipient)
6464
{
@@ -77,6 +77,7 @@ public DataTable GetDataSource(Sender sender, Recipient recipient)
7777
}
7878
}
7979

80+
#region RecipientClass
8081
public class Recipient
8182
{
8283
public Recipient(string companyName, string contactName, string contactTitle,
@@ -99,7 +100,9 @@ public Recipient(string companyName, string contactName, string contactTitle,
99100
public string PostalCode { get; set; }
100101
public string Email { get; set; }
101102
}
103+
#endregion
102104

105+
#region SenderClass
103106
public class Sender
104107
{
105108
public Sender(string firstName, string lastName, string title)
@@ -114,4 +117,5 @@ public Sender(string firstName, string lastName, string title)
114117
public string Title { get; set; }
115118
public string FullName => $"{FirstName} {LastName}";
116119
}
120+
#endregion
117121
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
@page
2+
@model BlazorApp_WordDocumentAPI.Pages.ErrorModel
3+
4+
<!DOCTYPE html>
5+
<html lang="en">
6+
7+
<head>
8+
<meta charset="utf-8" />
9+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
10+
<title>Error</title>
11+
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
12+
<link href="~/css/site.css" rel="stylesheet" asp-append-version="true" />
13+
</head>
14+
15+
<body>
16+
<div class="main">
17+
<div class="content px-4">
18+
<h1 class="text-danger">Error.</h1>
19+
<h2 class="text-danger">An error occurred while processing your request.</h2>
20+
21+
@if (Model.ShowRequestId)
22+
{
23+
<p>
24+
<strong>Request ID:</strong> <code>@Model.RequestId</code>
25+
</p>
26+
}
27+
28+
<h3>Development Mode</h3>
29+
<p>
30+
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
31+
</p>
32+
<p>
33+
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
34+
It can result in displaying sensitive information from exceptions to end users.
35+
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
36+
and restarting the app.
37+
</p>
38+
</div>
39+
</div>
40+
</body>
41+
42+
</html>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.AspNetCore.Mvc.RazorPages;
3+
using System.Diagnostics;
4+
5+
namespace BlazorApp_WordDocumentAPI.Pages
6+
{
7+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
8+
[IgnoreAntiforgeryToken]
9+
public class ErrorModel : PageModel
10+
{
11+
public string? RequestId { get; set; }
12+
13+
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
14+
15+
private readonly ILogger<ErrorModel> _logger;
16+
17+
public ErrorModel(ILogger<ErrorModel> logger)
18+
{
19+
_logger = logger;
20+
}
21+
22+
public void OnGet()
23+
{
24+
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)