예제 #1
0
파일: runscr.cs 프로젝트: skyclub66/HMI
 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();
     }
 }