Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions AIDevGallery/Controls/SampleContainer.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ public List<string> NugetPackageReferences
public static readonly DependencyProperty NugetPackageReferencesProperty =
DependencyProperty.Register("NugetPackageReferences", typeof(List<string>), typeof(SampleContainer), new PropertyMetadata(null));

private readonly object _ctsLock = new object();
private RichTextBlockFormatter codeFormatter;
private Dictionary<string, string> codeFiles = new();
private Sample? _sampleCache;
private Dictionary<ModelType, ExpandedModelDetails>? _cachedModels;
private List<ModelDetails>? _modelsCache;
private WinMlSampleOptions? _currentWinMlSampleOptions;
private CancellationTokenSource? _sampleLoadingCts;
private readonly object _ctsLock = new object();
private TaskCompletionSource? _sampleLoadedCompletionSource;
private double _codePaneWidth;
private ModelType? _wcrApi;
Expand Down Expand Up @@ -119,10 +119,14 @@ private void CancelCTS()

if (cts != null)
{
using (cts)
try
{
cts.Cancel();
}
finally
{
cts.Dispose();
}
}
}

Expand Down