xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
run_worker_completed_event_args.h
Go to the documentation of this file.
1 #pragma once
5 #include <any>
6 #include <optional>
7 #include <cstdint>
8 #include <xtd/event_args.h>
9 
11 namespace xtd {
13  namespace forms {
21  public:
24  run_worker_completed_event_args& operator=(const run_worker_completed_event_args& do_work_event_args) = default;
26 
29  run_worker_completed_event_args(const std::any& result, std::optional<std::reference_wrapper<std::exception>> exception, bool cancel) : cancel_(cancel), exception_(exception), result_(result) {}
30 
31  bool cancel() const {return cancel_;}
32  void cancel(bool value) {cancel_ = value;}
33 
36  std::any user_state() const {return user_state_;}
37 
38  std::any result() const {return result_;}
39 
40  private:
41  bool cancel_ = false;
42  std::optional<std::reference_wrapper<std::exception>> exception_;
43  std::any result_;
44  std::any user_state_;
45  };
46  }
47 }
Contains xtd::event_args event args.
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition: event_args.h:18
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Provides data for the do_work event handler.
Definition: run_worker_completed_event_args.h:20
Provides data for the do_work event handler.
Definition: do_work_event_args.h:19
Indicates that all styles except allow_binary_specifier, allow_octal_specifier and allow_hex_specifie...
std::any user_state() const
Gets a value that represents the argument of an asynchronous operation.
Definition: run_worker_completed_event_args.h:36
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
run_worker_completed_event_args(const std::any &result, std::optional< std::reference_wrapper< std::exception >> exception, bool cancel)
Initializes a new instance of the DoWorkEventArgs class.
Definition: run_worker_completed_event_args.h:29