Skip to content
This repository was archived by the owner on Nov 27, 2024. It is now read-only.

Commit 0bbc8e0

Browse files
committed
Update canvas and RealtimeRefreshRate
1 parent ab3da9b commit 0bbc8e0

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

OnnxStack.UI/UserControls/PaintInputControl.xaml.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using OnnxStack.UI.Dialogs;
44
using OnnxStack.UI.Models;
55
using OnnxStack.UI.Services;
6+
using OnnxStack.UI.Views;
67
using System;
78
using System.ComponentModel;
89
using System.IO;
@@ -25,7 +26,6 @@ public partial class PaintInputControl : UserControl, INotifyPropertyChanged
2526
private int _brushSize;
2627
private bool _isEraserEnabled;
2728
public DateTime _canvasLastUpdate;
28-
private int _canvasUpdatedelay = 250;
2929
private DrawingAttributes _brushAttributes;
3030
private Color _selectedColor = Colors.Black;
3131
private Brush _backgroundBrush = new SolidColorBrush(Colors.White);
@@ -54,6 +54,16 @@ public PaintInputControl()
5454
public AsyncRelayCommand CopyImageCommand { get; }
5555
public AsyncRelayCommand PasteImageCommand { get; }
5656

57+
58+
public OnnxStackUIConfig UISettings
59+
{
60+
get { return (OnnxStackUIConfig)GetValue(UISettingsProperty); }
61+
set { SetValue(UISettingsProperty, value); }
62+
}
63+
public static readonly DependencyProperty UISettingsProperty =
64+
DependencyProperty.Register("UISettings", typeof(OnnxStackUIConfig), typeof(PaintInputControl));
65+
66+
5767
public ImageInput InputImage
5868
{
5969
get { return (ImageInput)GetValue(InputImageProperty); }
@@ -412,7 +422,7 @@ private async void PaintCanvas_PreviewMouseMove(object sender, MouseEventArgs e)
412422
{
413423
if (DateTime.Now > _canvasLastUpdate)
414424
{
415-
_canvasLastUpdate = DateTime.Now.AddMilliseconds(_canvasUpdatedelay);
425+
_canvasLastUpdate = DateTime.Now.AddMilliseconds(UISettings.RealtimeRefreshRate);
416426
await SaveCanvas();
417427
}
418428
}

OnnxStack.UI/UserControls/SchedulerControl.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
</UniformGrid>
166166

167167
<UniformGrid>
168-
<Button>
168+
<Button Command="{Binding ResetParametersCommand}" Margin="0,5,0,0" HorizontalAlignment="Left">
169169
<userControls:FontAwesome Icon="&#xf2ea;" IconStyle="Light" Size="14" Margin="2"/>
170170
</Button>
171171
<CheckBox IsChecked="{Binding BatchOptions.IsRealtimeEnabled}" IsEnabled="{Binding BatchOptions.IsAutomationEnabled, Converter={StaticResource InverseBoolConverter}}" Content="Enable Live Update" HorizontalAlignment="Right" VerticalAlignment="Bottom" />

OnnxStack.UI/Views/PaintToImageView.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
<UniformGrid Columns="2" VerticalAlignment="Center" HorizontalAlignment="Center">
5959
<Viewbox Margin="40,40,20,40" >
6060
<userControls:PaintInputControl
61+
UISettings="{Binding UISettings}"
6162
InputImage="{Binding InputImage}"
6263
HasCanvasChanged="{Binding HasCanvasChanged, Mode=TwoWay}"
6364
CanvasResult="{Binding CanvasImage, Mode=TwoWay}"

0 commit comments

Comments
 (0)