/// <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>()); } }
public static void SaveDisplayPageSet(DisplayPageSet DisplayPageSet) { try { DisplayPageSet ma; using (fsbDB FSBDB = new fsbDB()) { ma = (from s in FSBDB.DisplayPageSet where s.ID == DisplayPageSet.ID select s).FirstOrDefault(); foreach (PropertyInfo pi in DisplayPageSet.GetType().GetProperties()) { if (pi.CanWrite) { pi.SetValue(ma, pi.GetValue(DisplayPageSet, null), null); } } FSBDB.SaveChanges(); } } catch (Exception ex) { ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex); } }
/// <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); }
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); }
/// <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); }
public static DisplayPageSet DisplayPageSet(int id) { DisplayPageSet res = new DisplayPageSet(); using (fsbDB FSBDB = new fsbDB()) { res = (from s in FSBDB.DisplayPageSet where s.ID == id select s).FirstOrDefault(); } return(res); }
///// <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); }
/// <summary> /// delets all objects, pages and the pageset itself /// </summary> /// <param name="DisplayPageSetID"></param> public static void DelDisplayPageSet(long DisplayPageSetID) { using (fsbDB FSBDB = new fsbDB()) { // del pages DelDisplayPagesForPageSet(DisplayPageSetID); // del pageset DisplayPageSet el = (from s in FSBDB.DisplayPageSet where s.ID == DisplayPageSetID select s).FirstOrDefault(); FSBDB.DisplayPageSet.Remove(el); FSBDB.SaveChanges(); } }
/// <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); }
/// <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 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); }
/// <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); }
/// <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>()); } }
public static long AddDisplayPageSet(DisplayPageSet DisplayPageSet) { try { long id = 0; using (fsbDB FSBDB = new fsbDB()) { FSBDB.DisplayPageSet.Add(DisplayPageSet); FSBDB.SaveChanges(); id = DisplayPageSet.ID; } return(id); } catch (Exception ex) { ClsError.CoreError(Name, MethodBase.GetCurrentMethod().ToString(), ex); return(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()); } }
private void ZeitAusloeser(object sender, ClsObjectEventArgs e) { Timerevent TimerEvent = (Timerevent)e.ObjectArgument; switch (TimerEvent.Eventtype) { case 0: { // Timer stoppen this.ClockStop(TimerEvent.TimerNr); GlobalServerEvents.SendMessage(null, new ClsStringEventArgs(ClsRequests.DataRequest(new ClsCommand(command: "TimerObjects")))); break; } case 1: { // anderen Timer starten if (TimerEvent.AndereTimerNr > 0) { this.ClockStart(TimerEvent.AndereTimerNr); GlobalServerEvents.SendMessage(null, new ClsStringEventArgs(ClsRequests.DataRequest(new ClsCommand(command: "TimerObjects")))); } break; } case 2: { // anderen Timer stoppen if (TimerEvent.AndereTimerNr > 0) { this.ClockStop(TimerEvent.AndereTimerNr); GlobalServerEvents.SendMessage(null, new ClsStringEventArgs(ClsRequests.DataRequest(new ClsCommand(command: "TimerObjects")))); } break; } case 3: { // Audio abspielen ClsSoundplayer.Instance.TPlay(TimerEvent.Soundfile + "|" + 75); break; } case 4: { // Layer wechsel if (!string.IsNullOrEmpty(TimerEvent.Layer)) { long id = Convert.ToInt64(TimerEvent.Layer); DisplayPageSet ps = (from x in ClsDisplayControler.DisplayPageSets() where x.ID == ClsPageSets.ActivePageSet() select x).FirstOrDefault(); // prüfen ob ID tatsächlich noch existiert long p = (from x in ClsDisplayControler.DisplayPagesForPageSet(ps.ID) where x.ID == id select x.ID).FirstOrDefault(); if (p != 0) { ClsDisplay.SetPage(ClsPageSets.ActivePageSet(), (int)p); GlobalServerEvents.SendMessage(null, new ClsStringEventArgs(ClsRequests.DataRequest(new ClsCommand(command: "ActivePage")))); GlobalServerEvents.SendMessage(null, new ClsStringEventArgs(ClsRequests.DataRequest(new ClsCommand(command: "DivsActivePage", pageSet: ps.PageSetName, page: p.ToString())))); } } break; } } }