Skip to content

Commit 0903ecf

Browse files
feat: 2.0.0
1 parent 376e7be commit 0903ecf

47 files changed

Lines changed: 222 additions & 181 deletions

Some content is hidden

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

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 Blazor Desktop Contributors
3+
Copyright (c) 2023 Blazor Desktop Contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Blazor Desktop allows you to create desktop apps using Blazor. Apps run inside o
1010
The easiest way to get started with Blazor Desktop is to install the templates, you can do so using the dotnet cli as follows:
1111

1212
```powershell
13-
dotnet new --install BlazorDesktop.Templates::1.1.0
13+
dotnet new --install BlazorDesktop.Templates::2.0.0
1414
```
1515

1616
Once you have the templates installed, you can either create a new project from the template either in Visual Studio in the template picker:
@@ -25,9 +25,9 @@ dotnet new blazordesktop -n MyBlazorApp
2525
The Blazor Desktop template is set up very similar to the Blazor WASM template, you can see the `Program.cs` file here:
2626

2727
```csharp
28-
using BlazorDesktop.Hosting;
2928
using HelloWorld;
3029
using HelloWorld.Data;
30+
using BlazorDesktop.Hosting;
3131
using Microsoft.AspNetCore.Components.Web;
3232

3333
var builder = BlazorDesktopHostBuilder.CreateDefault(args);
@@ -90,8 +90,7 @@ It is also possible to configure these values through `appsettings.json` like so
9090
},
9191
"Logging": {
9292
"LogLevel": {
93-
"Default": "Information",
94-
"Microsoft.Hosting.Lifetime": "Information"
93+
"Default": "Information"
9594
}
9695
}
9796
}
@@ -139,6 +138,7 @@ In terms of handling things such as the close button, you can inject the Window
139138
Here is an example changing `MainLayout.razor`:
140139
```razor
141140
@using System.Windows
141+
142142
@inherits LayoutComponentBase
143143
@inject Window window
144144

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This is the list versions being supported with security updates.
66

77
| Version | Supported |
88
| ------- | ------------------ |
9-
| 6.x.x | :white_check_mark: |
9+
| 2.x.x | :white_check_mark: |
1010

1111
## Reporting a Vulnerability
1212

src/BlazorDesktop.Sample/App.razor

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
99
</Found>
1010
<NotFound>
11-
<PageTitle>Not found</PageTitle>
1211
<LayoutView Layout="@typeof(MainLayout)">
1312
<p role="alert">Sorry, there's nothing at this address.</p>
1413
</LayoutView>

src/BlazorDesktop.Sample/BlazorDesktop.Sample.csproj

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0-windows</TargetFramework>
5-
<Nullable>enable</Nullable>
6-
<ImplicitUsings>enable</ImplicitUsings>
4+
<TargetFramework>net7.0-windows10.0.22000.0</TargetFramework>
5+
<OutputType>WinExe</OutputType>
76
<UseWPF>true</UseWPF>
87
</PropertyGroup>
98

src/BlazorDesktop.Sample/Data/WeatherForecast.cs

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,30 @@
22
// The Blazor Desktop Contributors licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
namespace BlazorDesktop.Data
5+
namespace BlazorDesktop.Sample.Data;
6+
7+
/// <summary>
8+
/// A weather forecast
9+
/// </summary>
10+
public class WeatherForecast
611
{
712
/// <summary>
8-
/// A weather forecast
13+
/// The date
914
/// </summary>
10-
public class WeatherForecast
11-
{
12-
/// <summary>
13-
/// The date
14-
/// </summary>
15-
public DateTime Date { get; set; }
15+
public DateTime Date { get; set; }
1616

17-
/// <summary>
18-
/// The temperature in celcius
19-
/// </summary>
20-
public int TemperatureC { get; set; }
17+
/// <summary>
18+
/// The temperature in celcius
19+
/// </summary>
20+
public int TemperatureC { get; set; }
2121

22-
/// <summary>
23-
/// The temperature in fahrenheit
24-
/// </summary>
25-
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
22+
/// <summary>
23+
/// The temperature in fahrenheit
24+
/// </summary>
25+
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
2626

27-
/// <summary>
28-
/// The summary
29-
/// </summary>
30-
public string? Summary { get; set; }
31-
}
27+
/// <summary>
28+
/// The summary
29+
/// </summary>
30+
public string? Summary { get; set; }
3231
}

src/BlazorDesktop.Sample/Data/WeatherForecastService.cs

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,33 @@
22
// The Blazor Desktop Contributors licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
namespace BlazorDesktop.Data
5+
namespace BlazorDesktop.Sample.Data;
6+
7+
/// <summary>
8+
/// The weather forecast service
9+
/// </summary>
10+
public class WeatherForecastService
611
{
712
/// <summary>
8-
/// The weather forecast service
13+
/// The list of summaries
914
/// </summary>
10-
public class WeatherForecastService
15+
private static readonly string[] s_summaries = new[]
1116
{
12-
/// <summary>
13-
/// The list of summaries
14-
/// </summary>
15-
private static readonly string[] s_summaries = new[]
16-
{
17-
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
18-
};
17+
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
18+
};
1919

20-
/// <summary>
21-
/// Gets the weather forecast asynchronously
22-
/// </summary>
23-
/// <param name="startDate">The starting date</param>
24-
/// <returns>An array of <see cref="WeatherForecast"/></returns>
25-
public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
20+
/// <summary>
21+
/// Gets the weather forecast asynchronously
22+
/// </summary>
23+
/// <param name="startDate">The starting date</param>
24+
/// <returns>An array of <see cref="WeatherForecast"/></returns>
25+
public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
26+
{
27+
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
2628
{
27-
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
28-
{
29-
Date = startDate.AddDays(index),
30-
TemperatureC = Random.Shared.Next(-20, 55),
31-
Summary = s_summaries[Random.Shared.Next(s_summaries.Length)]
32-
}).ToArray());
33-
}
29+
Date = startDate.AddDays(index),
30+
TemperatureC = Random.Shared.Next(-20, 55),
31+
Summary = s_summaries[Random.Shared.Next(s_summaries.Length)]
32+
}).ToArray());
3433
}
3534
}

src/BlazorDesktop.Sample/Pages/Counter.razor

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
@page "/counter"
66

7-
<PageTitle>Counter</PageTitle>
8-
97
<h1>Counter</h1>
108

119
<p role="status">Current count: @currentCount</p>

src/BlazorDesktop.Sample/Pages/FetchData.razor

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@
22
@* The Blazor Desktop Contributors licenses this file to you under the MIT license. *@
33
@* See the LICENSE file in the project root for more information. *@
44

5-
@page "/fetchdata"
6-
7-
@using BlazorDesktop.Data
5+
@using BlazorDesktop.Sample.Data
86

7+
@page "/fetchdata"
98
@inject WeatherForecastService ForecastService
109

11-
<PageTitle>Weather forecast</PageTitle>
12-
1310
<h1>Weather forecast</h1>
1411

15-
<p>This component demonstrates fetching data from the server.</p>
12+
<p>This component demonstrates fetching data from a service.</p>
1613

1714
@if (forecasts == null)
1815
{

src/BlazorDesktop.Sample/Pages/Index.razor

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
@page "/"
66

7-
<PageTitle>Index</PageTitle>
8-
97
<h1>Hello, world!</h1>
108

119
Welcome to your new app.

0 commit comments

Comments
 (0)