Skip to content

Commit 5c6179a

Browse files
committed
Improved sample code.
1 parent 937bf8b commit 5c6179a

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

samples/FlashCap.Avalonia/FlashCap.Avalonia.UI/ViewModels/MainWindowViewModel.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
using Avalonia.Controls;
1111
using Epoxy;
12-
using FlashCap.Devices;
1312
using SkiaSharp;
1413
using System;
1514
using System.Collections.ObjectModel;
@@ -188,8 +187,10 @@ private ValueTask OnDeviceChangedAsync(CaptureDeviceDescriptor? descriptor)
188187

189188
this.Characteristics = this.CharacteristicsList.FirstOrDefault();
190189
#endif
191-
192-
this.UpdateCurrentState(States.Ready);
190+
if (this.Characteristics != null)
191+
{
192+
this.UpdateCurrentState(States.Ready);
193+
}
193194
}
194195
else
195196
{

samples/FlashCap.Avalonia/FlashCap.Avalonia.UI/Views/MainWindow.axaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,16 @@
3737
SelectedItem="{Binding Characteristics, Mode=TwoWay}" />
3838
</StackPanel>
3939
<StackPanel Orientation="Horizontal">
40-
<Button IsEnabled="{Binding IsEnabledStartCapture}"
40+
<Button BorderBrush="White" BorderThickness="1"
41+
IsEnabled="{Binding IsEnabledStartCapture}"
4142
Content="Start capture"
4243
Command="{Binding StartCapture}" />
43-
<Button IsEnabled="{Binding IsEnabledStopCapture}"
44+
<Button BorderBrush="White" BorderThickness="1"
45+
IsEnabled="{Binding IsEnabledStopCapture}"
4446
Content="Stop capture"
4547
Command="{Binding StopCapture}" />
46-
<Button IsEnabled="{Binding IsEnabledShowPropertyPage}"
48+
<Button BorderBrush="White" BorderThickness="1"
49+
IsEnabled="{Binding IsEnabledShowPropertyPage}"
4750
Content="Show property page"
4851
Command="{Binding ShowPropertyPage}" />
4952
</StackPanel>

samples/FlashCap.Wpf/ViewModels/MainWindowViewModel.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
////////////////////////////////////////////////////////////////////////////
99

1010
using Epoxy;
11-
using FlashCap.Devices;
1211
using SkiaSharp;
1312
using System;
1413
using System.Collections.ObjectModel;
@@ -180,8 +179,10 @@ private ValueTask OnDeviceChangedAsync(CaptureDeviceDescriptor? descriptor)
180179

181180
this.Characteristics = this.CharacteristicsList.FirstOrDefault();
182181
#endif
183-
184-
this.UpdateCurrentState(States.Ready);
182+
if (this.Characteristics != null)
183+
{
184+
this.UpdateCurrentState(States.Ready);
185+
}
185186
}
186187
else
187188
{

0 commit comments

Comments
 (0)