Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="table"></param>
        public void DisplayScope(Target scope, bool isNoAllocation = false, bool readOnly = false)
        {
            this.Scope = scope;
            this.panel.Children.Clear();
            int index = 1;

            if (scope == null)
            {
                if (!this.IsReadOnly)
                {
                    this.ActiveItemPanel = new TargetItemPanel(index);
                    this.ActiveItemPanel.SetReadOnly(readOnly);
                    AddItemPanel(this.ActiveItemPanel);
                }
                return;
            }
            foreach (TargetItem item in scope.targetItemListChangeHandler.Items)
            {
                TargetItemPanel itemPanel = new TargetItemPanel(item, isNoAllocation);
                if (this.IsReadOnly)
                {
                    itemPanel.SetReadOnly(this.IsReadOnly);
                }
                AddItemPanel(itemPanel);
                index++;
            }

            if (!this.IsReadOnly)
            {
                this.ActiveItemPanel = new TargetItemPanel(index, isNoAllocation);
                this.ActiveItemPanel.SetReadOnly(readOnly);
                AddItemPanel(this.ActiveItemPanel);
            }
        }
Пример #2
0
        private void OnDeleted(object item)
        {
            TargetItemPanel panel = (TargetItemPanel)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 = (TargetItemPanel)this.panel.Children[this.panel.Children.Count - 1];
                }
                int index = 1;
                foreach (object pan in this.panel.Children)
                {
                    ((TargetItemPanel)pan).Index = index++;
                }
                if (Changed != null)
                {
                    Changed();
                }
                if (ItemDeleted != null && panel.TargetItem != null)
                {
                    ItemDeleted(panel.TargetItem);
                }
            }
        }
Пример #3
0
        private void OnUpdated(object item)
        {
            TargetItemPanel panel = (TargetItemPanel)item;

            if (this.Scope == null)
            {
                this.Scope = GetNewScope();
            }
            this.Scope.UpdateTargetItem(panel.TargetItem);
            OnChanged(panel.TargetItem);
        }
Пример #4
0
 protected void AddItemPanel(TargetItemPanel itemPanel)
 {
     //itemPanel.Changed += OnChanged;
     itemPanel.Added           += OnAdded;
     itemPanel.Updated         += OnUpdated;
     itemPanel.Deleted         += OnDeleted;
     itemPanel.Activated       += OnActivated;
     itemPanel.ValidateFormula += OnValidateFormula;
     itemPanel.Expand(IsExpanded);
     this.panel.Children.Add(itemPanel);
 }
Пример #5
0
        private void OnActivated(object item)
        {
            TargetItemPanel panel = (TargetItemPanel)item;

            this.ActiveItemPanel = panel;
        }
Пример #6
0
        private void OnValidateFormula(object item)
        {
            TargetItemPanel panel = (TargetItemPanel)item;

            OnChanged(panel.TargetItem);
        }