public static char GetLetter(PosKey key, int order, ref byte sequence) { lastPosKey = key; lastOrder = order; string strCriteria = ""; switch (key) { case PosKey.LabelStx: strCriteria = "Label" + (order + 1); break; case PosKey.Credit: strCriteria = "Credit" + order; break; default: strCriteria = key.ToString(); break; } if (Chars[strCriteria].Length == sequence) { sequence = 0; //labelda tanimlanan son karakterde ise basa don. (A B C A...) } return(Chars[strCriteria][sequence]); }
private void WriteChar(int order, PosKey key) { byte sequence = 0; char c = KeyMap.GetLetter(key, order, ref sequence); Append(c, true); }
private static void PressKeyboardButton(PosKey keyCode) { const int KEYEVENTF_EXTENDEDKEY = 0x1; const int KEYEVENTF_KEYUP = 0x2; keybd_event((byte)keyCode, 0x45, KEYEVENTF_EXTENDEDKEY, 0); keybd_event((byte)keyCode, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); }
public void ClearHighlightTileAt(int x, int y) { PosKey key = new PosKey(x, y); if (_highlightTiles.ContainsKey(key)) { Destroy(_highlightTiles[key]); _highlightTiles.Remove(key); } }
private PosKey GetPosKey(PosWithShop shop) { var posKey = new PosKey(); posKey.Key = Guid.NewGuid().ToString("N").Substring(0, 8); posKey.EncryptKey = LCDES.DesEncrypt(posKey.Key, Helper.GetPrimaryKey(shop)); posKey.Hash = BitConverter.ToString(LCDES.DesEncrypt(new byte[8], posKey.Key)).Replace("-", "").Substring(0, 8); return(posKey); }
//TODO Desctructor to set off buzzer private void KeyUp() { while (true) { if (serialPort.BytesToRead == 0) { if (stack.Count == 0) { System.Threading.Thread.Sleep(50); continue; } } else { byte [] buffer = new byte[3]; serialPort.Read(buffer, 0, 3); String s = ""; foreach (byte b in buffer) { if (b < 48) { s = b.ToString(); break; } } stack.AddRange(s.Split(' ')); } try { String input = ReadNext(); if (input.Length == 0) { continue; } try { PosKey key = KeyMap.Get(input); ConsumeKey(this, new ConsumeKeyEventArgs(key)); } catch { continue; } } catch (TimeoutException) { Display.Log.Error("Timeout exception on serial keyboard"); } catch (Exception e) { Display.Log.Error(e); } } }
private void WriteChar(int order, PosKey key) { if (order == KeyMap.LastOrder && KeyMap.LastPosKey == key) { canAdvance = false; sequence++; } else { canAdvance = true; } char c = KeyMap.GetLetter(key, order, ref sequence); switch (c) { case '\b': if (IsTouchDisplay) { return; } OnBackSpace(); break; case ' ': if (IsTouchDisplay) { return; } Numeric(' '); break; case '\n': if (IsTouchDisplay) { return; } Enter(); break; default: try { Append(c, false); } catch (ThreadStateException) { //Console.WriteLine("Threadstate Exception"); } break; } }
public KeyEvent(PosKey key) { if (key.Key_Class != null) { try { function = assembly.CreateInstance(key.Key_Class) as PosEvent; } catch (Exception e) { MessageBox.Show(e.ToString()); } } }
private void WriteChar(int order, PosKey key) { byte sequence = 0; char c = KeyMap.GetLetter(key, order, ref sequence); switch (c) { case SUBTRACT: case ADD: case DIVIDE: case MULTIPLY: Operation(c); break; default: break; } }
public void HighlightTileAt(int x, int y, Color color) { Tile targetTile = BoardTiles[x, y]; PosKey key = new PosKey(x, y); Vector3 tilePositon = targetTile.TileObject.gameObject.transform.position; GameObject newHighlight = Instantiate(TileHighlight, tilePositon, Quaternion.identity) as GameObject; SpriteRenderer spriteRenderer = newHighlight.GetComponent <SpriteRenderer>(); spriteRenderer.color = color; if (_highlightTiles.ContainsKey(key)) { Destroy(_highlightTiles[key]); } else { _highlightTiles[key] = newHighlight; } }
private static void Add(string key, PosKey posKey, string chars) { PosKeys.Add(key, posKey); if (chars == "Space") { chars = " "; } if (chars == "Enter") { chars = "\n"; } if (chars == "Backspace") { chars = "\b"; } if (chars.Length > 0) { Chars.Add(posKey.ToString(), chars); } }
Get(String key) { if (Label.ContainsKey(key)) { LabelBuffer = Label[key]; return(PosKey.LabelStx); } if (Credit.ContainsKey(key)) { CreditBuffer = Credit[key]; return(PosKey.Credit); } if (key == "EFT") { CreditBuffer = 1; return(PosKey.Credit); } if (KeyLock.ContainsKey(key)) { KeyLockBuffer = KeyLock[key]; return(PosKey.KeyStx); } if (CardPrefix.Contains(key)) { return(PosKey.MagstripeStx); } if (key == DoubleZero || key == "1000") { return(PosKey.DoubleZero); } if (PosKeys.ContainsKey(key)) { return(PosKeys[key]); } int numeric = 0; if (Parser.TryInt(key, out numeric)) { PosKey numerickey = (PosKey)numeric; switch (numerickey) { case PosKey.Numpad0: case PosKey.D0: return(PosKey.D0); case PosKey.Numpad1: case PosKey.D1: return(PosKey.D1); case PosKey.Numpad2: case PosKey.D2: return(PosKey.D2); case PosKey.Numpad3: case PosKey.D3: return(PosKey.D3); case PosKey.Numpad4: case PosKey.D4: return(PosKey.D4); case PosKey.Numpad5: case PosKey.D5: return(PosKey.D5); case PosKey.Numpad6: case PosKey.D6: return(PosKey.D6); case PosKey.Numpad7: case PosKey.D7: return(PosKey.D7); case PosKey.Numpad8: case PosKey.D8: return(PosKey.D8); case PosKey.Numpad9: case PosKey.D9: return(PosKey.D9); default: break; } } return(PosKey.UndefinedKey); }
//TODO Desctructor to set off buzzer private void KeyUp() { while (true) { if (Display.Terminate) { break; } if (serialPort.BytesToRead == 0) { if (stack.Count == 0) { System.Threading.Thread.Sleep(100); continue; } } else { String s = serialPort.ReadExisting(); if (s.StartsWith("%") || s.StartsWith(";")) { System.Threading.Thread.Sleep(25); stack.Add(s + serialPort.ReadExisting()); } else { if (s.StartsWith("135")) { List <string> tmp = new List <string>(); tmp.AddRange(s.Split(' ')); foreach (var item in tmp) { if (item == "135") { stack.Add(item); continue; } if (item.Contains("135") && item.EndsWith("135") && !(item.StartsWith("135"))) { if (item.Length == 4) { stack.Add(item.Substring(0, 1)); stack.Add(item.Remove(0, 1)); continue; } else if (item.Length == 5) { stack.Add(item.Substring(0, 2)); stack.Add(item.Remove(0, 2)); continue; } else { stack.Add(item); continue; } } else { stack.Add(item); continue; } } } else { stack.AddRange(s.Split(' ')); } } } try { String input = ReadNext(); //if starts with Z means that unexpected data received (or shift) if (input.StartsWith("Z") && input.Length > 2) { input = input.Substring(1); } //if sale led is on-off (led data comes before key data) if (input.StartsWith("?") && input.IndexOf('&') > 0) { input = input.Substring(input.IndexOf('&') + 1); } //if online led is on-off (led data comes before key data) if (input.StartsWith("½") && input.IndexOf('&') > 0) { input = input.Substring(input.IndexOf('&') + 1); } if (input.Length == 0) { continue; } try { int keyValue = -1; switch (input) { case "135": input = "L" + ReadNext(); break; //label case "67": input = "C" + (char)Convert.ToInt32(ReadNext()); break; //credit case "201": input = "EFT"; break; // EFT on Credit1 case "35": input = "K" + (char)Convert.ToInt32(ReadNext()); break; //keylock case "28": input = "Escape"; break; //Escape default: if (Parser.TryInt(input, out keyValue)) { input = ((ConsoleKey)keyValue).ToString(); break; } String cardCode = input; if ((cardCode = KeyMap.IsCard(input)) != input) { ConsumeKey(this, new ConsumeKeyEventArgs((int)PosKey.MagstripeStx)); foreach (Char c in cardCode) { if (!System.Text.RegularExpressions.Regex.IsMatch("" + c, "[0-9A-Za-z]")) { break; } ConsumeKey(this, new ConsumeKeyEventArgs((int)c)); } input = "Enter"; break; } continue; } PosKey key = KeyMap.Get(input); if (key == PosKey.UndefinedKey && keyValue > -1) { key = KeyMap.Get(48 + keyValue + ""); } ConsumeKey(this, new ConsumeKeyEventArgs((int)key)); //stack = new List<string>(); } catch { continue; } //finally { stack = new List<string>(); } } catch (TimeoutException) { Display.Log.Error("Timeout exception on serial keyboard"); } catch (Exception e) { Display.Log.Error(e); } } }
public void UpdatePosKey(PosKey item) { throw new NotImplementedException(); }
public void InsertPosKey(PosKey item) { throw new NotImplementedException(); }
public virtual void Process(PosKey key) { }
public void Update(PosKey item) { _databaseInstance.Update(item, TableName); }
/// <summary> /// </summary> public void AddPosKeys(int subMenuID, string menuName) { this.txtBlockMenuName.Text = menuName; PosKey posKey = new PosKey(); posKey.Panel_id = subMenuID; posKey.Config_no = PosSettings.Default.Configuration; //PosContext.Instance.Config.ConfigNo; DataSet data = posKey.LoadBySubMenu(); DataTable dt = data.Tables[0]; int rowNum = 0; int colNum = 0; foreach (DataRow dr in dt.Rows) { ++rowNum; PosButton btn = new PosButton(); btn.Style = (Style)FindResource("GlassyButtonStyle"); // btn.Height = 60; // btn.Width = 100; btn.KeyValue = int.Parse(dr["key_val"].ToString()); btn.KeyCode = int.Parse(dr["key_code"].ToString()); btn.KeyClass = dr["key_class"].ToString(); btn.Content = dr["param"].ToString(); //dr["image"].ToString(); btn.AccessKeyValue = int.Parse(dr["attr"].ToString()); // btn.FontSize = 12; btn.Margin = new Thickness(5, 0, 5, 10); btn.Focusable = false; btn.KeyText = dr["param"].ToString(); btn.Tag = "..\\..\\Images\\" + dr["image"].ToString().Trim(); Grid.SetRow(btn, rowNum); Grid.SetColumn(btn, colNum); if (rowNum == 8) { ++colNum; rowNum = 0; } // Grid.SetColumn(btn, 3); // Grid.SetColumn(btn, 0); /* * if (dr["flags"].ToString().Trim().Length > 0) * { * try * { * Image img = new Image(); * BitmapImage src = new BitmapImage(); * src.BeginInit(); * src.UriSource = new Uri(Environment.CurrentDirectory +"\\Images\\"+dr["flags"].ToString().Trim(), UriKind.RelativeOrAbsolute); * src.EndInit(); * img.VerticalAlignment = VerticalAlignment.Center; * img.HorizontalAlignment = HorizontalAlignment.Center; * img.Source = src; * img.Width = 25; * img.Height = 25; * Grid.SetRow(img, rowNum); * Grid.SetColumn(img, 1); * this.MyGrid.Children.Add(img); * } * catch * { * } * } * */ TextBlock txtBlock = new TextBlock(); txtBlock.Text = dr["param"].ToString(); // txtBlock.FontSize = 16; txtBlock.Margin = new Thickness(5, 5, 0, 0); txtBlock.TextAlignment = TextAlignment.Justify; txtBlock.Foreground = Brushes.White; Grid.SetColumn(txtBlock, 0); Grid.SetRow(txtBlock, rowNum); this.MyGrid.Children.Add(btn); //this.MyGrid.Children.Add(txtBlock); btn.Click += new RoutedEventHandler(btn_Click); string eventClass = dr["key_class"].ToString(); try { Assembly assembly = Assembly.GetExecutingAssembly(); PosEvent posEvent = assembly.CreateInstance(eventClass) as PosEvent; posEvent.PromptText = txtBlock.Text; PosContext.Instance.KeysById.Add(dr["key_code"].ToString(), posEvent); // PosContext.Instance.KeysByControl.Add(btn, posEvent); } catch (System.NullReferenceException exNull) { Logger.Error(this.GetType().ToString(), "Invalid class name " + exNull.ToString() + exNull); } catch (Exception ex) { Logger.Error(this.GetType().ToString(), ex.ToString(), ex); } } this.KeyDisable(); }
public override void Process(PosKey key) { if (isProcessing) { return; //occurs if pressed key when seral data is executing. } lock (serialLock) { lastKeyPressed = DateTime.Now; isProcessing = true; #region parse user input try { switch (key) { case PosKey.D0: case PosKey.D1: case PosKey.D2: case PosKey.D3: case PosKey.D4: case PosKey.D5: case PosKey.D6: case PosKey.D7: case PosKey.D8: case PosKey.D9: cr.State.Numeric((char)key); break; case PosKey.DoubleZero: cr.State.Numeric((char)PosKey.D0); cr.State.Numeric((char)PosKey.D0); break; case PosKey.Decimal: cr.State.Seperator(); break; case PosKey.Document: cr.State.Document(); break; case PosKey.Customer: cr.State.Customer(); break; case PosKey.Report: cr.State.Report(); break; case PosKey.Program: cr.State.Program(); break; case PosKey.Command: ISalesDocument doc = cr.Document; cr.State.Command(); break; case PosKey.CashDrawer: cr.State.CashDrawer(); break; case PosKey.Void: cr.State.Void(); break; case PosKey.PercentDiscount: cr.State.Adjust(AdjustmentType.PercentDiscount); break; case PosKey.Discount: cr.State.Adjust(AdjustmentType.Discount); break; case PosKey.PercentFee: cr.State.Adjust(AdjustmentType.PercentFee); break; case PosKey.Fee: cr.State.Adjust(AdjustmentType.Fee); break; case PosKey.ReceiveOnAcct: cr.State.ReceiveOnAcct(); break; case PosKey.PayOut: cr.State.PayOut(); break; case PosKey.PriceLookup: cr.State.PriceLookup(); break; case PosKey.Price: cr.State.Price(); break; case PosKey.Total: cr.State.TotalAmount(); break; case PosKey.Repeat: cr.State.Repeat(); break; case PosKey.UpArrow: cr.State.UpArrow(); break; case PosKey.DownArrow: cr.State.DownArrow(); break; case PosKey.Escape: cr.State.Escape(); break; case PosKey.Quantity: cr.State.Quantity(); break; case PosKey.Cash: cr.State.Pay(new CashPaymentInfo()); break; case PosKey.Credit: if (KeyMap.CreditBuffer == -1) { Thread.Sleep(20); //wait some for Console.KeyAvailable if (Console.In.Peek() > -1) { KeyMap.CreditBuffer = Console.In.Read() - 48; } else { cr.State.Alpha('C'); return; } } try { if (KeyMap.CreditBuffer == 0) { cr.State.Pay(new CreditPaymentInfo()); } else { Dictionary <int, ICredit> credits = cr.DataConnector.GetCredits(); if (credits.Count > (KeyMap.CreditBuffer - 1)) //?-1 { cr.State.Pay(new CreditPaymentInfo(credits[KeyMap.CreditBuffer])); } } } finally { KeyMap.CreditBuffer = -1; } break; case PosKey.Payment: cr.State.ShowPaymentList(); break; case PosKey.Check: cr.State.Pay(new CheckPaymentInfo()); break; case PosKey.ForeignCurrency: cr.State.Pay(new CurrencyPaymentInfo()); break; case PosKey.SubTotal: cr.State.SubTotal(); break; case PosKey.Enter: cr.State.Enter(); break; case PosKey.SalesPerson: cr.State.SalesPerson(); break; case PosKey.Correction: cr.State.Correction(); break; case PosKey.LabelStx: if (KeyMap.LabelBuffer == -1) { Thread.Sleep(20); //wait some for Console.KeyAvailable //Console.In.ReadLine() is changed as Console.In.Read() //because Readline command opens the text editor in WindowsCE int label = Console.In.Read(); if (label == -1) { cr.State.Alpha('L'); break; } KeyMap.LabelBuffer = label; } try { cr.State.LabelKey(KeyMap.LabelBuffer); } finally { KeyMap.LabelBuffer = -1; } break; case PosKey.Help: MessageBox.Show(cr.State.GetType().ToString()); break; case PosKey.MagstripeStx: cr.State.CardPrefix(); break; case PosKey.KeyStx: if (KeyMap.KeyLockBuffer == -1) { Thread.Sleep(20); //wait some for Console.KeyAvailable String label = Console.ReadLine(); KeyMap.KeyLockBuffer = int.Parse(label); } try { cr.State.End(KeyMap.KeyLockBuffer - 1); } finally { KeyMap.KeyLockBuffer = -1; } break; case PosKey.BarcodePrefix: cr.State.BarcodePrefix(); break; case PosKey.UndefinedKey: //do nothing break; case PosKey.SendOrder: cr.State.SendOrder(); break; default: switch (key) { case (PosKey)17: cr.State.Alpha('|'); break; case PosKey.MagstripeStx: cr.State.Alpha('\"'); break; case (PosKey)214: cr.State.Alpha('ж'); break; case (PosKey)286: cr.State.Alpha('а'); break; case (PosKey)199: cr.State.Alpha('Ч'); break; case (PosKey)220: cr.State.Alpha('м'); break; case (PosKey)304: cr.State.Alpha('н'); break; case (PosKey)350: cr.State.Alpha('о'); break; case (PosKey)221: break; case (PosKey)46: cr.State.Alpha('.'); break; case (PosKey)47: cr.State.Alpha('/'); break; default: if (char.IsLetter((char)key) || key == (PosKey)ConsoleKey.Spacebar || char.IsPunctuation((char)key)) { cr.State.Alpha((char)key); } else { cr.State.UndefinedKey(); } break; } break; } } #endregion #region handle errors catch (CmdSequenceException csex) { SoundManager.Sound(SoundType.FAILED); cr.State = States.AlertCashier.Instance(new Error(csex)); cr.Log.Error("CmdSequenceException occured. Last command: {0}", csex.LastCommand); cr.Log.Error(csex); //to do : cr.State = ex.Recover(); } catch (PowerFailureException pfex) { SoundManager.Sound(SoundType.FATAL_ERROR); try { Recover.RecoverPowerFailure(pfex); } catch (EJException eje) { cr.State = States.ElectronicJournalError.Instance(eje); } cr.Log.Warning(pfex); } catch (UnfixedSlipException ex) { try { cr.State = States.BlockOnPaper.Instance(); //Recover.RecoverUnfixedSlip(ex); } catch (EJException) { cr.State = States.ElectronicJournalError.Instance(); } cr.Log.Warning(ex); } catch (EJException eje) { SoundManager.Sound(SoundType.FATAL_ERROR); cr.State = States.ElectronicJournalError.Instance(eje); cr.Log.Warning(eje); } catch (SVCPasswordOrPointException ex) { SoundManager.Sound(SoundType.FAILED); //cr.State = States.ServiceMenu.Instance(); States.AlertCashier.Instance(new Confirm(ex.Message)); cr.Log.Warning(ex); } catch (FiscalIdException fie) { SoundManager.Sound(SoundType.FATAL_ERROR); cr.State = States.FiscalIdBlock.Instance(); cr.Log.Warning(fie); } catch (BlockingException bex) { SoundManager.Sound(SoundType.FATAL_ERROR); cr.State = States.PrinterBlockingError.Instance(new Error(bex)); } catch (NoReceiptRollException nrre) { SoundManager.Sound(SoundType.NEED_PROCESS); cr.State = States.PrinterStatusError.Instance(new Error(nrre)); cr.Log.Error(nrre); } catch (PrinterStatusException pse) { SoundManager.Sound(SoundType.FAILED); cr.State = States.PrinterStatusError.Instance(pse); cr.Log.Error(pse); } catch (MissingCashierException mcex) { SoundManager.Sound(SoundType.FAILED); cr.CurrentCashier = null; cr.State = States.AlertCashier.Instance(new Error(mcex, States.Login.Instance)); cr.Log.Warning(mcex); } catch (AssignedCashierLimitExeedException aclee) { SoundManager.Sound(SoundType.FAILED); cr.CurrentCashier = null; cr.State = States.AlertCashier.Instance(new Error(aclee, States.Login.Instance)); cr.Log.Warning(aclee); } catch (SlipRowCountExceedException srceex) { SoundManager.Sound(SoundType.FAILED); States.AlertCashier.Instance(new Error(srceex)); cr.State = States.ConfirmSlip.Instance(new Error(srceex)); cr.Log.Warning(srceex); } catch (CashierAlreadyAssignedException caaex) { States.AlertCashier.Instance(new Error(caaex)); ICashier assignedCashier = cr.DataConnector.FindCashierById(caaex.CashierId); if (assignedCashier != null) { cr.Log.Debug("Kasiyer zaten atanmis: {1} ({0})", assignedCashier.Id, assignedCashier.Name); } else { cr.Log.Error("Kasiyer girisi yapilmali"); } States.Login.LoginCashier(); } catch (ProductNotWeighableException pnwex) { SoundManager.Sound(SoundType.FAILED); cr.State = States.AlertCashier.Instance(new Error(pnwex)); } catch (DirectoryNotFoundException dnfex) { SoundManager.Sound(SoundType.FAILED); cr.Log.Fatal(dnfex); cr.State = States.AlertCashier.Instance(new Error(dnfex)); } catch (InvalidOperationException ioex) { SoundManager.Sound(SoundType.FAILED); cr.State = States.AlertCashier.Instance(new Error(ioex)); } catch (NegativeResultException nrex) { SoundManager.Sound(SoundType.FAILED); cr.State = States.AlertCashier.Instance(new Error(nrex)); cr.Log.Error(nrex); } catch (IncompleteXReportException ixrex) { SoundManager.Sound(SoundType.FATAL_ERROR); cr.State = States.XReportPE.Instance(ixrex); cr.Log.Warning("Printer exception occured during the x report", ixrex.Message); } catch (IncompleteEJSummaryReportException iejsex) { SoundManager.Sound(SoundType.FATAL_ERROR); cr.State = States.EJSummaryReportPE.Instance(iejsex); cr.Log.Warning("Printer exception occured during the ej summary report", iejsex.Message); } catch (IncompletePaymentException ipe) { SoundManager.Sound(SoundType.NEED_PROCESS); cr.State = States.PaymentAfterPE.Instance(ipe); cr.Log.Warning(ipe.Message); } catch (PrintDocumentException pde) { SoundManager.Sound(SoundType.FAILED); cr.State = States.DocumentPE.Instance(pde); cr.Log.Warning("Printer exception occured during the document printing ", pde.Message); } catch (FMFullException fmfe) { SoundManager.Sound(SoundType.FATAL_ERROR); cr.State = States.PrinterStatusError.Instance(new Error(fmfe)); cr.Log.Fatal(fmfe); } catch (FMLimitWarningException fmlwe) { SoundManager.Sound(SoundType.FATAL_ERROR); cr.State = States.PrinterStatusError.Instance(new Error(fmlwe)); cr.Log.Fatal(fmlwe); } catch (ZRequiredException zre) { SoundManager.Sound(SoundType.NEED_PROCESS); cr.State = States.PrinterStatusError.Instance(new Error(zre)); cr.Log.Error(zre); } catch (CashierAutorizeException cae) { SoundManager.Sound(SoundType.FAILED); cr.State = States.AlertCashier.Instance(new Error(cae)); cr.Log.Error(cae); } catch (FMNewException fmne) { SoundManager.Sound(SoundType.NEED_PROCESS); int fiscalId = int.Parse(PosConfiguration.Get("FiscalId").Substring(2, 8)); cr.State = States.EnterInteger.Instance(PosMessage.START_FM, fiscalId, new StateInstance <int>(States.Login.AcceptFiscalId), new StateInstance(Start.Instance)); cr.Log.Error(fmne); } catch (PrinterTimeoutException pte) { SoundManager.Sound(SoundType.FAILED); cr.State = States.PrinterConnectionError.Instance(pte); cr.Log.Warning(pte); } catch (System.Net.Sockets.SocketException ex) { SoundManager.Sound(SoundType.FAILED); cr.State = States.PrinterConnectionError.Instance(new PrinterException(PosMessage.CANNOT_ACCESS_PRINTER, ex)); cr.Log.Warning(new PrinterException(PosMessage.CANNOT_ACCESS_PRINTER, ex)); } catch (InvalidPaymentException ipe) { SoundManager.Sound(SoundType.FAILED); Confirm con = new Confirm(String.Format("{0}\n{1}", PosMessage.PAYMENT_INVALID, "жDEME нPTAL?(GнRно)"), new StateInstance(VoidPayment.Instance)); cr.State = States.ConfirmCashier.Instance(con); cr.Log.Error(ipe); } catch (OperationCanceledException oce) { SoundManager.Sound(SoundType.FAILED); cr.State = States.PrinterConnectionError.Instance(new PrinterException(PosMessage.CANNOT_ACCESS_PRINTER, oce)); cr.Log.Warning(new PrinterException(PosMessage.CANNOT_ACCESS_PRINTER, oce)); } catch (EftPosException epe) { SoundManager.Sound(SoundType.FAILED); cr.State = AlertCashier.Instance(new Error(epe)); cr.Log.Error(epe); } catch (Exception ex) { SoundManager.Sound(SoundType.FAILED); cr.State = States.AlertCashier.Instance(new Error(ex)); cr.Log.Error(ex); } finally { isProcessing = false; } #endregion } }
private void SendKeys(PosKey key) { if (ConsumeKey != null) ConsumeKey(this, new ConsumeKeyEventArgs((int)key)); }
/// <summary> /// </summary> public void AddPosKeys(int subMenuID, string menuName) { //this.txtBlockMenuName.Text = menuName; PosKey posKey = new PosKey(); posKey.Panel_id = subMenuID; posKey.Config_no = PosSettings.Default.Configuration; //PosContext.Instance.Config.ConfigNo; DataSet data = posKey.LoadBySubMenu(); DataTable dt = data.Tables[0]; int colNum = 0; int rowNum = 0; foreach (DataRow dr in dt.Rows) { PosButton btn = new PosButton(); btn.Style = (Style)FindResource("GlassyButtonStyle1"); btn.Height = 75; btn.KeyValue = int.Parse(dr["key_val"].ToString()); btn.KeyCode = int.Parse(dr["key_code"].ToString()); btn.AccessKeyValue = int.Parse(dr["attr"].ToString()); btn.Content = dr["key_text"].ToString(); btn.KeyClass = dr["key_class"].ToString(); btn.Tag = "..\\..\\Images\\" + dr["image"].ToString().Trim(); btn.Margin = new Thickness(2, 2, 2, 2); btn.Focusable = false; Grid.SetRow(btn, rowNum); Grid.SetColumn(btn, colNum++); this.MyGrid.Children.Add(btn); if (colNum > 5) { colNum = 0; ++rowNum; } btn.Click += new RoutedEventHandler(btn_Click); //Register key in PosContext; //Create events string eventClass = dr["key_class"].ToString(); try { Assembly assembly = Assembly.GetExecutingAssembly(); PosEvent posEvent = assembly.CreateInstance(eventClass) as PosEvent; if (!PosContext.Instance.KeysById.ContainsKey(dr["key_code"].ToString())) { PosContext.Instance.KeysById.Add(dr["key_code"].ToString(), posEvent); } } catch (System.NullReferenceException exNull) { Logger.Error(this.GetType().ToString(), "Invalid class name " + eventClass); } catch (Exception ex) { Logger.Error(this.GetType().ToString(), ex.ToString()); } } this.KeyDisable(); }
private void WriteChar(int order, PosKey key) { if (order == KeyMap.LastOrder && KeyMap.LastPosKey == key) { canAdvance = false; sequence++; } else { canAdvance = true; } ThreadState tState = t.ThreadState; if (tState == ThreadState.Unstarted || tState == ThreadState.Stopped) { sequence = 0; } char c = KeyMap.GetLetter(key, order, ref sequence); switch (c) { case '\b': if (input.Length == 0) { return; } if (DisplayAdapter.Cashier.CurrentColumn == 0) { return; } if (t != null || t.ThreadState == ThreadState.WaitSleepJoin) { if (t.ThreadState != ThreadState.Unstarted) { t.Interrupt(); t.Join(); } } if (input.Length >= DisplayAdapter.Cashier.CurrentColumn) { input.Remove(DisplayAdapter.Cashier.CurrentColumn - 1, 1); } DisplayAdapter.Cashier.BackSpace(); break; case ' ': Numeric(' '); break; case '\n': Enter(); break; default: try { if (tState == ThreadState.Unstarted) { Append(c, false); t.Start(); return; } else if (tState == ThreadState.Stopped) { canAdvance = true; sequence = 0; t = new Thread(new ThreadStart(AdvanceCursor)); t.Start(); Append(c, false); return; } else if (tState == ThreadState.WaitSleepJoin) { t.Interrupt(); t.Join(); t = new Thread(new ThreadStart(AdvanceCursor)); t.Start(); Append(c, false); } } catch (ThreadStateException) { //Console.WriteLine("Threadstate Exception"); } break; } }
public void Delete(PosKey item) { throw new NotImplementedException(); }
private void tlpPoskeys_Click(object sender, EventArgs e) { if (!(sender is Button)) return; PosKey key = PosKey.CapsLock; int buffer = -1; string butonName = ((Button)sender).Name; switch (butonName) { case "btnD00": key = PosKey.D0; SendKeys(key); break; case "btnD9": key = PosKey.D9; break; case "btnD8": key = PosKey.D8; break; case "btnD7": key = PosKey.D7; break; case "btnD6": key = PosKey.D6; break; case "btnD5": key = PosKey.D5; break; case "btnD4": key = PosKey.D4; break; case "btnD3": key = PosKey.D3; break; case "btnD2": key = PosKey.D2; break; case "btnD1": key = PosKey.D1; break; case "btnD0": key = PosKey.D0; break; case "btnPLU18": case "btnPLU17": case "btnPLU16": case "btnPLU15": case "btnPLU14": case "btnPLU13": case "btnPLU12": case "btnPLU11": case "btnPLU10": case "btnPLU9": case "btnPLU8": case "btnPLU7": case "btnPLU6": case "btnPLU5": case "btnPLU4": case "btnPLU3": case "btnPLU2": case "btnPLU1": buffer = int.Parse(butonName.Substring(6)); KeyMap.LabelBuffer = buffer - 1; key = PosKey.LabelStx; break; case "btnEnter": key = PosKey.Enter; break; case "btnEsc": key = PosKey.Escape; break; case "btnSeperator": key = PosKey.Decimal; break; case "btnDown": key = PosKey.DownArrow; break; case "btnUp": key = PosKey.UpArrow; break; case "btnFee": key = PosKey.Fee; break; case "btnPercentFee": key = PosKey.PercentFee; break; case "btnDiscount": key = PosKey.Discount; break; case "btnPercentDisc": key = PosKey.PercentDiscount; break; case "btnProcess": key = PosKey.Command; break; case "btnCash": key = PosKey.Cash; break; case "btnRepeat": key = PosKey.Repeat; break; case "btnProgram": key = PosKey.Program; break; case "btnCurrency": key = PosKey.ForeignCurrency; break; case "btnAmount": key = PosKey.Total; break; case "btnSubtotal": key = PosKey.SubTotal; break; case "btnReport": key = PosKey.Report; break; case "btnQuantity": key = PosKey.Quantity; break; case "btnPrice": key = PosKey.Price; break; case "btnCustomer": key = PosKey.Customer; break; case "btnSalesPerson": key = PosKey.SalesPerson; break; case "btnDrawer": key = PosKey.CashDrawer; break; case "btnCheck": key = PosKey.Check; break; case "btnCredit4": case "btnCredit3": case "btnCredit2": case "btnCredit1": buffer = int.Parse(butonName.Substring(9)); KeyMap.CreditBuffer = buffer; key = PosKey.Credit; break; case "btnCredit": KeyMap.CreditBuffer = 0; key = PosKey.Credit; break; case "btnPriceLookup": key = PosKey.PriceLookup; break; case "btnVoid": key = PosKey.Void; break; case "btnDoc": key = PosKey.Document; break; } SendKeys(key); }
private void WriteChar(int order, PosKey key) { if (order == KeyMap.LastOrder && KeyMap.LastPosKey == key) { sequence++; } if (threadCursor != null) { threadCursor.Abort(); } char c = KeyMap.GetLetter(key, order, ref sequence); switch (c) { case '\b': if (IsTouchDisplay) { return; } if (input.Length == 0) { return; } if (DisplayAdapter.Cashier.CurrentColumn == 0) { return; } if (input.Length >= DisplayAdapter.Cashier.CurrentColumn) { input.Remove(DisplayAdapter.Cashier.CurrentColumn - 1, 1); } DisplayAdapter.Cashier.BackSpace(); break; case ' ': if (IsTouchDisplay) { return; } Numeric(' '); break; case '\n': if (IsTouchDisplay) { return; } Enter(); break; default: try { Append(c, true); return; } catch (ThreadStateException) { //Console.WriteLine("Threadstate Exception"); } break; } threadCursor = new Thread(new ThreadStart(AdvanceCursor)); threadCursor.Start(); }
void display_ConsumeKey(object sender, ConsumeKeyEventArgs e) { PosKey key = (PosKey)e.KeyValue; switch (e.KeyValue) { case 16: //Shift if ((keyStack.Count == 0 || keyStack.Count == 2) && !(CashRegister.State is States.EnterQRCode)) { keyStack.Add(e.KeyValue); return; } break; case 66: //B if (keyStack.Count == 3) { keyStack.Add(e.KeyValue); return; } break; default: break; } if (keyStack.Count > 0) { switch (key) { case PosKey.D0: case PosKey.D1: case PosKey.D2: case PosKey.D3: case PosKey.D4: case PosKey.D5: case PosKey.D6: case PosKey.D7: case PosKey.D8: case PosKey.D9: keyStack.Add(e.KeyValue); return; case PosKey.Enter: int current = 1; if (keyStack.Count > 4 && keyStack[2] == 16) { current = 4; while (true) { if (keyStack[current] < (int)PosKey.D0 || keyStack[current] > (int)PosKey.D9) { current++; } else { break; } } Chassis.Engine.Process(PosKey.MagstripeStx); } else { Chassis.Engine.Process(PosKey.BarcodePrefix); } while (current < keyStack.Count) { if (keyStack[current] < (int)PosKey.D0 || keyStack[current] > (int)PosKey.D9) { break; } Chassis.Engine.Process((PosKey)(keyStack[current])); current++; } Chassis.Engine.Process(PosKey.Enter); keyStack.Clear(); return; default: if (keyStack[keyStack.Count - 1] == (int)PosKey.Enter) { return; } if (keyStack.Count > 4 && keyStack[2] == 16 && e.KeyValue == 16) { keyStack.Insert(4, (int)PosKey.MagstripeStx); keyStack.Add((int)PosKey.Enter); return; } foreach (int keyVal in keyStack) { Chassis.Engine.Process((PosKey)keyVal); } keyStack.Clear(); return; } } Chassis.Engine.Process(key); }
void gfb_Click(object sender, EventArgs e) { PosKey key = PosKey.UndefinedKey; string keyText = ((GradientFilledButton)sender).Name.Substring(3); switch (keyText) { case "Enter": key = PosKey.Enter; break; case "Backspace": key = PosKey.Correction; break; case "Delete": key = PosKey.Escape; break; case "UpArrow": key = PosKey.UpArrow; break; case "DownArrow": key = PosKey.DownArrow; break; case "Space": key = (PosKey)ConsoleKey.Spacebar; break; case "Comma": key = (PosKey)ConsoleKey.Decimal; break; case "Slash": key = (PosKey)ConsoleKey.ForwardSlash; break; case "Backslash": key = (PosKey)'\\'; break; case "Colon": key = (PosKey)':'; break; case "SemiColon": key = (PosKey)';'; break; case "Minus": key = (PosKey)'-'; break; case "Dot": key = (PosKey)46; break; case "UnderScore": key = (PosKey)'_'; break; case "D0": case "D1": case "D2": case "D3": case "D4": case "D5": case "D6": case "D7": case "D8": case "D9": key = (PosKey)Enum.Parse(typeof(PosKey), keyText); break; default: if (char.IsLetter(keyText[0])) { key = (PosKey)keyText[0]; } break; } ConsumeKey(sender, new ConsumeKeyEventArgs((int)key)); }
public virtual void KeyboardKey(PosKey keyboardKey) { cr.State = AlertCashier.Instance(cr.State.NotImplemented); }
public void Insert(PosKey item) { _databaseInstance.Insert(item, TableName); }