1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace VoidEngine; |
4
|
|
|
|
5
|
|
|
$APPLICATION = new class |
6
|
|
|
{ |
7
|
|
|
public WFClass $application; |
|
|
|
|
8
|
|
|
public string $executablePath; |
9
|
|
|
|
10
|
|
|
public function __construct () |
11
|
|
|
{ |
12
|
|
|
$this->application = new WFClass ('System.Windows.Forms.Application'); |
13
|
|
|
$this->executablePath = $this->application->executablePath; |
14
|
|
|
} |
15
|
|
|
|
16
|
|
|
public function run ($form = null): void |
17
|
|
|
{ |
18
|
|
|
if ($form instanceof WFObject) |
19
|
|
|
$this->application->run ($form->selector); |
20
|
|
|
|
21
|
|
|
elseif (is_int ($form) && VoidEngine::objectExists ($form)) |
22
|
|
|
$this->application->run ($form); |
23
|
|
|
|
24
|
|
|
elseif ($form === null) |
25
|
|
|
$this->application->run (); |
26
|
|
|
|
27
|
|
|
else throw new \Exception ('$form param must be instance of "VoidEngine\WFObject" ("VoidEngine\Form"), be null or object selector'); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
public function restart (): void |
31
|
|
|
{ |
32
|
|
|
$this->application->restart (); |
33
|
|
|
$this->close (); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
public function close (): void |
37
|
|
|
{ |
38
|
|
|
$this->application->exit (); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function __call (string $name, array $args) |
42
|
|
|
{ |
43
|
|
|
return $this->application->$name (...$args); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function __get (string $name) |
47
|
|
|
{ |
48
|
|
|
return $this->application->$name; |
49
|
|
|
} |
50
|
|
|
}; |
51
|
|
|
|
52
|
|
|
$SCREEN = new class |
53
|
|
|
{ |
54
|
|
|
public WFObject $screen; |
55
|
|
|
|
56
|
|
|
public function __construct () |
57
|
|
|
{ |
58
|
|
|
$this->screen = new WFClass ('System.Windows.Forms.Screen'); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function __get ($name) |
62
|
|
|
{ |
63
|
|
|
switch (strtolower ($name)) |
64
|
|
|
{ |
65
|
|
|
case 'width': |
66
|
|
|
case 'w': |
67
|
|
|
return $this->screen->primaryScreen->bounds->width; |
68
|
|
|
break; |
69
|
|
|
|
70
|
|
|
case 'height': |
71
|
|
|
case 'h': |
72
|
|
|
return $this->screen->primaryScreen->bounds->height; |
73
|
|
|
break; |
74
|
|
|
|
75
|
|
|
default: |
76
|
|
|
return $this->screen->$name; |
77
|
|
|
break; |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
public function __debugInfo (): array |
82
|
|
|
{ |
83
|
|
|
return [ |
84
|
|
|
$this->w, |
85
|
|
|
$this->h |
86
|
|
|
]; |
87
|
|
|
} |
88
|
|
|
}; |
89
|
|
|
|