mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 22:46:30 +00:00
make resizable panels
fix duration bug
This commit is contained in:
@@ -4,3 +4,4 @@ obj
|
|||||||
.vs
|
.vs
|
||||||
*.DotSettings*
|
*.DotSettings*
|
||||||
*.user
|
*.user
|
||||||
|
log*
|
||||||
@@ -5,5 +5,6 @@ public class VideoFileInfo
|
|||||||
public string Name { get; set; } = null!;
|
public string Name { get; set; } = null!;
|
||||||
public string Path { get; set; } = null!;
|
public string Path { get; set; } = null!;
|
||||||
public TimeSpan Duration { get; set; }
|
public TimeSpan Duration { get; set; }
|
||||||
|
public string DurationStr => $"{Duration:h\\:mm\\:ss}";
|
||||||
public bool HasAnnotations { get; set; }
|
public bool HasAnnotations { get; set; }
|
||||||
}
|
}
|
||||||
@@ -62,6 +62,7 @@
|
|||||||
<ColumnDefinition Width="250" />
|
<ColumnDefinition Width="250" />
|
||||||
<ColumnDefinition Width="4"/>
|
<ColumnDefinition Width="4"/>
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="4"/>
|
||||||
<ColumnDefinition Width="200" />
|
<ColumnDefinition Width="200" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
@@ -81,10 +82,11 @@
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
<Grid
|
<Grid
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Grid.Row="1">
|
Grid.Row="1">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="220" />
|
<ColumnDefinition Width="*" />
|
||||||
<ColumnDefinition Width="30"/>
|
<ColumnDefinition Width="30"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBox
|
<TextBox
|
||||||
@@ -124,7 +126,7 @@
|
|||||||
DisplayMemberBinding="{Binding Path=Name}"/>
|
DisplayMemberBinding="{Binding Path=Name}"/>
|
||||||
<GridViewColumn Width="Auto"
|
<GridViewColumn Width="Auto"
|
||||||
Header="Тривалість"
|
Header="Тривалість"
|
||||||
DisplayMemberBinding="{Binding Path=Duration}"/>
|
DisplayMemberBinding="{Binding Path=DurationStr}"/>
|
||||||
</GridView>
|
</GridView>
|
||||||
</ListView.View>
|
</ListView.View>
|
||||||
</ListView>
|
</ListView>
|
||||||
@@ -144,7 +146,7 @@
|
|||||||
CanUserResizeColumns="False">
|
CanUserResizeColumns="False">
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTemplateColumn
|
<DataGridTemplateColumn
|
||||||
Width="60"
|
Width="50"
|
||||||
Header="Клавіша"
|
Header="Клавіша"
|
||||||
CanUserSort="False">
|
CanUserSort="False">
|
||||||
<DataGridTemplateColumn.HeaderStyle>
|
<DataGridTemplateColumn.HeaderStyle>
|
||||||
@@ -178,6 +180,7 @@
|
|||||||
ResizeDirection="Columns"
|
ResizeDirection="Columns"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
|
Grid.RowSpan="3"
|
||||||
ResizeBehavior="PreviousAndNext"
|
ResizeBehavior="PreviousAndNext"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
@@ -189,11 +192,20 @@
|
|||||||
x:Name="VideoView">
|
x:Name="VideoView">
|
||||||
<controls:CanvasEditor x:Name="Editor" Background="#01000000" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
|
<controls:CanvasEditor x:Name="Editor" Background="#01000000" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
|
||||||
</wpf:VideoView>
|
</wpf:VideoView>
|
||||||
|
<GridSplitter
|
||||||
<DataGrid x:Name="DgAnnotations"
|
Background="DarkGray"
|
||||||
|
ResizeDirection="Columns"
|
||||||
Grid.Column="3"
|
Grid.Column="3"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.RowSpan="3"
|
Grid.RowSpan="3"
|
||||||
|
ResizeBehavior="PreviousAndNext"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
/>
|
||||||
|
<DataGrid x:Name="DgAnnotations"
|
||||||
|
Grid.Column="4"
|
||||||
|
Grid.Row="1"
|
||||||
|
Grid.RowSpan="3"
|
||||||
Background="Black"
|
Background="Black"
|
||||||
RowBackground="#252525"
|
RowBackground="#252525"
|
||||||
Foreground="White"
|
Foreground="White"
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ using Newtonsoft.Json;
|
|||||||
using Point = System.Windows.Point;
|
using Point = System.Windows.Point;
|
||||||
using Size = System.Windows.Size;
|
using Size = System.Windows.Size;
|
||||||
using IntervalTree;
|
using IntervalTree;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace Azaion.Annotator;
|
namespace Azaion.Annotator;
|
||||||
|
|
||||||
@@ -24,6 +25,7 @@ public partial class MainWindow
|
|||||||
|
|
||||||
private readonly IConfigRepository _configRepository;
|
private readonly IConfigRepository _configRepository;
|
||||||
private readonly HelpWindow _helpWindow;
|
private readonly HelpWindow _helpWindow;
|
||||||
|
private readonly ILogger<MainWindow> _logger;
|
||||||
|
|
||||||
public ObservableCollection<AnnotationClass> AnnotationClasses { get; set; } = new();
|
public ObservableCollection<AnnotationClass> AnnotationClasses { get; set; } = new();
|
||||||
private bool _suspendLayout;
|
private bool _suspendLayout;
|
||||||
@@ -39,7 +41,8 @@ public partial class MainWindow
|
|||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
FormState formState,
|
FormState formState,
|
||||||
IConfigRepository configRepository,
|
IConfigRepository configRepository,
|
||||||
HelpWindow helpWindow)
|
HelpWindow helpWindow,
|
||||||
|
ILogger<MainWindow> logger)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_libVLC = libVLC;
|
_libVLC = libVLC;
|
||||||
@@ -49,6 +52,7 @@ public partial class MainWindow
|
|||||||
_configRepository = configRepository;
|
_configRepository = configRepository;
|
||||||
_config = _configRepository.Get();
|
_config = _configRepository.Get();
|
||||||
_helpWindow = helpWindow;
|
_helpWindow = helpWindow;
|
||||||
|
_logger = logger;
|
||||||
|
|
||||||
VideoView.Loaded += VideoView_Loaded;
|
VideoView.Loaded += VideoView_Loaded;
|
||||||
Closed += OnFormClosed;
|
Closed += OnFormClosed;
|
||||||
@@ -217,15 +221,16 @@ public partial class MainWindow
|
|||||||
|
|
||||||
var files = dir.GetFiles("mp4", "mov").Select(x =>
|
var files = dir.GetFiles("mp4", "mov").Select(x =>
|
||||||
{
|
{
|
||||||
_mediaPlayer.Media = new Media(_libVLC, x.FullName);
|
var media = new Media(_libVLC, x.FullName);
|
||||||
|
media.Parse();
|
||||||
return new VideoFileInfo
|
var fInfo = new VideoFileInfo
|
||||||
{
|
{
|
||||||
Name = x.Name,
|
Name = x.Name,
|
||||||
Path = x.FullName,
|
Path = x.FullName,
|
||||||
Duration = TimeSpan.FromMilliseconds(_mediaPlayer.Media.Duration),
|
|
||||||
HasAnnotations = labelNames.ContainsKey(Path.GetFileNameWithoutExtension(x.Name).Replace(" ", ""))
|
HasAnnotations = labelNames.ContainsKey(Path.GetFileNameWithoutExtension(x.Name).Replace(" ", ""))
|
||||||
};
|
};
|
||||||
|
media.ParsedChanged += (_, _) => fInfo.Duration = TimeSpan.FromMilliseconds(media.Duration);
|
||||||
|
return fInfo;
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
LvFiles.ItemsSource = new ObservableCollection<VideoFileInfo>(files);
|
LvFiles.ItemsSource = new ObservableCollection<VideoFileInfo>(files);
|
||||||
@@ -271,7 +276,11 @@ public partial class MainWindow
|
|||||||
ReloadFiles();
|
ReloadFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PlayClick(object sender, RoutedEventArgs e) => _mediator.Publish(new PlaybackControlEvent(PlaybackControlEnum.Play));
|
private void PlayClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
_mediator.Publish(new PlaybackControlEvent(_mediaPlayer.CanPause ? PlaybackControlEnum.Pause : PlaybackControlEnum.Play));
|
||||||
|
}
|
||||||
|
|
||||||
private void PauseClick(object sender, RoutedEventArgs e)=> _mediator.Publish(new PlaybackControlEvent(PlaybackControlEnum.Pause));
|
private void PauseClick(object sender, RoutedEventArgs e)=> _mediator.Publish(new PlaybackControlEvent(PlaybackControlEnum.Pause));
|
||||||
private void StopClick(object sender, RoutedEventArgs e) => _mediator.Publish(new PlaybackControlEvent(PlaybackControlEnum.Stop));
|
private void StopClick(object sender, RoutedEventArgs e) => _mediator.Publish(new PlaybackControlEvent(PlaybackControlEnum.Stop));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user