private void GetInstalledApplications() { var appNames = Registry_Functions.GetKeyNames(); if (appNames != null) { foreach (var appName in appNames) { var valueNames = Registry_Functions.GetValueNames(appName); var item = new UpdateItem(); item.ApplyClicked += Apply; item.CheckForUpdatesClicked += Check; item.ApplicationName = appName; item.ApplicationTitle = GetValueData(valueNames.ToList().Find(x => x == "title"), appName); item.ApplicationSubtitle = GetValueData(valueNames.ToList().Find(x => x == "subtitle"), appName); string lastUpdated = GetValueData(valueNames.ToList().Find(x => x == "update_last_checked"), appName); string lastInstalled = GetValueData(valueNames.ToList().Find(x => x == "update_last_installed"), appName); if (!String.IsNullOrEmpty(lastUpdated)) { item.UpdateLastChecked = lastUpdated; } if (!String.IsNullOrEmpty(lastInstalled)) { item.UpdateLastInstalled = lastInstalled; } CheckForDownloadedUpdates(item); // Make sure that TrakHound Client/Bundle is first if (appName == ApplicationNames.TRAKHOUND_BUNDLE) { UpdateItems.Insert(0, item); } else { UpdateItems.Add(item); } } } }
private void CheckForDownloadedUpdates(UpdateItem item) { string appName = item.ApplicationName; var valueNames = Registry_Functions.GetValueNames(appName); if (valueNames != null) { var updatePath = valueNames.ToList().Exists(x => x == "update_path"); if (updatePath) { string version = GetValueData(valueNames.ToList().Find(x => x == "update_version"), appName); item.Loading = false; item.UpdateAvailable = true; item.Status = version + " Update Ready"; } } }
private void CheckTimestamps(UpdateItem item) { string appName = item.ApplicationName; var valueNames = Registry_Functions.GetValueNames(appName); if (valueNames != null) { string lastUpdated = GetValueData(valueNames.ToList().Find(x => x == "update_last_checked"), appName); string lastInstalled = GetValueData(valueNames.ToList().Find(x => x == "update_last_installed"), appName); if (!String.IsNullOrEmpty(lastUpdated)) { item.UpdateLastChecked = lastUpdated; } if (!String.IsNullOrEmpty(lastInstalled)) { item.UpdateLastInstalled = lastInstalled; } } }
private static string GetValueData(string valueName, string appName) { return(Registry_Functions.GetValue(valueName, appName)); }