/[NexusPowerControl]/trunk/NexusPowerControl/MainUI.cs
ViewVC logotype

Contents of /trunk/NexusPowerControl/MainUI.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 15 - (show annotations) (download)
Sun Oct 23 00:27:29 2011 UTC (7 years, 8 months ago) by william
File size: 2444 byte(s)
*** implement trapping mouse to form

1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Data;
5 using System.Drawing;
6 using System.Linq;
7 using System.Text;
8 using System.Windows.Forms;
9
10 namespace NexusPowerControl
11 {
12 public partial class MainUI : Form
13 {
14 MouseTrapper mouse_trapper = new MouseTrapper();
15 public MainUI()
16 {
17 InitializeComponent();
18 }
19
20 private void Form1_Load(object sender, EventArgs e)
21 {
22 // load theme
23 ThemeLoader loader = new ThemeLoader();
24 loader.LoadThemeOrDefault(NexusPowerControl.Properties.Settings.Default.ActiveThemeName);
25 ThemeLoader.ThemeDefinition theme = loader.GetLoadedTheme();
26
27 if (theme.ThemeLoaded)
28 {
29 pic_main.Image = Image.FromFile(theme.MainImage);
30 }
31
32
33 btnShutdown.OnClickEvent += new EventHandler(btnShutdown_Click);
34 btnRestart.OnClickEvent += new EventHandler(btnRestart_Click);
35 btnLogoff.OnClickEvent += new EventHandler(btnLogoff_Click);
36 btnLockScreen.OnClickEvent += new EventHandler(btnLockScreen_Click);
37 btnSleep.OnClickEvent += new EventHandler(btnSleep_Click);
38 btnClose.OnClickEvent += new EventHandler(btnClose_Click);
39 }
40 private void MainUI_Shown(object sender, EventArgs e)
41 {
42 mouse_trapper.TrapMouse(this);
43 }
44
45 private void MainUI_FormClosed(object sender, FormClosedEventArgs e)
46 {
47 mouse_trapper.ReleaseMouse(this);
48 }
49 private void btnShutdown_Click(object sender, EventArgs e)
50 {
51 // shutdown the computer
52 }
53
54 private void btnRestart_Click(object sender, EventArgs e)
55 {
56 // restart the computer
57 }
58
59 private void btnLogoff_Click(object sender, EventArgs e)
60 {
61 // logoff the current user
62 }
63
64 private void btnLockScreen_Click(object sender, EventArgs e)
65 {
66 // lock the screen
67 }
68
69 private void btnSleep_Click(object sender, EventArgs e)
70 {
71 // put the computer to sleep
72 }
73
74 private void btnClose_Click(object sender, EventArgs e)
75 {
76 // close this dialog
77 this.Close();
78 }
79 }
80 }

  ViewVC Help
Powered by ViewVC 1.1.22