Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 public unsafe void RunStop()
 {
     try
     {
         this.myapp.upapp.runstate = 0;
         this.binpath = null;
         if (this.myapp.upapp.runapptype == runapptype.bianji)
         {
             if (this.myapp.upapp.filesr != null)
             {
                 this.tobjs.Clear();
                 this.selectobjedits.Clear();
                 while (this.allobjedits.Count > 0)
                 {
                     objedit item = this.allobjedits[0];
                     this.allobjedits.Remove(item);
                     item.Dispose();
                 }
                 this.myapp.upapp.filesr.Close();
                 this.myapp.upapp.filesr.Dispose();
                 this.myapp.upapp.filesr = null;
             }
         }
         else if (this.myapp.upapp.runapptype == runapptype.run)
         {
             this.Writedatetimespan();
             this.CloseTimerThread();
             this.ClosemainThread();
             if (this.myapp.upapp.filesr != null)
             {
                 this.myapp.upapp.filesr.Close();
                 this.myapp.upapp.filesr.Dispose();
                 this.myapp.upapp.filesr = null;
             }
         }
         if (this.merrya != null)
         {
             Commake.Comstrbuf      = null;
             this.myapp.mymerry     = null;
             Hmi.Hexstrbuf          = null;
             this.myapp.systimerbuf = null;
             this.myapp.Mycanshus   = null;
             Marshal.FreeHGlobal((IntPtr)this.merrya);
             Commake.Comstrbuf      = null;
             this.myapp.mymerry     = null;
             Hmi.Hexstrbuf          = null;
             this.myapp.systimerbuf = null;
             this.myapp.Mycanshus   = null;
             this.merrya            = null;
         }
         this.Myapp = null;
         this.myapp.upapp.images = null;
     }
     catch (Exception exception)
     {
         MessageOpen.Show(exception.Message);
     }
 }
Ejemplo n.º 3
0
 private bool findselectedit(objedit objedit1)
 {
     foreach (objedit objedit in this.selectobjedits)
     {
         if (objedit == objedit1)
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 4
0
 public void setxuanzhong_del(objedit objedit1)
 {
     foreach (objedit objedit in this.selectobjedits)
     {
         if (objedit == objedit1)
         {
             objedit.Setxuanzhong(0);
             this.selectobjedits.Remove(objedit);
             this.findjizhun();
             break;
         }
     }
 }
Ejemplo n.º 5
0
        private void T_objXYchang(object sender, EventArgs e)
        {
            objedit objedit = (objedit)sender;

            if (this.ObjXYchang != null)
            {
                this.ObjXYchang(null, null);
            }
            if (objedit != null)
            {
                objedit.Focus();
            }
        }
Ejemplo n.º 6
0
        private void LoadpanelObj___(mobj obj)
        {
            objedit objedit = new objedit();

            try
            {
                objedit.dobj     = obj;
                objedit.Location = new Point(5, 3);
                if (this.tobjs.Count > 0)
                {
                    Point panelLocation = this.tobjs[this.tobjs.Count - 1].GetPanelLocation();
                    panelLocation.X += 40;
                    objedit.Location = panelLocation;
                }
                objedit.Width                 = 0x23;
                objedit.Height                = 0x23;
                objedit.IsMove                = false;
                objedit.BackColor             = (obj.atts[0].zhi[0] == objtype.page) ? Color.FromArgb(0, 0x48, 0x95, 0xfd) : Color.FromArgb(50, 0x48, 0x95, 0xfd);
                objedit.ObjMousedown         += new EventHandler(this.T_objMousedown);
                objedit.ObjXYchang           += new EventHandler(this.T_objXYchang);
                objedit.ObjKeyDown           += new EventHandler(this.T_objKeyDown);
                objedit.Myapp                 = this.Myapp;
                objedit.runscr1               = this;
                objedit.BackgroundImageLayout = ImageLayout.None;
                this.objpanel.Controls.Add(objedit);
                objedit.Chonghuibmp();
                objedit.BringToFront();
                objedit.Visible = true;
                this.allobjedits.Add(objedit);
                if (!this.objpanel.Visible)
                {
                    if (this.objpanel.Height != 60)
                    {
                        this.objpanel.Height = 60;
                    }
                    this.objpanel.Visible = true;
                    if (this.Objpanelresize != null)
                    {
                        this.Objpanelresize(null, null);
                    }
                }
                this.tobjs.Add(objedit);
            }
            catch (Exception exception)
            {
                MessageOpen.Show("加载控件出现错误 ".Language() + exception.Message);
            }
        }
Ejemplo n.º 7
0
        public void T_objMousedown(object sender, EventArgs e)
        {
            objedit objedit = (objedit)sender;
            bool    flag    = false;
            bool    flag2   = true;

            if (objedit != null)
            {
                this.setxuanzhong_del(0);
                if (Control.ModifierKeys != Keys.Control)
                {
                    if (!this.findselectedit(objedit))
                    {
                        this.setxuanzhong_all(false);
                        this.setxuanzhong_add(objedit);
                    }
                    else if (objedit.Isxuanzhong != 2)
                    {
                        this.findjizhun(objedit);
                        flag2 = false;
                    }
                }
                else
                {
                    foreach (objedit objedit2 in this.selectobjedits)
                    {
                        if (objedit2 == objedit)
                        {
                            flag = true;
                            this.setxuanzhong_del(objedit2);
                            break;
                        }
                    }
                    if (!flag)
                    {
                        this.setxuanzhong_add(objedit);
                    }
                }
                this.findjizhun();
                if (flag2 && (this.Objselect != null))
                {
                    this.Objselect(null, null);
                }
                objedit.Focus();
            }
        }
Ejemplo n.º 8
0
 private void findjizhun(objedit objedit1)
 {
     foreach (objedit objedit in this.selectobjedits)
     {
         if (objedit.IsMove && (objedit == objedit1))
         {
             if (objedit.Isxuanzhong != 2)
             {
                 objedit.Setxuanzhong(2);
             }
         }
         else if (objedit.Isxuanzhong != 1)
         {
             objedit.Setxuanzhong(1);
         }
     }
 }
Ejemplo n.º 9
0
        private void LoadObj___(mobj obj)
        {
            objedit objedit = new objedit();

            try
            {
                objedit.dobj     = obj;
                objedit.Location = new Point(objedit.dobj.myobj.redian.x, objedit.dobj.myobj.redian.y);
                objedit.Width    = (objedit.dobj.myobj.redian.endx - objedit.dobj.myobj.redian.x) + 1;
                objedit.Height   = (objedit.dobj.myobj.redian.endy - objedit.dobj.myobj.redian.y) + 1;
                objedit.IsMove   = obj.atts[0].zhi[0] != objtype.page;
                if (objedit.Width < 3)
                {
                    objedit.Width = 3;
                }
                if (base.Height < 3)
                {
                    objedit.Height = 3;
                }
                objedit.BackColor     = (obj.atts[0].zhi[0] == objtype.page) ? Color.FromArgb(0, 0x48, 0x95, 0xfd) : Color.FromArgb(50, 0x48, 0x95, 0xfd);
                objedit.ObjMousedown += new EventHandler(this.T_objMousedown);
                objedit.ObjXYchang   += new EventHandler(this.T_objXYchang);
                objedit.ObjKeyDown   += new EventHandler(this.T_objKeyDown);
                objedit.Dragobj      += new EventHandler(this.T_dragobj);
                objedit.Moveobj      += new EventHandler(this.T_moveobj);
                objedit.Myapp         = this.Myapp;
                objedit.runscr1       = this;
                objedit.Visible       = true;
                base.Controls.Add(objedit);
                objedit.BringToFront();
                objedit.Chonghuibmp();
                this.allobjedits.Add(objedit);
            }
            catch (Exception exception)
            {
                MessageOpen.Show("加载控件出现错误 ".Language() + exception.Message);
            }
        }
Ejemplo n.º 10
0
 private void movexy(objedit ed, ref int cc, ref int cy, int mod)
 {
     if (ed.IsMove)
     {
         if (ed.obj_posX + cc + ed.Width >= (int)this.Myapp.lcdwidth)
         {
             cc = (int)this.Myapp.lcdwidth - ed.obj_posX - ed.Width;
         }
         if (ed.obj_posY + cy + ed.Height >= (int)this.Myapp.lcdheight)
         {
             cy = (int)this.Myapp.lcdheight - ed.obj_posY - ed.Height;
         }
         if (ed.obj_posX + cc < 0)
         {
             cc = -ed.obj_posX;
         }
         if (ed.obj_posY + cy < 0)
         {
             cy = -ed.obj_posY;
         }
         if (mod == 1)
         {
             ed.Location = new Point(ed.obj_posX + cc, ed.obj_posY + cy);
             if (cc != 0 || cy != 0)
             {
                 ed.Isgaibian = true;
                 if (ed.Isxuanzhong == 2)
                 {
                     if (this.Dragobj != null)
                     {
                         this.Dragobj(ed.Location, null);
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 11
0
 public void setxuanzhong_add(objedit ed)
 {
     this.selectobjedits.Add(ed);
     ed.Setxuanzhong(1);
     this.findjizhun();
 }