private void OnIfActionSelect(object item) { BlockPanel panel = new BlockPanel(); panel.Display(null); //panel.Height = 100; initHandlers(panel); if (item is UIElement) { int index = this.Children.IndexOf((UIElement)item); if (index < 0 || index >= this.Children.Count) { this.Children.Add(panel); } else { this.Children.Insert(index, panel); } this.Children.Remove((UIElement)item); } else { this.Children.Add(panel); } }
public void Display(Instruction instruction) { trow = false; if (instruction == null) { Reset(); return; } this.ActionComboBox.SelectedItem = instruction.start; if (instruction.isCreateTable()) { if (BlockPanel.TransformationTables == null || BlockPanel.TransformationTables.Count == 0) { BlockPanel.TransformationTables = new List <string>(); string[] defaultTableList = new string[] { defaultTransformationTable, "" }; BlockPanel.TransformationTables.AddRange(defaultTableList.ToList <string>()); } if (!string.IsNullOrEmpty(instruction.args) && !BlockPanel.TransformationTables.Contains(instruction.args)) { BlockPanel.TransformationTables.Remove(""); BlockPanel.TransformationTables.Add(instruction.args); BlockPanel.TransformationTables.Add(""); } this.TableComboBox.SelectedItem = instruction.args; } if (instruction.isCreateSlide()) { if (BlockPanel.TransformationSlides == null || BlockPanel.TransformationSlides.Count == 0) { BlockPanel.TransformationSlides = new List <string>(); string[] defaultTableList = new string[] { defaultTransformationSlide, "" }; BlockPanel.TransformationSlides.AddRange(defaultTableList.ToList <string>()); } if (!string.IsNullOrEmpty(instruction.args) && !BlockPanel.TransformationSlides.Contains(instruction.args)) { BlockPanel.TransformationSlides.Remove(""); BlockPanel.TransformationSlides.Add(instruction.args); BlockPanel.TransformationSlides.Add(""); } this.TableComboBox.SelectedItem = instruction.args; } this.LoopComboBox.SelectedItem = BlockPanel.LoopByName(instruction.args); this.CommentTextBlock.Text = String.IsNullOrWhiteSpace(instruction.comment) ? "" : instruction.comment.Trim(); refreshCommentIcon(); trow = true; }
public UIElement GetNewSubItemPanel(Instruction child) { if (this.isThenBloc || this.isElseBloc) { if (child != null && child.isBlock()) { BlockPanel panel = new BlockPanel(); panel.IsReadOnly = this.IsReadOnly; panel.Display(child); initHandlers(panel); return(panel); } else { ThenOrElseItemPanel panel = new ThenOrElseItemPanel(); panel.SetReadOnly(this.IsReadOnly); panel.Display(child); panel.Height = 30; initHandlers(panel); return(panel); } } return(null); }
protected void initHandlers(BlockPanel panel) { panel.Added += OnAdd; panel.Deleted += OnDelete; panel.ChangeEventHandler += onChange; }