Esempio n. 1
0
        public override bool isEqual(DiagramEntity key)
        {
            if (!(key is DiagramKeySlideV))
            {
                return(false);
            }
            if (!base.isEqual(key))
            {
                return(false);
            }
            DiagramKeySlideV k = (DiagramKeySlideV)key;

            if (!this.SlideDown.GetKeyCodeString().Equals(k.SlideDown.GetKeyCodeString()))
            {
                return(false);
            }
            if (!this.SlideDownHold.GetKeyCodeString().Equals(k.SlideDownHold.GetKeyCodeString()))
            {
                return(false);
            }
            if (!this.SlideUpHold.GetKeyCodeString().Equals(k.SlideUpHold.GetKeyCodeString()))
            {
                return(false);
            }
            if (!this.SlideUp.GetKeyCodeString().Equals(k.SlideUp.GetKeyCodeString()))
            {
                return(false);
            }
            return(true);
        }
Esempio n. 2
0
        public override DiagramEntity Clone()
        {
            DiagramKeySlideV obj = new DiagramKeySlideV();

            obj.Copy(this);
            return(obj);
        }
Esempio n. 3
0
        private DiagramKeySlideV parse_csv_key_slidev_removed(string strCSV0, string strCSV1, string strCSV2, string strCSV3)
        {
            DiagramKeySlideV key = new DiagramKeySlideV();

            if (!key.FromCSV(strCSV0, strCSV1, strCSV2, strCSV3))
            {
                return(null);
            }
            key.Title = CreateUniqueName(key.TypeName);

            return(key);
        }
Esempio n. 4
0
        private object findSameItem(object obj, List <object> items)
        {
            if (obj is DiagramKeyArea)
            {
                DiagramKeyArea c = (DiagramKeyArea)obj;
                for (int i = 0; i < items.Count; i++)
                {
                    if (!(items[i] is DiagramKeyArea))
                    {
                        continue;
                    }
                    DiagramKeyArea d = (DiagramKeyArea)items[i];
                    if (c.isEqual(d))
                    {
                        return(d);
                    }
                }
            }
            else if (obj is DiagramKeySlideH)
            {
                DiagramKeySlideH c = (DiagramKeySlideH)obj;
                for (int i = 0; i < items.Count; i++)
                {
                    if (!(items[i] is DiagramKeySlideH))
                    {
                        continue;
                    }
                    DiagramKeySlideH d = (DiagramKeySlideH)items[i];
                    if (c.isEqual(d))
                    {
                        return(d);
                    }
                }
            }
            else if (obj is DiagramKeySlideV)
            {
                DiagramKeySlideV c = (DiagramKeySlideV)obj;
                for (int i = 0; i < items.Count; i++)
                {
                    if (!(items[i] is DiagramKeySlideV))
                    {
                        continue;
                    }
                    DiagramKeySlideV d = (DiagramKeySlideV)items[i];
                    if (c.isEqual(d))
                    {
                        return(d);
                    }
                }
            }

            return(null);
        }
Esempio n. 5
0
        public override void Copy(DiagramEntity obj)
        {
            base.Copy(obj);
            DiagramKeySlideV k = (DiagramKeySlideV)obj;
            bool             b = k.ContentModified;

            this.SlideUp         = k.SlideUp;
            this.SlideUpHold     = k.SlideUpHold;
            this.SlideDown       = k.SlideDown;
            this.SlideDownHold   = k.SlideDownHold;
            this.ContentModified = b;
        }
Esempio n. 6
0
        private void show_slidev_key(DiagramKeySlideV key)
        {
            //show codes
            grdList.Rows.Clear();
            grdList.Rows.Add(4);

            grdList.Rows[0].Cells[0].Value = "Up";
            grdList.Rows[0].Cells[1].Value = key.SlideUp.ToString();


            grdList.Rows[1].Cells[0].Value = "Up Hold";
            grdList.Rows[1].Cells[1].Value = key.SlideUpHold.ToString();

            grdList.Rows[2].Cells[0].Value = "Down";
            grdList.Rows[2].Cells[1].Value = key.SlideDown.ToString();

            grdList.Rows[3].Cells[0].Value = "Down Hold";
            grdList.Rows[3].Cells[1].Value = key.SlideDownHold.ToString();
        }
Esempio n. 7
0
        private void save_slidev_key(DiagramKeySlideV key)
        {
            //up
            string s = grdList.Rows[0].Cells[1].Value.ToString();

            key.SlideUp.SetKeyCodeString(s);


            //Up Hold;
            s = grdList.Rows[1].Cells[1].Value.ToString();
            key.SlideUpHold.SetKeyCodeString(s);

            //Down";
            s = grdList.Rows[2].Cells[1].Value.ToString();
            key.SlideDown.SetKeyCodeString(s);

            // "Down Hold";
            s = grdList.Rows[3].Cells[1].Value.ToString();
            key.SlideDownHold.SetKeyCodeString(s);
        }
Esempio n. 8
0
        /************************************************************************/

        /*
         * check key code error
         */
        /************************************************************************/
        public DiagramKey ErrorKeyUp()
        {
            int           ncount  = m_objs.GetSize();
            KB9Validation checker = new KB9Validation();

            for (int i = 0; i < ncount; i++)
            {
                DiagramEntity entity = m_objs.GetAt(i);
                if (entity.TypeName == DiagramKey.KEY_BUTTON)
                {
                    DiagramKeyArea key  = (DiagramKeyArea)entity;
                    string         code = key.KeyCode.GetKeyCodeString();
                    if (checker.ValidateKB9Keycodes(code) != KB9Validation.ERR_VALIDATION.OK)
                    {
                        return(key);
                    }
                }
                else if (entity.TypeName == DiagramKey.KEY_SLIDEH)
                {
                    DiagramKeySlideH key = (DiagramKeySlideH)entity;

                    string slideLeft = key.SlideLeft.GetKeyCodeString();
                    if (checker.ValidateKB9Keycodes(slideLeft) != KB9Validation.ERR_VALIDATION.OK)
                    {
                        return(key);
                    }
                    string slideLeftHold = key.SlideLeftHold.GetKeyCodeString();
                    if (checker.ValidateKB9Keycodes(slideLeftHold) != KB9Validation.ERR_VALIDATION.OK)
                    {
                        return(key);
                    }
                    string slideRight = key.SlideRight.GetKeyCodeString();
                    if (checker.ValidateKB9Keycodes(slideRight) != KB9Validation.ERR_VALIDATION.OK)
                    {
                        return(key);
                    }
                    string slideRightHold = key.SlideRightHold.GetKeyCodeString();
                    if (checker.ValidateKB9Keycodes(slideRightHold) != KB9Validation.ERR_VALIDATION.OK)
                    {
                        return(key);
                    }
                }
                else if (entity.TypeName == DiagramKey.KEY_SLIDEV)
                {
                    DiagramKeySlideV key = (DiagramKeySlideV)entity;

                    string slideUp = key.SlideUp.GetKeyCodeString();
                    if (checker.ValidateKB9Keycodes(slideUp) != KB9Validation.ERR_VALIDATION.OK)
                    {
                        return(key);
                    }
                    string slideUpHold = key.SlideUpHold.GetKeyCodeString();
                    if (checker.ValidateKB9Keycodes(slideUpHold) != KB9Validation.ERR_VALIDATION.OK)
                    {
                        return(key);
                    }
                    string slideDown = key.SlideDown.GetKeyCodeString();
                    if (checker.ValidateKB9Keycodes(slideDown) != KB9Validation.ERR_VALIDATION.OK)
                    {
                        return(key);
                    }
                    string slideDownHold = key.SlideDownHold.GetKeyCodeString();
                    if (checker.ValidateKB9Keycodes(slideDownHold) != KB9Validation.ERR_VALIDATION.OK)
                    {
                        return(key);
                    }
                }
            }
            return(null);
        }
Esempio n. 9
0
        /// <summary>
        /// Load data from xml file.
        /// </summary>
        /// <param name="xml"></param>
        /// <returns></returns>
        public override bool FromXml(CLCIXML xml)
        {
            //load my entity properites
            if (!base.FromXml(xml))
            {
                return(false);
            }
            //load sub entities
            string s = "";

            xml.get_attribute("rows", ref s);
            this.Rows = Util.string2int(s, 0);

            xml.get_attribute("rowspacing", ref s);
            this.RowSpacing = Util.string2int(s, 0);

            xml.get_attribute("cols", ref s);
            this.Cols = Util.string2int(s, 0);

            xml.get_attribute("colspacing", ref s);
            this.ColSpacing = Util.string2int(s, 0);


            xml.get_attribute("count", ref s);
            int ncount = Util.string2int(s, 0);

            this.Entities.Clear();
            for (int i = 0; i < ncount; i++)
            {
                s = "k" + i.ToString();
                if (!xml.get_first_group(s))
                {
                    continue;
                }
                s = "";
                xml.get_attribute("keytype", ref s);
                DiagramEntity k = null;
                switch (s)
                {
                case DiagramKey.KEY_BUTTON:    // "BUTTON":
                {
                    k = new DiagramKeyArea();
                    k.FromXml(xml);
                }
                break;

                case DiagramKey.KEY_SLIDEV:
                {
                    k = new DiagramKeySlideV();
                    k.FromXml(xml);
                }
                break;

                case DiagramKey.KEY_SLIDEH:
                {
                    k = new DiagramKeySlideH();
                    k.FromXml(xml);
                }
                break;

                default:
                    continue;
                }

                xml.back_to_parent();
                k.OnEntityPropertiesChanged      += new EventEntityPropertiesChanged(OnSubEntityPropertiesChanged);
                k.OnEntityPropertiesBeforeChange += new DiagramEntity.EventEntityPropertiesBeforeChange(OnSubEntityPropertiesWillChange);
                this.Entities.Add(k);
            }


            return(true);
        }