Example #1
0
        /// <summary>
        /// affiche le calculatedMeasure en edition
        /// </summary>
        /// <param name="table"></param>
        public void DisplayRole(Domain.Role root)
        {
            this.panel.Children.Clear();
            int index = 1;

            if (root == null)
            {
                this.ActiveItemPanel           = new RoleItemPanel(index);
                this.ActiveItemPanel.rolePanel = this;
                AddItemPanel(this.ActiveItemPanel);
                return;
            }
            foreach (Domain.Role item in root.childrenListChangeHandler.Items)
            {
                RoleItemPanel itemPanel = new RoleItemPanel(item);
                itemPanel.Index = index;
                itemPanel.newButton.Visibility = System.Windows.Visibility.Hidden;
                AddItemPanel(itemPanel);
                index++;
            }

            this.ActiveItemPanel           = new RoleItemPanel(index);
            this.ActiveItemPanel.rolePanel = this;
            AddItemPanel(this.ActiveItemPanel);
        }
Example #2
0
 public void fillObject(Domain.Role role)
 {
     foreach (UIElement el in this.panel.Children)
     {
         RoleItemPanel item     = (RoleItemPanel)el;
         String        roleName = item.TextBox.Text;
         if (String.IsNullOrEmpty(roleName))
         {
             continue;
         }
         Domain.Role roleItem = new Domain.Role()
         {
             name = roleName
         };
         if (item.Role != null)
         {
             item.Role.name = roleName;
             role.UpdateChild(item.Role);
         }
         else
         {
             role.AddChild(roleItem);
         }
     }
 }
Example #3
0
        private void OnUpdated(object item)
        {
            RoleItemPanel panel = (RoleItemPanel)item;

            updated = true;
            OnChanged(panel.Role);
        }
Example #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnValidateEdition()
        {
            String text = this.TextBox.Text;

            if (rolePanel != null)
            {
                foreach (UIElement el in rolePanel.panel.Children)
                {
                    RoleItemPanel item     = (RoleItemPanel)el;
                    String        roleName = item.TextBox.Text;

                    if (roleName.Equals(text) && item != this)
                    {
                        Util.MessageDisplayer.DisplayError("Duplicate Name", "There is another Target named: " + text);
                        this.TextBox.Text = null;
                    }
                }
            }

            decimal amount;
            bool    valid = decimal.TryParse(text, out amount);

            if (!valid)
            {
                return;
            }

            Domain.Role value = new Domain.Role();

            SetValue(value);
        }
Example #5
0
 protected void AddItemPanel(RoleItemPanel itemPanel)
 {
     itemPanel.Added     += OnAdded;
     itemPanel.Updated   += OnUpdated;
     itemPanel.Deleted   += OnDeleted;
     itemPanel.Activated += OnActivated;
     this.panel.Children.Add(itemPanel);
 }
Example #6
0
        private void OnAdded(object item)
        {
            RoleItemPanel panel = (RoleItemPanel)item;

            if (this.RootRole == null)
            {
                this.RootRole = new Domain.Role();
            }
            updated = false;
            OnChanged(panel);
            OnActivated(item);
        }
Example #7
0
        private void OnActivated(object item)
        {
            RoleItemPanel panel = (RoleItemPanel)item;

            if (this.ActiveItemPanel.Role != null && this.ActiveItemPanel.Role != panel.Role)
            {
                this.ActiveItemPanel = panel;
                if (ItemChanged != null && panel.Role != null)
                {
                    ItemChanged(panel.Role);
                }
            }
        }
Example #8
0
        private void OnDeleted(object item)
        {
            RoleItemPanel panel = (RoleItemPanel)item;

            if (item is UIElement)
            {
                this.panel.Children.Remove((UIElement)item);
                if (this.panel.Children.Count == 0)
                {
                    OnAdded(null);
                }
            }
            if (panel != null)
            {
                ItemDeleted(panel.Role);
            }
            Display();
        }