Beispiel #1
0
        /// <summary>
        /// returns a z-index Descending list of Displayobjects
        /// </summary>
        /// <param name="SetName"></param>
        /// <param name="Page"></param>
        /// <param name="MarkierIDs"></param>
        /// <returns></returns>
        public static List <DisplayObject> DivList(int SetID, int PageID, string[] MarkierIDs = null)
        {
            try
            {
                if (SetID == 0)
                {
                    return(new List <DisplayObject>());
                }

                List <DisplayPageSet> dpsl = ClsDisplayControler.DisplayPageSets();
                DisplayPageSet        dps  = (from x in dpsl where x.ID == SetID select x).FirstOrDefault();

                List <DisplayPage> dpl = ClsDisplayControler.DisplayPagesForPageSet(dps.ID);
                DisplayPage        dp  = (from x in dpl where x.ID == PageID select x).FirstOrDefault();

                if (dp != null)
                {
                    List <DisplayObject> ol = ClsDisplayControler.DisplayObjectsForPage(dp.ID).OrderByDescending(x => x.Zindex).ToList();
                    return(ol);
                }
                else
                {
                    return(new List <DisplayObject>());
                }
            }
            catch (Exception ex)
            {
                ClsError.Error(Name, MethodBase.GetCurrentMethod().ToString(), ex);
                return(new List <DisplayObject>());
            }
        }
Beispiel #2
0
        /// <summary>
        /// delets all objects, pages and the page set itself
        /// </summary>
        /// <param name="Name">name of the page set</param>
        public static void DeletePageSet(int PageSetID)
        {
            List <DisplayPageSet> l   = ClsDisplayControler.DisplayPageSets();
            DisplayPageSet        dps = (from x in l where x.ID == PageSetID select x).FirstOrDefault();

            ClsDisplayControler.DelDisplayPageSet(dps.ID);
        }
Beispiel #3
0
        public static void MoveDivs(int SetID, int PageID, string[] DivIDs, DirectionType Direction)
        {
            if (DivIDs.Length == 0)
            {
                return;
            }

            // list all objects and sort it by zindex
            List <DisplayObject> moveDivs = new List <DisplayObject>();

            for (int i = 0; i < DivIDs.Length; i++)
            {
                long          id    = Convert.ToInt64(DivIDs[i]);
                DisplayObject tempo = ClsDisplayControler.DisplayObject(id);
                moveDivs.Add(tempo);
            }

            if (Direction == DirectionType.up)
            {
                // bewegung muss mit oberstem gewählten Objekt starten
                moveDivs.Sort((a, b) => b.Zindex.CompareTo(a.Zindex));
            }
            else
            {
                // bewegung muss mit unterstem gewählten Objekt starten
                moveDivs.Sort((a, b) => a.Zindex.CompareTo(b.Zindex));
            }

            // loop over all moveDivs
            for (int i = 0; i < moveDivs.Count(); i++)
            {
                MoveDivUpDown(SetID, PageID, moveDivs[i].ID, Direction);
            }
        }
Beispiel #4
0
        private static void SetDivInfo(long divid)
        {
            DisplayObject o = ClsDisplayControler.DisplayObject(divid);

            // Inhalts Info Text setzten
            o.Info = "leer";

            if (!string.IsNullOrEmpty(o.innerText))
            {
                o.Info = o.innerText;
                if (o.innerText.Length > 10)
                {
                    o.Info = o.innerText.Substring(0, 10) + "...";
                }
            }

            if (o.bgid != "B00")
            {
                o.Info = ClsDBVariablen.Instance.GetBildVariable(o.bgid).Variable;
            }

            if (o.textid != "S00")
            {
                o.Info = ClsDBVariablen.Instance.GetTextVariable(o.textid).Variable;
            }

            if (o.tableid != "T00")
            {
                o.Info = ClsDBVariablen.Instance.GetTabellenVariable(o.tableid).Variable;
            }

            ClsDisplayControler.SaveDisplayObject(o);
        }
Beispiel #5
0
        /// <summary>
        /// Setzt einen StyleValue fúr ein oder mehrere Divs
        /// </summary>
        /// <param name="PageSetID"></param>
        /// <param name="PageID"></param>
        /// <param name="DivIDs">Komma seperierte Liste von DivIDs</param>
        /// <param name="StyleAttribute"></param>
        /// <param name="StyleValue"></param>
        public static void SetStyleValue(string[] DivIDs, string StyleAttribute, string StyleValue)
        {
            for (int i = 0; i < DivIDs.Length; i++)
            {
                if (DivIDs[i] == "")
                {
                    continue;
                }

                long id = Convert.ToInt64(DivIDs[i]);

                DisplayObject o = ClsDisplayControler.DisplayObject(id);

                using (ClsStyleGenerator sg = new ClsStyleGenerator())
                {
                    sg.ParseStyleStringJson(o.style);
                    sg.SetStyle(StyleAttribute, StyleValue);
                    // o.style = sg.GetStyleString();
                    o.style = sg.GetStyleStringJson();
                }

                ClsDisplayControler.SaveDisplayObject(o);
            }

            //ActivateDiv(SetName, Page, DivIDs[0]);
        }
Beispiel #6
0
        public static void RenamePageSet(int PageSetID, string newName)
        {
            List <DisplayPageSet> l   = ClsDisplayControler.DisplayPageSets();
            DisplayPageSet        dps = (from x in l where x.ID == PageSetID select x).FirstOrDefault();

            dps.PageSetName = newName;
            ClsDisplayControler.SaveDisplayPageSet(dps);
        }
Beispiel #7
0
 public static void DelDiv(string[] DivIDs)
 {
     for (int i = 0; i < DivIDs.Length; i++)
     {
         long          id = Convert.ToInt64(DivIDs[i]);
         DisplayObject o  = ClsDisplayControler.DisplayObject(id);
         ClsDisplayControler.DelDisplayObject(o.ID);
     }
 }
Beispiel #8
0
        internal static void SetStyleString(string[] div, string value1)
        {
            long          id = Convert.ToInt64(div[0]);
            DisplayObject o  = ClsDisplayControler.DisplayObject(id);

            o.style = value1;

            ClsDisplayControler.SaveDisplayObject(o);
        }
        /// <summary>
        /// Returns a List of the Page Objects.
        /// </summary>
        /// <param name="SetName"></param>
        /// <returns></returns>
        public static List <DisplayPage> PageList(int SetID)
        {
            List <DisplayPageSet> l   = ClsDisplayControler.DisplayPageSets();
            DisplayPageSet        dps = (from x in l where x.ID == SetID select x).FirstOrDefault();

            List <DisplayPage> pl = ClsDisplayControler.DisplayPagesForPageSet(dps.ID).OrderBy(x => x.Sort).ToList();

            // return Pagelist
            return(pl);
        }
Beispiel #10
0
        public static string GetPageNameFromID(int PageID)
        {
            DisplayPage dp = ClsDisplayControler.DisplayPage(PageID);

            if (dp == null)
            {
                return("");
            }

            return(dp.PageName);
        }
Beispiel #11
0
        public static void CopyPageSet(int sourceID, string newName)
        {
            // pageset
            int id = NewPageSet(newName, false);

            // page
            List <DisplayPage> dpl = ClsDisplayControler.DisplayPagesForPageSet(sourceID);

            for (int i = 0; i < dpl.Count; i++)
            {
                ClsPages.CopyPage(sourceID, id, dpl[i].PageName, dpl[i].PageName);
            }
        }
Beispiel #12
0
        ///// <summary>
        ///// Returns the highest meta tag sort.
        ///// </summary>
        ///// <param name="SetName"></param>
        ///// <returns></returns>
        //public static string GetMaxPageSort(string SetName)
        //{
        //	List<DisplayPage> pl = PageObjectList(SetName);

        //	string ret = "0";
        //	int s0 = Convert.ToInt32(pl[0].Sort);
        //	for (int i = 0; i < pl.Count; i++)
        //	{
        //		int s1 = Convert.ToInt32(pl[i].Sort);
        //		if (s1 > s0)
        //		{
        //			ret = s1.ToString();
        //			s0 = s1;
        //		}
        //	}

        //	return ret;
        //}

        /// <summary>
        /// Returns a sorted StringArray of the Page Names.
        /// </summary>
        /// <param name="SetName"></param>
        /// <returns></returns>
        public static string[] PageNameList(string SetName)
        {
            List <DisplayPageSet> l   = ClsDisplayControler.DisplayPageSets();
            DisplayPageSet        dps = (from x in l where x.PageSetName == SetName select x).FirstOrDefault();

            List <DisplayPage> pl = ClsDisplayControler.DisplayPagesForPageSet(dps.ID).OrderBy(x => x.Sort).ToList();

            // create name array
            string[] fl = (from x in pl select x.PageName).ToArray();

            // return Pagelist
            return(fl);
        }
Beispiel #13
0
        /// <summary>
        /// Setzt den Inhalt fúr ein oder mehrere Divs
        /// </summary>
        /// <param name="SetName"></param>
        /// <param name="Page"></param>
        /// <param name="DivIDs"></param>
        /// <param name="Wert"></param>
        public static void SetInnerHTML(string[] DivIDs, string Wert)
        {
            for (int i = 0; i < DivIDs.Length; i++)
            {
                long          id = Convert.ToInt64(DivIDs[i]);
                DisplayObject o  = ClsDisplayControler.DisplayObject(id);

                o.innerText = Wert;

                ClsDisplayControler.SaveDisplayObject(o);

                SetDivInfo(o.ID);
            }
        }
Beispiel #14
0
        /// <summary>
        /// Copy Page within a PageSet.
        /// </summary>
        /// <param name="PageSetID"></param>
        /// <param name="PageID"></param>
        /// <param name="newName"></param>
        public static void CopyPage(int PageSetID, int PageID, string newName)
        {
            List <DisplayPageSet> l   = ClsDisplayControler.DisplayPageSets();
            DisplayPageSet        dps = (from x in l where x.ID == PageSetID select x).FirstOrDefault();
            DisplayPage           dp  = (from x in ClsDisplayControler.DisplayPagesForPageSet(dps.ID) where x.ID == PageID select x).FirstOrDefault();

            long dpid = NewPage(PageSetID, newName, dp.Style, dp.MarkColor, dp.Grid);

            // copy objects
            List <DisplayObject> ol = ClsDisplayControler.DisplayObjectsForPage(dp.ID);

            for (int i = 0; i < ol.Count; i++)
            {
                ClsDivs.NewDiv(dps.ID, dpid, ol[i].textid, ol[i].bgid, ol[i].tableid, ol[i].style, ol[i].innerText, ol[i].Speed, ol[i].TableStyle);
            }
        }
Beispiel #15
0
        /// <summary>
        /// Copy Page cross PageSet.
        /// </summary>
        /// <param name="SetName"></param>
        /// <param name="oldName"></param>
        /// <param name="newName"></param>
        public static void CopyPage(int SourcePageSetID, int TargetPageSetID, string oldPageName, string newPageName)
        {
            List <DisplayPageSet> dpsl = ClsDisplayControler.DisplayPageSets();

            DisplayPage sdp = (from x in ClsDisplayControler.DisplayPagesForPageSet(SourcePageSetID) where x.PageName == oldPageName select x).FirstOrDefault();

            long dpid = NewPage(TargetPageSetID, newPageName, sdp.Style, sdp.MarkColor, sdp.Grid);

            // copy objects
            List <DisplayObject> ol = ClsDisplayControler.DisplayObjectsForPage(sdp.ID);

            for (int i = 0; i < ol.Count; i++)
            {
                ClsDivs.NewDiv(TargetPageSetID, dpid, ol[i].textid, ol[i].bgid, ol[i].tableid, ol[i].style, ol[i].innerText, ol[i].Speed, ol[i].TableStyle);
            }
        }
Beispiel #16
0
        /// <summary>
        /// Set Style property of Page.
        /// </summary>
        /// <param name="SetName"></param>
        /// <param name="Page"></param>
        /// <param name="StyleProperty"></param>
        /// <param name="StyleWert"></param>
        public static void SetStyleWert(int PageSetID, int PageID, string StyleProperty, string StyleWert)
        {
            List <DisplayPageSet> l   = ClsDisplayControler.DisplayPageSets();
            DisplayPageSet        dps = (from x in l where x.ID == PageSetID select x).FirstOrDefault();
            DisplayPage           dp  = (from x in ClsDisplayControler.DisplayPagesForPageSet(dps.ID) where x.ID == PageID select x).FirstOrDefault();


            using (ClsStyleGenerator sg = new ClsStyleGenerator())
            {
                sg.ParseStyleStringJson(dp.Style);
                sg.SetStyle(StyleProperty, StyleWert);
                dp.Style = sg.GetStyleStringJson();
            }

            ClsDisplayControler.SaveDisplayPage(dp);
        }
Beispiel #17
0
        /// <summary>		  --------------------------------
        /// Saves the style property of mark Div.
        /// </summary>
        /// <param name="SetName"></param>
        /// <param name="Page"></param>
        /// <param name="StyleProperty"></param>
        /// <param name="StyleWert"></param>
        public static void SetMarkStyleWert(int PageSetID, int PageID, string StyleProperty, string StyleWert)
        {
            DisplayPage dp = (from x in ClsDisplayControler.DisplayPagesForPageSet(PageSetID) where x.ID == PageID select x).FirstOrDefault();

            if (StyleProperty == "border-color")
            {
                dp.MarkColor = StyleWert;
            }

            if (StyleProperty == "Grid")
            {
                dp.Grid = Convert.ToInt64(StyleWert);
            }

            ClsDisplayControler.SaveDisplayPage(dp);
        }
Beispiel #18
0
        public static void CopyDiv(string DivID)
        {
            long          id = Convert.ToInt64(DivID);
            DisplayObject o  = ClsDisplayControler.DisplayObject(id);

            NewDiv(
                o.PageSetNo,
                o.PageNo,
                o.textid,
                o.bgid,
                o.tableid,
                o.style,
                o.innerText,
                o.Speed
                );
        }
Beispiel #19
0
        public static int NewPageSet(string newName, bool firstPage = true)
        {
            long           s   = (from x in ClsDisplayControler.DisplayPageSets() select x.Sort).Max();
            DisplayPageSet dps = new DisplayPageSet();

            dps.PageSetName = newName;
            dps.Sort        = s + 1;
            long id = ClsDisplayControler.AddDisplayPageSet(dps);

            // add first Page
            if (firstPage)
            {
                ClsPages.NewPage((int)id, "Spiel");
            }

            return((int)id);
        }
Beispiel #20
0
        /// <summary>
        /// Creates new Page.
        /// </summary>
        /// <param name="SetName"></param>
        /// <param name="newName"></param>
        public static long NewPage(int PageSetID, string newName, string Style = "", string MarkColor = "rgba(208, 2, 27, 1)", long Grid = 20)
        {
            if (Style == "")
            {
                using (ClsStyleGenerator sg = new ClsStyleGenerator())
                {
                    sg.SetStyle("margin", "0px");
                    sg.SetStyle("width", "100vw");
                    sg.SetStyle("height", "100vh");
                    sg.SetStyle("background-color", "rgba(0, 0, 0, 1)");
                    sg.SetStyle("background-repeat", "no-repeat");
                    sg.SetStyle("background-position", "center");
                    sg.SetStyle("background-image", "");
                    sg.SetStyle("background-size", "contain");

                    Style = sg.GetStyleStringJson();
                }
            }

            // get max page sort
            List <DisplayPageSet> l   = ClsDisplayControler.DisplayPageSets();
            List <DisplayPage>    dpl = ClsDisplayControler.DisplayPagesForPageSet(PageSetID);
            long max = 0;

            if (dpl.Count > 0)
            {
                max = (from x in dpl select x.Sort).Max();
            }
            long newmax = max + 1;

            DisplayPage dp = new DisplayPage();

            dp.PageSetNo = PageSetID;
            dp.PageName  = newName;
            dp.Style     = Style;
            dp.Sort      = newmax;
            dp.MarkColor = MarkColor;
            dp.Grid      = Grid;

            ClsDisplayControler.AddDisplayPage(dp);

            dpl = ClsDisplayControler.DisplayPagesForPageSet(PageSetID);
            long dpid = (from x in dpl where x.PageName == newName select x.ID).FirstOrDefault();

            return(dpid);
        }
Beispiel #21
0
        /// <summary>
        /// Returns a Style Value of the Page.
        /// </summary>
        /// <param name="SetName"></param>
        /// <param name="Page"></param>
        /// /// <param name="StyleProperty"></param>
        /// <returns></returns>
        public static string GetStyleValue(string SetName, string Page, string StyleProperty)
        {
            List <DisplayPageSet> l   = ClsDisplayControler.DisplayPageSets();
            DisplayPageSet        dps = (from x in l where x.PageSetName == SetName select x).FirstOrDefault();

            List <DisplayPage> pl = ClsDisplayControler.DisplayPagesForPageSet(dps.ID);
            DisplayPage        dp = (from x in pl where x.PageName == Page select x).FirstOrDefault();

            string ret = "";

            using (ClsStyleGenerator sg = new ClsStyleGenerator())
            {
                sg.ParseStyleString(dp.Style);
                ret = sg.GetStyle(StyleProperty);
            }

            return(ret);
        }
Beispiel #22
0
        /// <summary>
        /// Returns a un-sorted classlist of the Pages.
        /// </summary>
        /// <param name="SetName"></param>
        /// <returns></returns>
        public static List <DisplayPage> PageObjectList(int PageSetID)
        {
            try
            {
                List <DisplayPageSet> l   = ClsDisplayControler.DisplayPageSets();
                DisplayPageSet        dps = (from x in l where x.ID == PageSetID select x).FirstOrDefault();

                List <DisplayPage> pl = ClsDisplayControler.DisplayPagesForPageSet(dps.ID);


                return(pl);
            }
            catch (Exception ex)
            {
                ClsError.Error(Name, MethodBase.GetCurrentMethod().ToString(), ex);
                return(new List <DisplayPage>());
            }
        }
Beispiel #23
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);
            }
        }
Beispiel #24
0
        /// <summary>
        /// Return the Page properties.
        /// </summary>
        /// <param name="SetName"></param>
        /// <param name="Title"></param>
        public static DisplayPage Page(int SetID, int PageID)
        {
            try
            {
                List <DisplayPageSet> l   = ClsDisplayControler.DisplayPageSets();
                DisplayPageSet        dps = (from x in l where x.ID == SetID select x).FirstOrDefault();

                if (dps != null)
                {
                    List <DisplayPage> pl = ClsDisplayControler.DisplayPagesForPageSet(dps.ID);
                    DisplayPage        dp = (from x in pl where x.ID == PageID select x).FirstOrDefault();

                    return(dp);
                }

                return(new DisplayPage());
            }
            catch (Exception ex)
            {
                ClsError.Error(Name, MethodBase.GetCurrentMethod().ToString(), ex);
                return(new DisplayPage());
            }
        }
Beispiel #25
0
        //public static void NewDiv(int PageSetID, int PageID)
        //{
        //	List<DisplayPageSet> dpsl = ClsDisplayControler.DisplayPageSets();
        //	DisplayPageSet dps = (from x in dpsl where x.PageSetName == SetName select x).FirstOrDefault();

        //	List<DisplayPage> dpl = ClsDisplayControler.DisplayPagesForPageSet(dps.ID);
        //	DisplayPage dp = (from x in dpl where x.PageName == Page select x).FirstOrDefault();

        //	NewDiv(PageSetID, PageID);
        //}

        public static void NewDiv(
            long SetID,
            long PageID,
            string varText    = "S00",
            string varPicture = "B00",
            string varTable   = "T00",
            string Style      = "",
            string innerText  = "",
            long Speed        = 0,
            string TableStyle = "")
        {
            // zIndex berechnen
            long nextno = 0;

            if (ClsDisplayControler.DisplayObjectsForPage(PageID).Count > 0)
            {
                long max = (from x in ClsDisplayControler.DisplayObjectsForPage(PageID) select x.Zindex).Max();
                nextno = max + 1;
            }

            // pos berechnen
            string left = "10vw";
            string top  = "10vh";

            if (Style != "")
            {
                using (ClsStyleGenerator sg = new ClsStyleGenerator())
                {
                    sg.ParseStyleStringJson(Style);
                    top  = sg.GetStyle("top");
                    left = sg.GetStyle("left");
                }
            }

            List <DisplayObject> ol = ClsDisplayControler.DisplayObjectsForPage(PageID);

            if (ol.Count > 0)
            {
                for (int i = 0; i < ol.Count; i++)
                {
                    using (ClsStyleGenerator sg = new ClsStyleGenerator())
                    {
                        sg.ParseStyleStringJson(ol[i].style);
                        string t = sg.GetStyle("top");
                        string l = sg.GetStyle("left");
                        if (t == top && l == left)
                        {
                            decimal to = Convert.ToDecimal(top.Substring(0, top.Length - 2), CultureInfo.InvariantCulture);
                            decimal le = Convert.ToDecimal(left.Substring(0, left.Length - 2), CultureInfo.InvariantCulture);
                            top  = (to + 1).ToString(CultureInfo.InvariantCulture) + "vh";
                            left = (le + 1).ToString(CultureInfo.InvariantCulture) + "vw";
                        }
                    }
                }
            }

            DisplayObject o = new DisplayObject();

            o.PageSetNo = SetID;
            o.PageNo    = PageID;
            if (innerText == "")
            {
                o.innerText = "Box " + nextno;
            }
            else
            {
                o.innerText = innerText;
            }
            o.textid     = varText;
            o.bgid       = varPicture;
            o.tableid    = varTable;
            o.Zindex     = nextno;
            o.Speed      = Speed;
            o.TableStyle = TableStyle;

            string s = "";

            using (ClsStyleGenerator sg = new ClsStyleGenerator())
            {
                sg.SetStyle("position", "absolute");
                sg.SetStyle("top", top);
                sg.SetStyle("left", left);
                sg.SetStyle("height", "10vh");
                sg.SetStyle("width", "10vw");
                sg.SetStyle("display", "flex");
                sg.SetStyle("justify-content", "center");
                sg.SetStyle("align-items", "center");
                sg.SetStyle("background-color", "#56884e");
                sg.SetStyle("z-index", nextno.ToString());
                sg.SetStyle("visibility", "visible");
                sg.SetStyle("border-color", "#000000");
                sg.SetStyle("border-style", "solid");
                sg.SetStyle("border-width", "1px");
                sg.SetStyle("border-radius", "0px");
                sg.SetStyle("color", "black");
                sg.SetStyle("font-family", "Arial");
                sg.SetStyle("font-size", "5vh");
                sg.SetStyle("font-style", "normal");
                sg.SetStyle("font-weight", "normal");
                sg.SetStyle("white-space", "nowrap");
                sg.SetStyle("background-position", "center");
                sg.SetStyle("background-repeat", "no-repeat");
                sg.SetStyle("background-size", "contain");
                sg.SetStyle("background-position", "center");
                sg.SetStyle("background-repeat", "no-repeat");
                sg.SetStyle("box-sizing", "border-box");

                s = sg.GetStyleStringJson();
            }

            if (Style == "")
            {
                o.style = s;
            }
            else
            {
                using (ClsStyleGenerator sg = new ClsStyleGenerator())
                {
                    sg.ParseStyleStringJson(Style);
                    sg.SetStyle("top", top);
                    sg.SetStyle("left", left);
                    sg.SetStyle("z-index", nextno.ToString());
                    o.style = sg.GetStyleStringJson();
                }
            }

            ClsDisplayControler.AddDisplayObject(o);

            SetDivInfo(o.ID);
        }
Beispiel #26
0
        public static string[] PageSetNames()
        {
            List <string> dl = (from x in ClsDisplayControler.DisplayPageSets() select x.PageSetName).ToList();

            return(dl.ToArray());
        }
Beispiel #27
0
        public static string GetPageSetNameFromID(int PageSetID)
        {
            string psn = (from x in ClsDisplayControler.DisplayPageSets() where x.ID == PageSetID select x.PageSetName).FirstOrDefault();

            return(psn);
        }
Beispiel #28
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);
            }
        }
Beispiel #29
0
        public static long[] PageSetIDs()
        {
            List <long> dl = (from x in ClsDisplayControler.DisplayPageSets() select x.ID).ToList();

            return(dl.ToArray());
        }
Beispiel #30
0
        public static List <DisplayPageSet> PageSets()
        {
            List <DisplayPageSet> dl = (from x in ClsDisplayControler.DisplayPageSets() select x).ToList();

            return(dl);
        }