public static void WriteToDisplay(decimal Amount, PoleDisplayType displayType = PoleDisplayType.Nodisplay) { try { if (Amount == 0) { displayType = PoleDisplayType.Nodisplay; } if (CheckPortName()) { string DisplayText = ((char)27).ToString() + ((char)81).ToString() + ((char)65).ToString() + Amount.ToString("#0.00") + ((char)13).ToString(); PoleDisplayPort.Write(DisplayText); DisplayText = ((char)27).ToString() + ((char)115).ToString() + (int)displayType; PoleDisplayPort.Write(DisplayText); } PoleDisplayPort.Close(); } catch (Exception ex) { if (IsDebugMode) { MessageBox.Show(ex.GetBaseException().Message, "Pole Display Error", MessageBoxButton.OK, MessageBoxImage.Error); } } }
//static byte[] commandInitialize = new byte[] { 0x1B, 0x40 }; //static byte[] commandLight = new byte[] { 0x1B, 0x73 }; /// <summary> /// 在客显上显示金额 /// </summary> /// <param name="_text">数值</param> /// <param name="_type">显示类型</param> public static void Display(string _text, PoleDisplayType _type) { text = _text; type = _type; Thread thread = new Thread(new ThreadStart(Display)); thread.SetApartmentState(ApartmentState.STA); thread.Start(); }