Getting inactivity/idle time in a WPF application

前端 未结 4 1521
花落未央
花落未央 2021-01-02 07:20

I was looking for the best approach to find out the if my users are idle in my WPF application. Currently, I take this idle time from operating system, and if they minimize

4条回答
  •  情歌与酒
    2021-01-02 07:57

    public MainWindow()
        {
            InitializeComponent();
            ComponentDispatcher.ThreadIdle += new System.EventHandler(ComponentDispatcher_ThreadIdle);
        }
    
    void ComponentDispatcher_ThreadIdle(object sender, EventArgs e)
        {
            //do your idle stuff here
        }
    

提交回复
热议问题