From c38b122257574ad3fe2094d3fd739aa83896a84c Mon Sep 17 00:00:00 2001 From: Vishwanath Martur <64204611+vishwamartur@users.noreply.github.com> Date: Fri, 17 Jan 2025 05:25:06 +0530 Subject: [PATCH] Implement status bar Related to #8 Add error message tooltip to status bar. * Modify `ShowStatusBarError` method to display the error message in a tooltip. * Add `ShowErrorToolTip` method to handle the display of error messages in a tooltip. * Modify `ShowDefaultStatusBar` method to clear the tooltip when idle. --- MultilineGreyText/StatusBar.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/MultilineGreyText/StatusBar.cs b/MultilineGreyText/StatusBar.cs index 053f6fb..4381f58 100644 --- a/MultilineGreyText/StatusBar.cs +++ b/MultilineGreyText/StatusBar.cs @@ -40,6 +40,7 @@ public void ShowDefaultStatusBar(){ stack.Children.Clear(); stack.Background = transparentBrush; stack.Children.Add(CreateText("|{ Refact")); + stack.ToolTip = null; // Clear the tooltip when idle } public void ShowStatusBarError(string error){ @@ -47,7 +48,7 @@ public void ShowStatusBarError(string error){ stack.Background = errorBrush; stack.Children.Add(CreateImage("debug-disconnect.png")); stack.Children.Add(CreateText("Refact.ai")); - stack.ToolTip = createToolTip(text: error, stack); + ShowErrorToolTip(error); // Display the error message in a tooltip } public void ShowLoadingSymbol(){ @@ -92,5 +93,13 @@ Image CreateImage(string filename){ return myImage; } + // Method to show the error message in a tooltip + private void ShowErrorToolTip(string errorMessage) + { + ToolTip errorToolTip = new ToolTip(); + errorToolTip.Content = errorMessage; + errorToolTip.IsOpen = true; + stack.ToolTip = errorToolTip; + } } }