mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-25 23:18:44 -07:00
446a23da2b
Initial v0.1 (commit df9dac0) used PhotinoNET wrapping WebView2 + HTML/JS,
but rendered as a blank window on first run — WebView2 + file:// URI
quirks. Switching to native WPF: built into the .NET 9 Windows SDK
(no NuGet), single-file self-contained publish, instant window open.
All Backend/*.cs orchestration logic carried over unchanged (they're
UI-framework-agnostic). Replaced:
- Program.cs (PhotinoNET bootstrap) -> App.xaml(.cs) + MainWindow.xaml(.cs)
- ui/index.html + style.css + app.js -> MainWindow.xaml (XAML views) +
App.xaml resource styles
- Backend/MessageBridge.cs (JS<->C# router) -> direct method calls in
MainWindow.xaml.cs code-behind
RecRoomPicker now uses Microsoft.Win32.OpenFolderDialog (added in .NET 8)
instead of WinForms FolderBrowserDialog — keeps the project WPF-only.
Backend files needed explicit 'using System.IO;' since the WPF SDK
doesn't include it in implicit usings.
286 lines
16 KiB
XML
286 lines
16 KiB
XML
<Window x:Class="DorkNet.Launcher.MainWindow"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
Title="DorkNet"
|
|
Width="900" Height="640"
|
|
MinWidth="640" MinHeight="480"
|
|
WindowStartupLocation="CenterScreen"
|
|
Background="{StaticResource Bg}"
|
|
TextElement.Foreground="{StaticResource Ink}"
|
|
FontFamily="Segoe UI">
|
|
|
|
<Grid Margin="32,24">
|
|
<!-- View slots — only one is visible at a time. CodeBehind toggles
|
|
Visibility based on AppState.Mode + the settings drawer flag. -->
|
|
|
|
<!-- ── First-run wizard ───────────────────────────────────────── -->
|
|
<StackPanel x:Name="FirstRunView" Visibility="Visible">
|
|
<StackPanel HorizontalAlignment="Center" Margin="0,16,0,24">
|
|
<TextBlock Text="DorkNet"
|
|
FontSize="36" FontWeight="Bold"
|
|
Foreground="{StaticResource Brand}"
|
|
HorizontalAlignment="Center" />
|
|
<TextBlock Text="Self-hostable 2020 Rec Room backend"
|
|
Foreground="{StaticResource InkSoft}"
|
|
HorizontalAlignment="Center" Margin="0,4,0,0" />
|
|
</StackPanel>
|
|
|
|
<Grid Margin="0,16">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="16" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Button Grid.Column="0" Style="{StaticResource CardBtn}"
|
|
Click="OnPickHost">
|
|
<StackPanel>
|
|
<TextBlock Text="🛠" FontSize="28" Margin="0,0,0,8" />
|
|
<TextBlock Text="Host a server" FontSize="16"
|
|
FontWeight="SemiBold" Margin="0,0,0,8" />
|
|
<TextBlock Foreground="{StaticResource InkSoft}"
|
|
FontSize="12" TextWrapping="Wrap"
|
|
Text="Run a server for you and your friends. Picks a Rec Room version, downloads the matching server, opens a tunnel, shares a join code." />
|
|
</StackPanel>
|
|
</Button>
|
|
|
|
<Button Grid.Column="2" Style="{StaticResource CardBtn}"
|
|
Click="OnPickJoin">
|
|
<StackPanel>
|
|
<TextBlock Text="🎮" FontSize="28" Margin="0,0,0,8" />
|
|
<TextBlock Text="Join a friend" FontSize="16"
|
|
FontWeight="SemiBold" Margin="0,0,0,8" />
|
|
<TextBlock Foreground="{StaticResource InkSoft}"
|
|
FontSize="12" TextWrapping="Wrap"
|
|
Text="Paste a join code, point at your Rec Room install. The launcher fetches the matching patcher." />
|
|
</StackPanel>
|
|
</Button>
|
|
</Grid>
|
|
|
|
<TextBlock Text="You can switch modes later under Settings."
|
|
HorizontalAlignment="Center"
|
|
Foreground="{StaticResource InkFaint}"
|
|
FontSize="11" Margin="0,24,0,0" />
|
|
</StackPanel>
|
|
|
|
<!-- ── Host view ──────────────────────────────────────────────── -->
|
|
<Grid x:Name="HostView" Visibility="Collapsed">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="*" />
|
|
</Grid.RowDefinitions>
|
|
<Grid Grid.Row="0" Margin="0,0,0,16">
|
|
<TextBlock Text="Host" FontSize="20" FontWeight="SemiBold"
|
|
VerticalAlignment="Center" />
|
|
<Button HorizontalAlignment="Right" Style="{StaticResource Btn}"
|
|
Content="Settings" Click="OnOpenSettings" />
|
|
</Grid>
|
|
<Border Grid.Row="0" VerticalAlignment="Bottom"
|
|
BorderBrush="{StaticResource Border}" BorderThickness="0,0,0,1" />
|
|
|
|
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
|
<StackPanel>
|
|
<StackPanel Margin="0,0,0,16">
|
|
<TextBlock Text="REC ROOM INSTALL" Style="{StaticResource FieldLabel}" />
|
|
<DockPanel>
|
|
<Button DockPanel.Dock="Right" Style="{StaticResource Btn}"
|
|
Content="Pick..." Click="OnPickRecRoom" Margin="8,0,0,0" />
|
|
<Border Background="{StaticResource BgElev}"
|
|
BorderBrush="{StaticResource Border}" BorderThickness="1"
|
|
CornerRadius="6" Padding="8,6">
|
|
<TextBlock x:Name="HostRecRoomPath"
|
|
Text="(not picked)"
|
|
Foreground="{StaticResource InkSoft}"
|
|
TextTrimming="CharacterEllipsis" />
|
|
</Border>
|
|
</DockPanel>
|
|
</StackPanel>
|
|
|
|
<StackPanel Margin="0,0,0,16">
|
|
<TextBlock Text="SERVER NAME (SHOWN TO JOINERS)" Style="{StaticResource FieldLabel}" />
|
|
<TextBox x:Name="ServerNameInput"
|
|
LostFocus="OnServerNameChanged" />
|
|
</StackPanel>
|
|
|
|
<StackPanel Margin="0,0,0,16">
|
|
<TextBlock Text="REC ROOM VERSION TO HOST FOR" Style="{StaticResource FieldLabel}" />
|
|
<ComboBox x:Name="VersionSelect" />
|
|
</StackPanel>
|
|
|
|
<StackPanel Margin="0,0,0,16">
|
|
<TextBlock Text="PHOTON APPIDS (FREE AT DASHBOARD.PHOTONENGINE.COM)" Style="{StaticResource FieldLabel}" />
|
|
<TextBox x:Name="PhotonAppIdInput"
|
|
Margin="0,0,0,6"
|
|
LostFocus="OnPhotonChanged" />
|
|
<TextBox x:Name="PhotonVoiceAppIdInput"
|
|
Margin="0,0,0,6"
|
|
LostFocus="OnPhotonChanged" />
|
|
<ComboBox x:Name="PhotonRegionSelect"
|
|
SelectionChanged="OnPhotonChanged">
|
|
<ComboBoxItem Content="US" Tag="us" />
|
|
<ComboBoxItem Content="EU" Tag="eu" />
|
|
<ComboBoxItem Content="Asia" Tag="asia" />
|
|
<ComboBoxItem Content="Japan" Tag="jp" />
|
|
<ComboBoxItem Content="South America" Tag="sa" />
|
|
<ComboBoxItem Content="Korea" Tag="kr" />
|
|
<ComboBoxItem Content="India" Tag="in" />
|
|
<ComboBoxItem Content="Australia" Tag="au" />
|
|
</ComboBox>
|
|
</StackPanel>
|
|
|
|
<StackPanel Orientation="Horizontal" Margin="0,8,0,8">
|
|
<Button x:Name="HostStartBtn" Style="{StaticResource PrimaryBtn}"
|
|
Content="Start hosting" Click="OnHostStart" />
|
|
<Button x:Name="HostStopBtn" Style="{StaticResource Btn}"
|
|
Content="Stop" Click="OnHostStop"
|
|
Margin="8,0,0,0" Visibility="Collapsed" />
|
|
</StackPanel>
|
|
|
|
<Border Background="{StaticResource BgElev}"
|
|
BorderBrush="{StaticResource Border}" BorderThickness="1"
|
|
CornerRadius="6" Padding="12" MinHeight="40" Margin="0,8,0,16">
|
|
<TextBlock x:Name="HostStatusText"
|
|
Foreground="{StaticResource InkSoft}"
|
|
TextWrapping="Wrap" Text="Idle." />
|
|
</Border>
|
|
|
|
<StackPanel x:Name="JoinCodePanel" Visibility="Collapsed">
|
|
<TextBlock Text="JOIN CODE (SHARE THIS)" Style="{StaticResource FieldLabel}" />
|
|
<DockPanel>
|
|
<Button DockPanel.Dock="Right" Style="{StaticResource Btn}"
|
|
Content="Copy" Click="OnCopyJoinCode" Margin="8,0,0,0" />
|
|
<Border Background="{StaticResource BgElev2}"
|
|
BorderBrush="{StaticResource Border}" BorderThickness="1"
|
|
CornerRadius="6" Padding="8,6">
|
|
<TextBox x:Name="JoinCodeText" IsReadOnly="True"
|
|
FontFamily="Consolas" FontSize="11"
|
|
Background="Transparent" BorderThickness="0"
|
|
TextWrapping="Wrap" />
|
|
</Border>
|
|
</DockPanel>
|
|
<TextBlock Foreground="{StaticResource InkFaint}" FontSize="11"
|
|
Text="Joiners paste this into their DorkNet launcher's Join screen."
|
|
Margin="0,4,0,0" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</ScrollViewer>
|
|
</Grid>
|
|
|
|
<!-- ── Join view ──────────────────────────────────────────────── -->
|
|
<Grid x:Name="JoinView" Visibility="Collapsed">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="*" />
|
|
</Grid.RowDefinitions>
|
|
<Grid Grid.Row="0" Margin="0,0,0,16">
|
|
<TextBlock Text="Join" FontSize="20" FontWeight="SemiBold"
|
|
VerticalAlignment="Center" />
|
|
<Button HorizontalAlignment="Right" Style="{StaticResource Btn}"
|
|
Content="Settings" Click="OnOpenSettings" />
|
|
</Grid>
|
|
<Border Grid.Row="0" VerticalAlignment="Bottom"
|
|
BorderBrush="{StaticResource Border}" BorderThickness="0,0,0,1" />
|
|
|
|
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
|
<StackPanel>
|
|
<StackPanel Margin="0,0,0,16">
|
|
<TextBlock Text="PASTE THE JOIN CODE YOUR HOST SHARED" Style="{StaticResource FieldLabel}" />
|
|
<TextBox x:Name="JoinCodeInput"
|
|
AcceptsReturn="True" TextWrapping="Wrap"
|
|
Height="60" VerticalContentAlignment="Top"
|
|
TextChanged="OnJoinCodeInputChanged" />
|
|
<Button Style="{StaticResource Btn}"
|
|
Content="Preview" Click="OnDecodeJoinCode"
|
|
HorizontalAlignment="Left" Margin="0,8,0,0" />
|
|
</StackPanel>
|
|
|
|
<Border x:Name="JoinPreviewBorder" Visibility="Collapsed"
|
|
Background="{StaticResource BgElev}"
|
|
BorderBrush="{StaticResource Border}" BorderThickness="1"
|
|
CornerRadius="6" Padding="12" Margin="0,0,0,16">
|
|
<TextBlock x:Name="JoinPreviewText"
|
|
Foreground="{StaticResource InkSoft}"
|
|
TextWrapping="Wrap" />
|
|
</Border>
|
|
|
|
<StackPanel Margin="0,0,0,16">
|
|
<TextBlock Text="REC ROOM INSTALL" Style="{StaticResource FieldLabel}" />
|
|
<DockPanel>
|
|
<Button DockPanel.Dock="Right" Style="{StaticResource Btn}"
|
|
Content="Pick..." Click="OnPickRecRoom" Margin="8,0,0,0" />
|
|
<Border Background="{StaticResource BgElev}"
|
|
BorderBrush="{StaticResource Border}" BorderThickness="1"
|
|
CornerRadius="6" Padding="8,6">
|
|
<TextBlock x:Name="JoinRecRoomPath"
|
|
Text="(not picked)"
|
|
Foreground="{StaticResource InkSoft}"
|
|
TextTrimming="CharacterEllipsis" />
|
|
</Border>
|
|
</DockPanel>
|
|
</StackPanel>
|
|
|
|
<Button x:Name="JoinApplyBtn" Style="{StaticResource PrimaryBtn}"
|
|
Content="Patch and launch" Click="OnJoinApply"
|
|
HorizontalAlignment="Left" IsEnabled="False"
|
|
Margin="0,0,0,16" />
|
|
|
|
<Border Background="{StaticResource BgElev}"
|
|
BorderBrush="{StaticResource Border}" BorderThickness="1"
|
|
CornerRadius="6" Padding="12" MinHeight="40">
|
|
<TextBlock x:Name="JoinStatusText"
|
|
Foreground="{StaticResource InkSoft}"
|
|
TextWrapping="Wrap" Text="Idle." />
|
|
</Border>
|
|
</StackPanel>
|
|
</ScrollViewer>
|
|
</Grid>
|
|
|
|
<!-- ── Settings view ──────────────────────────────────────────── -->
|
|
<Grid x:Name="SettingsView" Visibility="Collapsed">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="*" />
|
|
</Grid.RowDefinitions>
|
|
<Grid Grid.Row="0" Margin="0,0,0,16">
|
|
<TextBlock Text="Settings" FontSize="20" FontWeight="SemiBold"
|
|
VerticalAlignment="Center" />
|
|
<Button HorizontalAlignment="Right" Style="{StaticResource Btn}"
|
|
Content="← Back" Click="OnBackFromSettings" />
|
|
</Grid>
|
|
<Border Grid.Row="0" VerticalAlignment="Bottom"
|
|
BorderBrush="{StaticResource Border}" BorderThickness="0,0,0,1" />
|
|
|
|
<StackPanel Grid.Row="1">
|
|
<StackPanel Margin="0,0,0,16">
|
|
<TextBlock Text="MODE" Style="{StaticResource FieldLabel}" />
|
|
<StackPanel Orientation="Horizontal">
|
|
<Button Style="{StaticResource Btn}"
|
|
Content="Switch to Host" Click="OnPickHost" />
|
|
<Button Style="{StaticResource Btn}"
|
|
Content="Switch to Join" Click="OnPickJoin"
|
|
Margin="8,0,0,0" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
|
|
<StackPanel Margin="0,0,0,16">
|
|
<TextBlock Text="CACHE LOCATIONS" Style="{StaticResource FieldLabel}" />
|
|
<TextBlock x:Name="CachePathsText"
|
|
Foreground="{StaticResource InkSoft}"
|
|
FontSize="11" TextWrapping="Wrap" />
|
|
</StackPanel>
|
|
|
|
<StackPanel>
|
|
<TextBlock Text="ABOUT" Style="{StaticResource FieldLabel}" />
|
|
<TextBlock Foreground="{StaticResource InkSoft}" FontSize="11">
|
|
DorkNet Launcher v0.1 —
|
|
<Hyperlink NavigateUri="https://github.com/DorkSquadRR/DorkNet"
|
|
Foreground="{StaticResource BrandHover}"
|
|
RequestNavigate="OnNavigate">GitHub</Hyperlink>
|
|
— AGPL-3.0
|
|
</TextBlock>
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</Grid>
|
|
</Grid>
|
|
</Window>
|