mirror of
https://github.com/azaion/annotations.git
synced 2026-04-23 01:56:31 +00:00
make resizable panels
fix duration bug
This commit is contained in:
@@ -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