private void AddExplanationItem(ClickItem reference, InsertItemAction action) { ExplanationItem selfExplanationClickItem = new ExplanationItem(captionText: string.Empty); selfExplanationClickItem.tagNo = SelfExplanationTagService.GenerateUniqueTag(); int index = action(reference, selfExplanationClickItem); ExplanationItem template = Items.LastOrDefault(o => o is ExplanationItem && GetItemIndex(o) < index) as ExplanationItem; selfExplanationClickItem.CopyFormat(template); isSynced = false; UpdateClickNumAndTriggerInItems(useWorker: false, e: null); ScrollItemToView(selfExplanationClickItem); }
public void CreateTemplateExplanations(params ExplanationItemTemplate[] items) { // add to IELearningLabController if (_pane != null) { _pane.ELearningLabMainPanel.Dispatcher.Invoke((Action)(() => { _pane.ELearningLabMainPanel.Items.Clear(); foreach (ExplanationItemTemplate item in items) { ExplanationItem explanationItem = CreateExplanationItem(); explanationItem.CopyFormat(item); if (!explanationItem.HasSameFormat(item)) { throw new Exception("Format failed to copy correctly"); } } })); } }