Shows how to create an application with xtd::forms::application::restart method. 
- Windows
 - 
 
 
  
- macOS
 - 
 
 
  
- Gnome
 - 
 
 
 
#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/form>
#include <xtd/environment>
 
 
auto main() -> int {
  auto restart_count = environment::get_environment_variable("application_restart_count").empty() ? 0 : parse<int>(environment::get_environment_variable("application_restart_count"));
  auto main_form = form::create(string::format("Restart {} times", restart_count));
  auto restart_button = button::create(main_form, "Restart", {10, 10});
  restart_button.click += application::restart;
  
  environment::set_environment_variable(
"application_restart_count", 
int32_object {restart_count + 1}.
to_string());
 
  
  application::run(main_form);
}
Represents a boxed integer object.
Definition box_integer.hpp:52
 
xtd::string to_string() const noexcept override
Returns a xtd::string that represents the current object.
Definition box.hpp:109
 
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10