Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Server Deployment/DeployWPF/WPFBlazorHybridApp/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application x:Class="WPFBlazorHybridApp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WPFBlazorHybridApp"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
13 changes: 13 additions & 0 deletions Server Deployment/DeployWPF/WPFBlazorHybridApp/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Configuration;
using System.Data;
using System.Windows;

namespace WPFBlazorHybridApp;

/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}

10 changes: 10 additions & 0 deletions Server Deployment/DeployWPF/WPFBlazorHybridApp/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Windows;

[assembly:ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
18 changes: 18 additions & 0 deletions Server Deployment/DeployWPF/WPFBlazorHybridApp/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Window x:Class="WPFBlazorHybridApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:blazor="clr-namespace:Microsoft.AspNetCore.Components.WebView.Wpf;assembly=Microsoft.AspNetCore.Components.WebView.Wpf"
xmlns:local="clr-namespace:WPFBlazorHybridApp"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<blazor:BlazorWebView HostPage="wwwroot\index.html" Services="{DynamicResource services}">
<blazor:BlazorWebView.RootComponents>
<blazor:RootComponent Selector="#app" ComponentType="{x:Type local:PDFViewer}" />
<!-- Replace 'YourRazorFileName' with the actual Razor component class (e.g., Main) in your project's namespace -->
</blazor:BlazorWebView.RootComponents>
</blazor:BlazorWebView>
</Grid>
</Window>
30 changes: 30 additions & 0 deletions Server Deployment/DeployWPF/WPFBlazorHybridApp/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Extensions.DependencyInjection;
using Syncfusion.Blazor;

namespace WPFBlazorHybridApp;

/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
var serviceCollection = new ServiceCollection();
serviceCollection.AddWpfBlazorWebView();
serviceCollection.AddMemoryCache();
serviceCollection.AddSyncfusionBlazor();
Resources.Add("services", serviceCollection.BuildServiceProvider());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@using Syncfusion.Blazor.SfPdfViewer;

<SfPdfViewer2 DocumentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
Height="100%"
Width="100%">
</SfPdfViewer2>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Wpf" Version="9.0.110" />
<PackageReference Include="Syncfusion.Blazor.SfPdfViewer" Version="31.1.17" />
<PackageReference Include="Syncfusion.Blazor.Themes" Version="31.1.17" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.2.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPFBlazorHybridApp", "WPFBlazorHybridApp.csproj", "{E9C00DD1-CE6A-E6CB-F1A2-800B189AD5F0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E9C00DD1-CE6A-E6CB-F1A2-800B189AD5F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E9C00DD1-CE6A-E6CB-F1A2-800B189AD5F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E9C00DD1-CE6A-E6CB-F1A2-800B189AD5F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E9C00DD1-CE6A-E6CB-F1A2-800B189AD5F0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8199E5BF-B4F3-4C46-AE9C-C724E3F9DD63}
EndGlobalSection
EndGlobal
2 changes: 2 additions & 0 deletions Server Deployment/DeployWPF/WPFBlazorHybridApp/_Import.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@using Microsoft.AspNetCore.Components.Web
@using Syncfusion.Blazor.SfPdfViewer
15 changes: 15 additions & 0 deletions Server Deployment/DeployWPF/WPFBlazorHybridApp/wwwroot/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>WPF Blazor Hybrid App</title>
<base href="/" />
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
</head>
<body>
<div id="app">Loading...</div>
<script src="_framework/blazor.webview.js"></script>
<script src="_content/Syncfusion.Blazor.SfPdfViewer/scripts/syncfusion-blazor-sfpdfviewer.min.js" type="text/javascript"></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@using Syncfusion.Blazor.SfPdfViewer;

<SfPdfViewer2 DocumentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
Height="100%"
Width="100%">
</SfPdfViewer2>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@using Microsoft.AspNetCore.Components.Web
@using Syncfusion.Blazor.SfPdfViewer

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions Server Deployment/WinForms/WinFormsBlazorHybridApp/Form1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace WinFormsBlazorHybridApp;
using Microsoft.AspNetCore.Components.WebView.WindowsForms;
using Microsoft.Extensions.DependencyInjection;
using Syncfusion.Blazor;
using WinFormsBlazorHybridApp.Components;

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
var services = new ServiceCollection();
services.AddWindowsFormsBlazorWebView();
services.AddMemoryCache();
services.AddSyncfusionBlazor();
var blazorWebView = new BlazorWebView()
{
HostPage = "wwwroot\\index.html",
Services = services.BuildServiceProvider(),
Dock = DockStyle.Fill
};
blazorWebView.RootComponents.Add<PDFViewer>("#app");
this.Controls.Add(blazorWebView);
}
}
16 changes: 16 additions & 0 deletions Server Deployment/WinForms/WinFormsBlazorHybridApp/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace WinFormsBlazorHybridApp;

static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.Blazor.SfPdfViewer" Version="31.1.17" />
<PackageReference Include="Syncfusion.Blazor.Themes" Version="31.1.17" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.WindowsForms" Version="9.0.110" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Compile Update="Form1.cs">
<SubType>Form</SubType>
</Compile>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.2.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsBlazorHybridApp", "WinFormsBlazorHybridApp.csproj", "{3FD92601-2909-12E4-0626-B9DCF8DD9781}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3FD92601-2909-12E4-0626-B9DCF8DD9781}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3FD92601-2909-12E4-0626-B9DCF8DD9781}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3FD92601-2909-12E4-0626-B9DCF8DD9781}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3FD92601-2909-12E4-0626-B9DCF8DD9781}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C7560C67-46F8-46B0-B154-E255188EB6F3}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>WinFormsBlazor</title>
<base href="/" />
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
</head>

<body>
<div id="app">Loading...</div>
<script src="_framework/blazor.webview.js"></script>
<script src="_content/Syncfusion.Blazor.SfPdfViewer/scripts/syncfusion-blazor-sfpdfviewer.min.js" type="text/javascript"></script>
</body>

</html>