コード例 #1
0
 /// <summary>
 /// Attempt to clear the ParentVM ListVM when appropriate.
 /// <para>Will figure if needs to load </para>
 /// </summary>
 public void ClearForParent()
 {
     if (String.Equals(Model.Code.ChildType, IcdCodeStrings.ChildType_Direct))
     {
         if ((ParentVM != null) && (ParentItemVM != null))
         {
             ParentItemVM.ClearToAllChildren();
             if (Object.ReferenceEquals(ParentVM.Items.Items[0], this))
             {
                 ParentVM.ReplaceSelectedItem(ParentItemVM, false);
             }
             else
             {
                 ReplaceShownChild(this, ParentItemVM);
             }
         }
         else if (ParentVM != null)
         {
             ParentVM.ClearToFullList();
         }
     }
 }
コード例 #2
0
        /// <summary>
        /// Update Comments and Children according to whether the item is chosen or not
        /// </summary>
        private void UpdateChosen()
        {
            if (IsChosen)
            {
                if (m_Children == null)
                {
                    Children = CodesToItems.GetChildItems(
                        Model.Children
                        .Where(ci => !ParentHasEnabledCode(ci)),
                        ParentVM, this);
                    if (m_Children.Count == 0)
                    {
                        SpecificityComplete = true;
                    }
                    else
                    {
                        if (!String.Equals(m_Children[0].Title.Title, CodesToItems.SpecificityString))
                        {
                            SpecificityComplete = true;
                        }
                    }
                    m_TrueChildren.Clear();
                    m_TrueChildren.AddRange(Children);
                }
                if ((ParentItemVM != null) && (String.Equals(Model.Code.ChildType, Data.IcdCodeStrings.ChildType_Direct)))
                {
                    Comment = ParentItemVM.Comment;
                    ParentItemVM.Comment       = ListItemVM.CommentStart;
                    ParentItemVM.HasOwnComment = false;
                }
            }
            else
            {
                SpecificityComplete = false;
                foreach (var child in m_TrueChildren)
                {
                    child.IsChosen = false;
                }
                m_TrueChildren.Clear();
                if (HasOwnComment)
                {
                    if ((ParentItemVM != null) && (String.Equals(Model.Code.ChildType, Data.IcdCodeStrings.ChildType_Direct)))
                    {
                        ParentItemVM.Comment       = Comment;
                        ParentItemVM.HasOwnComment = true;
                        Comment = CommentStart;
                    }
                }
                Children = null;
            }


            if (ParentVM != null)
            {
                if (ParentItemVM == null)
                {
                    if (IsChosen)
                    {
                        ParentVM.ClearToItem(this);
                    }
                    else
                    {
                        ParentVM.ClearToFullList();
                    }
                }
                else
                {
                    if (String.Equals(Model.Code.ChildType, IcdCodeStrings.ChildType_Direct))
                    {
                        if (IsChosen)
                        {
                            ParentItemVM.ClearChildrenToSelected();
                            ParentItemVM.ReplaceSelectedChild(this);
                        }
                        else
                        {
                            ClearForParent();
                        }
                    }
                    ParentVM.UpdateChecks();
                }
            }
        }