using System;
using System.Collections.Generic;
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.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace PDF_Office.Views.PropertyPanel.ViewModular
{
    /// <summary>
    /// ReadViewContent.xaml 的交互逻辑
    /// </summary>
    public partial class ReadViewContent : UserControl
    {
        public ReadViewContent()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 鼠标移动到控件范围时显示控件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RectangleReadMode_MouseEnter(object sender, MouseEventArgs e)
        {
            Dispatcher.BeginInvoke(DispatcherPriority.Send, new Action(delegate
            {
                if (App.IsBookMode)
                {
                    this.ReadModeContent.Visibility = Visibility.Visible;
                    this.RectangleReadMode.Visibility = Visibility.Collapsed;
                }
            }));
        }

        /// <summary>
        /// 鼠标移开页面控件，三秒后隐藏该控件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void ReadModeContent_MouseLeave(object sender, MouseEventArgs e)
        {
            await System.Threading.Tasks.Task.Delay(3000);
            //Thread.Sleep(3000);
            this.ReadModeContent.Visibility = Visibility.Collapsed;
            this.RectangleReadMode.Visibility = Visibility.Visible;
        }

        private void UserControl_KeyDown(object sender, KeyEventArgs e)
        {
        }
    }
}