Skip to content
This repository was archived by the owner on Oct 4, 2021. It is now read-only.

Commit cfcd350

Browse files
committed
Check if token is cancelled
1 parent a415aae commit cfcd350

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.Scaffolding/ScaffolderTemplateConfigurePage.cs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,20 @@ protected override Widget GetMainControl ()
7575

7676
Task.Run (async () => {
7777
var options = await comboField.Options;
78-
await Runtime.RunInMainThread (() =>
79-
Xwt.Toolkit.NativeEngine.Invoke (() => {
80-
foreach (var option in options) {
81-
comboBox.Items.Add (option);
82-
}
83-
comboField.SelectedValue = options.FirstOrDefault ();
84-
if (comboBox.Items.Count > 0)
85-
comboBox.SelectedIndex = 0;
86-
}));
78+
await Runtime.RunInMainThread (() => {
79+
if (Args.CancellationToken.IsCancellationRequested) {
80+
return;
81+
}
82+
Xwt.Toolkit.NativeEngine.Invoke (() => {
83+
foreach (var option in options) {
84+
comboBox.Items.Add (option);
85+
}
86+
comboField.SelectedValue = options.FirstOrDefault ();
87+
if (comboBox.Items.Count > 0)
88+
comboBox.SelectedIndex = 0;
89+
});
90+
91+
});
8792
}, Args.CancellationToken);
8893

8994
label.Text = comboField.DisplayName;

0 commit comments

Comments
 (0)