예제 #1
0
파일: main.cs 프로젝트: x893/NextionEditor
        /// <summary>
        /// 
        /// </summary>
        /// <param name="delete_all">1 = all components, 0 = current conponent</param>
        private void deleteObj(int delete_all)
        {
            bool flag = false;
            if (m_page == null)
            {
                MessageBox.Show("Please select page".Translate());
                return;
            }
            if (delete_all == 1)
            {
                m_page.DeleteAllObj();
                refreshPage();
            }
            else if (delete_all != 2)
            {
                if (m_obj == null)
                {
                    MessageBox.Show("Please select component".Translate());
                    return;
                }

                if (m_obj.Attributes[0].Data[0] == HmiObjType.PAGE)
                {
                    MessageBox.Show("Please select component".Translate());
                    return;
                }
                m_obj.Page.delobj(m_obj);
                if (m_objEdit.HmiObject.Attributes[0].Data[0] == HmiObjType.TIMER
                 || m_objEdit.HmiObject.Attributes[0].Data[0] == HmiObjType.VAR
                    )
                    flag = true;
                m_objEdit.Dispose();
                runScreen.HmiObjectEdit.Dispose();
            }

            m_obj = null;
            m_objEdit = null;
            runScreen.HmiObjectEdit = null;
            m_compiler.RefreshObject(m_app, m_page, m_obj);
            m_attributeEdit.RefreshObject(m_app, m_page, m_obj);
            m_app.ChangeApplication(true);
            if (flag)
                refreshTimerVar();
        }
예제 #2
0
파일: main.cs 프로젝트: x893/NextionEditor
        private void runScreen_ObjMouseUp(object sender, EventArgs e)
        {
            List<byte[]> bts = new List<byte[]>();
            HmiObjectEdit objedit = (HmiObjectEdit)sender;
            if ((m_app != null) && (m_page != null))
            {
                if (objedit != null)
                {
                    m_objEdit = objedit;
                    m_obj = m_objEdit.HmiObject;
                    textBox3.Text = Utility.ToStrings(m_obj.GetCodes());
                    m_obj.CompileCodes(bts);
                    textBox1.Text = Utility.ToStrings(bts);
                }
                else
                    m_obj = m_page.HmiObjects[0];

                m_compiler.RefreshObject(m_app, m_page, m_obj);
                m_attributeEdit.RefreshObject(m_app, m_page, m_obj);
                mi_Copy.Enabled = true;
            }
        }
예제 #3
0
파일: main.cs 프로젝트: x893/NextionEditor
        private void closeHMI()
        {
            m_app = null;
            m_page = null;

            m_compiler.RefreshObject(null, null, null);
            m_attributeEdit.RefreshObject(null, null, null);

            pageAdmin.SetAppInfo(m_app);
            fontAdmin.SetAppInfo(m_app);
            picAdmin.SetAppInfo(m_app);

            runScreen.RunStop();
            runScreen.Visible = false;

            m_obj = null;
            m_objEdit = null;

            m_binpath = "";

            mi_Save.Enabled = false;
            mi_Copy.Enabled = false;
            mi_Paste.Enabled = false;
            mi_DeleteComponent.Enabled = false;
            mi_Resolution.Enabled = false;
            mi_ID.Enabled = false;
            mi_XY.Enabled = false;
            mi_Compile.Enabled = false;

            mi_AddComponent.Enabled = false;

            if (m_app != null)
                m_app.ChangeApplication(false);

            refreshTimerVar();
        }
예제 #4
0
파일: main.cs 프로젝트: x893/NextionEditor
        private void refreshPage()
        {
            m_obj = null;
            if (runScreen.HmiObjectEdit != null)
            {
                runScreen.HmiObjectEdit.Dispose();
                runScreen.HmiObjectEdit = null;
            }
            if (m_page != null)
            {
                textBox2.Text = Utility.ToStrings(m_page.Codes);
                if (!runScreen.Visible)
                {
                    runScreen.GuiInit(HmiOptions.RunFilePath, m_app, true);
                    runScreen.Visible = true;
                }
                m_objEdit = null;
                listBox2.Items.Clear();
                for (int i = 0; i < m_page.HmiObjects.Count; i++)
                    listBox2.Items.Add(i.ToString());
            }

            runScreen.RefreshPageEdit(m_page);
            m_compiler.RefreshObject(m_app, m_page, m_obj);
            m_attributeEdit.RefreshObject(m_app, m_page, m_obj);
            mi_Copy.Enabled = false;

            refreshTimerVar();
        }
예제 #5
0
파일: main.cs 프로젝트: x893/NextionEditor
        private void panelView_MouseUp(object sender, MouseEventArgs e)
        {
            if (m_app != null)
            {
                if (m_objEdit != null)
                    m_objEdit.SetSelected(false);

                m_objEdit = null;
                m_obj = null;
                m_compiler.RefreshObject(m_app, m_page, m_obj);
                m_attributeEdit.RefreshObject(m_app, m_page, m_obj);
                mi_Copy.Enabled = false;
            }
        }
예제 #6
0
파일: main.cs 프로젝트: x893/NextionEditor
        private void loadObj(HmiObject obj)
        {
            HmiObjectEdit objEdit = new HmiObjectEdit();
            try
            {
                objEdit.HmiObject = obj;
                objEdit.Location = new Point(m_objXPos, 5);
                objEdit.Width = 40;
                objEdit.Height = 40;
                objEdit.IsMove = false;
                if (objEdit.Width < 3)
                    objEdit.Width = 3;

                if (base.Height < 3)
                    objEdit.Height = 3;

                objEdit.BackColor = (obj.Attributes[0].Data[0] == HmiObjType.PAGE)
                                        ? Color.FromArgb(0, 72, 149, 253)
                                        : Color.FromArgb(50, 72, 149, 253);
                objEdit.IsShowName = m_app.IsShowName;
                objEdit.HmiRunScreen = runScreen;
                objEdit.ObjMouseUp += new EventHandler(runScreen.T_objMouseUp);
                objEdit.ObjChange += new EventHandler(runScreen.T_ObjChange);
                objEdit.SetApp(m_app);
                objEdit.BackgroundImageLayout = ImageLayout.None;

                panel9.Controls.Add(objEdit);

                objEdit.MakeBackground();
                objEdit.BringToFront();
                objEdit.Visible = true;
                objEdit.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;

                if (m_objXPos == 0)
                    panel9.Visible = true;

                m_objXPos += 50;
                setControlsTop();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error occurred during loading components ".Translate() + ex.Message);
            }
        }