void DuplicateCurrentPage(int pos) { SaveCanvas(); LoadCanvas(); TestType_ControlN tst_type = new TestType_ControlN(Strings.ResStrings.Page, Stack_TestList.Children.Count, false, false); tst_type.OnClick += TestTypeCall_OnClick; tst_type.OnMenuClick += TestTypeCall_OnMenuClick; Stack_TestList.Children.Add(tst_type); data.pages.Add((Test_DefaultAbstract)ClassWorker.Clone(data.pages[pos])); data.pages.Last().Position = tst_type.Position; data.pages.Last().isUnlocked = true; data.pages.Last().CustomControls = new System.Collections.Generic.List <object>(data.pages[pos].CustomControls); data.pages.Last().AnimationList = new System.Collections.Generic.List <Class.Animations.IAnimation>(); data.pages[pos].AnimationList.ForEach((item) => { data.pages.Last().AnimationList.Add((IAnimation)ClassWorker.CloneObject(item)); }); UpdateCanvasIcon(tst_type.Position); ScrollViewer_TestList.ScrollToEnd(); TestTypeCall_OnClick(tst_type.Position, tst_type); }
void DeletePage(int pos) { Debug.WriteLine("Pos: " + pos + " Sel: " + SelectedPosition); CallAllUnloadEvent(CanvasSaveLoad.LoadSpecificCanvas(data, pos)); Stack_TestList.Children.RemoveAt(pos); data.pages.RemoveAt(pos); UpdateAllDataPosition(); UpdateAllStackListPosition(); if (pos == SelectedPosition) { SelectedControl = null; SelectedPosition = -1; if (Stack_TestList.Children.Count > 0) { TestTypeCall_OnClick(0, Stack_TestList.Children[0]); ScrollViewer_TestList.ScrollToHome(); } else { BorderWindowSize.Visibility = Visibility.Collapsed; } } }
public void OpenFile(string path) { try { SaveEditor save = new SaveEditor(); data = save.LoadWithCompression(path); SetWorkingFileLabel(path); LoadFileData(); pathtofile = path; BorderWindowSize.Width = data.CanvasW + 2; BorderWindowSize.Height = data.CanvasH + 2; CanvasW = data.CanvasW; CanvasH = data.CanvasH; FontWorker.LoadFonts(data); LoadCanvas(); IMG_StackCount = Stack_TestList.Children.Count; IMG_Work = false; IMG_Current = 0; IMG_dispatcherTimer = new DispatcherTimer(); IMG_dispatcherTimer.Tick += new EventHandler(IMG_dispatcherTimer_Tick); IMG_dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 10); IMG_dispatcherTimer.Start(); //UpdateCanvasIcon(); ScrollViewer_TestList.ScrollToHome(); MainWindow.IsChanged = false; } catch (Exception ex) { Debug.WriteLine(ex); MessageBox.Show(Strings.ResStrings.ErrorLoad, Strings.ResStrings.Error, MessageBoxButton.OK, MessageBoxImage.Error); } }
public void OpenFile(string path) { try { SaveEditor save = new SaveEditor(); output = (PresentationOutput)save.LoadWithCompressionO(path); pathtofile = path; SetWorkingFileLabel(path); DesignCanvas.Strokes.Clear(); CurrentPage = -1; LoadFileData(); BorderWindowSize.Width = output.W + 2; BorderWindowSize.Height = output.H + 2; IMG_StackCount = Stack_TestList.Children.Count; IMG_Work = false; IMG_Current = 0; IMG_dispatcherTimer = new DispatcherTimer(); IMG_dispatcherTimer.Tick += new EventHandler(IMG_dispatcherTimer_Tick); IMG_dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 10); IMG_dispatcherTimer.Start(); //UpdateCanvasIcon(); ScrollViewer_TestList.ScrollToHome(); } catch (Exception ex) { Debug.WriteLine(ex); MessageBox.Show(Good_Teacher.Strings.ResStrings.ErrorLoad, Good_Teacher.Strings.ResStrings.Error, MessageBoxButton.OK, MessageBoxImage.Error); } }