void RefreshThread(object o) { #if !PASSPORT_HEADER_ANALYSIS while (true) { Thread.Sleep(50 * 60 * 1000); // Wait 50 Minutes... //Thread.Sleep(1 * 60 * 1000); // Wait 1 Minute for test... LiveAuthClient client = this.AuthClient; if (client != null) { Traces.Main_TraceEvent(TraceEventType.Information, 1, "Try to refresh token!"); bool res = client.ForceRefreshToken(result => { // Result of refresh token Traces.Main_TraceEvent(TraceEventType.Information, 1, "RefreshToken Result: State: {0}, Status: {1}", result.State, result.Status); // Inform the others that the accesstoken has changed... // INFO: Do we need to synchronize the access to the token!? OnSessionChanged(); } ); if (res == false) { Traces.Main_TraceEvent(TraceEventType.Error, 1, "RefreshToken failed (false)"); } } } #endif }