Ejemplo n.º 1
0
        protected override async void OnExit(ExitEventArgs e)
        {
            await WpfApp.Instance.Stop();

            TrayIconContextMenuView.Close();
            base.OnExit(e);
        }
Ejemplo n.º 2
0
        protected override async void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            if (!CheckIsNet45Installed())
            {
                var message = "This application require .NET Framework 4.5 or above. Would you like to install the latest version of .NET Framework now?";
                var caption = ".NET Framework 4.5 is not installed";

                if (MessageBox.Show(message, caption, MessageBoxButton.YesNo, MessageBoxImage.Error) == MessageBoxResult.Yes)
                {
                    var downloadUrl = "https://www.microsoft.com/en-US/download/details.aspx?id=49981";
                    Process.Start(downloadUrl);
                }

                Process.GetCurrentProcess().Kill();
                return;
            }

            await WpfApp.Instance.Startup(e.Args);

            var trayIcon = new TrayIconContextMenuView();

            if (WpfApp.Instance.FirstStart)
            {
                trayIcon.ShowBalloonTip();
            }

            RefreshTrayArea();
        }