mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 12:36:31 +00:00
fix initialization, throttle operations
day/winter/night switcher fixes
This commit is contained in:
@@ -51,7 +51,8 @@
|
||||
CanUserResizeRows="False"
|
||||
CanUserResizeColumns="False"
|
||||
SelectionChanged="DetectionDataGrid_SelectionChanged"
|
||||
x:FieldModifier="public">
|
||||
x:FieldModifier="public"
|
||||
>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Width="50" Header="Клавіша" CanUserSort="False">
|
||||
<DataGridTemplateColumn.HeaderStyle>
|
||||
@@ -90,13 +91,13 @@
|
||||
IsChecked="True"
|
||||
Style="{StaticResource ButtonRadioButtonStyle}"/>
|
||||
<RadioButton x:Name="EveningModeRadioButton"
|
||||
Tag="1"
|
||||
Tag="20"
|
||||
Content="Зима"
|
||||
GroupName="Mode"
|
||||
Checked="ModeRadioButton_Checked" Margin="10,0,0,0"
|
||||
Style="{StaticResource ButtonRadioButtonStyle}"/>
|
||||
<RadioButton x:Name="NightModeRadioButton"
|
||||
Tag="2"
|
||||
Tag="40"
|
||||
Content="Ніч"
|
||||
GroupName="Mode"
|
||||
Checked="ModeRadioButton_Checked" Margin="10,0,0,0"
|
||||
|
||||
@@ -4,16 +4,26 @@ using Azaion.Common.DTO;
|
||||
|
||||
namespace Azaion.Common.Controls;
|
||||
|
||||
public class DetectionClassChangedEventArgs(DetectionClass? detectionClass, int classNumber) : EventArgs
|
||||
public class DetectionClassChangedEventArgs(DetectionClass detectionClass, int classNumber) : EventArgs
|
||||
{
|
||||
public DetectionClass? DetectionClass { get; } = detectionClass;
|
||||
public DetectionClass DetectionClass { get; } = detectionClass;
|
||||
public int ClassNumber { get; } = classNumber;
|
||||
}
|
||||
|
||||
public partial class DetectionClasses
|
||||
{
|
||||
public event EventHandler<DetectionClassChangedEventArgs>? DetectionClassChanged;
|
||||
public DetectionClasses() => InitializeComponent();
|
||||
|
||||
public DetectionClasses()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void Init(List<DetectionClass> detectionClasses)
|
||||
{
|
||||
DetectionDataGrid.ItemsSource = detectionClasses;
|
||||
DetectionDataGrid.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
public int CurrentClassNumber { get; private set; } = 0;
|
||||
public DetectionClass? CurrentDetectionClass { get; set; }
|
||||
@@ -27,26 +37,25 @@ public partial class DetectionClasses
|
||||
private void RaiseDetectionClassChanged()
|
||||
{
|
||||
var detClass = (DetectionClass)DetectionDataGrid.SelectedItem;
|
||||
var baseClassNumber = detClass?.Id ?? 0;
|
||||
if (detClass == null)
|
||||
return;
|
||||
|
||||
var modeAmplifier = 0;
|
||||
foreach (var child in ModeSwitcherPanel.Children)
|
||||
if (child is RadioButton { IsChecked: true } rb)
|
||||
if (int.TryParse(rb.Tag?.ToString(), out int modeIndex))
|
||||
{
|
||||
if (detClass != null)
|
||||
detClass.PhotoMode = (PhotoMode)modeIndex;
|
||||
modeAmplifier += modeIndex * 20;
|
||||
detClass.PhotoMode = (PhotoMode)modeIndex;
|
||||
modeAmplifier += modeIndex;
|
||||
}
|
||||
|
||||
CurrentDetectionClass = detClass;
|
||||
CurrentClassNumber = baseClassNumber + modeAmplifier;
|
||||
CurrentClassNumber = detClass.Id + modeAmplifier;
|
||||
|
||||
DetectionClassChanged?.Invoke(this, new DetectionClassChangedEventArgs(detClass, CurrentClassNumber));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void SelectNum(int keyNumber)
|
||||
{
|
||||
DetectionDataGrid.SelectedIndex = keyNumber;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class DetectionControl : Border
|
||||
_resizeStart = resizeStart;
|
||||
_classNameLabel = new TextBlock
|
||||
{
|
||||
Text = detectionClass.Name,
|
||||
Text = detectionClass.UIName,
|
||||
HorizontalAlignment = HorizontalAlignment.Center,
|
||||
VerticalAlignment = VerticalAlignment.Top,
|
||||
Margin = new Thickness(0, 15, 0, 0),
|
||||
@@ -120,7 +120,7 @@ public class DetectionControl : Border
|
||||
|
||||
public YoloLabel GetLabel(Size canvasSize, Size? videoSize = null)
|
||||
{
|
||||
var label = new CanvasLabel(DetectionClass.Id, Canvas.GetLeft(this), Canvas.GetTop(this), Width, Height);
|
||||
var label = new CanvasLabel(DetectionClass.YoloId, Canvas.GetLeft(this), Canvas.GetTop(this), Width, Height);
|
||||
return new YoloLabel(label, canvasSize, videoSize);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user