Ejemplo n.º 1
0
        public void PostPicture(Bitmap bmp, string label)
        {
            COMMAND_DATA cmd = new COMMAND_DATA();

            cmd.command = COMMANDS.POST_PICUTRE;
            cmd.bmp     = bmp;
            cmd.label   = label;
            m_CommandsQ.Enqueue(cmd);
        }
Ejemplo n.º 2
0
        public void PostHistogram(Bitmap bmp, string label)
        {
            COMMAND_DATA cmd = new COMMAND_DATA();

            cmd.command = COMMANDS.POST_HISTOGRAM;
            cmd.bmp     = bmp;
            cmd.label   = label;
            m_CommandsQ.Enqueue(cmd);
        }
        public async Task <ActionResult> GetCommand(string modelid)
        {
            List <COMMAND_DATA> commandData = new List <COMMAND_DATA>();

            try
            {
                DTDLModelResolver resolver = new DTDLModelResolver(_modelRepoUrl, _gitToken, _logger);

                var modelData = await resolver.ParseModelAsync(modelid);

                var interfaces = modelData.Where(r => r.Value.EntityKind == DTEntityKind.Command).ToList();

                foreach (var dt in interfaces)
                {
                    COMMAND_DATA data = new COMMAND_DATA();

                    DTCommandInfo commandInfo = dt.Value as DTCommandInfo;

                    if (commandInfo.DisplayName.Count > 0)
                    {
                        data.CommandDisplayName = commandInfo.DisplayName["en"];
                    }

                    if (commandInfo.Description.Count > 0)
                    {
                        data.CommandDescription = commandInfo.Description["en"];
                    }

                    data.CommandName = commandInfo.Name;

                    if (commandInfo.Request != null)
                    {
                        if (data.request == null)
                        {
                            data.request = new List <COMMAND_REQUEST>();
                        }
                        COMMAND_REQUEST request = new COMMAND_REQUEST();
                        request.requestName        = commandInfo.Request.Name;
                        request.requestKind        = commandInfo.Request.Schema.EntityKind.ToString();
                        request.requestDescription = commandInfo.Request.Description["en"];
                        request.requestisplayName  = commandInfo.Request.DisplayName["en"];
                        data.request.Add(request);
                    }

                    commandData.Add(data);
                }
            }
            catch (Exception ex)
            {
                _logger.LogError($"Error {ex}");
            }

            return(Json(commandData));
        }
Ejemplo n.º 4
0
        public void PostCharImage(Bitmap bmp, int cindex, string c)
        {
            if (cindex < 0 || cindex > m_AppData.MAX_DISPLAY_CHARS)
            {
                return;
            }
            COMMAND_DATA cmd = new COMMAND_DATA();

            cmd.command    = COMMANDS.POST_CHAR_IMAGE;
            cmd.bmp        = bmp;
            cmd.charString = c;
            cmd.cIndex     = cindex;
            m_CommandsQ.Enqueue(cmd);
        }
Ejemplo n.º 5
0
        void ProcessCommandsLoop()
        {
            while (!m_Stop)
            {
                Thread.Sleep(1);

                try
                {
                    COMMAND_DATA cmd = m_CommandsQ.Dequeue();
                    if (cmd == null)
                    {
                        continue;
                    }

                    switch (cmd.command)
                    {
                    case COMMANDS.POST_CHAR_IMAGE:

                        this.BeginInvoke((MethodInvoker) delegate { characterPBs[cmd.cIndex].Image = cmd.bmp; });
                        this.BeginInvoke((MethodInvoker) delegate { charResultTextBoxes[cmd.cIndex].Text = cmd.charString; });

                        break;

                    case COMMANDS.POST_PICUTRE:

                        this.BeginInvoke((MethodInvoker) delegate { pictureBoxPlateDisplay.Image = cmd.bmp; });
                        this.BeginInvoke((MethodInvoker) delegate { labelPlateNumbers.Text = cmd.label; });

                        break;

                    case COMMANDS.POST_HISTOGRAM:

                        this.BeginInvoke((MethodInvoker) delegate { pictureBoxHistogram.Image = cmd.bmp; });
                        this.BeginInvoke((MethodInvoker) delegate { labelHistoString.Text = cmd.label; });
                        break;
                    }
                }
                catch (Exception ex) { MessageBox.Show(ex.Message + ",  " + ex.StackTrace); }
            }
        }