public EventPageHtml(EventPageDetails details) { Details = details; HolderClientID = Details.ParentClientID + "_EventPage_" + Details.GetKey() + "_Holder"; }
void updatePage(EventPageDetails newPage) { string key = newPage.GetKey(); if (EventPageCache[key] != null) { EventPageDetails page = (EventPageDetails)EventPageCache[key]; if (page.HasIncompleteEventData) { if (page.Selected) newPage.Selected = true; bool selectedEventIsOnThisPage = false; for (int i = 0; i < 8; i++) { if (page.Events[i].Selected) { newPage.Events[i].Selected = true; CurrentlySelectedEvent = newPage.Events[i]; selectedEventIsOnThisPage = true; } } newPage.Html.InitialiseElements(true, false, false, true, false, false, true); // just initialise elements (from old html) newPage.Html.InitialiseElements(false, false, true, true, false, true, true); // now refresh new contents html if (selectedEventIsOnThisPage) { //if (EnableEffects) // PerformOrQueueAnimationTask(new Action[] { new Action(delegate() { CurrentlySelectedEvent.Html.ResizeInfoHolderAnimate(); }) }, "ResizeInfoHolderAnimate"); //else CurrentlySelectedEvent.Html.ResizeInfoHolderImmediate(); } } else return; } else { newPage.Html.InitialiseElements(true, true, false, true, true, false, true); } EventPageCache[key] = newPage; }
/// <summary> /// Anything that affects the DOM goes in here. /// </summary> void initialise() { jQuery.Window.Bind("hashchange", Application_Navigate); //Application.Navigate += new HistoryEventHandler(Application_Navigate); #region Initialisation variables ClientID = View.InitClientID.Value; EnableEffects = bool.Parse(View.InitEnableEffects.Value); #endregion #region JQuery handles EventInfoHolderOuterJ = View.EventInfoHolderOuterJ; #endregion View.EventIconsNavigationForwardHolderJ.Click(pageChangeForwardClick); View.EventIconsNavigationBackHolderJ.Click(pageChangeBackClick); View.MusicDropDownControl.View.DropDownJ.Change(musicChangeClick); View.PastEventsTabJ.Click(tabClickPast); View.FutureEventsTabJ.Click(tabClickFuture); View.TicketsTabJ.Click(tabClickTickets); #region Event data cache, and initialise first page from json data in the page EventPageCache = new Dictionary<object, object>(); EventPageStub firstPageData = ((EventPageStub[])Script.Eval(" [ " + View.InitFirstPage.Value + " ] "))[0]; EventPageDetails firstPage = new EventPageDetails(this, firstPageData, false); firstPage.Selected = true; firstPage.Html.InitialiseElements(true, false, false, true, true, false, true); for (int i = 0; i < firstPage.Events.Length; i++) { firstPage.Events[i].ChangeSelectedState(i == 0, false, ""); } CurrentlySelectedEvent = firstPage.Events[0]; #endregion EventPageCache[firstPage.GetKey()] = firstPage; #region Set initial page spec InitParentObjectType = firstPage.Data.parentObjectType; InitParentObjectK = firstPage.Data.parentObjectK; InitTabType = firstPage.Data.tabType; InitMusicTypeK = firstPage.Data.musicTypeK; InitPageIndex = firstPage.Data.pageIndex; #endregion #region Set initial and current page spec - this should be done by looking at the page hash state data... CurrentParentObjectType = InitParentObjectType; CurrentParentObjectK = InitParentObjectK; CurrentTabType = InitTabType; CurrentMusicTypeK = InitMusicTypeK; CurrentPageIndex = InitPageIndex; #endregion if (Misc.BrowserIsIE) { jQueryHistory.PushState(new Dictionary<object, object>()); //Application.AddHistoryPoint(new Dictionary<object, object>()); } }
void restorePageState(string key) { if (key == null) { EventPageDetails d = new EventPageDetails(this, new EventPageStub(InitParentObjectType, InitParentObjectK, InitTabType, InitMusicTypeK, InitPageIndex, InitPageIndex, null), false); key = d.GetKey(); } #region Get the event page to the right place if (CurrentEventPage.GetKey() == key) return; CurrentEventPage.ChangeSelectedState(false, false, ""); EventPageStub s = EventPageDetails.GetStubFromKey(key); CurrentParentObjectType = s.parentObjectType; CurrentParentObjectK = s.parentObjectK; CurrentMusicTypeK = s.musicTypeK; CurrentTabType = s.tabType; CurrentPageIndex = s.pageIndex; CurrentEventPage.ChangeSelectedState(true, false, ""); ChangeEventNow(CurrentEventPage.Events[0], false, ""); #endregion #region Set the music-type drop-down View.MusicDropDownControl.View.DropDown.Value = CurrentMusicTypeK.ToString(); #endregion #region Set the future / past events tabs updateTabsUI(); #endregion }