private async void Timer_Tick(object sender, EventArgs e)
 {
     await Window.Dispatcher.InvokeAsync(() =>
     {
         if (Mouse.LeftButton == MouseButtonState.Released)
         {
             IsInSizeChanging     = false;
             timer.IsEnabled      = false;
             Mouse.OverrideCursor = null;
             return;
         }
         else
         {
             DirectionType directionType = GetDirectionType(isOperatingBorder).Item1;
             Point point = WindowsTool.GetPositionFull();
             if (directionType == DirectionType.Top || directionType == DirectionType.TopLeft || directionType == DirectionType.TopRight)
             {
                 SetWindowSize(0, point);
             }
             if (directionType == DirectionType.Buttom || directionType == DirectionType.ButtomLeft || directionType == DirectionType.ButtomRight)
             {
                 SetWindowSize(3, point);
             }
             if (directionType == DirectionType.Left || directionType == DirectionType.TopLeft || directionType == DirectionType.ButtomLeft)
             {
                 SetWindowSize(1, point);
             }
             if (directionType == DirectionType.Right || directionType == DirectionType.TopRight || directionType == DirectionType.ButtomRight)
             {
                 SetWindowSize(2, point);
             }
             SizeChanged?.Invoke(this, new EventArgs());
         }
     });
 }
 private void BorderChangeSize_MouseDown(object sender, MouseButtonEventArgs e)
 {
     IsInSizeChanging  = true;
     timer.IsEnabled   = true;
     isOperatingBorder = (Border)sender;
     firstPoint        = WindowsTool.GetPositionFull();
     area = new Rect(Window.Left, Window.Top, Window.Width, Window.Height);
 }
        /// <summary>
        /// 窗体加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window1_OnLoaded(object sender, RoutedEventArgs e)
        {
            if (File.Exists(CacheFileName))
            {
                RichTextBoxTool.Read(RichTextBox1, CacheFileName);
                SetCaption();
            }

            SkinM = new SkinManage().GetSkin(WindowSettings.BackColorName);

            //设置提醒
            if (WindowSettings.RemindDateTime != null)
            {
                SetRemind((DateTime)WindowSettings.RemindDateTime);
            }
            //窗体效果设置
            WindowsTool tool = new WindowsTool(this);

            tool.SetTopAutoShow(GridTitleBottom, GridTitle);
            tool.SetNotMax(GridTitle);
            tool.DragMove(GridTitle);

            RichTextBox1.Focus();

            //Visibility = WindowSettings.NotepadState == NotepadState.Visible
            //    ? Visibility.Visible
            //    : Visibility.Collapsed;
            if (WindowSettings.Left != 0)
            {
                Left = WindowSettings.Left;
            }
            if (WindowSettings.Left != 0)
            {
                Top = WindowSettings.Top;
            }
        }