From 755a0f7f2fe111d8fc51a4fe10aa7c953c473243 Mon Sep 17 00:00:00 2001 From: Gammasoft Date: Tue, 9 Apr 2024 12:52:36 +0200 Subject: [PATCH] Add show assert dialog check_box --- .../src/application_and_assert.cpp | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/examples/xtd.forms.examples/applications/application_and_assert/src/application_and_assert.cpp b/examples/xtd.forms.examples/applications/application_and_assert/src/application_and_assert.cpp index 32a9e94d4fa3..798ab14819af 100644 --- a/examples/xtd.forms.examples/applications/application_and_assert/src/application_and_assert.cpp +++ b/examples/xtd.forms.examples/applications/application_and_assert/src/application_and_assert.cpp @@ -1,10 +1,14 @@ #include #include +#include #include #include #include #include +#include #include +#include +#include #include using namespace xtd; @@ -20,9 +24,6 @@ class main_form : public form { main_form() { text("application and assert example"); - // Uncomment following line to remove assert dialog - //debug::show_assert_dialog(false); - generate_assert_button.auto_size(true); generate_assert_button.location({10, 10}); generate_assert_button.parent(*this); @@ -46,6 +47,15 @@ class main_form : public form { generate_debugger_debug_break_button.parent(*this); generate_debugger_debug_break_button.text("Generate debugger::debug break"); generate_debugger_debug_break_button.click += event_handler(*this, &main_form::generate_debugger_debug_break); + + show_assert_dialog_check_box.auto_size(true); + for (auto listener : debug::listeners()) + if (is(listener) && as(listener)->assert_ui_enabled()) + show_assert_dialog_check_box.checked(true); + show_assert_dialog_check_box.location({10, 230}); + show_assert_dialog_check_box.parent(*this); + show_assert_dialog_check_box.text("Show assert dialog"); + show_assert_dialog_check_box.click += event_handler(*this, &main_form::show_assert_dialog); } private: @@ -67,10 +77,17 @@ class main_form : public form { debugger::debug_break(); } + void show_assert_dialog() { + for (auto listener : debug::listeners()) + if (is(listener)) + as(listener)->assert_ui_enabled(show_assert_dialog_check_box.checked()); + } + button generate_assert_button; button generate_debug_dassert_button; button generate_debug_break_button; button generate_debugger_debug_break_button; + check_box show_assert_dialog_check_box; }; startup_(main_form::main);