コード例 #1
0
ファイル: Sys.cs プロジェクト: skyclub66/HMI
        public static void Endcomdata()
        {
            int num = 0;

            if (Sys.myapp.USART.lei != 0)
            {
                if (Sys.myapp.USART.lei != 1)
                {
                    if (Sys.myapp.USART.lei != 10)
                    {
                        if (Sys.myapp.USART.lei == 11)
                        {
                            num = 1;
                        }
                    }
                }
            }
            if (num == 1)
            {
                Sys.myapp.USART.State = 0;
                Commake.Commake_ClearNorComData();
                Usart.Usart_SendByte(253);
                Commake.Commake_SendEnd();
            }
        }
コード例 #2
0
ファイル: Hmi.cs プロジェクト: skyclub66/HMI
        public unsafe static void Hmi_Getredian(byte state)
        {
            objxinxi objxinxi = default(objxinxi);
            byte     b        = (byte)(Hmi.myapp.dpagexinxi.objqyt - 1);
            int      num      = (int)(Hmi.myapp.dpagexinxi.objstar + (ushort)Hmi.myapp.dpagexinxi.objqyt - 1);

            if (Hmi.myapp.dpagexinxi.objqyt != 0)
            {
                if (Hmi.myapp.touchsendxy == 1)
                {
                    Usart.Usart_SendByte(103);
                    Usart.Usart_SendByte((byte)(Hmi.myapp.upapp.tp_dev.x_down >> 8));
                    Usart.Usart_SendByte((byte)Hmi.myapp.upapp.tp_dev.x_down);
                    Usart.Usart_SendByte((byte)(Hmi.myapp.upapp.tp_dev.y_down >> 8));
                    Usart.Usart_SendByte((byte)Hmi.myapp.upapp.tp_dev.y_down);
                    Usart.Usart_SendByte(state);
                    Commake.Commake_SendEnd();
                }
                if (state == 1)
                {
                    for (int i = num; i >= (int)Hmi.myapp.dpagexinxi.objstar; i--)
                    {
                        if (Hmi.myapp.pageobjs[b].vis == 1)
                        {
                            Readdata.Readdata_ReadObj(ref objxinxi, i);
                            if (Hmi.myapp.upapp.tp_dev.x_down > objxinxi.redian.x && Hmi.myapp.upapp.tp_dev.x_down < objxinxi.redian.endx && Hmi.myapp.upapp.tp_dev.y_down > objxinxi.redian.y && Hmi.myapp.upapp.tp_dev.y_down < objxinxi.redian.endy)
                            {
                                if (Hmi.myapp.pageobjs[b].touchstate != 1)
                                {
                                    return;
                                }
                                if (Hmi.myapp.downobjid != b)
                                {
                                    Hmi.myapp.downobjid = b;
                                    if (objxinxi.objType == objtype.OBJECT_TYPE_SLIDER)
                                    {
                                        GuiSlider.GuiSliderPressDown(&objxinxi, b);
                                        Hmi.myapp.moveobjstate = 1;
                                    }
                                    if (objxinxi.redian.events.Down != 0)
                                    {
                                        Hmi.Hmi_SetHexIndex((int)(objxinxi.redian.events.Down + objxinxi.zhilingstar));
                                    }
                                }
                                break;
                            }
                        }
                        b -= 1;
                    }
                }
                else if (state == 0)
                {
                    if (Hmi.myapp.downobjid == 255 || Hmi.myapp.pageobjs[Hmi.myapp.downobjid].vis == 0)
                    {
                        return;
                    }
                    b = Hmi.myapp.downobjid;
                    int i = (int)((ushort)Hmi.myapp.downobjid + Hmi.myapp.dpagexinxi.objstar);
                    Readdata.Readdata_ReadObj(ref objxinxi, i);
                    if (objxinxi.objType == objtype.OBJECT_TYPE_SLIDER)
                    {
                        GuiSlider.GuiSliderPressUp(&objxinxi, Hmi.myapp.downobjid);
                    }
                    if (objxinxi.redian.events.Up != 0)
                    {
                        Hmi.Hmi_SetHexIndex((int)(objxinxi.redian.events.Up + objxinxi.zhilingstar));
                    }
                    if (objxinxi.redian.events.Slide != 0)
                    {
                        Hmi.Hmi_SetHexIndex((int)(objxinxi.redian.events.Slide + objxinxi.zhilingstar));
                    }
                }
                if (((int)objxinxi.redian.sendkey & 1 << (int)state) > 0)
                {
                    Usart.Usart_SendByte(101);
                    Usart.Usart_SendByte((byte)Hmi.myapp.dpage);
                    Usart.Usart_SendByte(b);
                    Usart.Usart_SendByte(state);
                    Commake.Commake_SendEnd();
                }
            }
        }