0
私は、ITセキュリティポリシーのために「セッション休止タイムアウト」を実装しようと必死になっています。 sss しかし、私の非アクティブリセットロジックは起動していません。私は間違って何をしていますか? Silverlightバイナリに接続するとVisual Studioがクラッシュするため、ブレークポイントを付加できません。アプリケーションのコンストラクタが呼び出されたときなど、問題が非常に微妙なものかどうか、私はまだ「現在のRootVisual」はないと思っています。 #Silverlightは死んでいる/陳腐化しているので、#WPFでタグ付けすることもできます。以下のサンプルコード。Silverlightグローバルマウスダウンイベントハンドラー
namespace TestApp
{
public partial class App : Application
{
System.Windows.Threading.DispatcherTimer sessionTimer = new System.Windows.Threading.DispatcherTimer();
public App()
{
ResetSessionTimer();
this.RootVisual.AddHandler(UIElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(rootVisual_MouseLeftButtonDown), true);
//this.RootVisual.MouseLeftButtonDown += rootVisual_MouseLeftButtonDown;
InitializeComponent();
}
private void ResetSessionTimer()
{
sessionTimer.Stop();
sessionTimer.Tick -= sessionTimer_Tick;
sessionTimer = new System.Windows.Threading.DispatcherTimer();
sessionTimer.Interval = TimeSpan.FromMinutes(1);
sessionTimer.Tick += sessionTimer_Tick;
sessionTimer.Start();
}
private void sessionTimer_Tick(object sender, EventArgs e)
{
System.Windows.Browser.HtmlPage.Document.GetElementById("LogoutButton").Invoke("click", null);
}
private void rootVisual_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
// added this alert to see if code is even firing.
System.Windows.Browser.HtmlPage.Window.Invoke("alert", "hello, world");
ResetSessionTimer();
e.Handled = false;
}
}
}