예제 #1
0
        private void mnuNodesReload_Click(object sender, EventArgs e)
        {
            IBaseNode currentNode = TreeNodeAsBaseNode(tvDecisionTree.SelectedNode);

            if (currentNode != null)
            {
                IDecisionTree tree = currentNode.Tree;

                bool CanDelete = false;

                if (tree.IsDirty)
                {
                    CanDelete = App.GetFloatingForm(eFloatReason.NotSet, new ucConfirmDropModel(tree)).ShowDialog() == DialogResult.OK;
                }
                else
                {
                    CanDelete = true;
                }

                if (CanDelete)
                {
                    int           treeIndex = Trees.IndexOf(tree);
                    IDecisionTree newTree   = App.NewDescisionTree();
                    newTree.Load(tree.Persistence.Clone(), tree.FullPath);

                    Trees.Remove(tree);
                    Trees.Insert(treeIndex, newTree);
                    RefreshTree(tvDecisionTree);

                    App.SelectedTree = Trees.Count > 0 ? Trees[0] : null;

                    App.SelectedObject = Trees.Count > 0 ? Trees[0] : null;
                }
            }
        }
예제 #2
0
        private void MoveLastItemToFirst()
        {
            if (Trees.Count == 0)
            {
                return;
            }
            var tree = Trees[Trees.Count - 1];

            Trees.RemoveAt(Trees.Count - 1);
            Trees.Insert(0, tree);
        }