├── icon.ico ├── icon_cables.ico ├── App.xaml.cs ├── DemoDialog.xaml.cs ├── .github └── workflows │ └── build.yml ├── webdemoexe.sln ├── App.xaml ├── WebDemoExe.csproj ├── MainWindow.xaml ├── readme.md ├── DemoDialog.xaml └── MainWindow.xaml.cs /icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pandrr/WebDemoExe/HEAD/icon.ico -------------------------------------------------------------------------------- /icon_cables.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pandrr/WebDemoExe/HEAD/icon_cables.ico -------------------------------------------------------------------------------- /App.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Microsoft Corporation. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | using System.Runtime.InteropServices; 6 | using System.Windows; 7 | 8 | namespace WebDemoExe 9 | { 10 | /// 11 | /// Interaction logic for App.xaml 12 | /// 13 | public partial class App : Application 14 | { 15 | public bool newRuntimeEventHandled = false; 16 | 17 | public App() 18 | { 19 | InitializeComponent(); 20 | this.Resources["AdditionalArgs"] = "--enable-features=ThirdPartyStoragePartitioning,PartitionedCookies"; 21 | 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /DemoDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | // Copyright (C) Microsoft Corporation. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | using System.Diagnostics; 6 | using System.Drawing.Printing; 7 | using System.Runtime.InteropServices; 8 | using System.Windows; 9 | 10 | namespace WebDemoExe 11 | { 12 | /// 13 | /// Interaction logic for App.xaml 14 | /// 15 | public partial class DemoDialog :Window 16 | { 17 | 18 | public DemoDialog() 19 | { 20 | InitializeComponent(); 21 | } 22 | 23 | private void okButton_Click(object sender, RoutedEventArgs e) 24 | { 25 | DialogResult = true; 26 | 27 | } 28 | 29 | private void fullscreen_Toggle(object sender, RoutedEventArgs e) 30 | { 31 | //Trace.WriteLine("toggle !!!", String(Fullscreen)); 32 | 33 | 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | push: 5 | pull_request: 6 | branches: [ main ] 7 | paths: 8 | - '**.cs' 9 | - '**.csproj' 10 | # Allows you to run this workflow manually from the Actions tab 11 | workflow_dispatch: null 12 | 13 | env: 14 | DOTNET_VERSION: '8.0.311' 15 | 16 | jobs: 17 | build: 18 | 19 | name: build-${{matrix.os}} 20 | runs-on: ${{ matrix.os }} 21 | strategy: 22 | matrix: 23 | os: [windows-latest] 24 | 25 | steps: 26 | - uses: actions/checkout@v3 27 | - name: Setup .NET Core 28 | uses: actions/setup-dotnet@v3 29 | with: 30 | dotnet-version: ${{ env.DOTNET_VERSION }} 31 | 32 | - name: Install dependencies 33 | run: dotnet restore 34 | 35 | - name: Build 36 | run: dotnet build --configuration Release --no-restore 37 | 38 | - name: Upload Build Artifacts 39 | uses: actions/upload-artifact@v4 40 | with: 41 | name: build-artifacts 42 | path: ./bin -------------------------------------------------------------------------------- /webdemoexe.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.5.33516.290 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebDemoExe", "WebDemoExe.csproj", "{EE405166-276B-486B-A7C6-D3E5BE2BBB6C}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {EE405166-276B-486B-A7C6-D3E5BE2BBB6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {EE405166-276B-486B-A7C6-D3E5BE2BBB6C}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {EE405166-276B-486B-A7C6-D3E5BE2BBB6C}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {EE405166-276B-486B-A7C6-D3E5BE2BBB6C}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {D67C87AC-0755-417B-837B-CF60986F29DF} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 14 | 15 | 18 | 19 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /WebDemoExe.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | net48 5 | true 6 | Hybrid Application Team 7 | holon 8 | WebDemoExe 9 | true 10 | Debug;Release 11 | icon.ico 12 | true 13 | 5 14 | true 15 | true 16 | latest 17 | true 18 | 19 | 20 | x64 21 | 22 | 23 | x86 24 | 25 | 26 | AnyCPU 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /MainWindow.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 32 | 33 | 36 | 43 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | ![image](https://user-images.githubusercontent.com/98792/229350512-f74e4f52-9f70-4a86-874a-3cb07f25bb17.png) 2 | 3 | ## webDemoExe 4 | 5 | [![Build](https://github.com/pandrr/WebDemoExe/actions/workflows/build.yml/badge.svg)](https://github.com/pandrr/WebDemoExe/actions/workflows/build.yml) 6 | 7 | wrap your web demo into a windows exe format, just like a native demo. 8 | 9 | [download](https://github.com/pandrr/WebDemoExe/releases) 10 | 11 | ### about 12 | 13 | - it does not use electron, size is ~0.5mb 14 | - it will use edge to display your demo. edge is a chromium based browser, which is basically chrome 15 | - shows a little start dialog (only fullscreen option right now, more in the future hopefully) 16 | 17 | ### how 18 | 19 | - download the zip file from the releases section 20 | - put your static html/js files into the demo subfolder 21 | - edit webdemoexe.xml and change the title 22 | - rename webdemoexe.exe to your demo name 23 | - add `` into the config to not show the dialog at all and start directly, don't do this if you want to play audio without having another user interaction! 24 | - add `yourdomain.localhost` to customize the virtual host domain (defaults to webdemoexe.localhost) 25 | 26 | - if the url contains "webdemoexe_exit" it will exit, e.g. use window.location.hash="webdemoexe_exit" 27 | 28 | ### technical 29 | - exe is not signed, still have to click "run anyway", like with most demos 30 | - webdemoexe uses [webview2](https://learn.microsoft.com/en-us/microsoft-edge/webview2/) and creates a virtual host from the demo subfolder to run your demo 31 | - escape to close is handled by webdemoexe 32 | - if you need to handle escape key manually, add `` in the config. 33 | - no gesture is needed to auto play audio, if you normally display a play button, make sure it only shows when audiocontext stats is not "running"... 34 | 35 | ### ideas 36 | - currently has no resolution selection, not sure how this is possible with wpf etc. 37 | - in the future the dialog could show link to website/online version and maybe a little teaser image... 38 | - there should be way to exit the app from js / in electron we always used `window.close()` not possible with webview2 afaik 39 | 40 | ### misc 41 | 42 | thanks to kb for helping with initial setup! 43 | 44 | any help is appreciated. i am not a windows developer, i hope everything here is not too wrong. 45 | 46 | -------------------------------------------------------------------------------- /DemoDialog.xaml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16 | 20 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 |