Fix button spacing, opacity simplification, gitignore cleanup
This commit is contained in:
1 parent
36fd5a6b6e
commit
cdd3414771
10 files changed
+135
-21
No files matched your search
@@ -0,0 +1,5 @@
|
||||
<Application x:Class="Gott.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
StartupUri="MainWindow.xaml">
|
||||
</Application>
|
||||
@@ -0,0 +1,5 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace Gott;
|
||||
|
||||
public partial class App : Application { }
|
||||
@@ -0,0 +1,21 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net10.0-windows</TargetFramework>
|
||||
<UseWPF>true</UseWPF>
|
||||
<AssemblyName>Gott</AssemblyName>
|
||||
<RootNamespace>Gott</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3065.39" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="appsettings.json" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
|
||||
<Content Include="appsettings.Production.json" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,16 @@
|
||||
<Window x:Class="Gott.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
|
||||
Title="// gott"
|
||||
Width="400" Height="300"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Background="#222">
|
||||
<Grid>
|
||||
<wv2:WebView2 x:Name="webView" Visibility="Hidden" />
|
||||
<StackPanel x:Name="loader" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<ProgressBar IsIndeterminate="True" Width="200" Height="3" Foreground="#c91" Background="#333" BorderThickness="0" />
|
||||
<TextBlock Text="Laden..." Foreground="#ddd" FontSize="13" HorizontalAlignment="Center" Margin="0,10,0,0" FontFamily="Segoe UI" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using System.Windows;
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
|
||||
namespace Gott;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private readonly AppSettings _settings;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
_settings = LoadSettings();
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
var screenW = SystemParameters.PrimaryScreenWidth;
|
||||
var screenH = SystemParameters.PrimaryScreenHeight;
|
||||
Width = 930;
|
||||
Height = screenH * 0.95;
|
||||
Left = (screenW - Width) / 2;
|
||||
Top = (screenH - Height) / 2;
|
||||
|
||||
Loaded += async (_, _) =>
|
||||
{
|
||||
await webView.EnsureCoreWebView2Async();
|
||||
|
||||
// Dark background to avoid white flash
|
||||
webView.DefaultBackgroundColor = System.Drawing.Color.FromArgb(255, 17, 17, 17);
|
||||
|
||||
// Open external links in default browser
|
||||
webView.CoreWebView2.NewWindowRequested += (_, e) =>
|
||||
{
|
||||
e.Handled = true;
|
||||
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(e.Uri) { UseShellExecute = true });
|
||||
};
|
||||
|
||||
webView.CoreWebView2.NavigationCompleted += (_, _) =>
|
||||
{
|
||||
webView.Visibility = Visibility.Visible;
|
||||
loader.Visibility = Visibility.Collapsed;
|
||||
};
|
||||
|
||||
webView.CoreWebView2.Navigate(_settings.Url);
|
||||
};
|
||||
}
|
||||
|
||||
private static AppSettings LoadSettings()
|
||||
{
|
||||
foreach (var file in new[] { "appsettings.Production.json", "appsettings.json" })
|
||||
{
|
||||
var path = Path.Combine(AppContext.BaseDirectory, file);
|
||||
if (File.Exists(path))
|
||||
{
|
||||
try
|
||||
{
|
||||
var json = File.ReadAllText(path);
|
||||
return JsonSerializer.Deserialize<AppSettings>(json) ?? new();
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
return new();
|
||||
}
|
||||
}
|
||||
|
||||
public class AppSettings
|
||||
{
|
||||
public string Url { get; set; } = "http://localhost:19000";
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"Url": "http://localhost:19000"
|
||||
}
|
||||
Reference in new issue
Block a user