コード例 #1
0
ファイル: Hmi.cs プロジェクト: skyclub66/HMI
        public unsafe static byte Hmi_Refobj(byte index)
        {
            objxinxi objxinxi = default(objxinxi);
            byte     b        = 0;
            byte     result;

            if (index < Hmi.myapp.dpagexinxi.objqyt)
            {
                if (Hmi.myapp.pageobjs[index].vis == 1)
                {
                    ushort index2 = (ushort)(Hmi.myapp.dpagexinxi.objstar + (ushort)index);
                    Readdata.Readdata_ReadObj(ref objxinxi, (int)index2);
                    if (objxinxi.objType < 50)
                    {
                        GuiObjControl.GuiObjControls[(int)objxinxi.objType].Ref(&objxinxi, index);
                    }
                    else if (objxinxi.redian.events.Ref != 0)
                    {
                        Hmi.Hmi_SetHexIndex((int)(objxinxi.redian.events.Ref + objxinxi.zhilingstar));
                        if (Hmi.myapp.Hexstrindex != 65535)
                        {
                            b = 1;
                        }
                    }
                }
                Hmi.myapp.pageobjs[index].refFlag = 0;
                result = b;
            }
            else
            {
                Hmi.myapp.errcode = 2;
                result            = 0;
            }
            return(result);
        }
コード例 #2
0
ファイル: Hmi.cs プロジェクト: skyclub66/HMI
        public unsafe static byte Hmi_Hideobj(byte index)
        {
            objxinxi objxinxi = default(objxinxi);

            if (Hmi.myapp.pageobjs[index].vis == 1 && Hmi.myapp.pagestate == 1)
            {
                Readdata.Readdata_ReadObj(ref objxinxi, (int)(Hmi.myapp.dpagexinxi.objstar + (ushort)index));
                if (objxinxi.redian.events.Vis != 0)
                {
                    Hmi.Hmi_SetHexIndex((int)(objxinxi.redian.events.Vis + objxinxi.zhilingstar));
                }
            }
            Hmi.myapp.pageobjs[index].vis = 0;
            return(1);
        }
コード例 #3
0
ファイル: Hmi.cs プロジェクト: skyclub66/HMI
        public unsafe static byte Hmi_GetTimerHexbufIndex()
        {
            byte result;

            if (*Hmi.myapp.systimerbuf > 0)
            {
                if (Hmi.myapp.systimerbuf[1] >= *Hmi.myapp.systimerbuf)
                {
                    Hmi.myapp.systimerbuf[1] = 0;
                }
                for (byte b = Hmi.myapp.systimerbuf[1]; b < *Hmi.myapp.systimerbuf; b += 1)
                {
                    systimer_type *ptr = (systimer_type *)(Hmi.myapp.systimerbuf + (b * 5 + 4));
                    if (ptr->val == 65534)
                    {
                        Hmi.Hmi_SetHexIndex((int)ptr->hexbufindex);
                        ptr->val = 65535;
                        Hmi.myapp.systimerbuf[1] = (byte)(b + 1);
                        result = 1;
                        return(result);
                    }
                }
                for (byte b = 0; b < Hmi.myapp.systimerbuf[1]; b += 1)
                {
                    systimer_type *ptr = (systimer_type *)(Hmi.myapp.systimerbuf + (b * 5 + 4));
                    if (ptr->val == 65534)
                    {
                        Hmi.Hmi_SetHexIndex((int)ptr->hexbufindex);
                        ptr->val = 65535;
                        Hmi.myapp.systimerbuf[1] = (byte)(b + 1);
                        result = 1;
                        return(result);
                    }
                }
            }
            result = 0;
            return(result);
        }
コード例 #4
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();
                }
            }
        }