どうぶつしょうぎの完全解析をするGUI
@@ -41,21 +41,21 @@ | ||
41 | 41 | |
42 | 42 | Private Sub btnUndoFirst_Click(sender As System.Object, e As System.EventArgs) Handles btnUndoFirst.Click |
43 | 43 | BoardViewer1.kyokumen.UndoAll() |
44 | - BoardViewer1.DrawCurrentBitmap() | |
44 | + FormUpdate() | |
45 | 45 | End Sub |
46 | 46 | |
47 | 47 | Private Sub btnUndo_Click(sender As System.Object, e As System.EventArgs) Handles btnUndo.Click |
48 | 48 | BoardViewer1.kyokumen.Undo() |
49 | - BoardViewer1.DrawCurrentBitmap() | |
49 | + FormUpdate() | |
50 | 50 | End Sub |
51 | 51 | |
52 | 52 | Private Sub btnNext_Click(sender As System.Object, e As System.EventArgs) Handles btnNext.Click |
53 | 53 | BoardViewer1.kyokumen.DoNext() |
54 | - BoardViewer1.DrawCurrentBitmap() | |
54 | + FormUpdate() | |
55 | 55 | End Sub |
56 | 56 | |
57 | 57 | Private Sub BoardViewer1_Edited(sender As System.Object, e As doubutu.UI.Form.Control.Board.EditedEventArgs) Handles BoardViewer1.Edited |
58 | - BackgroundWorker1.RunWorkerAsync() | |
58 | + ReAnalyze() | |
59 | 59 | End Sub |
60 | 60 | |
61 | 61 | Private Sub BackgroundWorker1_DoWork(sender As System.Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork |
@@ -83,10 +83,21 @@ | ||
83 | 83 | If bestMoveCode <> String.Empty Then |
84 | 84 | Dim move As Move = New Move(bestMoveCode) |
85 | 85 | BoardViewer1.kyokumen.DoMove(move) |
86 | - BoardViewer1.DrawCurrentBitmap() | |
87 | - BackgroundWorker1.RunWorkerAsync() | |
88 | - output = String.Empty | |
89 | - TextBox1.Text = String.Empty | |
86 | + FormUpdate() | |
87 | + ReAnalyze() | |
90 | 88 | End If |
91 | 89 | End Sub |
90 | + | |
91 | + Private Sub FormUpdate() | |
92 | + BoardViewer1.DrawCurrentBitmap() | |
93 | + output = String.Empty | |
94 | + TextBox1.Text = String.Empty | |
95 | + End Sub | |
96 | + | |
97 | + Private Sub ReAnalyze() | |
98 | + While BackgroundWorker1.IsBusy | |
99 | + Threading.Thread.Sleep(1) | |
100 | + End While | |
101 | + BackgroundWorker1.RunWorkerAsync() | |
102 | + End Sub | |
92 | 103 | End Class |