Skip to content

Commit 6916889

Browse files
Initial Commit
0 parents  commit 6916889

File tree

385 files changed

+37878
-0
lines changed

Some content is hidden

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

385 files changed

+37878
-0
lines changed

979-8-8688-1789-2.jpg

22.5 KB
Loading
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"help": "https://go.microsoft.com/fwlink/?linkid=866610",
3+
"root": false,
4+
5+
"dependentFileProviders": {
6+
"add": {
7+
"fileSuffixToExtension": {
8+
"add": {
9+
"Base.cs": [
10+
".razor"
11+
],
12+
"Customized.cs": [
13+
".razor", ".cs"
14+
]
15+
}
16+
}
17+
}
18+
}
19+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Razor">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<RootNamespace>AdventureWorks.Client.Blazor.Common</RootNamespace>
6+
<AssemblyName>AdventureWorks.Client.Blazor.Common</AssemblyName>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<XomegaProjectType>Client.Blazor.Common</XomegaProjectType>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<SupportedPlatform Include="browser" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.0" />
17+
<PackageReference Include="Xomega.Framework.Blazor" Version="4.4.1" />
18+
</ItemGroup>
19+
20+
<ItemGroup>
21+
<ProjectReference Include="..\AdventureWorks.Client.Common\AdventureWorks.Client.Common.csproj" />
22+
</ItemGroup>
23+
24+
</Project>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<base href="/" />
7+
<link href="favicon.png" rel="icon" type="image/png" />
8+
9+
@* Bootstrap 5 *@
10+
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
11+
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
12+
<link href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css" rel="stylesheet">
13+
@* Xomega Framework *@
14+
<link href="_content/Xomega.Framework.Blazor/xfk-blazor.css" rel="stylesheet" />
15+
16+
@* Site *@
17+
<link href="_content/AdventureWorks.Client.Blazor.Common/css/site.css" rel="stylesheet" />
18+
<link href="AdventureWorks.Client.Blazor.styles.css" rel="stylesheet" />
19+
20+
<HeadOutlet />
21+
</head>
22+
<body>
23+
<Routes @rendermode="@RenderModeForPage" />
24+
25+
<script src="_framework/blazor.web.js"></script>
26+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
27+
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
28+
<script src="_content/Xomega.Framework.Blazor/xfk-blazor.js"></script>
29+
</body>
30+
</html>
31+
32+
@code {
33+
public static IComponentRenderMode RenderModeForPage { get; set; }
34+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@inject NavigationManager Navigation
2+
3+
<ul class="navbar-nav">
4+
<li class="nav-item dropdown text-nowrap">
5+
<AuthorizeView>
6+
<Authorized>
7+
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#">@context.User.Identity.Name</a>
8+
<ul class="dropdown-menu dropdown-menu-end dropdown-menu-dark mt-0 p-0" style="min-width: 0">
9+
<li class="nav-item text-nowrap">
10+
<a class="nav-link btn" @onclick="Navigation.NavigateToSignOut">
11+
<i class="bi bi-power me-1"></i>Sign out</a>
12+
</li>
13+
</ul>
14+
</Authorized>
15+
<NotAuthorized>
16+
<a class="nav-link btn border-0" @onclick="() => Navigation.NavigateToLogin()">Sign in</a>
17+
</NotAuthorized>
18+
</AuthorizeView>
19+
</li>
20+
</ul>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
@inherits LayoutComponentBase
2+
@inject MainMenu menu
3+
4+
<PageTitle>AdventureWorks</PageTitle>
5+
6+
<div>
7+
<div class="sidebar-pane sidebar collapse bg-dark navbar-dark">
8+
<NavMenu Class="navbar-nav" Items="menu.Items" />
9+
</div>
10+
11+
<header class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0 shadow">
12+
<button class="navbar-toggler shadow-none border-0" type="button"
13+
data-bs-toggle="collapse" data-bs-target=".sidebar-pane">
14+
<span class="navbar-toggler-icon"></span>
15+
</button>
16+
<a class="navbar-brand me-auto" href="#">AdventureWorks</a>
17+
<nav class="navbar-expand px-3">
18+
<LoginDisplay />
19+
</nav>
20+
</header>
21+
22+
<main class="sidebar-pane collapse">
23+
<div class="body">
24+
@Body
25+
</div>
26+
<footer class="px-2 py-1 row gx-0 justify-content-between bg-dark text-white-50">
27+
<div class="col-auto">Copyright © @DateTime.Now.Year MyCompany. All rights reserved.</div>
28+
<div class="col-auto">Powered by <a class="text-white-50" href="http://xomega.net">Xomega.Net</a></div>
29+
</footer>
30+
</main>
31+
</div>
32+
33+
<div id="blazor-error-ui">
34+
An unhandled error has occurred.
35+
<a href="" class="reload">Reload</a>
36+
<a class="dismiss">🗙</a>
37+
</div>
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
.body {
2+
min-height: calc(100vh - 40px - 32px); /* reduce by header and footer height */
3+
display: flex;
4+
}
5+
6+
div {
7+
--sidebar-width: 220px;
8+
}
9+
10+
main.sidebar-pane.collapse:not(.show) {
11+
display: block;
12+
}
13+
14+
main.sidebar-pane.collapse.show {
15+
margin-left: var(--sidebar-width);
16+
}
17+
18+
.sidebar-pane.collapsing {
19+
height: unset;
20+
transition: margin .2s;
21+
}
22+
23+
.sidebar {
24+
position: fixed;
25+
top: 0px;
26+
left: 0px;
27+
bottom: 0px;
28+
padding-top: 40px;
29+
width: var(--sidebar-width);
30+
margin-left: calc(-1 * var(--sidebar-width));
31+
}
32+
33+
.sidebar.collapse.show {
34+
margin-left: 0px;
35+
display: block;
36+
}
37+
38+
.sidebar a[data-bs-toggle="collapse"] {
39+
position: relative;
40+
}
41+
42+
/* right-align the toggle on collapsible sidebar menus */
43+
.sidebar .dropdown-toggle::after {
44+
display: block;
45+
position: absolute;
46+
top: 50%;
47+
right: 1rem;
48+
transform: translateY(-50%);
49+
}
50+
51+
.sidebar ul {
52+
padding-left: 1rem;
53+
}
54+
55+
.sidebar i {
56+
margin-right: 10px;
57+
}
58+
59+
#blazor-error-ui {
60+
background: lightyellow;
61+
bottom: 0;
62+
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
63+
display: none;
64+
left: 0;
65+
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
66+
position: fixed;
67+
width: 100%;
68+
z-index: 1000;
69+
}
70+
71+
#blazor-error-ui .dismiss {
72+
cursor: pointer;
73+
position: absolute;
74+
right: 0.75rem;
75+
top: 0.5rem;
76+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<Router AppAssembly="@typeof(App).Assembly" AdditionalAssemblies="@AdditionalAssemblies">
2+
<Found Context="routeData">
3+
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)">
4+
<NotAuthorized>
5+
@if (!context.User.Identity.IsAuthenticated)
6+
{
7+
<NotAuthenticated />
8+
}
9+
else
10+
{
11+
<NotAuthorized />
12+
}
13+
</NotAuthorized>
14+
</AuthorizeRouteView>
15+
</Found>
16+
<NotFound>
17+
<LayoutView Layout="@typeof(MainLayout)">
18+
<p>Sorry, there's nothing at this address.</p>
19+
</LayoutView>
20+
</NotFound>
21+
</Router>
22+
23+
@code {
24+
public static System.Reflection.Assembly[] AdditionalAssemblies { get; set; }
25+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using System.Net;
2+
using Microsoft.AspNetCore.Components;
3+
using Microsoft.AspNetCore.WebUtilities;
4+
5+
namespace AdventureWorks.Client.Blazor.Common
6+
{
7+
public static class UrlConfig
8+
{
9+
public const string ReturnUrlParam = "ReturnUrl";
10+
11+
public static string GetRedirectUri(this NavigationManager navigation) =>
12+
QueryHelpers.ParseQuery(new Uri(navigation.Uri).Query).TryGetValue(ReturnUrlParam, out var returnUrl) ? returnUrl[0] : null;
13+
14+
public const string LoginUrl = "/login";
15+
16+
public static void NavigateToLogin(this NavigationManager navigation, IDictionary<string, string> query = null)
17+
{
18+
var uri = new Uri(navigation.Uri);
19+
if (uri.AbsolutePath != LoginUrl) // prevent recursive redirects to the login page
20+
{
21+
string loginUri = $"{LoginUrl}?{ReturnUrlParam}={WebUtility.UrlEncode(uri.AbsoluteUri)}";
22+
if (query != null) loginUri = QueryHelpers.AddQueryString(loginUri, query);
23+
navigation.NavigateTo(loginUri);
24+
}
25+
else if (query != null)
26+
navigation.NavigateTo(QueryHelpers.AddQueryString(uri.AbsoluteUri, query));
27+
}
28+
29+
public const string SignInUrl = "/SignIn";
30+
public const string SignInTicketParam = "ticket";
31+
32+
public static void NavigateToSignIn(this NavigationManager navigation, string authTicket) =>
33+
navigation.NavigateTo($"{SignInUrl}?{SignInTicketParam}={authTicket}", true);
34+
35+
public const string SignOutUrl = "/SignOut";
36+
37+
public static void NavigateToSignOut(this NavigationManager navigation) =>
38+
navigation.NavigateTo($"{SignOutUrl}?{ReturnUrlParam}={WebUtility.UrlEncode(navigation.Uri)}", true);
39+
40+
public const string UnauthorizedUrl = "/unauthorized";
41+
}
42+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
@*
2+
=============================================================================================
3+
This file was AUTO-GENERATED by "Blazor Views" Xomega.Net generator.
4+
5+
Manual CHANGES to this file WILL BE LOST when the code is regenerated.
6+
=============================================================================================
7+
*@
8+
9+
@namespace AdventureWorks.Client.Blazor.Common.Views
10+
@inherits LoginViewBase
11+
12+
@if (Visible)
13+
{
14+
<div @ref="MainPanel" class="@UpperClass">
15+
<div class="@MiddleClass">
16+
<div class="d-flex">
17+
<div class="@GetViewCol(null) @LowerClass">
18+
<div class="modal-header">
19+
<h5 class="modal-title">
20+
<ViewTitle @ref="TitleComponent" Title="@Model?.ViewTitle"></ViewTitle>
21+
</h5>
22+
<XActionButton Class="btn-close" NoText="true" OnClick="OnCloseAsync"
23+
Action="@VM?.CloseAction"></XActionButton>
24+
</div>
25+
<div class="modal-body">
26+
<div class="row g-3">
27+
<Errors ErrorList="@Model?.Errors" ViewKey="@Model?.GetResourceKey()"></Errors>
28+
<div class="row g-2 @GetRowCol(1)">
29+
<XInputText Property="@VM?.MainObj?.UserNameProperty"></XInputText>
30+
<XInputText Property="@VM?.MainObj?.PasswordProperty" Type="password"></XInputText>
31+
</div>
32+
</div>
33+
</div>
34+
<div class="@FooterClass">
35+
<XActionButton Action="@VM?.MainObj?.SaveAction" OnClick="OnSaveAsync"
36+
IsPrimary="true"></XActionButton>
37+
<XActionButton Action="@VM?.CloseAction" OnClick="OnCloseAsync"></XActionButton>
38+
</div>
39+
</div>
40+
</div>
41+
</div>
42+
</div>
43+
}

0 commit comments

Comments
 (0)