mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 08:06:31 +00:00
remove warnings
This commit is contained in:
@@ -14,8 +14,8 @@ public class AnnotationControl : Border
|
||||
|
||||
private readonly Grid _grid;
|
||||
private readonly TextBlock _classNameLabel;
|
||||
|
||||
private AnnotationClass _annotationClass;
|
||||
|
||||
private AnnotationClass _annotationClass = null!;
|
||||
public AnnotationClass AnnotationClass
|
||||
{
|
||||
get => _annotationClass;
|
||||
|
||||
@@ -22,15 +22,15 @@ public class CanvasEditor : Canvas
|
||||
private readonly Line _verticalLine;
|
||||
private readonly TextBlock _classNameHint;
|
||||
|
||||
private Rectangle _curRec;
|
||||
private AnnotationControl _curAnn;
|
||||
private Rectangle _curRec = new();
|
||||
private AnnotationControl _curAnn = null!;
|
||||
|
||||
private const int MIN_SIZE = 20;
|
||||
|
||||
public FormState FormState { get; set; }
|
||||
public IMediator Mediator { get; set; }
|
||||
|
||||
private AnnotationClass _currentAnnClass;
|
||||
public FormState FormState { get; set; } = null!;
|
||||
public IMediator Mediator { get; set; } = null!;
|
||||
|
||||
private AnnotationClass _currentAnnClass = null!;
|
||||
public AnnotationClass CurrentAnnClass
|
||||
{
|
||||
get => _currentAnnClass;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Azaion.Annotator.Controls
|
||||
{
|
||||
public delegate void ValueChange(double oldValue, double newValue);
|
||||
|
||||
public event ValueChange? ValueChanged;
|
||||
public new event ValueChange? ValueChanged;
|
||||
|
||||
public UpdatableProgressBar() : base()
|
||||
{
|
||||
|
||||
@@ -24,13 +24,11 @@ public partial class MainWindow
|
||||
private readonly HelpWindow _helpWindow;
|
||||
private readonly TimeSpan _annotationTime = TimeSpan.FromSeconds(1);
|
||||
|
||||
public ObservableCollection<AnnotationClass> AnnotationClasses { get; set; }
|
||||
public ObservableCollection<AnnotationClass> AnnotationClasses { get; set; } = new();
|
||||
private bool _suspendLayout;
|
||||
|
||||
public Dictionary<string, List<AnnotationInfo>> Annotations { get; set; } = new();
|
||||
|
||||
public bool ShowHelpOnStart { get; set; }
|
||||
|
||||
|
||||
public MainWindow(LibVLC libVLC, MediaPlayer mediaPlayer,
|
||||
IMediator mediator,
|
||||
FormState formState,
|
||||
@@ -72,8 +70,7 @@ public partial class MainWindow
|
||||
if (LvFiles.Items.IsEmpty)
|
||||
BlinkHelp(HelpTexts.HelpTextsDict[HelpTextEnum.Initial]);
|
||||
|
||||
ShowHelpOnStart = _config.ShowHelpOnStart;
|
||||
if (ShowHelpOnStart)
|
||||
if (_config.ShowHelpOnStart)
|
||||
_helpWindow.Show();
|
||||
}
|
||||
|
||||
@@ -131,15 +128,17 @@ public partial class MainWindow
|
||||
}).ToList();
|
||||
|
||||
//remove annotations: either in 1 sec, either earlier if there is next annotation in a dictionary
|
||||
var strs = curTime.Split("_");
|
||||
var timeStr = strs.LastOrDefault();
|
||||
var ts = TimeSpan.FromMilliseconds(int.Parse(timeStr)*100);
|
||||
var timeSpanRemove = Enumerable.Range(1, ((int)_annotationTime.TotalMilliseconds / 100) - 1)
|
||||
var timeStr = curTime.Split("_").LastOrDefault();
|
||||
if (!int.TryParse(timeStr, out var time))
|
||||
return;
|
||||
|
||||
var ts = TimeSpan.FromMilliseconds(time * 100);
|
||||
var timeSpanRemove = Enumerable.Range(1, (int)_annotationTime.TotalMilliseconds / 100 - 1)
|
||||
.Select(x =>
|
||||
{
|
||||
var time = TimeSpan.FromMilliseconds(x * 100);
|
||||
var fName = _formState.GetTimeName(ts.Add(time));
|
||||
return Annotations.ContainsKey(fName) ? time : (TimeSpan?)null;
|
||||
var timeNext = TimeSpan.FromMilliseconds(x * 100);
|
||||
var fName = _formState.GetTimeName(ts.Add(timeNext));
|
||||
return Annotations.ContainsKey(fName) ? timeNext : (TimeSpan?)null;
|
||||
}).FirstOrDefault(x => x != null) ?? _annotationTime;
|
||||
|
||||
_ = Task.Run(async () =>
|
||||
@@ -240,8 +239,10 @@ public partial class MainWindow
|
||||
};
|
||||
if (dlg.ShowDialog() != CommonFileDialogResult.Ok)
|
||||
return;
|
||||
|
||||
if (!string.IsNullOrEmpty(dlg.FileName))
|
||||
_config.VideosDirectory = dlg.FileName;
|
||||
|
||||
_config.VideosDirectory = dlg.FileName;
|
||||
ReloadFiles();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,9 +25,13 @@ public class PlayerControlHandler(LibVLC libVLC, MediaPlayer mediaPlayer, MainWi
|
||||
{ Key.Delete, PlaybackControlEnum.RemoveSelectedAnns },
|
||||
{ Key.X, PlaybackControlEnum.RemoveAllAnns }
|
||||
};
|
||||
|
||||
public async Task Handle(AnnClassSelectedEvent notification, CancellationToken cancellationToken) =>
|
||||
|
||||
public async Task Handle(AnnClassSelectedEvent notification, CancellationToken cancellationToken)
|
||||
{
|
||||
SelectClass(notification.AnnotationClass);
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
|
||||
private void SelectClass(AnnotationClass annClass)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user