Example #1
0
 /// <summary>
 /// Removes a document from the tree view.
 /// </summary>
 /// <param name="documentId">The id of the document to be removed</param>
 /// <param name="items">The UI components the tree view consists of</param>
 public void RemoveDocument(int documentId, ItemCollection items)
 {
     foreach (TreeViewItem item in items)
     {
         object[] tag = (object[])item.Tag;
         if ((bool)tag[2] == false && int.Parse(tag[0].ToString()) == documentId)
         {
             items.Remove(item);
             return;
         }
         else if ((bool)tag[2] == true)
         {
             RemoveDocument(documentId, item.Items);
         }
     }
 }
Example #2
0
        private void Analyze(Assembly assembly, ItemCollection collection)
        {
            var item = new TreeViewItem();
            {
                item.Header = assembly.GetName().Name;
                item.Tag = assembly;
                collection.Add(item);
                item.PreviewMouseDown += (o, args) => PresentSummary(item);
            }
            foreach (Type type in assembly.GetExportedTypes())
                Analyze(type, item.Items);

            if (item.Items.Count == 0)
            {
                collection.Remove(item); // pruning assemblies without testcases
                return;
            }
            item.ContextMenu = InitContextMenu(item);
        }
Example #3
0
        void RemoveMenuItem(ItemCollection items, string header)
        {
            var m = Find(items, header);

            items.Remove(m);
        }