public MainForm() { InitializeComponent(); #region initilaizeRandomVars m_MasterList = new List <List <string> >(); m_TempList = new List <List <string> >(); m_Indicies = new List <int>(); wordIndex = 1; LogFileName = "Log.txt"; m_StringBuilder = new StringBuilder(); new StreamWriter(LogFileName); m_MyHWND = this.Handle; DockMouse = true; this.Opacity = 80; char[] alphabet = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }; m_Alphabet = alphabet; #endregion #region threads HWndThread = new Thread(new ThreadStart(WatchHWNDs)); HWndThread.IsBackground = true; HWndThread.Start(); #endregion #region KeyboardAndMouseManagers m_MouseManager = new MouseHookManager(); m_MouseManager.OnMouseActivity += new MouseEventHandler(MouseManager_Activity); m_MouseManager.Start(); m_KeyboardManager = new KeyHookManager(); m_KeyboardManager.KeyDown += new KeyEventHandler(KeyboardManager_KeyDown); m_KeyboardManager.Start(); #endregion #region SystemTray m_Icon = new NotifyIcon(); m_Icon.Icon = Properties.Resources.keyboard; MenuItem[] items = new MenuItem[4]; items[3] = new MenuItem("Exit"); items[3].Click += new EventHandler(Exit); items[2] = new MenuItem("About"); items[2].Click += new EventHandler(About_Click); items[1] = new MenuItem("Update"); items[1].Click += new EventHandler(Update_Click); items[0] = new MenuItem("Customize"); items[0].Click += new EventHandler(Customize_Click); m_Icon.ContextMenu = new ContextMenu(items); m_Icon.Visible = true; m_Icon.BalloonTipIcon = ToolTipIcon.Info; m_Icon.BalloonTipText = "ZTyper"; //m_Icon.BalloonTipClicked += new EventHandler(m_Icon_MouseClick); //m_Icon.MouseClick += new MouseEventHandler(m_Icon_MouseClick); m_Icon.Text = this.Text; #endregion #region initialSorting using (StringReader sr = new StringReader(Properties.Resources.words)) { char currentLetter = 'a'; string line; int index = 0; m_MasterList.Add(new List <string>()); while ((line = sr.ReadLine()) != null) { if (line[0] != currentLetter) { index++; int temp = (int)currentLetter; temp++; currentLetter = (char)temp; m_MasterList.Add(new List <string>()); } m_MasterList[index].Add(line); } m_TempList = new List <List <string> >(m_MasterList); } #endregion }
public MainForm() { InitializeComponent(); #region initilaizeRandomVars m_MasterList = new List<List<string>>(); m_TempList = new List<List<string>>(); m_Indicies = new List<int>(); wordIndex = 1; LogFileName = "Log.txt"; m_StringBuilder = new StringBuilder(); new StreamWriter(LogFileName); m_MyHWND = this.Handle; DockMouse = true; this.Opacity = 80; char[] alphabet = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }; m_Alphabet = alphabet; #endregion #region threads HWndThread = new Thread(new ThreadStart(WatchHWNDs)); HWndThread.IsBackground = true; HWndThread.Start(); #endregion #region KeyboardAndMouseManagers m_MouseManager = new MouseHookManager(); m_MouseManager.OnMouseActivity += new MouseEventHandler(MouseManager_Activity); m_MouseManager.Start(); m_KeyboardManager = new KeyHookManager(); m_KeyboardManager.KeyDown += new KeyEventHandler(KeyboardManager_KeyDown); m_KeyboardManager.Start(); #endregion #region SystemTray m_Icon = new NotifyIcon(); m_Icon.Icon = Properties.Resources.keyboard; MenuItem[] items = new MenuItem[4]; items[3] = new MenuItem("Exit"); items[3].Click += new EventHandler(Exit); items[2] = new MenuItem("About"); items[2].Click += new EventHandler(About_Click); items[1] = new MenuItem("Update"); items[1].Click += new EventHandler(Update_Click); items[0] = new MenuItem("Customize"); items[0].Click += new EventHandler(Customize_Click); m_Icon.ContextMenu = new ContextMenu(items); m_Icon.Visible = true; m_Icon.BalloonTipIcon = ToolTipIcon.Info; m_Icon.BalloonTipText = "ZTyper"; //m_Icon.BalloonTipClicked += new EventHandler(m_Icon_MouseClick); //m_Icon.MouseClick += new MouseEventHandler(m_Icon_MouseClick); m_Icon.Text = this.Text; #endregion #region initialSorting using (StringReader sr = new StringReader(Properties.Resources.words)) { char currentLetter = 'a'; string line; int index = 0; m_MasterList.Add(new List<string>()); while ((line = sr.ReadLine()) != null) { if (line[0] != currentLetter) { index++; int temp = (int)currentLetter; temp++; currentLetter = (char)temp; m_MasterList.Add(new List<string>()); } m_MasterList[index].Add(line); } m_TempList = new List<List<string>>(m_MasterList); } #endregion }