private void RaiseCommandReaded(PrnCommands command, byte [] data = null, int count = -1) { if (OnCommandReaded != null) { OnCommandReaded(command, data, count); } }
private void _viewer_OnCommandReaded(PrnCommands command, byte[] data, int count) { switch (command) { case PrnCommands.FeedLines: FeedLines(count); return; case PrnCommands.LeftMargin: if (count > 0) { int offset = (960 - (_bytesPerLine * 4)) / 16; //_x += _step * count; _leftMargin = (byte)(count * _step); } return; case PrnCommands.BytesPerLine: _bytesPerLine = count; return; case PrnCommands.EndOfFile: return; case PrnCommands.EndJob: //_pic.Image.Save(AppDomain.CurrentDomain.BaseDirectory + "\\data\\pic.png", ImageFormat.Png); return; case PrnCommands.PrintComprLine: ResetX(); DrawCompressedLine(data, count); //for (int i = 0; i < count; i++) //{ // DrawCompressed(data[i]); //} return; case PrnCommands.PrintLine: ResetX(); for (int i = 0; i < count; i++) { Draw(data[i]); } return; case PrnCommands.Error: _g.DrawString(string.Format("Current line {0}", count), new Font("Tahoma", 24), _blackBush, 0, 120 * _step); _g.FillRectangle(_blueBush, new Rectangle(0, _y, _width, 10)); // whatever return; default: return; } }
private void _viewer_OnCommandReaded(PrnCommands command, byte[] data, int count) { switch (command) { case PrnCommands.FeedLines: FeedLines(count); return; case PrnCommands.LeftMargin: if (count > 0) { } return; case PrnCommands.EndOfFile: return; case PrnCommands.EndJob: //_pic.Image.Save(AppDomain.CurrentDomain.BaseDirectory + "\\data\\pic.png", ImageFormat.Png); return; case PrnCommands.PrintComprLine: ResetX(); for (int i = 0; i < count; i++) { DrawCompressed(data[i]); } return; case PrnCommands.PrintLine: ResetX(); for (int i = 0; i < count; i++) { Draw(data[i]); } return; } }