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

Annotation of /trunk/NexusPowerControl/MainUI.cs

Parent Directory Parent Directory | Revision Log Revision Log


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

1 william 4 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 william 13 public partial class MainUI : Form
13 william 4 {
14 william 15 MouseTrapper mouse_trapper = new MouseTrapper();
15 william 13 public MainUI()
16 william 4 {
17     InitializeComponent();
18     }
19 william 8
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 william 10
27     if (theme.ThemeLoaded)
28     {
29     pic_main.Image = Image.FromFile(theme.MainImage);
30 william 16 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 william 10 }
37    
38 william 11
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 william 8 }
46 william 15 private void MainUI_Shown(object sender, EventArgs e)
47     {
48     mouse_trapper.TrapMouse(this);
49     }
50 william 10
51 william 15 private void MainUI_FormClosed(object sender, FormClosedEventArgs e)
52     {
53     mouse_trapper.ReleaseMouse(this);
54     }
55 william 10 private void btnShutdown_Click(object sender, EventArgs e)
56     {
57 william 12 // shutdown the computer
58 william 10 }
59    
60     private void btnRestart_Click(object sender, EventArgs e)
61     {
62 william 12 // restart the computer
63 william 10 }
64    
65     private void btnLogoff_Click(object sender, EventArgs e)
66     {
67 william 12 // logoff the current user
68 william 10 }
69    
70     private void btnLockScreen_Click(object sender, EventArgs e)
71     {
72 william 12 // lock the screen
73 william 10 }
74    
75     private void btnSleep_Click(object sender, EventArgs e)
76     {
77 william 12 // put the computer to sleep
78 william 10 }
79    
80     private void btnClose_Click(object sender, EventArgs e)
81     {
82 william 12 // close this dialog
83 william 11 this.Close();
84     }
85 william 4 }
86     }

  ViewVC Help
Powered by ViewVC 1.1.22