using LogoForceTestApp.Modules.MainModule.Models;
using Prism.Events;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;
using TouchSocket.Core;
using MouseEventArgs = System.Windows.Input.MouseEventArgs;

namespace LogoForceTestApp.Modules.MainModule.Views
{
    /// <summary>
    /// KBWindow.xaml 的交互逻辑
    /// </summary>
    public partial class KBWindow : Window
    {
        public KBWindow()
        {
            InitializeComponent();
            this.MouseMove += window_MouseMove;
            this.MouseDoubleClick += window_MouseDoubleClick;
            
            //btnMin.Click+=(s,e)=>{this.WindowState=WindowState.Minimized;};
            //btnMax.Click += (s, e) => 
            //{
            //    if (this.WindowState == WindowState.Maximized)
            //    {
            //        this.WindowState = WindowState.Normal;
            //    }
            //    else
            //    {
            //        this.WindowState = WindowState.Maximized;
            //    }
            //};
            btnClose.Click += (s, e) => { this.Close(); };
            this.datagrid_person.LoadingRow += new EventHandler<DataGridRowEventArgs>(this.datagrid_person_LoadingRow);

        }


        private void window_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (this.WindowState == WindowState.Normal)
            {
                this.WindowState = WindowState.Maximized;
            }
            else
            {
                this.WindowState = WindowState.Normal;
            }
        }

        private void window_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                this.DragMove();
            }
        }

        private void datagrid_person_LoadingRow(object sender, DataGridRowEventArgs e)
        {
            e.Row.Header = e.Row.GetIndex() + 1;
            if ((int)e.Row.Header==1)
            {
                e.Row.Foreground = new SolidColorBrush(Colors.Yellow);
            }
            if ((int)e.Row.Header == 2)
            {
                e.Row.Foreground = new SolidColorBrush(Colors.Yellow);
            }
            if ((int)e.Row.Header == 3)
            {
                e.Row.Foreground = new SolidColorBrush(Colors.Yellow);
            }
        }
    }
}