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:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user