예제 #1
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]);
        }
예제 #2
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);
        }
예제 #3
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);
        }
예제 #4
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);
        }
예제 #5
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);
        }
예제 #6
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);
            }
        }