示例#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
文件: Touch.cs 项目: skyclub66/HMI
 public unsafe static void Touch_Tpscan()
 {
     if (Touch.myapp.upapp.tp_dev.touchstate == 1)
     {
         Touch.myapp.upapp.tp_dev.x_now = (ushort)(Control.MousePosition.X - Touch.myapp.upapp.mouse_pos.X + (int)Touch.myapp.upapp.tp_dev.x_down);
         Touch.myapp.upapp.tp_dev.y_now = (ushort)(Control.MousePosition.Y - Touch.myapp.upapp.mouse_pos.Y + (int)Touch.myapp.upapp.tp_dev.y_down);
         if (Touch.myapp.dra == 1)
         {
             Lcd.Lcd_Fill((int)Touch.myapp.upapp.tp_dev.x_now, (int)Touch.myapp.upapp.tp_dev.y_now, 2, 2, Touch.myapp.dracolor);
         }
         if (Touch.myapp.Hexstrindex == 65535 && Touch.myapp.moveobjstate > 0 && Touch.myapp.systime.movetime > 20u)
         {
             objxinxi objxinxi = default(objxinxi);
             Readdata.Readdata_ReadObj(ref objxinxi, (int)((ushort)Touch.myapp.downobjid + Touch.myapp.dpagexinxi.objstar));
             if (GuiSlider.GuiSliderPressMove(&objxinxi, Touch.myapp.downobjid) > 0)
             {
                 if (objxinxi.redian.events.Slide != 0 && Touch.myapp.Hexstrindex == 65535)
                 {
                     Touch.myapp.Hexstrindex = (ushort)(objxinxi.redian.events.Slide + objxinxi.zhilingstar);
                 }
             }
             Touch.myapp.systime.movetime = 0u;
         }
     }
 }
示例#3
0
文件: Hmi.cs 项目: skyclub66/HMI
        public unsafe static byte Hmi_GuiObjectInit(byte ObjId)
        {
            objxinxi objxinxi = default(objxinxi);

            Readdata.Readdata_ReadObj(ref objxinxi, (int)(Hmi.myapp.dpagexinxi.objstar + (ushort)ObjId));
            if (objxinxi.objType < 50)
            {
                GuiObjControl.GuiObjControls[(int)objxinxi.objType].Init(&objxinxi, ObjId);
            }
            return(1);
        }
示例#4
0
文件: Readdata.cs 项目: skyclub66/HMI
 public static void Readdata_ReadObj(ref objxinxi obj, int index)
 {
     byte[] array = new byte[(int)Readdata.objxinxisize];
     if (Readdata.myapp.upapp.runapptype == runapptype.run)
     {
         Readdata.myapp.upapp.filesr.BaseStream.Position = (long)((ulong)Readdata.myapp.app.objadd + (ulong)((long)((int)(Readdata.objxinxisize + 180) * index)));
     }
     else
     {
         Readdata.myapp.upapp.filesr.BaseStream.Position = (long)((ulong)Readdata.myapp.app.objadd + (ulong)((long)((int)Readdata.objxinxisize * index)));
     }
     Readdata.myapp.upapp.filesr.BaseStream.Read(array, 0, (int)Readdata.objxinxisize);
     obj = (objxinxi)array.BytesTostruct(default(objxinxi).GetType());
 }
示例#5
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);
        }
示例#6
0
文件: Hmi.cs 项目: skyclub66/HMI
        public unsafe static byte Hmi_loadref(byte index)
        {
            objxinxi objxinxi = default(objxinxi);
            byte     result;

            if (index < Hmi.myapp.dpagexinxi.objqyt)
            {
                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].Load(&objxinxi, index);
                }
                result = 1;
            }
            else
            {
                Hmi.myapp.errcode = 2;
                result            = 0;
            }
            return(result);
        }
示例#7
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();
                }
            }
        }