The following code example demonstrate the use of progress_dialog dialog.
#include <thread>
#include <xtd/xtd>
using namespace std::literals;
class form1 :
public form {
public:
form1() {
text("Progress dialog example");
button_process.auto_size(true);
button_process.location({10, 10});
button_process.parent(*this);
button_process.text("Process...");
button_process.click += [this] {
dialog.
text(
"Process running");
for (
auto step = 1; step <= dialog.
maximum(); ++step) {
std::this_thread::sleep_for(100ms);
}
};
button_indeterminate_process.auto_size(true);
button_indeterminate_process.location({100, 10});
button_indeterminate_process.parent(*this);
button_indeterminate_process.text("Indeterminate process...");
button_indeterminate_process.click += [this] {
dialog.
text(
"Indeterminate process running");
dialog.
message(
"Click \"Cancel\" to abort");
application::do_events();
std::this_thread::sleep_for(100ms);
}
};
}
private:
button button_indeterminate_process;
};
int main() {
application::run(form1());
}
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17