wait and close
This commit is contained in:
parent
a2fd7f32c8
commit
3184022bf1
@ -60,7 +60,7 @@ namespace nana
|
|||||||
template<typename Form, bool IsVisible = true>
|
template<typename Form, bool IsVisible = true>
|
||||||
using form_loader = detail::form_loader<Form, IsVisible>;
|
using form_loader = detail::form_loader<Form, IsVisible>;
|
||||||
|
|
||||||
void exec(unsigned wait = 0, std::function<void()> = {});
|
void exec(unsigned wait = 0, std::function<void()> = {}, unsigned wait_end=0, form *fm= nullptr);
|
||||||
|
|
||||||
}//end namespace nana
|
}//end namespace nana
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -18,8 +18,6 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
//#define NANA_AUTOMATIC_GUI_TESTING
|
|
||||||
|
|
||||||
inline unsigned Wait(unsigned wait = 0)
|
inline unsigned Wait(unsigned wait = 0)
|
||||||
{
|
{
|
||||||
#ifdef NANA_AUTOMATIC_GUI_TESTING
|
#ifdef NANA_AUTOMATIC_GUI_TESTING
|
||||||
@ -39,7 +37,7 @@ namespace nana
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void exec(unsigned wait, std::function<void()> f )
|
void exec(unsigned wait, std::function<void()> f, unsigned wait_end, form *fm )
|
||||||
{
|
{
|
||||||
#ifdef NANA_ADD_DEF_AUTOMATIC_GUI_TESTING
|
#ifdef NANA_ADD_DEF_AUTOMATIC_GUI_TESTING
|
||||||
if (!wait)
|
if (!wait)
|
||||||
@ -51,16 +49,21 @@ namespace nana
|
|||||||
wait = Wait(wait);
|
wait = Wait(wait);
|
||||||
|
|
||||||
std::cout << "Will wait " << wait << " sec...\n";
|
std::cout << "Will wait " << wait << " sec...\n";
|
||||||
std::thread t([wait, &f]()
|
std::thread t([wait, &f, wait_end, fm]()
|
||||||
{ if (wait)
|
{ if (wait)
|
||||||
{
|
{
|
||||||
std::cout << "Waiting " << wait << " sec...\n";
|
std::cout << "Waiting " << wait << " sec...\n";
|
||||||
std::this_thread::sleep_for(std::chrono::seconds{ wait } );
|
std::this_thread::sleep_for(std::chrono::seconds{ wait } );
|
||||||
std::cout << "Waited !! running... \n" ;
|
std::cout << "running... \n" ;
|
||||||
f();
|
f();
|
||||||
//API::exit();
|
std::cout << "Done... \n";
|
||||||
std::cout << "Runed... \n";
|
std::cout << "Now waiting anothers " << wait << " sec...\n";
|
||||||
}
|
std::this_thread::sleep_for(std::chrono::seconds{ wait_end } );
|
||||||
|
std::cout << "Done... \n";
|
||||||
|
if (fm)
|
||||||
|
fm->close();
|
||||||
|
API::exit(); // why not works?
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
detail::bedrock::instance().pump_event(nullptr, false);
|
detail::bedrock::instance().pump_event(nullptr, false);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user