Exemple #1
0
        private void RefreshTreeview()
        {
            treeView1.Nodes.Clear();
            if (_scmFile == null)
            {
                return;
            }

            TreeNode parentTreeNode = treeView1.Nodes.Add(Path.GetFileName(_scmFile.FileName));

            string[] allFiles = _scmFile.GetAllFiles();

            foreach (string f in allFiles)
            {
                TreeNode treeNode = parentTreeNode.Nodes.Add(f);
                if (!SCMFile.IsSupportedFile(f))
                {
                    treeNode.ForeColor = Color.LightGray;
                }
            }

            treeView1.ExpandAll();
            if (parentTreeNode.Nodes.Count > 0)
            {
                treeView1.SelectedNode = parentTreeNode.Nodes[0];
            }
            else
            {
                CloseAll();
            }
        }
Exemple #2
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if ((treeView1.Nodes.Count <= 0) || (e.Node == treeView1.Nodes[0]))
            {
                return;
            }

            _currentFilename = e.Node.Text;

            try
            {
                Cursor.Current = Cursors.WaitCursor;

                // Reorder current map file if its loaded
                if (_mapFile != null)
                {
                    ucSingleEdit1.SaveState();
                }

                ucSingleEdit1.Clear();

                _mapFile   = null;
                _otherFile = null;

                if (SCMFile.IsSupportedFile(_currentFilename))
                {
                    if (SCMFile.IsChannelMapFile(_currentFilename))
                    {
                        WriteStatus("Reading channels...");
                        if (OpenMapFile(_currentFilename))
                        {
                            WriteChanels();
                        }
                    }
                    else
                    {
                        WriteStatus("Reading file...");
                        if (OpenOtherFile(_currentFilename))
                        {
                            WriteOtherFile();
                        }
                    }
                }
                else
                {
                    WriteStatus("File not supported.");
                }
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }