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

Annotation of /trunk/NexusPowerControl/DesktopSplash.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 14 - (hide annotations) (download)
Sat Oct 22 23:37:10 2011 UTC (8 years ago) by william
File size: 1325 byte(s)
** 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

1 william 13 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 william 14 using Ownskit.Utils;
10 william 13
11     namespace NexusPowerControl
12     {
13     public partial class DesktopSplash : Form
14     {
15 william 14 KeyboardListener keyboard_listener = new KeyboardListener();
16    
17 william 13 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 william 14 keyboard_listener = new KeyboardListener();
25     keyboard_listener.DisableKeyboard();
26    
27 william 13 ui.FormClosed += new FormClosedEventHandler(ui_FormClosed);
28     }
29    
30     void ui_FormClosed(object sender, FormClosedEventArgs e)
31     {
32 william 14 keyboard_listener.EnableKeyboard();
33 william 13 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     }

  ViewVC Help
Powered by ViewVC 1.1.22