Skip to content

Commit

Permalink
After booting up, GameActivity reports Afterburner "is logging but no…
Browse files Browse the repository at this point in the history
…t running" #63
  • Loading branch information
Lacro59 committed Nov 17, 2021
1 parent 1b42088 commit 27c70a9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
25 changes: 22 additions & 3 deletions source/GameActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
using CommonPluginsShared.Controls;
using CommonPlayniteShared.Common;
using CommonPluginsShared.Extensions;
using System.Threading;

namespace GameActivity
{
Expand All @@ -31,7 +32,7 @@ public class GameActivity : PluginExtended<GameActivitySettingsViewModel, Activi
public override Guid Id { get; } = Guid.Parse("afbb1a0d-04a1-4d0c-9afa-c6e42ca855b4");

// Variables timer function
public Timer t { get; set; }
public System.Timers.Timer t { get; set; }
private GameActivities GameActivitiesLog;
public List<WarningData> WarningsMessage { get; set; } = new List<WarningData>();

Expand Down Expand Up @@ -190,7 +191,7 @@ public void DataLogging_start()
logger.Info("DataLogging_start");

WarningsMessage = new List<WarningData>();
t = new Timer(PluginSettings.Settings.TimeIntervalLogging * 60000);
t = new System.Timers.Timer(PluginSettings.Settings.TimeIntervalLogging * 60000);
t.AutoReset = true;
t.Elapsed += new ElapsedEventHandler(OnTimedEvent);
t.Start();
Expand Down Expand Up @@ -892,7 +893,25 @@ public override void OnGameStopped(OnGameStoppedEventArgs args)
// Add code to be executed when Playnite is initialized.
public override void OnApplicationStarted(OnApplicationStartedEventArgs args)
{
CheckGoodForLogging(true);
Task.Run(() =>
{
if (!CheckGoodForLogging(false))
{
Thread.Sleep(10000);
if (!CheckGoodForLogging(false))
{
Thread.Sleep(10000);
if (!CheckGoodForLogging(false))
{
Thread.Sleep(10000);
Application.Current.Dispatcher.BeginInvoke((Action)delegate
{
CheckGoodForLogging(true);
});
}
}
}
});
}

// Add code to be executed when Playnite is shutting down.
Expand Down

0 comments on commit 27c70a9

Please sign in to comment.