// Adds base nodes (those with a parent id of 0). private void AddNodes(Cluster c) { List<long> nodeList = c.GetChildNodes(0); foreach (long id in nodeList) { TreeNode node = new TreeNode(c.GetTitle(id)); node.Tag = id; nodeTree.Nodes.Add(node); AddNodes(c, node); } }
// Adds nodes for children of the given parent. private void AddNodes(Cluster c, TreeNode parent) { long parent_id = (long)parent.Tag; List<long> nodeList = c.GetChildNodes(parent_id); foreach (long id in nodeList) { TreeNode node = new TreeNode(c.GetTitle(id)); node.Tag = id; parent.Nodes.Add(node); AddNodes(c, node); } }
public MainWindow() { InitializeComponent(); m_clusterExplorer = new ClusterExplorer(this); m_clusterExplorer.Show(mainDockPanel, DockState.DockLeft); m_revisionViewer = new RevisionViewer(this); m_revisionViewer.Show(mainDockPanel, DockState.DockLeft); m_tagViewer = new TagViewer(this); m_tagViewer.Show(mainDockPanel, DockState.DockLeft); m_currentCluster = null; }
// Open an existing cluster file private void openMenuItem_Click(object sender, EventArgs e) { //Create a dialog to prompt the user to open an existing file. OpenFileDialog openFile = new OpenFileDialog(); openFile.Filter = "Clusterpad Cluster|*.cpc"; openFile.Title = "Open Cluster"; if (openFile.ShowDialog() == DialogResult.OK) { // If a cluster is currently open, check to see if items // need to be saved and closed. if (m_currentCluster != null) { if (!CanClose()) { return; } } m_currentCluster = new Cluster(openFile.FileName); this.Text = "Clusterpad - " + Path.GetFileNameWithoutExtension(openFile.FileName); UpdateViewers(); } }
// Create a new cluster file private void newMenuItem_Click(object sender, EventArgs e) { // Create a dialog to prompt the user to make a new file. SaveFileDialog newFile = new SaveFileDialog(); newFile.Filter = "Clusterpad Cluster|*.cpc"; newFile.Title = "New Cluster"; if (newFile.ShowDialog() == DialogResult.OK) { // Display a message if the file already exists. if (File.Exists(newFile.FileName)) { MessageBox.Show("File already exists."); return; } else { // If a cluster is currently open, check to see if items // need to be saved and closed. if (m_currentCluster != null) { if (!CanClose()) { return; } } m_currentCluster = new Cluster(newFile.FileName); this.Text = "Clusterpad - " + Path.GetFileNameWithoutExtension(newFile.FileName); UpdateViewers(); } } }