ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/NexusPowerControl/trunk/NexusPowerControl/DesktopSplash.cs
Revision: 14
Committed: Sat Oct 22 23:37:10 2011 UTC (11 years, 7 months ago) by william
File size: 1325 byte(s)
Log Message:
** set .Net Framework 4 rather than .Net Framework 4 Client Profile
Add keyboard hook support from
    // Obtained From: https://gist.github.com/471698
    // Modifications used from: http://stackoverflow.com/questions/3920315/ignore-keyboard-input

File Contents

# Content
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 using Ownskit.Utils;
10
11 namespace NexusPowerControl
12 {
13 public partial class DesktopSplash : Form
14 {
15 KeyboardListener keyboard_listener = new KeyboardListener();
16
17 MainUI ui = new MainUI();
18
19 const int MAX_TICK_COUNT = 10; // milliseconds
20 int tick_count = 0;
21 public DesktopSplash()
22 {
23 InitializeComponent();
24 keyboard_listener = new KeyboardListener();
25 keyboard_listener.DisableKeyboard();
26
27 ui.FormClosed += new FormClosedEventHandler(ui_FormClosed);
28 }
29
30 void ui_FormClosed(object sender, FormClosedEventArgs e)
31 {
32 keyboard_listener.EnableKeyboard();
33 this.Close();
34 }
35
36 private void DesktopSplash_Shown(object sender, EventArgs e)
37 {
38 timer1.Start();
39 }
40
41 private void timer1_Tick(object sender, EventArgs e)
42 {
43 tick_count++;
44 if (tick_count > MAX_TICK_COUNT)
45 {
46 timer1.Stop();
47 ui.ShowDialog();
48 }
49 }
50 }
51 }