KBWindow.xaml.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using LogoForceTestApp.Modules.MainModule.Models;
  2. using Prism.Events;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. using System.Windows.Controls;
  11. using System.Windows.Data;
  12. using System.Windows.Documents;
  13. using System.Windows.Forms;
  14. using System.Windows.Input;
  15. using System.Windows.Media;
  16. using System.Windows.Media.Imaging;
  17. using System.Windows.Shapes;
  18. using System.Windows.Threading;
  19. using TouchSocket.Core;
  20. using MouseEventArgs = System.Windows.Input.MouseEventArgs;
  21. namespace LogoForceTestApp.Modules.MainModule.Views
  22. {
  23. /// <summary>
  24. /// KBWindow.xaml 的交互逻辑
  25. /// </summary>
  26. public partial class KBWindow : Window
  27. {
  28. public KBWindow()
  29. {
  30. InitializeComponent();
  31. this.MouseMove += window_MouseMove;
  32. this.MouseDoubleClick += window_MouseDoubleClick;
  33. //btnMin.Click+=(s,e)=>{this.WindowState=WindowState.Minimized;};
  34. //btnMax.Click += (s, e) =>
  35. //{
  36. // if (this.WindowState == WindowState.Maximized)
  37. // {
  38. // this.WindowState = WindowState.Normal;
  39. // }
  40. // else
  41. // {
  42. // this.WindowState = WindowState.Maximized;
  43. // }
  44. //};
  45. btnClose.Click += (s, e) => { this.Close(); };
  46. this.datagrid_person.LoadingRow += new EventHandler<DataGridRowEventArgs>(this.datagrid_person_LoadingRow);
  47. }
  48. private void window_MouseDoubleClick(object sender, MouseButtonEventArgs e)
  49. {
  50. if (this.WindowState == WindowState.Normal)
  51. {
  52. this.WindowState = WindowState.Maximized;
  53. }
  54. else
  55. {
  56. this.WindowState = WindowState.Normal;
  57. }
  58. }
  59. private void window_MouseMove(object sender, MouseEventArgs e)
  60. {
  61. if (e.LeftButton == MouseButtonState.Pressed)
  62. {
  63. this.DragMove();
  64. }
  65. }
  66. private void datagrid_person_LoadingRow(object sender, DataGridRowEventArgs e)
  67. {
  68. e.Row.Header = e.Row.GetIndex() + 1;
  69. if ((int)e.Row.Header==1)
  70. {
  71. e.Row.Foreground = new SolidColorBrush(Colors.Yellow);
  72. }
  73. if ((int)e.Row.Header == 2)
  74. {
  75. e.Row.Foreground = new SolidColorBrush(Colors.Yellow);
  76. }
  77. if ((int)e.Row.Header == 3)
  78. {
  79. e.Row.Foreground = new SolidColorBrush(Colors.Yellow);
  80. }
  81. }
  82. }
  83. }