commit f04a0d517ce98b4d68f60c0f6bed2e904dcab5a9 Author: kykaevv Date: Tue Sep 1 13:09:05 2026 +0300 Initial commit: SiteViewer kiosk app (WPF + WebView2, schedule, LAN admin). Co-authored-by: Cursor diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..148b87f --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +# Build +**/bin/ +**/obj/ +publish/ + +# IDE +.vs/ +*.user +*.suo +*.userosscache +*.sln.docstates + +# OS +Thumbs.db +Desktop.ini + +# Logs / local data (not in repo) +*.log diff --git a/README.md b/README.md new file mode 100644 index 0000000..68c907c --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# SiteViewer + +Полноэкранное Windows-приложение на C# (WPF + WebView2), целевая платформа **.NET Framework 4.8**. + +## Запуск + +`D:\SiteViewer\publish\SiteViewer.exe` + +Требуется: +- [.NET Framework 4.8](https://dotnet.microsoft.com/download/dotnet-framework/net48) +- WebView2 Runtime (обычно уже есть в Windows 10/11) + +## Сборка + +```powershell +cd D:\SiteViewer\SiteViewer +dotnet publish -c Release -o D:\SiteViewer\publish +``` diff --git a/SiteViewer/App.xaml b/SiteViewer/App.xaml new file mode 100644 index 0000000..c993676 --- /dev/null +++ b/SiteViewer/App.xaml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + Segoe UI, Arial Unicode MS, Arial + + + + + + + + + + + + diff --git a/SiteViewer/App.xaml.cs b/SiteViewer/App.xaml.cs new file mode 100644 index 0000000..6bf9603 --- /dev/null +++ b/SiteViewer/App.xaml.cs @@ -0,0 +1,97 @@ +using System; +using System.IO; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Threading; +using SiteViewer.Services; + +namespace SiteViewer +{ + public partial class App : Application + { + public static SitesStore Sites { get; } = new SitesStore(); + public static UiSettings Ui { get; } = new UiSettings(); + public static AdminHost Admin { get; } = new AdminHost(Sites); + + public static string WebViewUserDataFolder { get; } = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), + "SiteViewer", + "WebView2"); + + protected override void OnStartup(StartupEventArgs e) + { + DispatcherUnhandledException += (_, args) => + { + args.Handled = true; + try + { + MessageBox.Show( + "Произошла ошибка, приложение продолжит работу.\n\n" + args.Exception.Message, + "SiteViewer", + MessageBoxButton.OK, + MessageBoxImage.Warning); + } + catch + { + // ignore + } + }; + + AppDomain.CurrentDomain.UnhandledException += (_, args) => + { + if (args.ExceptionObject is Exception ex) + { + try + { + var folder = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), + "SiteViewer"); + Directory.CreateDirectory(folder); + File.AppendAllText( + Path.Combine(folder, "crash.log"), + "[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "] " + ex + "\n\n"); + } + catch + { + // ignore + } + } + }; + + TaskScheduler.UnobservedTaskException += (_, args) => + { + args.SetObserved(); + }; + + Directory.CreateDirectory(WebViewUserDataFolder); + base.OnStartup(e); + + try + { + Admin.Start(); + } + catch (Exception ex) + { + MessageBox.Show( + "Не удалось запустить веб-сервер на порту " + AdminHost.Port + ".\n" + ex.Message, + "SiteViewer", + MessageBoxButton.OK, + MessageBoxImage.Warning); + } + } + + protected override void OnExit(ExitEventArgs e) + { + try + { + Admin.Dispose(); + } + catch + { + // ignore + } + + base.OnExit(e); + } + } +} diff --git a/SiteViewer/Assets/app.ico b/SiteViewer/Assets/app.ico new file mode 100644 index 0000000..410fdfa Binary files /dev/null and b/SiteViewer/Assets/app.ico differ diff --git a/SiteViewer/MainWindow.xaml b/SiteViewer/MainWindow.xaml new file mode 100644 index 0000000..bd72544 --- /dev/null +++ b/SiteViewer/MainWindow.xaml @@ -0,0 +1,314 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + +
НазваниеСсылкаОкноДата включенияСтатус
+
+ +
+ + +
+ + + +