public void Annotation_ToString() { IAnnotation annotation = Annotation.FromDescription("MyAnnotationText"); Assert.Contains("MyAnnotationText", annotation.ToString()); Dictionary <string, IAttributeValue> attributes = new Dictionary <string, IAttributeValue>(); attributes.Add( "MyStringAttributeKey", AttributeValue <string> .Create("MyStringAttributeValue")); annotation = Annotation.FromDescriptionAndAttributes("MyAnnotationText2", attributes); Assert.Contains("MyAnnotationText2", annotation.ToString()); Assert.Contains(Collections.ToString(attributes), annotation.ToString()); }
private void annotationsListView_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e) { if (currentSpectrum.AnnotationList.Count <= e.ItemIndex) { e.Item = new ListViewItem("error"); return; } IAnnotation annotation = currentSpectrum.AnnotationList[e.ItemIndex]; e.Item = new ListViewItem(new string[] { "", annotation.ToString() }); // weird workaround for unchecked checkboxes to display in virtual mode e.Item.Checked = true; e.Item.Checked = annotation.Enabled; if (annotation.Enabled) { e.Item.ForeColor = Control.DefaultForeColor; } else { e.Item.ForeColor = Color.Gray; } }