Ejemplo n.º 1
0
 /// <summary>
 /// 验证是否符合类型
 /// </summary>
 /// <param name="_input"></param>
 /// <returns></returns>
 public static bool Judge(string _input, Keys.SUPPORTED_TYPE _type)
 {
     bool _result = false;
     Regex regex = null;
     try
     {
         switch (_type)
         {
             case Keys.SUPPORTED_TYPE.chinese:
                 regex = new Regex(reg_chinese);
                 break;
             case Keys.SUPPORTED_TYPE.digit:
                 regex = new Regex(reg_digit);
                 break;
             case Keys.SUPPORTED_TYPE.html:
                 regex = new Regex(reg_html);
                 break;
             case Keys.SUPPORTED_TYPE.email:
                 regex = new Regex(reg_email);
                 break;
         }
         _result = !regex.IsMatch(_input.ToLower());
     }
     catch (Exception)
     {
         _result = false;
     }
     return _result;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Checks if a specified button or key is pressed
        /// </summary>
        /// <param name="button">Button to check</param>
        /// <param name="key">Key to check</param>
        /// <returns>Returns true if one is pressed otherwise false</returns>
        private bool IsActionTriggered(Buttons button, Keys key)
        {
#if WINDOWS
            if (IsButtonPressed(button) || IsKeyPressed(key))
#else
            if (IsButtonPressed(button))
#endif
                return true;

            return false;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Checks if a key is pressed
 /// </summary>
 /// <param name="key">Key to check</param>
 /// <returns>Returns true if the key is pressed otherwise false</returns>
 private bool IsKeyPressed(Keys key)
 {
     return _previousKey.IsKeyDown(key) && _currentKey.IsKeyUp(key);
 }
Ejemplo n.º 4
0
    private void ProcessKeyDown(Keys keyCode)
    {
      if (keyCode == Keys.Tab)
      {
        using (var dbContext = new DataBaseDataContext())
        {

          var resultAnzeige = from k in dbContext.Kunde
                              where k.Name_Firma.Contains(tbxKdName.Text)
                              select new { k.KundeID, k.Name_Firma,k.PLZ,k.Ort };

          var res = dbContext.Kunde.Where(k => k.Name_Firma.Contains(tbxKdName.Text)).Select(k => k);


          if (resultAnzeige.Count() == 1)
          {
            foreach (Kunde kunde in res)
            {
              tbxKdNummer.Text = "";
              tbxKdNummer.Text = kunde.KundeID.ToString();
            }
          }
          else
          {
            Func.FKundeMiniAuswahl = new Form_Kunde_MiniAuswahl(resultAnzeige, false);
            Func.FKundeMiniAuswahl.StartPosition = FormStartPosition.CenterScreen;
            Func.FKundeMiniAuswahl.ShowDialog();
          }
        }
      }
    }
Ejemplo n.º 5
0
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (m_ximulator.IsRunning())
            {
                if( keyData == Keys.Return )
                {
                    m_ximulator.ProcessChar('\r');
                }
                Win32Api.User32.TranslateMessage(ref msg);
                return true;
            }

            return base.ProcessCmdKey(ref msg, keyData);
        }
Ejemplo n.º 6
0
 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
 {
     switch (keyData)
     {
         case Keys.Control | Keys.Tab:
             NextTab();
             return true;
         case Keys.Control | Keys.Shift | Keys.Tab:
             PreviousTab();
             return true;
         case Keys.Control | Keys.N:
             CreateConnection(null);
             return true;
     }
     return false;
 }
Ejemplo n.º 7
0
 // standard keyboard state method
 public static bool IsKeyUp(Keys key)
 {
     return CurrentKeyboardState.IsKeyUp(key);
 }
Ejemplo n.º 8
0
 // was the key was typed? (down-up)
 public static bool IsKeyReleased(Keys key)
 {
     return PreviousKeyboardState.IsKeyDown(key) && CurrentKeyboardState.IsKeyUp(key);
 }
Ejemplo n.º 9
0
 private bool IsKeyPressed(Keys key)
 {
     return !_previousKeyState.IsKeyDown(key) && _currentKeyState.IsKeyDown(key);
 }