protected void Application_Start() { m_softkey = new SoftKey(); AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); GlobalConfiguration.Configuration.Formatters.XmlFormatter.SupportedMediaTypes.Clear();//清除xml 只返回json }
public void SetSoftKey(SoftKey index, SoftKeyIcon icon, Color color) { Cellphone.CallFunction( "SET_SOFT_KEYS", (int)index, true, (int)icon ); Cellphone.CallFunction( "SET_SOFT_KEYS_COLOUR", (int)index, (int)color.R, (int)color.G, (int)color.B ); }
private ButtonBase CreateSoftKey() { SoftKey b = new SoftKey(); b.Margin = buttonMargin; b.UseMnemonic = false; b.BackColor = Color.Black; b.ParentHandle = this.Handle; b.BackColor = this.BackColor; b.MouseUp += new MouseEventHandler(SoftKey_MouseUp); return b; }
private void ChangeStyleForKey(SoftKey key) { if (IsSwitchKey(key.ScanCode)) { SetStyleForKeyType(key, KeyType.SwitchKey); } else { SetStyleForKeyType(key, KeyType.Normal); } }
protected virtual void SimulateKeyPress(SoftKey key) { SendInput.SendSingleScanCode((ushort)key.ScanCode, NativeMethods.KEYEVENTF.KEYDOWN); if (key.IsChecked == false) { SendInput.SendSingleScanCode((ushort)key.ScanCode, NativeMethods.KEYEVENTF.KEYUP); } //ResetModifiersAsNeeded((int)key.VirutalKeyCodeValue); ResetModifiersAsNeeded((int)key.ScanCode); }
protected virtual void SetStyleForKeyType(SoftKey key, KeyType keyType) { if ((keyType & KeyType.Toggled) == KeyType.Toggled) { key.NormalColor = new Color[] { Color.Orange, Color.OrangeRed }; key.ForeColor = Color.White; } else if ((keyType & KeyType.Normal) == KeyType.Normal) { key.NormalColor = new Color[] { Color.White, Color.LightGray }; key.ForeColor = Color.Black; } else if ((keyType & KeyType.SwitchKey) == KeyType.SwitchKey) { key.NormalColor = new Color[] { Color.FromArgb(177, 216, 250), Color.FromArgb(105, 180, 255) }; key.ForeColor = Color.Black; } }
protected void SetCapsLockState(SoftKey key) { if ((NativeMethods.GetKeyState(NativeMethods.VK.CAPITAL) & 0x1) != 0x1) { SetStyleForKeyType(key, KeyType.Normal); CapsLock = false; } else { SetStyleForKeyType(key, KeyType.Toggled); CapsLock = true; } }