public void RecordWorst(ICheckable o, CheckResult result) { lock (checkResultsDictionary) { if (checkResultsDictionary.ContainsKey(o)) { checkResultsDictionary.Remove(o); } checkResultsDictionary.Add(o, result); if (_tree.IndexOf(o) != -1) { _tree.RefreshObject(o); } } }
void _activator_Emphasise(object sender, EmphasiseEventArgs args) { var rootObject = _activator.GetRootObjectOrSelf(args.Request.ObjectToEmphasise); // unpin first if there is somthing pinned, so we find our object! if (_pinFilter != null && _activator.IsRootObjectOfCollection(_collection, rootObject)) { _pinFilter.UnApplyToTree(); } //get the parental hierarchy var decendancyList = CoreChildProvider.GetDescendancyListIfAnyFor(args.Request.ObjectToEmphasise); if (decendancyList != null) { //for each parent in the decendandy list foreach (var parent in decendancyList.Parents) { //parent isn't in our tree if (Tree.IndexOf(parent) == -1) { return; } //parent is in our tree so make sure it's expanded Tree.Expand(parent); } } //tree doesn't contain object even after expanding parents int index = Tree.IndexOf(args.Request.ObjectToEmphasise); if (index == -1) { return; } if (args.Request.ExpansionDepth > 0) { try { Tree.BeginUpdate(); ExpandToDepth(args.Request.ExpansionDepth, args.Request.ObjectToEmphasise); } finally { Tree.EndUpdate(); } } if (args.Request.Pin && Settings.AllowPinning) { Pin(args.Request.ObjectToEmphasise, decendancyList); } //update index now pin filter is applied index = Tree.IndexOf(args.Request.ObjectToEmphasise); //select the object and ensure it's visible Tree.SelectedObject = args.Request.ObjectToEmphasise; Tree.EnsureVisible(index); args.Sender = Tree.FindForm(); }