private void _checkExternalBlocksMenuItem_Click(object sender, RoutedEventArgs e)
{
if (!_checkExternalBlocksMenuItem_IsEnabled) return;
_checkExternalBlocksMenuItem_IsEnabled = false;
var window = new ProgressWindow(true);
window.Owner = this;
window.Title = string.Format(LanguagesManager.Instance.ProgressWindow_Title, LanguagesManager.Instance.MainWindow_CheckExternalBlocks_Message);
window.Message = string.Format(LanguagesManager.Instance.MainWindow_CheckBlocks_State, 0, 0, 0);
window.ButtonMessage = LanguagesManager.Instance.ProgressWindow_Cancel;
Task.Factory.StartNew(() =>
{
bool flag = false;
window.Closed += (object sender2, EventArgs e2) =>
{
flag = true;
};
_amoebaManager.CheckExternalBlocks((object sender2, int badBlockCount, int checkedBlockCount, int blockCount, out bool isStop) =>
{
this.Dispatcher.Invoke(DispatcherPriority.Background, new Action(() =>
{
try
{
window.Value = 100 * ((double)checkedBlockCount / (double)blockCount);
window.Message = string.Format(LanguagesManager.Instance.MainWindow_CheckBlocks_State, badBlockCount, checkedBlockCount, blockCount);
}
catch (Exception)
{
}
}));
isStop = flag;
});
this.Dispatcher.Invoke(DispatcherPriority.Background, new Action(() =>
{
try
{
window.ButtonMessage = LanguagesManager.Instance.ProgressWindow_Ok;
}
catch (Exception)
{
}
}));
}, TaskCreationOptions.LongRunning);
window.Closed += (object sender2, EventArgs e2) =>
{
_checkExternalBlocksMenuItem_IsEnabled = true;
};
window.Owner = this;
window.Show();
}