mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 09:56:31 +00:00
add logs, help and logo
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Threading;
|
||||
using Azaion.Annotator.DTO;
|
||||
using LibVLCSharp.Shared;
|
||||
using MediatR;
|
||||
@@ -30,6 +32,13 @@ public partial class App : Application
|
||||
services.AddSingleton<PlayerControlHandler>();
|
||||
_serviceProvider = services.BuildServiceProvider();
|
||||
_mediator = _serviceProvider.GetService<IMediator>()!;
|
||||
DispatcherUnhandledException += OnDispatcherUnhandledException;
|
||||
}
|
||||
|
||||
private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
|
||||
{
|
||||
File.AppendAllText("logs.txt", e.Exception.Message);
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UseWPF>true</UseWPF>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<ApplicationIcon>logo.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -26,4 +27,11 @@
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="logo.ico" />
|
||||
<Resource Include="logo.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -5,8 +5,11 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Azaion.Annotator"
|
||||
mc:Ignorable="d"
|
||||
Title="HelpWindow" Height="450" Width="800">
|
||||
<Grid>
|
||||
Title="Як анотувати" Height="580" Width="800"
|
||||
ResizeMode="NoResize"
|
||||
Topmost="True"
|
||||
WindowStartupLocation="CenterScreen">
|
||||
<Grid Margin="15">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto"/>
|
||||
@@ -39,10 +42,10 @@
|
||||
<TextBlock Grid.Row="6" TextWrapping="Wrap" FontSize="18" >
|
||||
6. Артилерія - це гармати, міномети. Якщо це САУ наприклад, або будь що на гусеничній техніці, це Броньована техніка.
|
||||
</TextBlock>
|
||||
<CheckBox Grid.Row="7" x:Name="CbShowHelp" IsChecked="{Binding Path=ShowHelpOnStart}">
|
||||
<CheckBox Grid.Row="7" x:Name="CbShowHelp" Margin="10" Checked="CbShowHelp_OnChecked" Unchecked="CbShowHelp_OnUnchecked">
|
||||
Показувати при запуску
|
||||
</CheckBox>
|
||||
<Button Grid.Row="8" Click="Close" IsEnabledChanged="UIElement_OnIsEnabledChanged">
|
||||
<Button Grid.Row="8" Click="Close" Height="28" Margin="10" Cursor="Hand">
|
||||
Закрити
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
@@ -5,23 +5,16 @@ namespace Azaion.Annotator;
|
||||
|
||||
public partial class HelpWindow : Window
|
||||
{
|
||||
public bool ShowHelpOnStart { get; set; }
|
||||
private readonly Config _config;
|
||||
|
||||
public HelpWindow(Config config)
|
||||
{
|
||||
_config = config;
|
||||
ShowHelpOnStart = config.ShowHelpOnStart;
|
||||
Loaded += (_, _) => CbShowHelp.IsChecked = _config.ShowHelpOnStart;
|
||||
InitializeComponent();
|
||||
}
|
||||
private void Close(object sender, RoutedEventArgs e) => Close();
|
||||
|
||||
private void Close(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void UIElement_OnIsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
_config.ShowHelpOnStart = CbShowHelp.IsChecked ?? true;
|
||||
}
|
||||
private void CbShowHelp_OnChecked(object sender, RoutedEventArgs e) => _config.ShowHelpOnStart = true;
|
||||
private void CbShowHelp_OnUnchecked(object sender, RoutedEventArgs e) => _config.ShowHelpOnStart = false;
|
||||
}
|
||||
@@ -70,7 +70,12 @@
|
||||
<MenuItem Header="Файл" Foreground="#FFBDBCBC" Margin="0,3,0,0">
|
||||
<MenuItem x:Name="OpenFolderItem"
|
||||
Foreground="Black"
|
||||
IsEnabled="True" Header="Відкрити папку..." Click="MenuItem_OnClick"/>
|
||||
IsEnabled="True" Header="Відкрити папку..." Click="OpenFolderItemClick"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Допомога" Foreground="#FFBDBCBC" Margin="0,3,0,0">
|
||||
<MenuItem x:Name="OpenHelpWindow"
|
||||
Foreground="Black"
|
||||
IsEnabled="True" Header="Як анотувати" Click="OpenHelpWindowClick"/>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<Grid
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Threading;
|
||||
using Azaion.Annotator.DTO;
|
||||
using Azaion.Annotator.Extensions;
|
||||
using LibVLCSharp.Shared;
|
||||
using MediatR;
|
||||
using Microsoft.WindowsAPICodePack.Dialogs;
|
||||
using Point = System.Windows.Point;
|
||||
using Size = System.Windows.Size;
|
||||
|
||||
namespace Azaion.Annotator;
|
||||
|
||||
@@ -74,18 +74,7 @@ public partial class MainWindow
|
||||
|
||||
ShowHelpOnStart = _config.ShowHelpOnStart;
|
||||
if (ShowHelpOnStart)
|
||||
{
|
||||
_helpWindow.Show();
|
||||
_ = Task.Run(() =>
|
||||
{
|
||||
Task.Delay(300);
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
_helpWindow.Activate();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void BlinkHelp(string helpText, int times = 3)
|
||||
@@ -230,6 +219,7 @@ public partial class MainWindow
|
||||
_libVLC.Dispose();
|
||||
_config.AnnotationClasses = AnnotationClasses.ToList();
|
||||
_config.Save();
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
|
||||
// private void AddClassBtnClick(object sender, RoutedEventArgs e)
|
||||
@@ -238,7 +228,7 @@ public partial class MainWindow
|
||||
// AnnotationClasses.Add(new AnnotationClass(AnnotationClasses.Count));
|
||||
// LvClasses.SelectedIndex = AnnotationClasses.Count - 1;
|
||||
// }
|
||||
private void MenuItem_OnClick(object sender, RoutedEventArgs e) => OpenFolder();
|
||||
private void OpenFolderItemClick(object sender, RoutedEventArgs e) => OpenFolder();
|
||||
private void OpenFolderButtonClick(object sender, RoutedEventArgs e) => OpenFolder();
|
||||
private void OpenFolder()
|
||||
{
|
||||
@@ -266,4 +256,10 @@ public partial class MainWindow
|
||||
|
||||
private void RemoveSelectedClick(object sender, RoutedEventArgs e) => _mediator.Publish(new PlaybackControlEvent(PlaybackControlEnum.RemoveSelectedAnns));
|
||||
private void RemoveAllClick(object sender, RoutedEventArgs e) => _mediator.Publish(new PlaybackControlEvent(PlaybackControlEnum.RemoveAllAnns));
|
||||
|
||||
private void OpenHelpWindowClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_helpWindow.Show();
|
||||
_helpWindow.Activate();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
Reference in New Issue
Block a user