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

Contents of /trunk/NexusPowerControl/MainUI.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 16 - (show annotations) (download)
Sun Oct 23 00:29:11 2011 UTC (8 years, 3 months ago) by william
File size: 2874 byte(s)
add image themeing for themebuttons

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 btnShutdown.Image = Image.FromFile(theme.ShutdownImage);
31 btnRestart.Image = Image.FromFile(theme.RestartImage);
32 btnLogoff.Image = Image.FromFile(theme.LogoffImage);
33 btnLockScreen.Image = Image.FromFile(theme.LockScreenImage);
34 btnSleep.Image = Image.FromFile(theme.SleepImage);
35 btnClose.Image = Image.FromFile(theme.CloseImage);
36 }
37
38
39 btnShutdown.OnClickEvent += new EventHandler(btnShutdown_Click);
40 btnRestart.OnClickEvent += new EventHandler(btnRestart_Click);
41 btnLogoff.OnClickEvent += new EventHandler(btnLogoff_Click);
42 btnLockScreen.OnClickEvent += new EventHandler(btnLockScreen_Click);
43 btnSleep.OnClickEvent += new EventHandler(btnSleep_Click);
44 btnClose.OnClickEvent += new EventHandler(btnClose_Click);
45 }
46 private void MainUI_Shown(object sender, EventArgs e)
47 {
48 mouse_trapper.TrapMouse(this);
49 }
50
51 private void MainUI_FormClosed(object sender, FormClosedEventArgs e)
52 {
53 mouse_trapper.ReleaseMouse(this);
54 }
55 private void btnShutdown_Click(object sender, EventArgs e)
56 {
57 // shutdown the computer
58 }
59
60 private void btnRestart_Click(object sender, EventArgs e)
61 {
62 // restart the computer
63 }
64
65 private void btnLogoff_Click(object sender, EventArgs e)
66 {
67 // logoff the current user
68 }
69
70 private void btnLockScreen_Click(object sender, EventArgs e)
71 {
72 // lock the screen
73 }
74
75 private void btnSleep_Click(object sender, EventArgs e)
76 {
77 // put the computer to sleep
78 }
79
80 private void btnClose_Click(object sender, EventArgs e)
81 {
82 // close this dialog
83 this.Close();
84 }
85 }
86 }

  ViewVC Help
Powered by ViewVC 1.1.22