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