mirror of
https://github.com/muskit/MercuryConverter.git
synced 2026-06-02 20:24:26 -07:00
refactors and more UI
This commit is contained in:
+5
-1
@@ -1,6 +1,7 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="MercuryConverter.UI.App"
|
||||
xmlns:dialogHostAvalonia="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
|
||||
RequestedThemeVariant="Default"> <!-- Dark Default Light -->
|
||||
|
||||
<Application.Styles>
|
||||
@@ -15,6 +16,8 @@
|
||||
</FluentTheme>
|
||||
|
||||
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml"/>
|
||||
<dialogHostAvalonia:DialogHostStyles/>
|
||||
<StyleInclude Source="avares://AvaloniaProgressRing/Styles/ProgressRing.xaml"/>
|
||||
</Application.Styles>
|
||||
|
||||
<Application.Resources>
|
||||
@@ -28,7 +31,8 @@
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="Dark">
|
||||
<SolidColorBrush x:Key="ExpanderHeaderBackgroundPointerOver">#20000000</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="DataGridContentBackground">#20000000</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="DataGridContentBackground">#ff000000</SolidColorBrush>
|
||||
<SolidColorBrush x:Key="DialogHostOverlayBackgroundMixinBrush">#222244</SolidColorBrush>
|
||||
<Bitmap x:Key="BannerBitmap">/Assets/imgs/banner_dark.png</Bitmap>
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.ThemeDictionaries>
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
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:MercuryConverter.UI.Dialogs"
|
||||
xmlns:progRing="clr-namespace:AvaloniaProgressRing;assembly=AvaloniaProgressRing"
|
||||
x:Class="MercuryConverter.UI.Dialogs.DataOpen"
|
||||
>
|
||||
<StackPanel Margin="12">
|
||||
<TextBlock Text="Select your data folder..."/>
|
||||
<progRing:ProgressRing Foreground="{DynamicResource SystemBaseMediumColor}"
|
||||
Width="36"
|
||||
Height="36"
|
||||
IsActive="True"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0,15,0,0"/>
|
||||
</StackPanel>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform.Storage;
|
||||
using Avalonia.Threading;
|
||||
|
||||
namespace MercuryConverter.UI.Dialogs;
|
||||
|
||||
public partial class DataOpen : Window
|
||||
{
|
||||
public DataOpen()
|
||||
{
|
||||
InitializeComponent();
|
||||
BeginDirSelection();
|
||||
}
|
||||
|
||||
private void BeginDirSelection()
|
||||
{
|
||||
Dispatcher.UIThread.Invoke(async () =>
|
||||
{
|
||||
await Task.Delay(200);
|
||||
var dirSelection = await GetTopLevel(this)!.StorageProvider.OpenFolderPickerAsync
|
||||
(
|
||||
new FolderPickerOpenOptions
|
||||
{
|
||||
Title = "Open Data Folder",
|
||||
AllowMultiple = false,
|
||||
}
|
||||
);
|
||||
|
||||
if (dirSelection.Count <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var d = dirSelection!.First().TryGetLocalPath()!;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
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:MercuryConverter.UI.Dialogs"
|
||||
x:Class="MercuryConverter.UI.Dialogs.Welcome"
|
||||
>
|
||||
<StackPanel Margin="12">
|
||||
<TextBlock FontSize="36" HorizontalAlignment="Center">
|
||||
Welcome to <Bold>MercuryConverter</Bold>!
|
||||
</TextBlock>
|
||||
<TextBlock HorizontalAlignment="Center">
|
||||
<InlineUIContainer BaselineAlignment="Bottom">
|
||||
<!-- TODO: move HOWTO to this repo -->
|
||||
<HyperlinkButton Content="Setup your data folder" Padding="0" NavigateUri="https://github.com/muskit/WacK-Repackager/blob/main/HOWTO.md" />
|
||||
</InlineUIContainer>
|
||||
before proceeding.
|
||||
</TextBlock>
|
||||
<Button Content="Open Data Folder" Click="ClickHandler" HorizontalAlignment="Center" Margin="0 8 0 0" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using DialogHostAvalonia;
|
||||
|
||||
namespace MercuryConverter.UI.Dialogs;
|
||||
|
||||
public partial class Welcome : Window
|
||||
{
|
||||
public Welcome()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void ClickHandler(object sender, RoutedEventArgs args)
|
||||
{
|
||||
MainWindow.Instance!.Dialog.DialogContent = new DataOpen().Content;
|
||||
}
|
||||
}
|
||||
+34
-27
@@ -2,41 +2,48 @@
|
||||
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:dialogHost="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia"
|
||||
xmlns:local="clr-namespace:MercuryConverter.UI"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
|
||||
x:Class="MercuryConverter.UI.MainWindow"
|
||||
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
Title="MercuryConverter"
|
||||
Width="1024" Height="800"
|
||||
MinWidth="800" MinHeight="600"
|
||||
ExtendClientAreaToDecorationsHint="True"
|
||||
>
|
||||
<!-- Components -->
|
||||
<Panel>
|
||||
<!-- Banner -->
|
||||
<StackPanel>
|
||||
<UserControl Background="{DynamicResource SystemAltHighColor}" Height="86"/>
|
||||
</StackPanel>
|
||||
<StackPanel HorizontalAlignment="Right">
|
||||
<Image Height="86" Source="{DynamicResource BannerBitmap}"/>
|
||||
</StackPanel>
|
||||
<dialogHost:DialogHost CloseOnClickAway="False" Name="Dialog">
|
||||
<dialogHost:DialogHost.DialogContent>
|
||||
<Button Content="Test"/>
|
||||
</dialogHost:DialogHost.DialogContent>
|
||||
|
||||
<DockPanel>
|
||||
|
||||
<Menu Name="MenuBar" DockPanel.Dock="Top">
|
||||
<MenuItem Header="File">
|
||||
<MenuItem Header="Open Data Folder..." />
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<!-- Components -->
|
||||
<Panel>
|
||||
<!-- Banner -->
|
||||
<StackPanel>
|
||||
<UserControl Background="{DynamicResource SystemAltHighColor}" Height="86"/>
|
||||
</StackPanel>
|
||||
<StackPanel HorizontalAlignment="Right">
|
||||
<Image Height="86" Source="{DynamicResource BannerBitmap}"/>
|
||||
</StackPanel>
|
||||
|
||||
<TabControl>
|
||||
<TabItem Header="selection">
|
||||
<UserControl Name="SelectionControl"/>
|
||||
</TabItem>
|
||||
<DockPanel>
|
||||
|
||||
<Menu Name="MenuBar" DockPanel.Dock="Top">
|
||||
<MenuItem Header="File">
|
||||
<MenuItem Header="Open Data Folder..." />
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
|
||||
<TabItem Header="export">
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
</Panel>
|
||||
<TabControl>
|
||||
<TabItem Header="selection">
|
||||
<UserControl Name="SelectionControl"/>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="export">
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
</Panel>
|
||||
</dialogHost:DialogHost>
|
||||
</Window>
|
||||
|
||||
+21
-2
@@ -1,14 +1,21 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Styling;
|
||||
using Avalonia.Threading;
|
||||
using MercuryConverter.UI.Dialogs;
|
||||
using MercuryConverter.UI.Views;
|
||||
|
||||
namespace MercuryConverter.UI;
|
||||
|
||||
using MercuryConverter.UI.Views;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public static MainWindow? Instance { get; private set; }
|
||||
private bool initialShown = false;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
Instance = this;
|
||||
InitializeComponent();
|
||||
|
||||
// Force dark mode in designer
|
||||
@@ -19,5 +26,17 @@ public partial class MainWindow : Window
|
||||
|
||||
// Setup tab views
|
||||
SelectionControl.Content = new Selection();
|
||||
|
||||
// Show dialog on startup
|
||||
Activated += OnActivated;
|
||||
}
|
||||
|
||||
private void OnActivated(object? sender, EventArgs e)
|
||||
{
|
||||
if (initialShown) return;
|
||||
initialShown = true;
|
||||
|
||||
Dialog.DialogContent = new Welcome().Content;
|
||||
Dialog.IsOpen = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user