Quantcast
Channel: Caliburn.Micro: Xaml Made Easy
Viewing all articles
Browse latest Browse all 1760

New Post: Auto Logout on user inactivity

$
0
0
In my Silverlight App I need an auto logout on userinactivity. I tried the solution with mouse move event in the shell view model:
private void StartAutoLogoutTimer()
      {
         Timer = DateTime.Now;
         _Logouttimer.Tick += _Logouttimer_Tick;
         _Logouttimer.Interval = TimeSpan.FromSeconds( 60 );
         _Logouttimer.Start();
      }

      private void StopAutoLogoutTimer()
      {
         _Logouttimer.Stop();
         _Logouttimer.Tick -= _Logouttimer_Tick;
      }

      private void _Logouttimer_Tick( object sender, EventArgs e )
      {
         try
         {
            if ( ( System.DateTime.Now - Timer ) > new TimeSpan( 0, 10, 0 ) )
            {
               Logout();
            }
         }
         catch ( Exception ex )
         {

         }
      }

      public void OnMouseMove()
      {
         Timer = DateTime.Now;
      }
The problem is that I do not get mouse move events when child windows (dialogs) are opened because only the Shell has implemented the mouse move event - and I really do not want to implement the mouse move event in each dialog/window. Somebody has a hint/example of how this can be done? Perhaps not using mouse move event?

Viewing all articles
Browse latest Browse all 1760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>