示例#1
0
        internal static void setDivAttribute(string SetName, string Page, string[] DivIDs, string Attribute, string Value)
        {
            for (int i = 0; i < DivIDs.Length; i++)
            {
                long          id = Convert.ToInt64(DivIDs[i]);
                DisplayObject o  = ClsDisplayControler.DisplayObject(id);

                if (Attribute == "textid")
                {
                    o.textid = Value;
                }

                if (Attribute == "bgid")
                {
                    o.bgid = Value;
                }

                if (Attribute == "tableid")
                {
                    o.tableid = Value;
                }

                if (Attribute == "Speed")
                {
                    o.Speed = Convert.ToInt64(Value);
                }

                if (Attribute == "innerText")
                {
                    o.innerText = Value;
                }

                if (Attribute == "TableStyle")
                {
                    o.TableStyle = Value;
                }

                ClsDisplayControler.SaveDisplayObject(o);

                SetDivInfo(o.ID);
            }
        }
示例#2
0
        private static void MoveDivUpDown(int SetID, int PageID, long DivID, DirectionType direction)
        {
            // get already sorted by z-index object List
            List <DisplayObject> divList = DivList(SetID, PageID);

            if (divList == null)
            {
                return;
            }

            // get object to move
            DisplayObject currentDiv = (from x in divList where x.ID == DivID select x).FirstOrDefault();

            if (currentDiv == null)
            {
                return;
            }

            // get index of object to move
            int ind = divList.IndexOf(currentDiv);

            // up
            if (direction == DirectionType.up)
            {
                if (ind == 0)
                {
                    // already at top
                    return;
                }

                DisplayObject aboveDiv = divList[ind - 1];
                long          zNeu     = aboveDiv.Zindex;

                // z in dem darüber liegenden ándern
                using (ClsStyleGenerator sg = new ClsStyleGenerator())
                {
                    sg.ParseStyleStringJson(aboveDiv.style);
                    sg.SetStyle("z-index", currentDiv.Zindex.ToString());
                    aboveDiv.style = sg.GetStyleStringJson();
                }

                aboveDiv.Zindex = currentDiv.Zindex;
                ClsDisplayControler.SaveDisplayObject(aboveDiv);

                // z in dem gewáhlten ándern
                using (ClsStyleGenerator sg = new ClsStyleGenerator())
                {
                    sg.ParseStyleStringJson(currentDiv.style);
                    sg.SetStyle("z-index", zNeu.ToString());
                    currentDiv.style = sg.GetStyleStringJson();
                }

                currentDiv.Zindex = zNeu;
                ClsDisplayControler.SaveDisplayObject(currentDiv);
            }

            // down
            if (direction == DirectionType.down)
            {
                if (ind == divList.Count - 1)
                {
                    // already at bottom
                    return;
                }

                DisplayObject belowDiv = divList[ind + 1];
                long          zNeu     = belowDiv.Zindex;

                // z in dem darunter liegenden ándern
                using (ClsStyleGenerator sg = new ClsStyleGenerator())
                {
                    sg.ParseStyleStringJson(belowDiv.style);
                    sg.SetStyle("z-index", currentDiv.Zindex.ToString());
                    belowDiv.style = sg.GetStyleStringJson();
                }

                belowDiv.Zindex = currentDiv.Zindex;
                ClsDisplayControler.SaveDisplayObject(belowDiv);

                // z in dem gewáhlten ándern
                using (ClsStyleGenerator sg = new ClsStyleGenerator())
                {
                    sg.ParseStyleStringJson(currentDiv.style);
                    sg.SetStyle("z-index", zNeu.ToString());
                    currentDiv.style = sg.GetStyleStringJson();
                }

                currentDiv.Zindex = zNeu;
                ClsDisplayControler.SaveDisplayObject(currentDiv);
            }
        }