Пример #1
0
        private void OnExitEditMode(object sender, EO.Wpf.EditItemEventArgs e)
        {
            try
            {
                if (e.Item is Kernel.Domain.Role)
                {
                    Kernel.Domain.Role editedMeasure = (Kernel.Domain.Role)e.Item;
                    string             name          = e.Text.Trim();

                    Kernel.Domain.Role validName = ValidateName(editedMeasure, name);
                    if (validName == null)
                    {
                        e.Canceled = true;
                        return;
                    }
                    if (editedMeasure.IsDefault)
                    {
                        if (name.ToUpper() != Label_DEFAULT_ROLE.ToUpper())
                        {
                            Kernel.Domain.Role addedNode = new Domain.Role();
                            addedNode.name = name;

                            editedMeasure.name = Label_DEFAULT_ROLE;
                            editedMeasure.parent.UpdateChild(editedMeasure);

                            addedNode = ValidateName(addedNode, name);
                            AddNode(null, addedNode.name);
                            e.Canceled = true;
                        }
                    }
                    else
                    {
                        Kernel.Domain.Role valid = ValidateName(editedMeasure, name);
                        editedMeasure.name = valid.name;
                        editedMeasure.parent.UpdateChild(editedMeasure);
                    }
                    if (Changed != null)
                    {
                        Changed();
                    }
                }
                //The event must be canceled, otherwise the TreeView will
                //set the TreeViewItem's Header to the new text
                e.Canceled = true;
            }
            catch (Exception)
            {
                return;
            }
        }
Пример #2
0
 private void OnEnterEditMode(object sender, EO.Wpf.EditItemEventArgs e)
 {
 }