public static bool RegisterHotKey(this HotKeyData keyData, Form parent) { if (!keyData.UseHotKey) { return(true); } // update HotKey User32HotKey.KeyModifiers modifiers = User32HotKey.KeyModifiers.None; if (keyData.KeyData.HasFlag(Keys.Control)) { modifiers |= User32HotKey.KeyModifiers.Control; } if (keyData.KeyData.HasFlag(Keys.Shift)) { modifiers |= User32HotKey.KeyModifiers.Shift; } if (keyData.KeyData.HasFlag(Keys.Alt)) { modifiers |= User32HotKey.KeyModifiers.Alt; } if (keyData.KeyData.HasFlag(Keys.LWin) || keyData.KeyData.HasFlag(Keys.RWin)) { modifiers |= User32HotKey.KeyModifiers.Windows; } Keys key = (Keys)((int)keyData.KeyData & 0x0000FFFF); //filter out modifiers LogC.WriteLine("RegisterHotKey: " + keyData); return(User32HotKey.RegisterHotKey(parent.Handle, keyData.AppId, modifiers, key)); } //end RegisterHotKey
} //end RegisterHotKey public static void UnregisterHotKey(this HotKeyData keyData, Form parent) { LogC.WriteLine("UnregisterHotKey: " + keyData); User32HotKey.UnregisterHotKey(parent.Handle, keyData.AppId); } //end UnregisterHotKey
public void Warning() { LogC.WriteLine(LogLevel.Warn, "warning! someone called warning()!"); }
public Test() { // this message won't get logged because LINFO is too low LogC.WriteLine(LogLevel.Info, "constructed a test object"); }