SystemAnnouncementView.xaml.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using Muchinfo.MTPClient.Account.ViewModels;
  2. using Muchinfo.MTPClient.Data.Model;
  3. using Muchinfo.MTPClient.Infrastructure.Windows;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Data;
  11. using System.Windows.Documents;
  12. using System.Windows.Input;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Imaging;
  15. using System.Windows.Navigation;
  16. using System.Windows.Shapes;
  17. using Muchinfo.WPF.Controls.Windows;
  18. namespace Muchinfo.MTPClient.Account.Views
  19. {
  20. /// <summary>
  21. /// SystemAnnouncement.xaml 的交互逻辑
  22. /// </summary>
  23. public partial class SystemAnnouncementView : WindowBase
  24. {
  25. public SystemAnnouncementView(System.Collections.ObjectModel.ObservableCollection<Announcement> announcementList )
  26. {
  27. InitializeComponent();
  28. this.DataContext = new SystemAnnouncementViewModel(announcementList);
  29. this.Closing+=SystemAnnouncementView_Closing;
  30. }
  31. public SystemAnnouncementView()
  32. {
  33. InitializeComponent();
  34. this.DataContext = new SystemAnnouncementViewModel();
  35. this.Closing+=SystemAnnouncementView_Closing;
  36. }
  37. void SystemAnnouncementView_Closing(object sender, System.ComponentModel.CancelEventArgs e)
  38. {
  39. e.Cancel = false;
  40. this.WindowState = WindowState.Minimized;
  41. this.Opacity = 0;
  42. }
  43. public void Shows()
  44. {
  45. this.WindowState = WindowState.Normal;
  46. this.Opacity = 1;
  47. }
  48. new public bool? ShowDialog()
  49. {
  50. Shows();
  51. return true;
  52. }
  53. }
  54. }