mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 09:56:31 +00:00
add badge with window switch on the top right
This commit is contained in:
@@ -7,7 +7,8 @@
|
|||||||
xmlns:controls1="clr-namespace:Azaion.Common.Controls;assembly=Azaion.Common"
|
xmlns:controls1="clr-namespace:Azaion.Common.Controls;assembly=Azaion.Common"
|
||||||
xmlns:controls2="clr-namespace:Azaion.Annotator.Controls;assembly=Azaion.Common"
|
xmlns:controls2="clr-namespace:Azaion.Annotator.Controls;assembly=Azaion.Common"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Azaion Annotator" Height="450" Width="1100"
|
Title="Azaion Annotator" Height="800" Width="1100"
|
||||||
|
WindowState="Maximized"
|
||||||
>
|
>
|
||||||
|
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
|
|||||||
@@ -76,21 +76,21 @@ public partial class Annotator
|
|||||||
_vlcFrameExtractor = vlcFrameExtractor;
|
_vlcFrameExtractor = vlcFrameExtractor;
|
||||||
_aiDetector = aiDetector;
|
_aiDetector = aiDetector;
|
||||||
|
|
||||||
Loaded += VideoView_Loaded;
|
Loaded += OnLoaded;
|
||||||
Closed += OnFormClosed;
|
Closed += OnFormClosed;
|
||||||
|
|
||||||
Editor.GetTimeFunc = () => TimeSpan.FromMilliseconds(_mediaPlayer.Time);
|
Editor.GetTimeFunc = () => TimeSpan.FromMilliseconds(_mediaPlayer.Time);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void VideoView_Loaded(object sender, RoutedEventArgs e)
|
private void OnLoaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Core.Initialize();
|
Core.Initialize();
|
||||||
InitControls();
|
InitControls();
|
||||||
|
|
||||||
_suspendLayout = true;
|
_suspendLayout = true;
|
||||||
|
|
||||||
MainGrid.ColumnDefinitions.FirstOrDefault()!.Width = new GridLength(_appConfig.WindowConfig.LeftPanelWidth);
|
MainGrid.ColumnDefinitions.FirstOrDefault()!.Width = new GridLength(_appConfig.AnnotatorWindowConfig.LeftPanelWidth);
|
||||||
MainGrid.ColumnDefinitions.LastOrDefault()!.Width = new GridLength(_appConfig.WindowConfig.RightPanelWidth);
|
MainGrid.ColumnDefinitions.LastOrDefault()!.Width = new GridLength(_appConfig.AnnotatorWindowConfig.RightPanelWidth);
|
||||||
|
|
||||||
_suspendLayout = false;
|
_suspendLayout = false;
|
||||||
|
|
||||||
@@ -229,8 +229,8 @@ public partial class Annotator
|
|||||||
if (_suspendLayout)
|
if (_suspendLayout)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_appConfig.WindowConfig.LeftPanelWidth = MainGrid.ColumnDefinitions.FirstOrDefault()!.Width.Value;
|
_appConfig.AnnotatorWindowConfig.LeftPanelWidth = MainGrid.ColumnDefinitions.FirstOrDefault()!.Width.Value;
|
||||||
_appConfig.WindowConfig.RightPanelWidth = MainGrid.ColumnDefinitions.LastOrDefault()!.Width.Value;
|
_appConfig.AnnotatorWindowConfig.RightPanelWidth = MainGrid.ColumnDefinitions.LastOrDefault()!.Width.Value;
|
||||||
|
|
||||||
await ThrottleExt.Throttle(() =>
|
await ThrottleExt.Throttle(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
using System.Windows;
|
|
||||||
using Azaion.Annotator.DTO;
|
|
||||||
using Azaion.Common.DTO.Config;
|
|
||||||
|
|
||||||
namespace Azaion.Annotator.Extensions;
|
|
||||||
|
|
||||||
public static class WindowExtensions
|
|
||||||
{
|
|
||||||
public static WindowConfig GetConfig(this Window window) =>
|
|
||||||
new()
|
|
||||||
{
|
|
||||||
WindowSize = new Size(window.Width, window.Height),
|
|
||||||
WindowLocation = new Point(window.Left, window.Top),
|
|
||||||
FullScreen = window.WindowState == WindowState.Maximized
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -6,12 +6,12 @@ namespace Azaion.Annotator;
|
|||||||
|
|
||||||
public partial class HelpWindow : Window
|
public partial class HelpWindow : Window
|
||||||
{
|
{
|
||||||
private readonly WindowConfig _windowConfig;
|
private readonly AnnotatorWindowConfig _annotatorWindowConfig;
|
||||||
|
|
||||||
public HelpWindow(IOptions<WindowConfig> windowConfig)
|
public HelpWindow(IOptions<AnnotatorWindowConfig> windowConfig)
|
||||||
{
|
{
|
||||||
_windowConfig = windowConfig.Value;
|
_annotatorWindowConfig = windowConfig.Value;
|
||||||
Loaded += (_, _) => CbShowHelp.IsChecked = _windowConfig.ShowHelpOnStart;
|
Loaded += (_, _) => CbShowHelp.IsChecked = _annotatorWindowConfig.ShowHelpOnStart;
|
||||||
Closing += (sender, args) =>
|
Closing += (sender, args) =>
|
||||||
{
|
{
|
||||||
args.Cancel = true;
|
args.Cancel = true;
|
||||||
@@ -20,7 +20,7 @@ public partial class HelpWindow : Window
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CbShowHelp_OnChecked(object sender, RoutedEventArgs e) => _windowConfig.ShowHelpOnStart = true;
|
private void CbShowHelp_OnChecked(object sender, RoutedEventArgs e) => _annotatorWindowConfig.ShowHelpOnStart = true;
|
||||||
private void CbShowHelp_OnUnchecked(object sender, RoutedEventArgs e) => _windowConfig.ShowHelpOnStart = false;
|
private void CbShowHelp_OnUnchecked(object sender, RoutedEventArgs e) => _annotatorWindowConfig.ShowHelpOnStart = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -56,16 +56,17 @@ public class Constants
|
|||||||
|
|
||||||
# endregion AIRecognitionConfig
|
# endregion AIRecognitionConfig
|
||||||
|
|
||||||
# region WindowConfig
|
# region AnnotatorWindowConfig
|
||||||
|
|
||||||
public static readonly Size DefaultWindowSize = new(1280, 720);
|
public static int DEFAULT_LEFT_PANEL_WIDTH = 250;
|
||||||
public static readonly Point DefaultWindowLocation = new(100, 100);
|
public static int DEFAULT_RIGHT_PANEL_WIDTH = 250;
|
||||||
public static readonly Size DefaultThumbnailSize = new(240, 135);
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Thumbnails
|
#region Thumbnails
|
||||||
|
|
||||||
|
public static readonly Size DefaultThumbnailSize = new(240, 135);
|
||||||
|
|
||||||
public const int DEFAULT_THUMBNAIL_BORDER = 10;
|
public const int DEFAULT_THUMBNAIL_BORDER = 10;
|
||||||
|
|
||||||
public const string THUMBNAIL_PREFIX = "_thumb";
|
public const string THUMBNAIL_PREFIX = "_thumb";
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Azaion.Common.DTO.Config;
|
||||||
|
|
||||||
|
public class AnnotatorWindowConfig
|
||||||
|
{
|
||||||
|
public double LeftPanelWidth { get; set; }
|
||||||
|
public double RightPanelWidth { get; set; }
|
||||||
|
public bool ShowHelpOnStart { get; set; }
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ public class AppConfig
|
|||||||
|
|
||||||
public AnnotationConfig AnnotationConfig { get; set; } = null!;
|
public AnnotationConfig AnnotationConfig { get; set; } = null!;
|
||||||
|
|
||||||
public WindowConfig WindowConfig { get; set; } = null!;
|
public AnnotatorWindowConfig AnnotatorWindowConfig { get; set; } = null!;
|
||||||
|
|
||||||
public AIRecognitionConfig AIRecognitionConfig { get; set; } = null!;
|
public AIRecognitionConfig AIRecognitionConfig { get; set; } = null!;
|
||||||
|
|
||||||
@@ -51,13 +51,10 @@ public class ConfigUpdater : IConfigUpdater
|
|||||||
ImageFormats = Constants.DefaultImageFormats,
|
ImageFormats = Constants.DefaultImageFormats,
|
||||||
},
|
},
|
||||||
|
|
||||||
WindowConfig = new WindowConfig
|
AnnotatorWindowConfig = new AnnotatorWindowConfig
|
||||||
{
|
{
|
||||||
WindowSize = Constants.DefaultWindowSize,
|
LeftPanelWidth = Constants.DEFAULT_LEFT_PANEL_WIDTH,
|
||||||
WindowLocation = Constants.DefaultWindowLocation,
|
RightPanelWidth = Constants.DEFAULT_RIGHT_PANEL_WIDTH
|
||||||
FullScreen = true,
|
|
||||||
LeftPanelWidth = 250,
|
|
||||||
RightPanelWidth = 250,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
DirectoriesConfig = new DirectoriesConfig
|
DirectoriesConfig = new DirectoriesConfig
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
using System.Windows;
|
|
||||||
|
|
||||||
namespace Azaion.Common.DTO.Config;
|
|
||||||
|
|
||||||
public class WindowConfig
|
|
||||||
{
|
|
||||||
public Size WindowSize { get; set; }
|
|
||||||
public Point WindowLocation { get; set; }
|
|
||||||
public bool FullScreen { get; set; }
|
|
||||||
|
|
||||||
public double LeftPanelWidth { get; set; }
|
|
||||||
public double RightPanelWidth { get; set; }
|
|
||||||
public bool ShowHelpOnStart { get; set; }
|
|
||||||
}
|
|
||||||
@@ -9,7 +9,8 @@
|
|||||||
xmlns:controls="clr-namespace:Azaion.Common.Controls;assembly=Azaion.Common"
|
xmlns:controls="clr-namespace:Azaion.Common.Controls;assembly=Azaion.Common"
|
||||||
xmlns:controls1="clr-namespace:Azaion.Annotator.Controls;assembly=Azaion.Common"
|
xmlns:controls1="clr-namespace:Azaion.Annotator.Controls;assembly=Azaion.Common"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Переглядач анотацій" Height="900" Width="1200">
|
Title="Переглядач анотацій" Height="900" Width="1200"
|
||||||
|
WindowState="Maximized">
|
||||||
|
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<DataTemplate x:Key="ThumbnailTemplate" DataType="{x:Type datasetExplorer:ThumbnailDto}">
|
<DataTemplate x:Key="ThumbnailTemplate" DataType="{x:Type datasetExplorer:ThumbnailDto}">
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ namespace Azaion.Dataset;
|
|||||||
|
|
||||||
public class DatasetExplorerModule : IAzaionModule
|
public class DatasetExplorerModule : IAzaionModule
|
||||||
{
|
{
|
||||||
public string Name => "Переглядач Анотацій";
|
public string Name => "Переглядач";
|
||||||
|
|
||||||
public string SvgIcon =>
|
public string SvgIcon =>
|
||||||
@"<?xml version=""1.0"" encoding=""utf-8""?>
|
@"<?xml version=""1.0"" encoding=""utf-8""?>
|
||||||
|
|||||||
@@ -12,9 +12,11 @@ public partial class Loader : Window
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RunClick(object sender, RoutedEventArgs e)
|
private async void RunClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Process.Start("Azaion.Suite.exe", $"-e {TbEmail.Text} -p {TbPassword.Password}");
|
Process.Start("Azaion.Suite.exe", $"-e {TbEmail.Text} -p {TbPassword.Password}");
|
||||||
|
await Task.Delay(2000);
|
||||||
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CloseClick(object sender, RoutedEventArgs e) => Close();
|
private void CloseClick(object sender, RoutedEventArgs e) => Close();
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using Azaion.Annotator;
|
using Azaion.Annotator;
|
||||||
@@ -104,7 +103,7 @@ public partial class App
|
|||||||
services.ConfigureSection<ApiConfig>(context.Configuration);
|
services.ConfigureSection<ApiConfig>(context.Configuration);
|
||||||
services.ConfigureSection<DirectoriesConfig>(context.Configuration);
|
services.ConfigureSection<DirectoriesConfig>(context.Configuration);
|
||||||
services.ConfigureSection<AnnotationConfig>(context.Configuration);
|
services.ConfigureSection<AnnotationConfig>(context.Configuration);
|
||||||
services.ConfigureSection<WindowConfig>(context.Configuration);
|
services.ConfigureSection<AnnotatorWindowConfig>(context.Configuration);
|
||||||
services.ConfigureSection<AIRecognitionConfig>(context.Configuration);
|
services.ConfigureSection<AIRecognitionConfig>(context.Configuration);
|
||||||
services.ConfigureSection<ThumbnailConfig>(context.Configuration);
|
services.ConfigureSection<ThumbnailConfig>(context.Configuration);
|
||||||
|
|
||||||
@@ -171,18 +170,26 @@ public partial class App
|
|||||||
_ = ThrottleExt.Throttle(() => _mediator.Publish(keyEvent), TimeSpan.FromMilliseconds(50));
|
_ = ThrottleExt.Throttle(() => _mediator.Publish(keyEvent), TimeSpan.FromMilliseconds(50));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private readonly Dictionary<string, WindowEnum> _uiElementToWindowEnum = new()
|
||||||
|
{
|
||||||
|
{ "LibVLCSharp.WPF.ForegroundWindow", WindowEnum.Annotator },
|
||||||
|
{ "Azaion.Annotator.Annotator", WindowEnum.Annotator },
|
||||||
|
{ "Azaion.Annotator.DatasetExplorer", WindowEnum.DatasetExplorer }
|
||||||
|
};
|
||||||
|
|
||||||
private WindowEnum GetParentWindow(FrameworkElement? element)
|
private WindowEnum GetParentWindow(FrameworkElement? element)
|
||||||
{
|
{
|
||||||
if (element?.GetType().Name == "LibVLCSharp.WPF.ForegroundWindow")
|
while (element != null)
|
||||||
return WindowEnum.Annotator;
|
{
|
||||||
|
var windowEnum = _uiElementToWindowEnum!.GetValueOrDefault(element.GetType().FullName);
|
||||||
|
|
||||||
|
if (windowEnum != WindowEnum.None)
|
||||||
|
return windowEnum;
|
||||||
|
|
||||||
while (element != null && element is not TabItem)
|
|
||||||
element = element.Parent as FrameworkElement;
|
element = element.Parent as FrameworkElement;
|
||||||
|
}
|
||||||
|
|
||||||
if (element is not TabItem || element.Tag == null)
|
return WindowEnum.None;
|
||||||
return WindowEnum.None;
|
|
||||||
|
|
||||||
return (WindowEnum)element.Tag;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,11 +33,18 @@
|
|||||||
<ProjectReference Include="..\Azaion.Dataset\Azaion.Dataset.csproj" />
|
<ProjectReference Include="..\Azaion.Dataset\Azaion.Dataset.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="logo.png" />
|
||||||
|
<Content Include="logo.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="PostBuild" AfterTargets="Build">
|
<Target Name="PostBuild" AfterTargets="Build">
|
||||||
<MakeDir Directories="$(TargetDir)secure" />
|
<MakeDir Directories="$(TargetDir)secure" />
|
||||||
<Move SourceFiles="$(TargetDir)Azaion.Annotator.dll" DestinationFolder="$(TargetDir)secure" />
|
<Move SourceFiles="$(TargetDir)Azaion.Annotator.dll" DestinationFolder="$(TargetDir)secure" />
|
||||||
<Move SourceFiles="$(TargetDir)Azaion.Dataset.dll" DestinationFolder="$(TargetDir)secure" />
|
<Move SourceFiles="$(TargetDir)Azaion.Dataset.dll" DestinationFolder="$(TargetDir)secure" />
|
||||||
<Exec Command="upload.cmd" />
|
<Exec Command="upload.cmd $(ConfigurationName)" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -4,19 +4,58 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Azaion Оператор" Height="100" Width="200"
|
Title="Azaion Оператор" Height="60" Width="214"
|
||||||
WindowStyle="None"
|
WindowStyle="None"
|
||||||
ResizeMode="NoResize"
|
ResizeMode="NoResize"
|
||||||
Top="0"
|
Top="0"
|
||||||
Topmost="True"
|
Topmost="True"
|
||||||
>
|
>
|
||||||
<Grid>
|
<Grid Background="Black">
|
||||||
<ListView Name="ListView" Background="Black" BorderBrush="Black">
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="48"></ColumnDefinition>
|
||||||
|
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||||
|
<ColumnDefinition Width="24"></ColumnDefinition>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Border Grid.Column="0" Padding="5">
|
||||||
|
<Image Source="logo.png" />
|
||||||
|
</Border>
|
||||||
|
<ListView
|
||||||
|
Grid.Column="1"
|
||||||
|
Name="ListView"
|
||||||
|
Background="Black" BorderBrush="Black">
|
||||||
<ListView.ItemsPanel>
|
<ListView.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<StackPanel Orientation="Horizontal" />
|
<StackPanel Orientation="Horizontal" />
|
||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
</ListView.ItemsPanel>
|
</ListView.ItemsPanel>
|
||||||
</ListView>
|
</ListView>
|
||||||
|
|
||||||
|
<Border Grid.Column="2">
|
||||||
|
<Button
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
Width="24"
|
||||||
|
Height="24"
|
||||||
|
ToolTip="Закрити" Background="Black" BorderBrush="Black" Cursor="Hand"
|
||||||
|
Name="CloseBtn"
|
||||||
|
Click="CloseBtn_OnClick">
|
||||||
|
<Path Stretch="Fill" Fill="LightGray" Data="M5.29289 5.29289C5.68342 4.90237 6.31658 4.90237 6.70711 5.29289L12 10.5858L17.2929 5.29289C17.6834 4.90237 18.3166
|
||||||
|
4.90237 18.7071 5.29289C19.0976 5.68342 19.0976 6.31658 18.7071 6.70711L13.4142 12L18.7071 17.2929C19.0976 17.6834 19.0976 18.3166 18.7071 18.7071C18.3166
|
||||||
|
19.0976 17.6834 19.0976 17.2929 18.7071L12 13.4142L6.70711 18.7071C6.31658 19.0976 5.68342 19.0976 5.29289 18.7071C4.90237 18.3166 4.90237 17.6834 5.29289
|
||||||
|
17.2929L10.5858 12L5.29289 6.70711C4.90237 6.31658 4.90237 5.68342 5.29289 5.29289Z" />
|
||||||
|
<Button.Style>
|
||||||
|
<Style TargetType="{x:Type Button}">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="{x:Type Button}">
|
||||||
|
<Border Background="{TemplateBinding Background}" BorderThickness="1">
|
||||||
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</Button.Style>
|
||||||
|
</Button>
|
||||||
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public partial class MainSuite
|
|||||||
private readonly IConfigUpdater _configUpdater;
|
private readonly IConfigUpdater _configUpdater;
|
||||||
private readonly IEnumerable<IAzaionModule> _modules;
|
private readonly IEnumerable<IAzaionModule> _modules;
|
||||||
private readonly IServiceProvider _sp;
|
private readonly IServiceProvider _sp;
|
||||||
private readonly List<Window> _openedWindows = new();
|
private readonly Dictionary<WindowEnum, Window> _openedWindows = new();
|
||||||
|
|
||||||
public MainSuite(IOptions<AppConfig> appConfig, IConfigUpdater configUpdater, IEnumerable<IAzaionModule> modules, IServiceProvider sp )
|
public MainSuite(IOptions<AppConfig> appConfig, IConfigUpdater configUpdater, IEnumerable<IAzaionModule> modules, IServiceProvider sp )
|
||||||
{
|
{
|
||||||
@@ -33,7 +33,7 @@ public partial class MainSuite
|
|||||||
SizeChanged += async (_, _) => await SaveUserSettings();
|
SizeChanged += async (_, _) => await SaveUserSettings();
|
||||||
LocationChanged += async (_, _) => await SaveUserSettings();
|
LocationChanged += async (_, _) => await SaveUserSettings();
|
||||||
StateChanged += async (_, _) => await SaveUserSettings();
|
StateChanged += async (_, _) => await SaveUserSettings();
|
||||||
Left = SystemParameters.WorkArea.Width - Width - 150;
|
Left = SystemParameters.WorkArea.Width - Width - 250;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnLoaded(object sender, RoutedEventArgs e)
|
private void OnLoaded(object sender, RoutedEventArgs e)
|
||||||
@@ -71,15 +71,35 @@ public partial class MainSuite
|
|||||||
Cursor = Cursors.Hand,
|
Cursor = Cursors.Hand,
|
||||||
Tag = azaionModule
|
Tag = azaionModule
|
||||||
};
|
};
|
||||||
lvItem.MouseUp += (sender, _) =>
|
lvItem.MouseUp += (lv, _) => OpenWindow((lv as ListViewItem)!);
|
||||||
{
|
|
||||||
var module = ((sender as ListViewItem)!.Tag as IAzaionModule)!;
|
|
||||||
var window = (_sp.GetRequiredService(module.MainWindowType) as Window)!;
|
|
||||||
_openedWindows.Add(window);
|
|
||||||
window.Show();
|
|
||||||
};
|
|
||||||
ListView.Items.Add(lvItem);
|
ListView.Items.Add(lvItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//by default show first
|
||||||
|
ListView.SelectedIndex = 0;
|
||||||
|
OpenWindow((ListView.Items[0] as ListViewItem)!);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OpenWindow(ListViewItem sender)
|
||||||
|
{
|
||||||
|
var module = (sender.Tag as IAzaionModule)!;
|
||||||
|
var window = (_sp.GetRequiredService(module.MainWindowType) as Window)!;
|
||||||
|
|
||||||
|
if (_openedWindows.ContainsKey(module.WindowEnum))
|
||||||
|
window.Activate();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_openedWindows[module.WindowEnum] = window;
|
||||||
|
window.Closed += (_, _) =>
|
||||||
|
{
|
||||||
|
_openedWindows.Remove(module.WindowEnum);
|
||||||
|
if (!_openedWindows.Any())
|
||||||
|
Close();
|
||||||
|
};
|
||||||
|
window.Show();
|
||||||
|
window.Activate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SaveUserSettings()
|
private async Task SaveUserSettings()
|
||||||
@@ -95,7 +115,9 @@ public partial class MainSuite
|
|||||||
{
|
{
|
||||||
_configUpdater.Save(_appConfig);
|
_configUpdater.Save(_appConfig);
|
||||||
foreach (var window in _openedWindows)
|
foreach (var window in _openedWindows)
|
||||||
window.Close();
|
window.Value.Close();
|
||||||
Application.Current.Shutdown();
|
Application.Current.Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CloseBtn_OnClick(object sender, RoutedEventArgs e) => Close();
|
||||||
}
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 50 KiB |
+25
-16
@@ -1,14 +1,22 @@
|
|||||||
setlocal enabledelayedexpansion
|
setlocal enabledelayedexpansion
|
||||||
|
set CONFIG=%1
|
||||||
|
@echo off
|
||||||
|
|
||||||
|
set API_URL=https://api.azaion.com
|
||||||
|
|
||||||
set LOGIN_URL=https://api.azaion.com/login
|
|
||||||
set RESOURCE_URL=https://api.azaion.com/resources
|
|
||||||
set EMAIL=uploader@azaion.com
|
set EMAIL=uploader@azaion.com
|
||||||
set PASSWORD=Az@1on_10Upl0@der
|
set PASSWORD=Az@1on_10Upl0@der
|
||||||
set FILE_TO_UPLOAD=bin\Release\net8.0-windows\secure\Azaion.Annotator.dll
|
|
||||||
|
set FILE1_TO_UPLOAD=%cd%\bin\%CONFIG%\net8.0-windows\secure\Azaion.Annotator.dll
|
||||||
|
set "FILE1_TO_UPLOAD=%FILE1_TO_UPLOAD:\=/%"
|
||||||
|
|
||||||
|
set FILE2_TO_UPLOAD=%cd%\bin\%CONFIG%\net8.0-windows\secure\Azaion.Dataset.dll
|
||||||
|
set "FILE2_TO_UPLOAD=%FILE2_TO_UPLOAD:\=/%"
|
||||||
|
|
||||||
|
|
||||||
echo Logging in and retrieving token...
|
echo Logging in and retrieving token...
|
||||||
for /f "tokens=*" %%i in ('curl -s -X POST -H "Content-Type: application/json" ^
|
for /f "tokens=*" %%i in ('curl -s -X POST -H "Content-Type: application/json" ^
|
||||||
-d "{\"email\":\"%EMAIL%\",\"password\":\"%PASSWORD%\"}" %LOGIN_URL%') do set RESPONSE=%%i
|
-d "{\"email\":\"%EMAIL%\",\"password\":\"%PASSWORD%\"}" %API_URL%/login') do set RESPONSE=%%i
|
||||||
|
|
||||||
for /f "tokens=2 delims=:" %%a in ('echo %RESPONSE% ^| findstr /i "token"') do (
|
for /f "tokens=2 delims=:" %%a in ('echo %RESPONSE% ^| findstr /i "token"') do (
|
||||||
set "TOKEN=%%a"
|
set "TOKEN=%%a"
|
||||||
@@ -16,18 +24,19 @@ for /f "tokens=2 delims=:" %%a in ('echo %RESPONSE% ^| findstr /i "token"') do (
|
|||||||
set "TOKEN=!TOKEN:~0,-2!"
|
set "TOKEN=!TOKEN:~0,-2!"
|
||||||
)
|
)
|
||||||
|
|
||||||
echo Token retrieved: %TOKEN%
|
|
||||||
|
|
||||||
:: Step 2: Upload the DLL file
|
:: Step 2: Upload the DLL file
|
||||||
if not exist "%FILE_TO_UPLOAD%" (
|
|
||||||
echo File %FILE_TO_UPLOAD% does not exist. Exiting...
|
|
||||||
exit /b 1
|
|
||||||
)
|
|
||||||
|
|
||||||
echo Uploading file to resources...
|
echo Uploading files to resources...
|
||||||
curl -X POST -H "Authorization: Bearer %TOKEN%" ^
|
|
||||||
-H "Content-Type: application/octet-stream" ^
|
|
||||||
--data-binary @"%FILE_TO_UPLOAD%" ^
|
|
||||||
%RESOURCE_URL%
|
|
||||||
|
|
||||||
echo Done!
|
curl --location %API_URL%/resources ^
|
||||||
|
-H "Authorization: Bearer %TOKEN%" ^
|
||||||
|
-H "Content-Type: multipart/form-data" ^
|
||||||
|
--form "data=@%FILE1_TO_UPLOAD%"
|
||||||
|
|
||||||
|
curl --location %API_URL%/resources ^
|
||||||
|
-H "Authorization: Bearer %TOKEN%" ^
|
||||||
|
-H "Content-Type: multipart/form-data" ^
|
||||||
|
--form "data=@%FILE2_TO_UPLOAD%"
|
||||||
|
|
||||||
|
|
||||||
|
echo Done!
|
||||||
|
|||||||
Reference in New Issue
Block a user