Пример #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 LoadFile(string fileName)
        {
            LastUsedFolder = fileName;
            IDecisionTree tree        = IApplicationInterface.NewDescisionTree();
            IPersistence  persistence = new XmlPersistenceImpl(fileName);

            if (tree.Load(persistence, fileName))
            {
                ctrl.AddTree(tree);
                IApplicationInterface.StatusLine = string.Format("Opened {0} from disk", Path.GetFileName(fileName)) + UI_Constants.ZoomPanHint;
            }
        }
Пример #3
0
        private void LoadFile(string fileName)
        {
            LastUsedFolder = fileName;
            IDecisionTree tree        = IApplicationInterface.NewDescisionTree();
            IPersistence  persistence = new XmlPersistenceImpl(fileName);

            if (tree.Load(persistence, fileName))
            {
                if (tree.RootNode.GetNode(eNodeType.DataObjects) == null)
                {
                    IBaseNode dataObjects = tree.CreateNewNode(eNodeType.DataObjects, null, Constants.DataNodesTreeName);
                    tree.RootNode.AddNode(dataObjects);
                }

                if (tree.RootNode.GetNode(eNodeType.DataSources) == null)
                {
                    IBaseNode dataSources = tree.CreateNewNode(eNodeType.DataSources, null, Constants.DataSourcesTreeName);
                    tree.RootNode.AddNode(dataSources);
                }

                ctrl.AddTree(tree);
                IApplicationInterface.StatusLine = string.Format("Opened {0} from disk", Path.GetFileName(fileName)) + UI_Constants.ZoomPanHint;
            }
        }