public static Canvas LoadSpecificCanvas(DataStore data, int pos) { Canvas canvas = new Canvas(); canvas.Width = MainWindow.CanvasW; canvas.Height = MainWindow.CanvasH; if (!String.IsNullOrWhiteSpace(data.pages[pos].canvas)) { CanvasWriter.LoadCanvas(canvas, data.pages[pos].canvas); } ExtractHiddenData(data, canvas, pos); return(canvas); }
private void LoadCanvas(int pos, bool IgnoreHidden = false) { //Hidden page if (!IgnoreHidden) { if (data.pages[pos].isHidden) { bool finded = false; if (LoadedPage > pos) { for (int i = pos; i >= 0; i--) { if (!data.pages[i].isHidden) { pos = i; finded = true; break; } } } else { for (int i = pos; i < maxC; i++) { if (!data.pages[i].isHidden) { pos = i; finded = true; break; } } } if (!finded) { return; } } } //hidden page Good_Teacher.MainWindow.ActualPage = pos; LoadedPage = pos; currentC = pos; if (data.SaveOutput) { SaveOutputData(); } if (data.SaveTemporaryData) { SaveTemporary(); } PlaySound(pos); TGood = 0; TWrong = 0; TAllAnswers = 0; PlayCanvas.Children.Clear(); if (!String.IsNullOrWhiteSpace(data.pages[pos].canvas)) { CanvasWriter.LoadCanvas(PlayCanvas, data.pages[pos].canvas); } CanvasSaveLoad.ExtractHiddenData(data, PlayCanvas, pos); CanvasSaveLoad.ToPresentationMode(PlayCanvas); ToSpecialPresentation(); UpdateNumberLabel(); MakeAnimations(pos); currentLoaded = pos; NoCount = true; if (data.SaveTemporaryData) { LoadTempData(); } NoCount = false; foreach (RepeatingData repeat in data.RepeatingControls) { if (!repeat.IgnorePages.Contains((pos + 1))) { ContentViewer contentViewer = repeat.contentViewer.CreateControl(data); contentViewer.IsHitTestVisible = false; PlayCanvas.Children.Add(contentViewer); } } foreach (TimerAction timer in data.pages[currentLoaded].Timers) { timer.SetActualTime(); timer.Stop = false; } DoScript(); dispatcherTimerTransition.Interval = TimeSpan.FromMilliseconds(data.pages[LoadedPage].TransitionMove); dispatcherTimerTransition.IsEnabled = (data.pages[LoadedPage].transitionType != Good_Teacher.Class.Enumerators.TransitionTypeEnum.TransitionType.Manual); }