You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
47 lines
1.1 KiB
1 week ago
|
using Avalonia;
|
||
|
using Avalonia.Controls;
|
||
|
using Avalonia.Input;
|
||
|
using Avalonia.Interactivity;
|
||
|
using Avalonia.Markup.Xaml;
|
||
|
using Avalonia.Media.Imaging;
|
||
|
using Avalonia.Threading;
|
||
|
using System;
|
||
|
|
||
|
namespace Bodk.Ava.UI.Views;
|
||
|
|
||
|
public partial class MainWindow : Window
|
||
|
{
|
||
|
private DispatcherTimer _hideMouseTimer;
|
||
|
public MainWindow()
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
this.Loaded += MainWindow_Loaded;
|
||
|
// ��ʼ����ʱ�����趨2������������
|
||
|
_hideMouseTimer = new DispatcherTimer
|
||
|
{
|
||
|
Interval = TimeSpan.FromSeconds(2)
|
||
|
};
|
||
|
_hideMouseTimer.Tick += (sender, e) => HideMouse();
|
||
|
|
||
|
// ���������ƶ��¼�
|
||
|
this.PointerMoved += OnPointerMoved;
|
||
|
}
|
||
|
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
||
|
{
|
||
|
this.Cursor = new Cursor(StandardCursorType.None);
|
||
|
}
|
||
|
|
||
|
private void OnPointerMoved(object sender, PointerEventArgs e)
|
||
|
{
|
||
|
this.Cursor = new Cursor(StandardCursorType.Arrow);
|
||
|
|
||
|
_hideMouseTimer.Stop();
|
||
|
_hideMouseTimer.Start();
|
||
|
}
|
||
|
|
||
|
private void HideMouse()
|
||
|
{
|
||
|
this.Cursor = new Cursor(StandardCursorType.None);
|
||
|
}
|
||
|
|
||
|
}
|