回答編集履歴
1
ThrowIfCancellationRequested
test
CHANGED
@@ -80,11 +80,20 @@
|
|
80
80
|
await image.ReadAsync(filePath, token);
|
81
81
|
|
82
82
|
// 他が遅いなら全体をTask.Runするしかないか
|
83
|
+
|
84
|
+
// キャンセル要求されたら例外出して抜ける(ネックがわからんのでしつこく確認w
|
85
|
+
token.ThrowIfCancellationRequested();
|
83
86
|
image.Resize(pictureBox1.Size.Height, pictureBox1.Size.Width);
|
87
|
+
|
88
|
+
token.ThrowIfCancellationRequested();
|
84
89
|
bitmap = image.ToBitmap();
|
90
|
+
|
91
|
+
token.ThrowIfCancellationRequested();
|
85
92
|
bitmap.RotateFlip(RotateFlipType.Rotate90FlipNone);
|
86
|
-
}, token); // token忘れずに
|
87
93
|
|
94
|
+
}, token);
|
95
|
+
|
96
|
+
token.ThrowIfCancellationRequested();
|
88
97
|
pictureBox1.Image = bitmap;
|
89
98
|
}
|
90
99
|
}
|