Add Tabbed controlled window

This commit is contained in:
Timothy Baldridge 2022-01-28 23:15:17 -07:00
parent dc1fd60bfd
commit ebc3172f74
4 changed files with 44 additions and 9 deletions

View File

@ -4,5 +4,12 @@
Startup="OnStartup"
Exit="OnExit">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Dark.Purple.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@ -1,20 +1,34 @@
<Window x:Class="Wabbajack.App.Blazor.MainWindow"
<mah:MetroWindow x:Class="Wabbajack.App.Blazor.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:local="clr-namespace:Wabbajack.App.Blazor"
xmlns:blazor="clr-namespace:Microsoft.AspNetCore.Components.WebView.Wpf;assembly=Microsoft.AspNetCore.Components.WebView.Wpf"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d"
Title="MainWindow" Height="750" Width="1200" MinHeight="750" MinWidth="1200">
<Grid Background="#121212">
<blazor:BlazorWebView HostPage="wwwroot\index.html" x:Name="BlazorWebView">
<blazor:BlazorWebView.RootComponents>
<blazor:RootComponent Selector="#app" ComponentType="{x:Type local:Main}" />
</blazor:BlazorWebView.RootComponents>
</blazor:BlazorWebView>
ShowTitleBar="False"
Title="WABBAJACK" Height="750" Width="1200" MinHeight="750" MinWidth="1200">
<Grid Background="#121212" MouseDown="UIElement_OnMouseDown">
<TabControl>
<TabItem>
<TabItem.Header>
<TextBlock FontSize="16" Margin="0, 0, 8, 0">WABBAJACK 3.0.0</TextBlock>
</TabItem.Header>
<blazor:BlazorWebView HostPage="wwwroot\index.html" x:Name="BlazorWebView">
<blazor:BlazorWebView.RootComponents>
<blazor:RootComponent Selector="#app" ComponentType="{x:Type local:Main}" />
</blazor:BlazorWebView.RootComponents>
</blazor:BlazorWebView>
</TabItem>
<TabItem>
<TabItem.Header>
<TextBlock FontSize="16">Manual Download</TextBlock>
</TabItem.Header>
</TabItem>
</TabControl>
</Grid>
<Window.TaskbarItemInfo>
<TaskbarItemInfo x:Name="TaskBarItem"/>
</Window.TaskbarItemInfo>
</Window>
</mah:MetroWindow>

View File

@ -1,10 +1,14 @@
using System;
using System.Windows;
using System.Windows.Input;
using Wabbajack.App.Blazor.State;
namespace Wabbajack.App.Blazor;
public partial class MainWindow
{
private Point _lastPosition;
public MainWindow(IServiceProvider serviceProvider, IStateContainer stateContainer)
{
stateContainer.TaskBarStateObservable.Subscribe(state =>
@ -20,6 +24,11 @@ public partial class MainWindow
InitializeComponent();
BlazorWebView.Services = serviceProvider;
}
private void UIElement_OnMouseDown(object sender, MouseButtonEventArgs e)
{
this.DragMove();
}
}
// Required so compiler doesn't complain about not finding the type. [MC3050]

View File

@ -18,6 +18,7 @@
<PackageReference Include="Blazored.Toast" Version="3.2.2" />
<PackageReference Include="DynamicData" Version="7.4.9" />
<PackageReference Include="GitInfo" Version="2.2.0" />
<PackageReference Include="MahApps.Metro" Version="2.4.9" />
<PackageReference Include="Microsoft-WindowsAPICodePack-Shell" Version="1.1.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Wpf" Version="6.0.101-preview.11.2349" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.0" />
@ -47,6 +48,10 @@
<ProjectReference Include="..\Wabbajack.Services.OSIntegrated\Wabbajack.Services.OSIntegrated.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Browser\BrowserWindow.xaml.cs" />
</ItemGroup>
<!-- dotnet tool install Excubo.WebCompiler -g -->
<Target Name="TestWebCompiler" BeforeTargets="PreBuildEvent">
<Exec Command="webcompiler -h" ContinueOnError="true" StandardOutputImportance="low" StandardErrorImportance="low" LogStandardErrorAsError="false" IgnoreExitCode="true">