private void ContextMenuOnCommitCollapseStatesClicked(object sender, CommitCollapseStatesEventArgs e)
 {
     if (CommitCollapseStatesClicked != null)
     {
         CommitCollapseStatesClicked(sender, e);
     }
 }
Exemplo n.º 2
0
        private void ContextMenuOnCommitCollapseStatesClicked(object sender, CommitCollapseStatesEventArgs e)
        {
            var pendingVisibilityNodes = new List<Node>();
            var pendingCollapseStateNodes = new List<Node>();
            foreach (NodeControl nodeControl in GetNodeControls())
            {
                if (e.Group == PermissionLevel.Author)
                {
                    if (nodeControl.ViewModelNode.IsAuthorCollapseStateDirty)
                    {
                        pendingCollapseStateNodes.Add(nodeControl.ViewModelNode);
                        nodeControl.ViewModelNode.IsAuthorCollapseStateDirty = false;
                    }

                    if (nodeControl.ViewModelNode.IsAuthorVisibilityDirty)
                    {
                        pendingVisibilityNodes.Add(nodeControl.ViewModelNode);
                        nodeControl.ViewModelNode.IsAuthorVisibilityDirty = false;
                    }
                }
                else
                {
                    if (nodeControl.ViewModelNode.IsViewerCollapseStateDirty ||
                            nodeControl.ViewModelNode.State != nodeControl.ViewModelNode.ViewerCollapseState)
                    {
                        pendingCollapseStateNodes.Add(nodeControl.ViewModelNode);
                        nodeControl.ViewModelNode.IsViewerCollapseStateDirty = false;
                    }

                    if (nodeControl.ViewModelNode.IsViewerVisibilityDirty ||
                        nodeControl.ViewModelNode.Visibility != nodeControl.ViewModelNode.ViewerVisibility)
                    {
                        pendingVisibilityNodes.Add(nodeControl.ViewModelNode);
                        nodeControl.ViewModelNode.IsViewerVisibilityDirty = false;
                    }
                }
            }
            IoC.GetInstance<ISuperGraphNodeBatchOperations>()
                .CommitCollapseStates(pendingVisibilityNodes, pendingCollapseStateNodes, e.Group);
        }