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); }
private void Insert_Page_Click(object sender, RoutedEventArgs e) { int toPos = SelectedPosition; string tag = ""; if (((Control)sender).Tag != null) { tag = ((Control)sender).Tag.ToString(); } 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); Test_Form frm = new Test_Form(); frm.Position = tst_type.Position; data.pages.Add(frm); UpdateCanvasIcon(data.pages.Count - 1); if (toPos >= 0) { MovePage(tst_type.Position, toPos); } TestTypeCall_OnClick(toPos, tst_type); }
void LoadFileData() { DesignCanvas.Children.Clear(); Stack_TestList.Children.Clear(); int k = 0; foreach (KeyValuePair <int, OutputPage> pair in output.Pages) { TestType_ControlN type = new TestType_ControlN(Good_Teacher.Strings.ResStrings.Page, Stack_TestList.Children.Count, false, false); type.Tag = pair.Key; type.OnClick += TestTypeCall_OnClick; type.ContextMenu.Visibility = Visibility.Collapsed; type.HoverBrush = new SolidColorBrush(Color.FromArgb(200, 121, 134, 203)); type.SelectBrush = new SolidColorBrush(Color.FromRgb(57, 73, 171)); type.CBorderBrush = new SolidColorBrush(Color.FromRgb(57, 73, 171)); Stack_TestList.Children.Add(type); k++; } SelectedPosition = -1; if (Stack_TestList.Children[0] != null) { TestTypeCall_OnClick(0, Stack_TestList.Children[0]); } }
private void TestTypeCall_OnClick(int Pos, object sender) { if (LastSelected != null) { LastSelected.Select(false); } ((TestType_ControlN)sender).Select(true); LastSelected = (TestType_ControlN)sender; SelectedPosition = Pos; LoadCanvas(int.Parse(((TestType_ControlN)sender).Tag.ToString())); }
void LoadFileData() { DesignCanvas.Children.Clear(); Stack_TestList.Children.Clear(); int k = 0; foreach (Test_DefaultAbstract tst in data.pages) { // TestType_Control type = new TestType_Control(tst.TestType, tst.Position, Strings.ResStrings.Form, Strings.ResStrings.Form, "Resources/Menu/form.png", Stretch.Uniform); TestType_ControlN type = new TestType_ControlN(Strings.ResStrings.Page, Stack_TestList.Children.Count, !data.pages[k].isUnlocked, data.pages[k].isHidden); type.OnClick += TestTypeCall_OnClick; type.OnMenuClick += TestTypeCall_OnMenuClick; Stack_TestList.Children.Add(type); k++; } SelectedPosition = -1; if (Stack_TestList.Children[0] != null) { TestTypeCall_OnClick(0, Stack_TestList.Children[0]); } }