Beispiel #1
0
        private void treeView1_DragDrop(object sender, DragEventArgs e)
        {
            if (!(e.Data.GetDataPresent("FileNameW")))
            {
                MessageBox.Show("Nothing loadable found.", "Open file", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            var data = e.Data.GetData("FileNameW") as string[];

            if (data == null || data.Length <= 0)
            {
                MessageBox.Show("Nothing loadable found.", "Open file", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
#if DEBUG
            this.LoadCs(data[0]);
#else
            try
            {
                this.LoadCs(data[0]);
            }
            catch (Exception ex)
            {
                this.code_tree = null;
                var s = new StringBuilder();
                s.AppendLine("EXCEPTION:");
                s.AppendLine(string.Format("Type: {0}", ex.GetType().Name));
                s.AppendLine(string.Format("Message: {0}", ex.Message));
                s.AppendLine();
                s.AppendLine(ex.ToString());
                txtResult.Text = s.ToString();
                MessageBox.Show(string.Format("Failed to load \"{0}\".", data[0]), "Open file", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
#endif
        }
Beispiel #2
0
 private void LoadCs(string filename)
 {
     code_tree = CodeSearchTree.Node.CreateTreeFromFile(filename);
     treeView1.BeginUpdate();
     treeView1.Nodes.Clear();
     foreach (var code_tree_node in code_tree)
     {
         var treeview_node = treeView1.Nodes.Add(code_tree_node.ToString());
         treeview_node.Tag = code_tree_node;
         this.ConstructChildren(treeview_node, code_tree_node);
     }
     treeView1.EndUpdate(); //Detta är av någon märklig anlednign leading för treeView1.EndUpdate();
 }