async Task <UsageModel> GetCurrentReport(UsageData data) { var current = data.Reports.FirstOrDefault(x => x.Dimensions.Date.Date == DateTimeOffset.Now.Date); if (current == null) { var guid = await service.GetUserGuid(); current = UsageModel.Create(guid); data.Reports.Add(current); } current.Dimensions.Lang = CultureInfo.InstalledUICulture.IetfLanguageTag; current.Dimensions.CurrentLang = CultureInfo.CurrentCulture.IetfLanguageTag; current.Dimensions.AppVersion = AssemblyVersionInformation.Version; current.Dimensions.VSVersion = vsservices.VSVersion; if (connectionManager.Connections.Any(x => x.HostAddress.IsGitHubDotCom())) { current.Dimensions.IsGitHubUser = true; } if (connectionManager.Connections.Any(x => !x.HostAddress.IsGitHubDotCom())) { current.Dimensions.IsEnterpriseUser = true; } return(current); }
async Task <UsageModel> UpdateModelUserData(UsageModel model) { model.Guid = await service.GetUserGuid(); if (connectionManager.Connections.Any(x => x.HostAddress.IsGitHubDotCom())) { model.IsGitHubUser = true; } if (connectionManager.Connections.Any(x => !x.HostAddress.IsGitHubDotCom())) { model.IsEnterpriseUser = true; } return(model); }
async Task <UsageModel> GetCurrentReport(UsageData data) { var current = data.Reports.FirstOrDefault(x => x.Dimensions.Date.Date == DateTimeOffset.Now.Date); if (current == null) { var guid = await service.GetUserGuid(); current = UsageModel.Create(guid); data.Reports.Add(current); } current.Dimensions.Lang = CultureInfo.InstalledUICulture.IetfLanguageTag; current.Dimensions.CurrentLang = CultureInfo.CurrentCulture.IetfLanguageTag; current.Dimensions.CurrentUILang = CultureInfo.CurrentUICulture.IetfLanguageTag; current.Dimensions.AppVersion = ExtensionInformation.Version; current.Dimensions.VSVersion = vsservices.VSVersion; current.Dimensions.IsGitHubUser = IsGitHubUser; current.Dimensions.IsEnterpriseUser = IsEnterpriseUser; return(current); }