App.xaml.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using EEMSUIClient.Services;
  2. using EEMSUIClient.Views;
  3. using Hardcodet.Wpf.TaskbarNotification;
  4. using System.Configuration;
  5. using System.Data;
  6. using System.Windows;
  7. namespace EEMSUIClient
  8. {
  9. /// <summary>
  10. /// Interaction logic for App.xaml
  11. /// </summary>
  12. public partial class App : PrismApplication
  13. {
  14. protected override Window CreateShell()
  15. {
  16. return Container.Resolve<MainWindow>();
  17. }
  18. protected override void RegisterTypes(IContainerRegistry containerRegistry)
  19. {
  20. containerRegistry.RegisterSingleton<ITrayControl, TrayController>();
  21. }
  22. protected override void OnInitialized()
  23. {
  24. base.OnInitialized();
  25. Container.Resolve<ITrayControl>().Tray = (TaskbarIcon)App.Current.FindResource("TrayIcon");
  26. Container.Resolve<ITrayControl>().ShowBalloonTip();
  27. }
  28. private void TrayIcon_TrayMouseDoubleClick(object sender, RoutedEventArgs e)
  29. {
  30. Container.Resolve<ITrayControl>().ShowMainWindow();
  31. }
  32. private void ShowMenu_Click(object sender, RoutedEventArgs e)
  33. {
  34. Container.Resolve<ITrayControl>().ShowMainWindow();
  35. }
  36. private void ExitMenu_Click(object sender, RoutedEventArgs e)
  37. {
  38. Container.Resolve<ITrayControl>().Exit();
  39. }
  40. private void OnExit(object sender, ExitEventArgs e)
  41. {
  42. Container.Resolve<ITrayControl>().Dispose();
  43. }
  44. }
  45. }