Expose BalloonTip events to the outside world

This commit is contained in:
Paddy Xu
2017-06-09 21:40:10 +03:00
committed by Emanuel Alves
parent eb6524f15c
commit ad083d8a57

View File

@@ -47,9 +47,25 @@ namespace QuickLook
_icon.Visible = false;
}
public void ShowNotification(string title, string content, bool isError = false)
public void ShowNotification(string title, string content, bool isError = false, Action clickEvent = null,
Action closeEvent = null)
{
_icon.ShowBalloonTip(5000, title, content, isError ? ToolTipIcon.Error : ToolTipIcon.Info);
_icon.BalloonTipClicked += OnIconOnBalloonTipClicked;
_icon.BalloonTipClosed += OnIconOnBalloonTipClosed;
void OnIconOnBalloonTipClicked(object sender, EventArgs e)
{
clickEvent?.Invoke();
_icon.BalloonTipClicked -= OnIconOnBalloonTipClicked;
}
void OnIconOnBalloonTipClosed(object sender, EventArgs e)
{
closeEvent?.Invoke();
_icon.BalloonTipClosed -= OnIconOnBalloonTipClosed;
}
}
internal static TrayIconManager GetInstance()