Add gui for photo renamer
This commit is contained in:
10
PhotoRenamerGui/App.axaml
Normal file
10
PhotoRenamerGui/App.axaml
Normal file
@ -0,0 +1,10 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="PhotoRenamerGui.App"
|
||||
RequestedThemeVariant="Default">
|
||||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
||||
|
||||
<Application.Styles>
|
||||
<FluentTheme />
|
||||
</Application.Styles>
|
||||
</Application>
|
23
PhotoRenamerGui/App.axaml.cs
Normal file
23
PhotoRenamerGui/App.axaml.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace PhotoRenamerGui;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
desktop.MainWindow = new MainWindow();
|
||||
}
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
}
|
61
PhotoRenamerGui/MainWindow.axaml
Normal file
61
PhotoRenamerGui/MainWindow.axaml
Normal file
@ -0,0 +1,61 @@
|
||||
<Window
|
||||
Title="PhotoRenamerGui"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d"
|
||||
x:Class="PhotoRenamerGui.MainWindow"
|
||||
x:DataType="photoRenamerGui:MainWindowViewModel"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:photoRenamerGui="clr-namespace:PhotoRenamerGui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Window.DataContext>
|
||||
<photoRenamerGui:MainWindowViewModel />
|
||||
</Window.DataContext>
|
||||
<Grid ColumnDefinitions="Auto,*,Auto" RowDefinitions="Auto,Auto,*">
|
||||
<Grid.Styles>
|
||||
<Style Selector="TemplatedControl.space">
|
||||
<Setter Property="Margin" Value="5" />
|
||||
</Style>
|
||||
</Grid.Styles>
|
||||
<Label
|
||||
Classes="space"
|
||||
Content="Input Folder"
|
||||
Grid.Column="0"
|
||||
Grid.Row="0"
|
||||
VerticalAlignment="Center" />
|
||||
<Label
|
||||
Classes="space"
|
||||
Content="Output Folder"
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
VerticalAlignment="Center" />
|
||||
<TextBox
|
||||
Classes="space"
|
||||
Grid.Column="1"
|
||||
Grid.Row="0"
|
||||
Text="{Binding InputFolder}"
|
||||
Watermark="Input" />
|
||||
<TextBox
|
||||
Classes="space"
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
Text="{Binding OutputFolder}"
|
||||
Watermark="Output" />
|
||||
<Button
|
||||
Classes="space"
|
||||
Grid.Column="2"
|
||||
Grid.Row="0"
|
||||
VerticalAlignment="Stretch">
|
||||
...
|
||||
</Button>
|
||||
<Button
|
||||
Classes="space"
|
||||
Grid.Column="2"
|
||||
Grid.Row="1"
|
||||
VerticalAlignment="Stretch">
|
||||
...
|
||||
</Button>
|
||||
</Grid>
|
||||
</Window>
|
11
PhotoRenamerGui/MainWindow.axaml.cs
Normal file
11
PhotoRenamerGui/MainWindow.axaml.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace PhotoRenamerGui;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
9
PhotoRenamerGui/MainWindowViewModel.cs
Normal file
9
PhotoRenamerGui/MainWindowViewModel.cs
Normal file
@ -0,0 +1,9 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace PhotoRenamerGui;
|
||||
|
||||
public partial class MainWindowViewModel : ObservableObject
|
||||
{
|
||||
[ObservableProperty] private string? _inputFolder;
|
||||
[ObservableProperty] private string? _outputFolder;
|
||||
}
|
21
PhotoRenamerGui/PhotoRenamerGui.csproj
Normal file
21
PhotoRenamerGui/PhotoRenamerGui.csproj
Normal file
@ -0,0 +1,21 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="11.0.4" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.0.4" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.4" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.4" />
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.4" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
21
PhotoRenamerGui/Program.cs
Normal file
21
PhotoRenamerGui/Program.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using Avalonia;
|
||||
using System;
|
||||
|
||||
namespace PhotoRenamerGui;
|
||||
|
||||
class Program
|
||||
{
|
||||
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||
// yet and stuff might break.
|
||||
[STAThread]
|
||||
public static void Main(string[] args) => BuildAvaloniaApp()
|
||||
.StartWithClassicDesktopLifetime(args);
|
||||
|
||||
// Avalonia configuration, don't remove; also used by visual designer.
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
=> AppBuilder.Configure<App>()
|
||||
.UsePlatformDetect()
|
||||
.WithInterFont()
|
||||
.LogToTrace();
|
||||
}
|
18
PhotoRenamerGui/app.manifest
Normal file
18
PhotoRenamerGui/app.manifest
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<!-- This manifest is used on Windows only.
|
||||
Don't remove it as it might cause problems with window transparency and embeded controls.
|
||||
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
|
||||
<assemblyIdentity version="1.0.0.0" name="PhotoRenamerGui.Desktop"/>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of the Windows versions that this application has been tested on
|
||||
and is designed to work with. Uncomment the appropriate elements
|
||||
and Windows will automatically select the most compatible environment. -->
|
||||
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
Reference in New Issue
Block a user