public static IReadOnlyList <SystemTrayAction> FindAllActions() { var actions = new List <SystemTrayAction> { new SystemTrayAction { Name = "Profile", Action = () => { Process.Start(OpenProfile); } }, new SystemTrayAction { Name = "Control Panel", Action = () => { Process.Start(OpenControlPanel); } }, new SystemTrayAction { Name = "Refresh Games", Action = () => { GameStore.ReloadGamesFromCentralRepository(); } }, new SystemTrayAction { Name = "Rematch Process Sessions", Action = () => { new UserActivityBackfiller().Backfill(); } }, }; if (!AddToStartupAction.ShortcutExists()) { actions.Add(new SystemTrayAction { Name = "Add to startup", Action = () => { AddToStartupAction.Execute(); } }); } actions.Add(new SystemTrayAction { Name = "Exit", Action = () => { Application.Exit(); Program.CloseServiceToken.Cancel(); } }); return(actions); }
public GameTrackerService() { GamesDataUpdateTimer = new System.Timers.Timer(TimeSpan.FromDays(1).TotalMilliseconds) { AutoReset = true }; GamesDataUpdateTimer.Elapsed += (sender, args) => GameStore.ReloadGamesFromCentralRepository(); ProcessScannerTimer = new System.Timers.Timer(AppSettings.Instance.ProcessScanIntervalInSeconds * 1000) { AutoReset = true }; ProcessScannerTimer.Elapsed += (sender, args) => { new ProcessScanner().ScanProcesses(ProcessScannerTimer); }; UserActivityFileMonitor = new HostFileChangeMonitor(new[] { UserActivityStore.DataFilePath }.ToList()); UserActivityFileMonitor.NotifyOnChanged((_) => { AllUserActivityCache.CancellationTokenSource.Cancel(); }); WebAssetsFileMonitor = new HostFileChangeMonitor(WebAssets.AllAssetPaths.ToArray()); WebAssetsFileMonitor.NotifyOnChanged((_) => { WebAssets.CancellationTokenSource.Cancel(); }); WebHost = new WebHostBuilder() .UseKestrel() .UseStartup <WebHostConfiguration>() .UseConfiguration(AppSettings.Instance.Configuration) .UseSerilog() .UseUrls(WebHostListenAddress) .Build(); }
public async Task <ActionResult <ReloadGamesMetadataResponse> > ReloadGames() { await GameStore.ReloadGamesFromCentralRepository(); return(new ReloadGamesMetadataResponse { Success = true }); }
public Task StartAsync(CancellationToken cancellationToken) { LogUsefulInformation(); ProcessScannerTimer.Start(); GamesDataUpdateTimer.Start(); Task.Delay(1000).ContinueWith(x => GameStore.ReloadGamesFromCentralRepository()); WebHost.StartAsync(cancellationToken).ContinueWith((func) => PrefetchUserProfile()); Application.Run(new SystemTrayForm()); return(Task.CompletedTask); }