|
|
@@ -75,70 +75,6 @@ public static class TooltipHelper
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// Shows the tooltip message on the UI.
|
|
|
- /// </summary>
|
|
|
- /// <param name="message">The message to display in the tooltip.</param>
|
|
|
- /// <param name="center">Determines whether the tooltip should be centered or aligned at the bottom.</param>
|
|
|
- /// <param name="interval">The duration for which the tooltip should be visible.</param>
|
|
|
- public static void ShowTooltipMessage(object message, bool center, TimeSpan interval)
|
|
|
- {
|
|
|
- var timer = new DispatcherTimer { Interval = interval };
|
|
|
- timer.Tick += (_, _) =>
|
|
|
- {
|
|
|
- if (!_isRunning)
|
|
|
- {
|
|
|
- Dispatcher.UIThread.Invoke(() =>
|
|
|
- {
|
|
|
- var toolTip = UIHelper.GetToolTipMessage;
|
|
|
- if (toolTip != null)
|
|
|
- {
|
|
|
- toolTip.Opacity = 0;
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- _isRunning = false;
|
|
|
- timer.Stop();
|
|
|
- };
|
|
|
- timer.Start();
|
|
|
-
|
|
|
- try
|
|
|
- {
|
|
|
- Dispatcher.UIThread.Invoke(() =>
|
|
|
- {
|
|
|
- var toolTip = UIHelper.GetToolTipMessage;
|
|
|
- if (toolTip is null)
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- _isRunning = true;
|
|
|
- toolTip.IsVisible = true;
|
|
|
- toolTip.ToolTipMessageText.Text = message.ToString();
|
|
|
- toolTip.Margin = center ? new Thickness(0) : new Thickness(0, 0, 0, 15);
|
|
|
- toolTip.VerticalAlignment = center ? VerticalAlignment.Center : VerticalAlignment.Bottom;
|
|
|
- toolTip.Opacity = 1;
|
|
|
- });
|
|
|
- }
|
|
|
- catch (Exception exception)
|
|
|
- {
|
|
|
-#if DEBUG
|
|
|
- Console.WriteLine($"{nameof(ShowTooltipMessage)} exception, \n{exception.Message}");
|
|
|
-#endif
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// Shows the tooltip message on the UI with a default duration of 2 seconds.
|
|
|
- /// </summary>
|
|
|
- /// <param name="message">The message to display in the tooltip.</param>
|
|
|
- /// <param name="center">Determines whether the tooltip should be centered or aligned at the bottom.</param>
|
|
|
- internal static void ShowTooltipMessage(object message, bool center = false)
|
|
|
- {
|
|
|
- ShowTooltipMessage(message, center, TimeSpan.FromSeconds(2));
|
|
|
- }
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// Shows the tooltip message on the UI with a default duration of 2 seconds.
|
|
|
/// </summary>
|