NoticeView.xaml.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using GalaSoft.MvvmLight.Messaging;
  2. using Muchinfo.MTPClient.Data.Enums;
  3. using Muchinfo.MTPClient.Data.Model.Message;
  4. using Muchinfo.MTPClient.Infrastructure.Windows;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows;
  10. using System.Windows.Controls;
  11. using System.Windows.Data;
  12. using System.Windows.Documents;
  13. using System.Windows.Input;
  14. using System.Windows.Media;
  15. using System.Windows.Media.Imaging;
  16. using System.Windows.Shapes;
  17. using Muchinfo.MTPClient.Infrastructure.Helpers;
  18. using Muchinfo.MTPClient.Resources;
  19. namespace Muchinfo.MTPClient.Account.Views
  20. {
  21. /// <summary>
  22. /// NoticeView.xaml 的交互逻辑
  23. /// </summary>
  24. public partial class NoticeView : TradeAccountWindow
  25. {
  26. public NoticeView( )
  27. {
  28. InitializeComponent();
  29. this.Loaded+=NoticeView_Loaded;
  30. this.Closing+=NoticeView_Closing;
  31. }
  32. void NoticeView_Closing(object sender, System.ComponentModel.CancelEventArgs e)
  33. {
  34. e.Cancel = true;
  35. this.Visibility = Visibility.Hidden;
  36. }
  37. void NoticeView_Loaded(object sender, RoutedEventArgs e)
  38. {
  39. SetWindow();
  40. }
  41. public void SetWindow()
  42. {
  43. double m_ScreenWidth = SystemParameters.WorkArea.Width;
  44. double m_ScreenHeight = SystemParameters.WorkArea.Height;
  45. this.Left = m_ScreenWidth - this.Width - 1.5;
  46. this.Top = m_ScreenHeight - this.Height - 1.5;
  47. }
  48. public void Shows()
  49. {
  50. if (this.Visibility == Visibility.Hidden)
  51. {
  52. SetWindow();
  53. this.Visibility = Visibility.Visible;
  54. }
  55. }
  56. private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
  57. {
  58. this.Close();
  59. var notice = this.DataContext as NoticeMsg;
  60. if (notice != null && !notice.IsClicked)
  61. {
  62. MessengerHelper.DefaultSend(notice, MessengerTokens.AnnouncementDetail);
  63. }
  64. }
  65. }
  66. }