Skip to content

Commit

Permalink
UI and refactor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben2776 committed Nov 28, 2024
1 parent fc22406 commit d86c9ba
Show file tree
Hide file tree
Showing 6 changed files with 186 additions and 175 deletions.
63 changes: 36 additions & 27 deletions src/PicView.Avalonia.Win32/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,40 +46,49 @@ public override void Initialize()

public override async void OnFrameworkInitializationCompleted()
{
base.OnFrameworkInitializationCompleted();

if (ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop)
{
return;
}

bool settingsExists;
try
{
settingsExists = await SettingsHelper.LoadSettingsAsync().ConfigureAwait(false);
}
catch (TaskCanceledException)
{
return;
}
base.OnFrameworkInitializationCompleted();

if (ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop)
{
return;
}

bool settingsExists;
try
{
settingsExists = await SettingsHelper.LoadSettingsAsync().ConfigureAwait(false);
}
catch (TaskCanceledException)
{
return;
}

TranslationHelper.Init();
TranslationHelper.Init();

await Dispatcher.UIThread.InvokeAsync(() =>
{
ThemeManager.DetermineTheme(Current, settingsExists);
await Dispatcher.UIThread.InvokeAsync(() =>
{
ThemeManager.DetermineTheme(Current, settingsExists);
_mainWindow = new WinMainWindow();
desktop.MainWindow = _mainWindow;
});
_mainWindow = new WinMainWindow();
desktop.MainWindow = _mainWindow;
});

_vm = new MainViewModel(this);
_vm = new MainViewModel(this);

await Dispatcher.UIThread.InvokeAsync(() =>
await Dispatcher.UIThread.InvokeAsync(() =>
{
_mainWindow.DataContext = _vm;
StartUpHelper.Start(_vm, settingsExists, desktop, _mainWindow);
});
}
catch (Exception e)
{
_mainWindow.DataContext = _vm;
StartUpHelper.Start(_vm, settingsExists, desktop, _mainWindow);
});
#if DEBUG
Console.WriteLine(e);
#endif
}
}

#region Interface Implementations
Expand Down Expand Up @@ -366,7 +375,7 @@ void Set()
}
else
{
_batchResizeWindow.Activate();
_batchResizeWindow.Show();
}
_= FunctionsHelper.CloseMenus();
}
Expand Down
3 changes: 3 additions & 0 deletions src/PicView.Avalonia/PicViewTheme/Classes.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="LineHeight" Value="18" />
<Style Selector="^:disabled">
<Setter Property="Opacity" Value="{StaticResource ThemeDisabledOpacity}" />
</Style>
</Style>

<Style Selector="TextBlock.txtShadow">
Expand Down
7 changes: 5 additions & 2 deletions src/PicView.Avalonia/PicViewTheme/Controls/CheckBox.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
Height="18"
VerticalAlignment="Center"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{DynamicResource MainBorderColor}"
BorderThickness="1"
CornerRadius="{TemplateBinding CornerRadius}">
<Panel>
<Path Name="checkMark"
Expand Down Expand Up @@ -66,6 +66,9 @@
<Style Selector="^:checked /template/ Path#checkMark">
<Setter Property="IsVisible" Value="True" />
</Style>
<Style Selector="^:checked /template/ Border#border">
<Setter Property="BorderBrush" Value="{DynamicResource TertiaryBorderColor}" />
</Style>
<Style Selector="^:indeterminate /template/ Rectangle#indeterminateMark">
<Setter Property="IsVisible" Value="True" />
</Style>
Expand Down
4 changes: 2 additions & 2 deletions src/PicView.Avalonia/PicViewTheme/Controls/Slider.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Setter Property="Height" Value="12" />
<Setter Property="Template">
<ControlTemplate>
<Border Background="{DynamicResource AccentColor}" />
<Border Name="DecreaseThemeBorder" Background="{DynamicResource AccentColor}" />
</ControlTemplate>
</Setter>
</ControlTheme>
Expand All @@ -16,7 +16,7 @@
<Setter Property="Height" Value="12" />
<Setter Property="Template">
<ControlTemplate>
<Border Background="{DynamicResource AccentColor}" Opacity="0.2" />
<Border Name="IncreaseThemeBorder" Background="{DynamicResource AccentColor}" Opacity="0.2" />
</ControlTemplate>
</Setter>
</ControlTheme>
Expand Down
10 changes: 4 additions & 6 deletions src/PicView.Avalonia/PicViewTheme/Controls/TextBlock.axaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Design.PreviewWith>
<Border />
</Design.PreviewWith>

<ControlTheme x:Key="{x:Type TextBlock}" TargetType="TextBlock">
<ControlTheme TargetType="TextBlock" x:Key="{x:Type TextBlock}">

<Setter Property="Button.Template">
<ControlTemplate TargetType="TextBlock">
<ContentPresenter
x:Name="PART_ContentPresenter"
Padding="{TemplateBinding Padding}"
RecognizesAccessKey="True"
UseLayoutRounding="False" />
UseLayoutRounding="False"
x:Name="PART_ContentPresenter" />
</ControlTemplate>
</Setter>
</ControlTheme>

</ResourceDictionary>
Loading

0 comments on commit d86c9ba

Please sign in to comment.