private void OnDeleted(object item) { ScopeItemPanel panel = (ScopeItemPanel)item; if (panel.TargetItem != null) { if (this.Scope == null) { this.Scope = GetNewScope(); } panel.TargetItem.parent = this.Scope; //this.Scope.RemoveTargetItem(panel.TargetItem); this.panel.Children.Remove(panel); if (this.ActiveItemPanel != null && this.ActiveItemPanel == panel) { this.ActiveItemPanel = (ScopeItemPanel)this.panel.Children[this.panel.Children.Count - 1]; } int index = 1; foreach (object pan in this.panel.Children) { ((ScopeItemPanel)pan).Index = index++; } if (Changed != null) { Changed(); } if (ItemDeleted != null && panel.TargetItem != null) { ItemDeleted(panel.TargetItem); } } }
protected void AddItemPanel(ScopeItemPanel itemPanel) { //itemPanel.Changed += OnChanged; itemPanel.Added += OnAdded; itemPanel.Updated += OnUpdated; itemPanel.Deleted += OnDeleted; itemPanel.Activated += OnActivated; this.panel.Children.Add(itemPanel); }
private void OnUpdated(object item) { ScopeItemPanel panel = (ScopeItemPanel)item; if (this.Scope == null) { this.Scope = GetNewScope(); } this.Scope.UpdateTargetItem(panel.TargetItem); OnChanged(panel.TargetItem); }
/// <summary> /// /// </summary> /// <param name="table"></param> public void DisplayScope(Target scope) { this.Scope = scope; this.panel.Children.Clear(); int index = 1; if (scope == null) { AddDefaultLine(index, isCustomize); return; } foreach (TargetItem item in scope.targetItemListChangeHandler.Items) { ScopeItemPanel itemPanel = isCustomize ? new ScopeItemPanel(item, isCustomize) : new ScopeItemPanel(item); itemPanel.SetReadOnly(this.isReadOnly); AddItemPanel(itemPanel); index++; } AddDefaultLine(index, isCustomize); }
private void OnActivated(object item) { ScopeItemPanel panel = (ScopeItemPanel)item; this.ActiveItemPanel = panel; }