xtd 0.2.0
Loading...
Searching...
No Matches
xtd::console_cancel_event_args Class Referencefinal
Inheritance diagram for xtd::console_cancel_event_args:
xtd::event_args xtd::object

Definition

Provides data for the console::cancel_key_press event. This class cannot be inherited.

Header
#include <xtd/console_cancel_event_args>
Namespace
xtd
Library
xtd.core
Remarks
A user can interrupt a console application process by simultaneously pressing the Control modifier key and the C console key (Ctrl+C), or the Control modifier key and the Break console key (Ctrl+Break). The console consequently provides a console_cancel_event_args object to the event handler for the console::cancel_key_press event to specify whether the process should be cancelled.
If the cancel property is set to true in the event handler, the process is resumed; otherwise, the process is terminated. By default, the value of the console_cancel_event_args property is false, and the process terminates.
Examples
console_read_key.cpp.

Public Constructors

 console_cancel_event_args ()=default
 Initializes a new instance of the console_cancel_event_args class.
 
 console_cancel_event_args (console_special_key special_key)
 Initializes a new instance of the console_cancel_event_args class.
 

Public Properties

bool cancel () const noexcept
 Gets a value that indicates whether simultaneously pressing the Control modifier key and the C console key (Ctrl+C) or the Ctrl+Break keys terminates the current process. The default is false, which terminates the current process.
 
void cancel (bool cancel)
 Sets a value that indicates whether simultaneously pressing the Control modifier key and the C console key (Ctrl+C) or the Ctrl+Break keys terminates the current process. The default is false, which terminates the current process.
 
console_special_key special_key () const noexcept
 Gets the combination of modifier and console keys that interrupted the current process.
 

Additional Inherited Members

- Static Public Attributes inherited from xtd::event_args
static const event_args empty
 Provides a value to use with events that do not have event data.
 
- Public Member Functions inherited from xtd::event_args
 event_args ()=default
 Initializes a new instance of the event_args class.
 
- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object.
 
bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object.
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const noexcept
 Creates a shallow copy of the current object.
 
virtual xtd::ustring to_string () const noexcept
 Returns a sxd::ustring that represents the current object.
 
- Static Public Member Functions inherited from xtd::object
static bool equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
static bool reference_equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 

Constructor & Destructor Documentation

◆ console_cancel_event_args() [1/2]

xtd::console_cancel_event_args::console_cancel_event_args ( )
default

Initializes a new instance of the console_cancel_event_args class.

◆ console_cancel_event_args() [2/2]

xtd::console_cancel_event_args::console_cancel_event_args ( console_special_key  special_key)
explicit

Initializes a new instance of the console_cancel_event_args class.

Parameters
special_keyOne of the enumeration values that specifies the key combination that interrupted the current process. There is no default value..

Member Function Documentation

◆ cancel() [1/2]

bool xtd::console_cancel_event_args::cancel ( ) const
noexcept

Gets a value that indicates whether simultaneously pressing the Control modifier key and the C console key (Ctrl+C) or the Ctrl+Break keys terminates the current process. The default is false, which terminates the current process.

Returns
true if the current process should resume when the event handler concludes; false if the current process should terminate. The default value is false; the current process terminates when the event handler returns. If true, the current process continues.

◆ cancel() [2/2]

void xtd::console_cancel_event_args::cancel ( bool  cancel)

Sets a value that indicates whether simultaneously pressing the Control modifier key and the C console key (Ctrl+C) or the Ctrl+Break keys terminates the current process. The default is false, which terminates the current process.

Parameters
trueif the current process should resume when the event handler concludes; false if the current process should terminate. The default value is false; the current process terminates when the event handler returns. If true, the current process continues.

◆ special_key()

console_special_key xtd::console_cancel_event_args::special_key ( ) const
noexcept

Gets the combination of modifier and console keys that interrupted the current process.

Returns
One of the enumeration values that specifies the key combination that interrupted the current process. There is no default value.

The documentation for this class was generated from the following file: