Line | |
---|
1 | unit FormMenu;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Menus,
|
---|
7 | Buttons, ComCtrls;
|
---|
8 |
|
---|
9 | type
|
---|
10 |
|
---|
11 | { TFormMenu }
|
---|
12 |
|
---|
13 | TFormMenu = class(TForm)
|
---|
14 | ListBoxApps: TListBox;
|
---|
15 | MenuItemReboot: TMenuItem;
|
---|
16 | PopupMenu1: TPopupMenu;
|
---|
17 | ToolBar1: TToolBar;
|
---|
18 | ToolButton1: TToolButton;
|
---|
19 | procedure FormDeactivate(Sender: TObject);
|
---|
20 | procedure FormShow(Sender: TObject);
|
---|
21 | procedure ListBoxAppsClick(Sender: TObject);
|
---|
22 | procedure MenuItemRebootClick(Sender: TObject);
|
---|
23 | procedure ToolButton1Click(Sender: TObject);
|
---|
24 | public
|
---|
25 | procedure ReloadList;
|
---|
26 | end;
|
---|
27 |
|
---|
28 |
|
---|
29 | implementation
|
---|
30 |
|
---|
31 | {$R *.lfm}
|
---|
32 |
|
---|
33 | uses
|
---|
34 | OsSystem;
|
---|
35 |
|
---|
36 | { TFormMenu }
|
---|
37 |
|
---|
38 | procedure TFormMenu.FormDeactivate(Sender: TObject);
|
---|
39 | begin
|
---|
40 | Hide;
|
---|
41 | end;
|
---|
42 |
|
---|
43 | procedure TFormMenu.FormShow(Sender: TObject);
|
---|
44 | begin
|
---|
45 | ReloadList;
|
---|
46 | end;
|
---|
47 |
|
---|
48 | procedure TFormMenu.ListBoxAppsClick(Sender: TObject);
|
---|
49 | var
|
---|
50 | FormClass: TFormTaskClass;
|
---|
51 | begin
|
---|
52 | if ListBoxApps.ItemIndex <> -1 then begin
|
---|
53 | FormClass := TFormTaskClass(ListBoxApps.Items.Objects[ListBoxApps.ItemIndex]);
|
---|
54 | BaseSystem.Tasks.StartTask(FormClass);
|
---|
55 | end;
|
---|
56 | end;
|
---|
57 |
|
---|
58 | procedure TFormMenu.MenuItemRebootClick(Sender: TObject);
|
---|
59 | begin
|
---|
60 | Hide;
|
---|
61 | BaseSystem.Reboot;
|
---|
62 | end;
|
---|
63 |
|
---|
64 | procedure TFormMenu.ToolButton1Click(Sender: TObject);
|
---|
65 | begin
|
---|
66 | Hide;
|
---|
67 | BaseSystem.ShutDown;
|
---|
68 | end;
|
---|
69 |
|
---|
70 | procedure TFormMenu.ReloadList;
|
---|
71 | var
|
---|
72 | I: Integer;
|
---|
73 | begin
|
---|
74 | ListBoxApps.Clear;
|
---|
75 | with BaseSystem do begin
|
---|
76 | for I := 0 to Apps.Count - 1 do
|
---|
77 | with TApp(Apps[I]) do begin
|
---|
78 | ListBoxApps.Items.AddObject(Name, TObject(FormClass));
|
---|
79 | end;
|
---|
80 | end;
|
---|
81 | end;
|
---|
82 |
|
---|
83 | end.
|
---|
84 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.