File tree Expand file tree Collapse file tree 13 files changed +245
-1
lines changed
Expand file tree Collapse file tree 13 files changed +245
-1
lines changed Original file line number Diff line number Diff line change 1+ @namespace JSONSerialization
2+ <Router AppAssembly =" @typeof(App).Assembly" >
3+ <Found Context =" routeData" >
4+ <RouteView RouteData =" @routeData" DefaultLayout =" @typeof(MainLayout)" />
5+ <FocusOnNavigate RouteData =" @routeData" Selector =" h1" />
6+ </Found >
7+ <NotFound >
8+ <PageTitle >Not found</PageTitle >
9+ <LayoutView Layout =" @typeof(MainLayout)" >
10+ <p role =" alert" >Sorry, there's nothing at this address.</p >
11+ </LayoutView >
12+ </NotFound >
13+ </Router >
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" utf-8" ?>
2+ <Project Sdk =" Microsoft.NET.Sdk.Web" >
3+ <PropertyGroup >
4+ <TargetFramework >net6.0</TargetFramework >
5+ <Nullable >enable</Nullable >
6+ <ImplicitUsings >enable</ImplicitUsings >
7+ </PropertyGroup >
8+ <ItemGroup >
9+ <PackageReference Include =" Syncfusion.Blazor" Version =" *" />
10+ <PackageReference Include =" Syncfusion.Blazor.Themes" Version =" *" />
11+ </ItemGroup >
12+ </Project >
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" utf-8" ?>
2+ <Project Sdk =" Microsoft.NET.Sdk.Web" >
3+ <PropertyGroup >
4+ <TargetFramework >net8.0</TargetFramework >
5+ <Nullable >enable</Nullable >
6+ <ImplicitUsings >enable</ImplicitUsings >
7+ </PropertyGroup >
8+ <ItemGroup >
9+ <PackageReference Include =" Syncfusion.Blazor" Version =" *" />
10+ <PackageReference Include =" Syncfusion.Blazor.Themes" Version =" *" />
11+ </ItemGroup >
12+ </Project >
Original file line number Diff line number Diff line change 1+ @inherits LayoutComponentBase
2+ @namespace JSONSerialization
3+ <main > @Body </main >
Original file line number Diff line number Diff line change 1+ @page " /"
2+
3+ @using Syncfusion .Blazor .Diagram
4+ @using Syncfusion .Blazor .Buttons
5+ @using System .Collections .ObjectModel
6+ @using Newtonsoft .Json
7+ @using SelectionChangedEventArgs = Syncfusion .Blazor .Diagram .SelectionChangedEventArgs
8+
9+
10+ <SfDiagramComponent @ref =" diagramComponent"
11+ Width =" 700px"
12+ Height =" 300px"
13+ Nodes =" nodes"
14+
15+ >
16+ </SfDiagramComponent >
17+ <SfButton Content =" Save" OnClick =" OnSave" ></SfButton >
18+ <SfButton Content =" Load" OnClick =" OnLoad" ></SfButton >
19+ @code {
20+ SfDiagramComponent diagramComponent ;
21+ JsonSerializerSettings settings ;
22+ string output ;
23+ Node node ;
24+ DiagramObjectCollection <Node > nodes = new Syncfusion .Blazor .Diagram .DiagramObjectCollection <Node >();
25+ protected override void OnInitialized ()
26+ {
27+ node = new Node ()
28+ {
29+ ID = " node1" ,
30+ Height = 100 ,
31+ Width = 100 ,
32+ OffsetX = 100 ,
33+ OffsetY = 100 ,
34+ Shape = new BpmnActivity ()
35+ {
36+ ActivityType = BpmnActivityType .Task ,
37+ TaskType = BpmnTaskType .None
38+ }
39+ };
40+
41+ nodes .Add (node );
42+
43+ settings = new JsonSerializerSettings ()
44+ {
45+ TypeNameHandling = TypeNameHandling .All
46+ };
47+ }
48+
49+ public void OnSave ()
50+ {
51+ output = JsonConvert .SerializeObject (node , settings );
52+ }
53+
54+ public void OnLoad ()
55+ {
56+ diagramComponent .Clear ();
57+ Node deserializedNode = JsonConvert .DeserializeObject <Node >(output , settings );
58+ nodes .Add (deserializedNode );
59+ }
60+ }
Original file line number Diff line number Diff line change 1+ @page " /"
2+ @using Microsoft .AspNetCore .Components .Web
3+ @namespace JSONSerialization.Pages
4+ @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
5+
6+ <!DOCTYPE html>
7+ <html lang =" en" >
8+ <head >
9+ <meta charset =" utf-8" />
10+ <base href =" ~/" />
11+ <link href =" css/site.css" rel =" stylesheet" />
12+ <component type =" typeof(HeadOutlet)" render-mode =" ServerPrerendered" />
13+ <script src =" _content/Syncfusion.Blazor/scripts/syncfusion-blazor.min.js" type =" text/javascript" ></script >
14+ <link href =" _content/Syncfusion.Blazor/styles/bootstrap5.css" rel =" stylesheet" />
15+ </head >
16+ <body >
17+ <component type =" typeof(App)" render-mode =" ServerPrerendered" />
18+
19+ <div id =" blazor-error-ui" >
20+ <environment include =" Staging,Production" >
21+ An error has occurred. This application may no longer respond until reloaded.
22+ </environment >
23+ <environment include =" Development" >
24+ An unhandled exception has occurred. See browser dev tools for details.
25+ </environment >
26+ <a href =" " class =" reload" >Reload</a >
27+ <a class =" dismiss" >🗙</a >
28+ </div >
29+
30+ <script src =" _framework/blazor.server.js" ></script >
31+ </body >
32+ </html >
Original file line number Diff line number Diff line change 1+ using Microsoft . AspNetCore . Components ;
2+ using Microsoft . AspNetCore . Components . Web ;
3+ using Syncfusion . Blazor ;
4+
5+ var builder = WebApplication . CreateBuilder ( args ) ;
6+ builder . Services . AddRazorPages ( ) ;
7+ builder . Services . AddServerSideBlazor ( ) ;
8+ builder . Services . AddSyncfusionBlazor ( ) ;
9+ var app = builder . Build ( ) ;
10+
11+ if ( ! app . Environment . IsDevelopment ( ) )
12+ {
13+ // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
14+ app . UseHsts ( ) ;
15+ }
16+
17+ app . UseHttpsRedirection ( ) ;
18+
19+ app . UseStaticFiles ( ) ;
20+
21+ app . UseRouting ( ) ;
22+
23+ app . MapBlazorHub ( ) ;
24+ app . MapFallbackToPage ( "/_Host" ) ;
25+
26+ app . Run ( ) ;
Original file line number Diff line number Diff line change 1+ {
2+ "iisSettings" : {
3+ "iisExpress" : {
4+ "applicationUrl" : " http://localhost:32445" ,
5+ "sslPort" : 44313
6+ }
7+ },
8+ "profiles" : {
9+ "http" : {
10+ "commandName" : " Project" ,
11+ "dotnetRunMessages" : true ,
12+ "launchBrowser" : true ,
13+ "applicationUrl" : " http://localhost:5098" ,
14+ "environmentVariables" : {
15+ "ASPNETCORE_ENVIRONMENT" : " Development"
16+ }
17+ },
18+ "https" : {
19+ "commandName" : " Project" ,
20+ "dotnetRunMessages" : true ,
21+ "launchBrowser" : true ,
22+ "applicationUrl" : " https://localhost:7081;http://localhost:5098" ,
23+ "environmentVariables" : {
24+ "ASPNETCORE_ENVIRONMENT" : " Development"
25+ }
26+ },
27+ "IIS Express" : {
28+ "commandName" : " IISExpress" ,
29+ "launchBrowser" : true ,
30+ "environmentVariables" : {
31+ "ASPNETCORE_ENVIRONMENT" : " Development"
32+ }
33+ }
34+ }
35+ }
Original file line number Diff line number Diff line change 1+ @using Microsoft .AspNetCore .Components .Routing
2+ @using Microsoft .AspNetCore .Components .Web
3+ @using Microsoft .JSInterop
4+ @using JSONSerialization
5+ @using Syncfusion .Blazor .Diagram
Original file line number Diff line number Diff line change 1+ {
2+ "DetailedErrors" : true ,
3+ "Logging" : {
4+ "LogLevel" : {
5+ "Default" : " Information" ,
6+ "Microsoft.AspNetCore" : " Warning"
7+ }
8+ }
9+ }
You can’t perform that action at this time.
0 commit comments