private void video_NewFrame(object sender, NewFrameEventArgs eventArgs)
        {
            try
            {
                Bitmap bitmap = (Bitmap)eventArgs.Frame.Clone();
                LoadFrame?.Invoke(bitmap);
                Result result = reader.Decode((Bitmap)eventArgs.Frame.Clone());

                eventArgs.Frame.Dispose();

                if (result != null)
                {
                    var fromEncodind = Encoding.GetEncoding("ISO-8859-1"); //из какой кодировки
                    var bytes        = fromEncodind.GetBytes(result.Text);
                    var toEncoding   = Encoding.GetEncoding(1251);         //в какую кодировку

                    string datamatrix = toEncoding.GetString(bytes);

                    while (datamatrix.IndexOf("\u001d") != -1)
                    {
                        datamatrix = datamatrix.Replace("\u001d", "и");
                    }

                    if (SetResult(FormingOrder(datamatrix), _Orders, false))
                    {
                        LoadResult?.Invoke(_Orders);
                    }
                }
            }
            catch
            {
            }
        }
예제 #2
0
        protected void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            try
            {
                if (!connect)
                {
                    return;
                }
                string code = port.ReadExisting();

                while (code.IndexOf("\u001d") != -1)
                {
                    code = code.Replace("\u001d", "и");
                }

                if (SetResult(FormingOrder(code), _Orders, false))
                {
                    LoadResult?.Invoke(_Orders);
                }
            }
            catch (Exception Ex)
            {
                SystemArgs.PrintLog(Ex.ToString());
                MessageBox.Show(Ex.Message);
            }
        }
        protected void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            if (!connect)
            {
                return;
            }
            string code = port.ReadExisting();

            if (SetResult(code, _Added, _Orders))
            {
                Status?.Invoke(code.Replace("\u00a0", "").Replace(" ", ""));

                LoadResult?.Invoke(_Orders);
            }
        }
        protected void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            if (!connect)
            {
                return;
            }
            string code = port.ReadExisting();

            while (code.IndexOf("\u001d") != -1)
            {
                code = code.Replace("\u001d", "и");
            }

            if (SetResult(FormingOrder(code), _Orders))
            {
                LoadResult?.Invoke(_Orders);
            }
        }
예제 #5
0
        private void video_NewFrame(object sender, NewFrameEventArgs eventArgs)
        {
            try
            {
                Bitmap bitmap = (Bitmap)eventArgs.Frame.Clone();
                LoadFrame?.Invoke(bitmap);

                Result result = reader.Decode((Bitmap)eventArgs.Frame.Clone());
                if (result != null)
                {
                    if (SetResult(result.Text, Added, _Orders))
                    {
                        Status?.Invoke(result.Text.Replace("\u00a0", "").Replace(" ", ""));
                        LoadResult?.Invoke(_Orders);
                    }
                }
            }
            catch
            {
            }
        }
예제 #6
0
        protected void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            try
            {
                if (!connect)
                {
                    return;
                }
                string code = port.ReadExisting();

                if (SetResult(code, _Added, _BS, _Orders))
                {
                    Status?.Invoke(code.Replace("\u00a0", "").Trim());

                    LoadResult?.Invoke(_Orders);
                }
            }
            catch (Exception Ex)
            {
                SystemArgs.PrintLog(Ex.ToString());
                MessageBox.Show(Ex.Message);
            }
        }