public bool Get(ref ThreadP2Ctrl_Message msg)
        {
            if (pOut != pIn)
            {
                msg.Set(m_obuff[pOut].Message_ID,
                        m_obuff[pOut].Message,
                        m_obuff[pOut].Procedure,
                        m_obuff[pOut].oResult,
                        m_obuff[pOut].ErrorMessage);

                m_obuff[pOut].Do_Dispose();
                pOut = Next(pOut);
                return true;
            }
            else
            {
                return false;
            }
        }
Beispiel #2
0
        private void Run(object othdata)
        {
            ThreadData thdata = (ThreadData)othdata;
            ThreadP2Ctrl_MessageBox xThreadP2Ctrl_MessageBox = thdata.m_ThreadP2Ctrl_MessageBox;
            ThreadP_Message p_message = new ThreadP_Message(0, ThreadP_Message.eMessage.NONE, null,null);
            ThreadP2Ctrl_Message xThreadP2Ctrl_Message = new ThreadP2Ctrl_Message(0, ThreadP2Ctrl_Message.eMessage.START, null,null,null);
            xThreadP2Ctrl_MessageBox.Post(xThreadP2Ctrl_Message);
            for (;;)
            {
                switch (message_box.Get(ref p_message))
                {
                    case Result_MessageBox_Get.OK:
                        switch (p_message.Message)
                        {

                            case ThreadP_Message.eMessage.TASK:
                                ThreadP_Message.delegate_Procedure proc = p_message.Procedure;
                                object oParam = p_message.ParameterAsObject;
                                string Err = null;
                                object oResult = proc(oParam, ref Err);
                                if (oResult is bool)
                                {
                                    if (!(bool)oResult)
                                    {
                                        xThreadP2Ctrl_Message.Set(0, ThreadP2Ctrl_Message.eMessage.ERROR, proc, oResult, Err);
                                    }
                                    else
                                    {
                                        xThreadP2Ctrl_Message.Set(0, ThreadP2Ctrl_Message.eMessage.MESSAGE, proc, oResult, Err);
                                    }
                                }
                                else
                                {
                                    xThreadP2Ctrl_Message.Set(0, ThreadP2Ctrl_Message.eMessage.MESSAGE, proc, oResult, Err);
                                }

                                xThreadP2Ctrl_MessageBox.Post(xThreadP2Ctrl_Message);
                                break;

                            case ThreadP_Message.eMessage.END:
                                xThreadP2Ctrl_Message.Set(0, ThreadP2Ctrl_Message.eMessage.END, null,null,null);
                                xThreadP2Ctrl_MessageBox.Post(xThreadP2Ctrl_Message);
                                return;
                        }
                        break;
                    case Result_MessageBox_Get.TIMEOUT:
                        break;
                }
            }
        }