public byte Refpage_Edit(mpage page) { this.dpage = page; this.tobjs.Clear(); this.selectobjedits.Clear(); while (this.allobjedits.Count > 0) { objedit item = this.allobjedits[0]; this.allobjedits.Remove(item); item.Dispose(); } Hmi.Hmi_ClearTimer(); Hmi.Hmi_Clearredian(0); Hmi.Hmi_ClearHexstr(); this.BackgroundImage = null; if ((this.Myapp.pages.Count != 0) && (page != null)) { this.myapp.dpage = (ushort)page.pageid; base.Visible = false; this.LoadAllObj(); base.Visible = true; if ((this.tobjs.Count == 0) && this.objpanel.Visible) { this.objpanel.Visible = false; if (this.Objpanelresize != null) { this.Objpanelresize(null, null); } } } return(1); }
private void runmain() { Thread.Sleep(100); Win32.timeBeginPeriod(1); try { while (this.myapp.upapp.runstate == 1) { Touch.Touch_Tpscan(); switch (this.myapp.USART.State) { case 0xfd: lock (this.myapp.upapp.Screenbm) { Graphics.FromImage(this.myapp.upapp.Screenbm).Clear(Color.Black); } this.myapp.upapp.ScreenRef(1); Application.DoEvents(); Thread.Sleep(100); Hmi.Hmi_OpenInit(); Hmi.Hmi_Init(); Hmi.Hmi_RefPage(0); this.myapp.USART.State = 0; Commake.Commake_ClearNorComData(); break; case 0xff: Commake.Commake_ClearNorComData(); this.myapp.USART.State = 0; break; case 0x16: Usart.Usart_SendByte(0xfe); Commake.Commake_SendEnd(); this.myapp.USART.State = 0x17; break; case 0: if (this.myapp.runmod > 0) { if (Commake.Commake_ScanComcode() == 0) { Commake.Commake_CheckNorComIdle(); } if (this.myapp.upapp.Lcdshouxian == 1) { this.myapp.upapp.ScreenRef(0); } if (this.myapp.runmod == 2) { break; } } if (this.myapp.Hexstrindex != 0xffff) { Hmi.Hmi_ScanHexCode(); } else { this.myapp.pagestate = 1; if (this.myapp.upapp.Lcdshouxian == 1) { this.myapp.upapp.ScreenRef(0); } if (this.myapp.tpdownenter == 1) { Hmi.Hmi_Scanrediandown(); } else if (this.myapp.tpupenter == 1) { Hmi.Hmi_Scanredianup(); } else if (Commake.Commake_ScanComcode() == 0) { Commake.Commake_CheckNorComIdle(); Hmi.Hmi_GuiObjectRef(); if (this.myapp.Hexstrindex == 0xffff) { Hmi.Hmi_GetTimerHexbufIndex(); } } } break; case 9: Sys.Endcomdata(); break; } } } catch (Exception exception) { if (this.myapp.upapp.runstate == 1) { MessageOpen.Show(exception.Message); } } }
public unsafe void gui_int(List <guiimagetype> guiimages_, string binpath_, Myapp_inf mapp_, byte bianjistate) { this.Myapp = mapp_; this.myapp.upapp.images = guiimages_; this.binpath = binpath_; this.myapp.upapp.filesr = new StreamReader(this.binpath); this.myapp.upapp.runapptype = bianjistate; if (this.merrya == null) { this.merrya = (byte *)Marshal.AllocHGlobal(0x1f400); } this.myapp.upapp.pageidchange = new pageidchange_(this.pageidchange); this.myapp.upapp.ScreenRef = new ScreenRef_(this.Screenref); this.myapp.upapp.Sendruncodestr = new Sendruncodestr_(this.Sendruncodestr); this.myapp.upapp.Lcd_Set = new Lcd_Set_(this.Lcd_Set); this.myapp.upapp.SendCom = new SendCom_(this.SendCom_Code); Attmake.myapp = this.myapp; CodeRun.myapp = this.myapp; Commake.myapp = this.myapp; GuiCurve.myapp = this.myapp; Showpic.myapp = this.myapp; Showfont.myapp = this.myapp; GuiSlider.myapp = this.myapp; GuiTimer.myapp = this.myapp; Hmi.myapp = this.myapp; Lcd.myapp = this.myapp; Readdata.myapp = this.myapp; Sys.myapp = this.myapp; Sysatt.myapp = this.myapp; Touch.myapp = this.myapp; Usart.myapp = this.myapp; Commake.Comstrbuf = this.merrya; this.myapp.mymerry = this.merrya + 0x400; Hmi.Hexstrbuf = this.merrya + 0x2400; this.myapp.systimerbuf = this.merrya + 0x2c00; this.myapp.Mycanshus = (PosLaction *)(this.merrya + 0x2e00); this.myapp.binsuc = 1; if (Readdata.Readdata_ReadBinapp() == 0) { MessageOpen.Show("错误的资源文件或者资源文件已经受损".Language()); this.myapp.binsuc = 0; } Hmi.Hmi_OpenInit(); Hmi.Hmi_Init(); Hmi.Hmi_RefPage(0); this.myapp.USART.State = 0; Commake.Commake_ClearNorComData(); this.myapp.upapp.runstate = 1; if ((this.myapp.upapp.runapptype == runapptype.run) && ((this.mainthread == null) || !this.mainthread.IsAlive)) { Win32.timeBeginPeriod(1); DateTime now = DateTime.Now; DateTime time2 = now; Rtc.DatetimeSpan = now.AddDays((double)Kuozhan.Getval("datetime_d").Getint()).AddHours((double)Kuozhan.Getval("datetime_h").Getint()).AddMinutes((double)Kuozhan.Getval("datetime_m").Getint()).AddSeconds((double)Kuozhan.Getval("datetime_s").Getint()).Subtract(time2); if ((((Rtc.DatetimeSpan.Days == 0) && (Rtc.DatetimeSpan.Hours == 0)) && (Rtc.DatetimeSpan.Minutes == 0)) && (Rtc.DatetimeSpan.Seconds == 0)) { Rtc.DatetimeSpan_val = false; } else { Rtc.DatetimeSpan_val = true; } this.mainthread = new Thread(new ThreadStart(this.runmain)); this.timerms5 = new Thread(new ThreadStart(this.timerm_5ms)); Hmi.Hmi_ClearTimer(); this.timerms5.Start(); this.mainthread.Start(); } }
public static unsafe void Attmake_GetAtt(byte *buf, PosLaction *bufpos, runattinf *att) { PosLaction laction = new PosLaction(); pagexinxi page = new pagexinxi(); strxinxi str = new strxinxi(); uint add = 0; ushort index = 0; ushort num5 = 0; ushort num6 = 0; ushort num7 = 0; att->datafrom = 0xff; att->isref = 0; if (buf[bufpos->star] != 0x2e) { uint attdatapos; if (buf[bufpos->star] == 1) { Kuozhan.memcpy((byte *)&attdatapos, buf + (bufpos->star + 1), 4); attdatapos = (uint)(attdatapos * datasize.attxinxisize); attdatapos += myapp.app.attdatapos; } else { for (uint i = bufpos->star; i <= bufpos->end; i++) { if (buf[i] < 9) { i += 5; } if ((buf[i] == 0x2e) && (add != 1)) { if (num6 == 0) { num6 = (ushort)i; continue; } if (num7 == 0) { num7 = (ushort)i; continue; } return; } if (buf[i] == 0x5b) { add = 1; } else if (buf[i] == 0x5d) { add = 2; } } if (num6 == 0) { Sysatt.Sysatt_GetSysname(buf + bufpos->star, (byte)((bufpos->end - bufpos->star) + 1), att); return; } laction.star = bufpos->star; laction.end = (ushort)(num6 - 1); if (num7 > 0) { index = Hmi.Hmi_GetPageid(buf, &laction); if (index == 0xffff) { return; } laction.star = (ushort)(num6 + 1); laction.end = (ushort)(num7 - 1); if (index == myapp.dpage) { num5 = Hmi.Hmi_GetObjid(buf, &laction, myapp.dobjnameseradd, myapp.dpagexinxi.objqyt); attdatapos = myapp.dpagexinxi.attdatapos; } else { Readdata.Readdata_ReadPage(ref page, index); Readdata.Readdata_ReadStr(ref str, page.zhilingstar); num5 = Hmi.Hmi_GetObjid(buf, &laction, str.addbeg + myapp.app.strdataadd, page.objqyt); attdatapos = page.attdatapos; } laction.star = (ushort)(num7 + 1); } else { index = myapp.dpage; num5 = Hmi.Hmi_GetObjid(buf, &laction, myapp.dobjnameseradd, myapp.dpagexinxi.objqyt); laction.star = (ushort)(num6 + 1); attdatapos = myapp.dpagexinxi.attdatapos; } laction.end = bufpos->end; if ((num5 == 0xffff) || (laction.star > laction.end)) { return; } num6 = Attmake_GetAttindex(buf + laction.star, (byte)((laction.end - laction.star) + 1)); if (num6 == 0xff) { return; } if (index != myapp.dpage) { add = myapp.app.objadd + ((uint)(((ushort)(num5 + page.objstar)) * (datasize.objxinxisize + 180))); num7 = 0; Readdata.SPI_Flash_Read((byte *)&num7, add + 15, 1); if (num7 != 1) { return; } } else { add = myapp.app.objadd + ((uint)(((ushort)(num5 + myapp.dpagexinxi.objstar)) * (datasize.objxinxisize + 180))); } Readdata.SPI_Flash_Read((byte *)&num6, (uint)((add + datasize.objxinxisize) + (num6 * 2)), 2); if (num6 == 0xffff) { return; } attdatapos += (uint)(datasize.attxinxisize * num6); } add = myapp.app.strdataadd + attdatapos; Readdata.SPI_Flash_Read((byte *)&att->att, add, (uint)datasize.attxinxisize); att->attlei = (byte)(att->att.state & 15); if ((att->att.state & 0x10) > 0) { att->isxiugai = 1; att->datafrom = 0xfe; att->Pz = myapp.mymerry + att->att.pos; } else { att->isxiugai = 0; if (att->attlei != attshulei.Sstr.typevalue) { att->datafrom = 0xfd; } else { att->datafrom = 0xfc; } } if ((att->att.state & 0x20) > 0) { att->isref = 1; } if (att->attlei != attshulei.Sstr.typevalue) { att->val = 0; if (att->datafrom == 0xfe) { if (att->attlei == attshulei.SS16.typevalue) { short num8 = 0; Kuozhan.memcpy((byte *)&num8, myapp.mymerry + att->att.pos, att->att.merrylenth); att->val = num8; } else { Kuozhan.memcpy((byte *)&att->val, myapp.mymerry + att->att.pos, att->att.merrylenth); } } else { Kuozhan.memcpy((byte *)&att->val, (byte *)&att->att.pos, 4); } } } }