/// <summary> /// Callback for highlighting a new item. /// Updates the text box on the main form. /// </summary> /// <param name="sender">sender object</param> /// <param name="e">SackPanelEventArgs data</param> private void NewItemHighlightedCallback(object sender, SackPanelEventArgs e) { Item item = e.Item; SackCollection sack = e.Sack; SackPanel sackPanel = (SackPanel)sender; if (item == null) { // Only do something if this sack is the "owner" of the current item highlighted. if (sack == this.lastSackHighlighted) { this.itemText.Text = string.Empty; // hide the tooltip this.tooltipText = null; this.tooltip.ChangeText(this.tooltipText); } } else { var result = ItemHtmlHelper.NewItemHighlightedTooltip(item); this.itemText.ForeColor = result.ForeColor; this.itemText.Text = result.FriendlyName; this.tooltipText = result.TooltipText; this.tooltip.ChangeText(this.tooltipText); } this.lastSackHighlighted = sack; this.lastSackPanelHighlighted = sackPanel; }
/// <summary> /// Returns a string containing the tool tip text for the highlighted result. /// </summary> /// <param name="selectedResult">Currently selected Result</param> /// <returns>String containing the tool tip for the Result.</returns> private string GetToolTip(Result selectedResult) { if (selectedResult == null || selectedResult.Item == null) { // hide the tooltip this.tooltipText = null; } else { var result = ItemHtmlHelper.NewItemHighlightedTooltip(selectedResult.Item); // show tooltip this.tooltipText = result.TooltipText; } return(this.tooltipText); }