解决点击继续扫描会重复弹窗进度指示器的问题;BUG-814

This commit is contained in:
yangjiaxuan 2023-12-06 17:33:30 +08:00
parent cda1388516
commit cd6298168a
2 changed files with 23 additions and 35 deletions

View File

@ -1650,46 +1650,33 @@ int scanner::thread_start(void)
/*if (indicator_.get() && !IsWindowVisible(indicator_->hwnd())) /*if (indicator_.get() && !IsWindowVisible(indicator_->hwnd()))
indicator_->show(true);*/ indicator_->show(true);*/
} }
//else if (indicator_.get())
//{
// indicator_->notify_scan_over(hg_scanner_err_description(ret), true);
//}
else else
{ {
// display error message on progress UI, may be closed immediately by APP, so we hide progress UI and call message_box ...
//
err_ = ret; err_ = ret;
#ifdef START_SCAN_IN_THREAD
if (callback::show_progress_ui && is_bIndicator && ui_notify && !is_in_working_thread_)
{
int ev = SANE_EVENT_WORKING;
ui_notify(SANE_EVENT_SCAN_FINISHED, (void *)hg_scanner_err_description(ret), ret); //start失败或阻塞时就不再调用回调通知 BUG-814
if (ui_notify)
{
ui_notify(SANE_EVENT_WORKING, NULL, 0);
ui_notify(SANE_EVENT_SCAN_FINISHED, (void*)hg_scanner_err_description(ret), ret);
while (is_scanning_)
std::this_thread::sleep_for(std::chrono::milliseconds(3));
} }
else if(!is_in_working_thread_) else if (callback::show_messagebox_ui)
#endif
{
scan_over_ = true;
if (callback::close_ui)
callback::close_ui(UI_INDICATOR);
if (callback::show_messagebox_ui)
{ {
callback::show_messagebox_ui(app_wnd_, ret, (void*)hg_scanner_err_description(ret), 0); callback::show_messagebox_ui(app_wnd_, ret, (void*)hg_scanner_err_description(ret), 0);
} }
else else
{ {
std::wstring msg(local_trans::a2u(hg_scanner_err_description(ret), CP_UTF8)); std::wstring msg(local_trans::a2u(hg_scanner_err_description(ret), CP_UTF8));
//if (indicator_.get())
// indicator_->show(false);
if (!IsWindow(app_wnd_)) if (!IsWindow(app_wnd_))
callback::bring_message_box_topmost(local_trans::lang_trans_between_hz936(CONST_STRING_START_FAILED).c_str()); callback::bring_message_box_topmost(local_trans::lang_trans_between_hz936(CONST_STRING_START_FAILED).c_str());
MessageBoxW(app_wnd_, msg.c_str(), local_trans::lang_trans_between_hz936(CONST_STRING_START_FAILED).c_str(), MB_OK | MB_ICONERROR); MessageBoxW(app_wnd_, msg.c_str(), local_trans::lang_trans_between_hz936(CONST_STRING_START_FAILED).c_str(), MB_OK | MB_ICONERROR);
} }
scan_over_ = true;
is_scanning_ = false; is_scanning_ = false;
} }
}
prev_start_result_ = ret; prev_start_result_ = ret;
return ret; return ret;

View File

@ -1,4 +1,4 @@
#ifdef max #ifdef max
#undef max #undef max
#endif #endif
#ifdef min #ifdef min
@ -3927,6 +3927,7 @@ int huagao_ds::handle_scanner_event(int ev, bool from_event_proc)
//} //}
break; break;
case SANE_EVENT_TWAIN_XFER_READY: case SANE_EVENT_TWAIN_XFER_READY:
load_sane_util::log_info(L"notifyXferReady ...\r\n", 1);
notifyXferReady(); notifyXferReady();
break; break;
} }