main
 1using System;
 2using System.Windows;
 3using System.Windows.Controls.Primitives;
 4using System.Windows.Input;
 5using solidware.financials.windows.ui.views.icons;
 6
 7namespace solidware.financials.windows.ui.views
 8{
 9    public partial class Toast
10    {
11        bool isClosing;
12
13        public Toast()
14        {
15            InitializeComponent();
16            closeImage.apply_icon(UIIcon.Close);
17            infoImage.apply_icon(UIIcon.Info);
18            TrayIcon.AddBalloonClosingHandler(this, OnBalloonClosing);
19        }
20
21        void OnBalloonClosing(object sender, RoutedEventArgs e)
22        {
23            e.Handled = true;
24            isClosing = true;
25        }
26
27        void imgClose_MouseDown(object sender, MouseButtonEventArgs e)
28        {
29            TrayIcon.GetParentTaskbarIcon(this).CloseBalloon();
30        }
31
32        void grid_MouseEnter(object sender, MouseEventArgs e)
33        {
34            if (isClosing) return;
35            TrayIcon.GetParentTaskbarIcon(this).ResetBalloonCloseTimer();
36        }
37
38        void OnFadeOutCompleted(object sender, EventArgs e)
39        {
40            ((Popup) Parent).IsOpen = false;
41        }
42    }
43}