/// <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>()); } }
/// <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); } }
/// <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); } }
//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); }