public ConditionMatch ProfileMatches(int?storedProfile) { if (storedProfile == null) { return(ConditionMatch.Exact); } if (UserProfiles == null) { return(ConditionMatch.No); } return(UserProfiles.Contains(storedProfile) ? ConditionMatch.Exact : ConditionMatch.No); }
public UserProfileManager() { _userProfileFilePath = Path.Combine(Directory.GetCurrentDirectory(), @"UserProfile.json"); _companyProfileFilePath = Path.Combine(Directory.GetCurrentDirectory(), @"CompanyProfile.json"); CompanyProfiles = LoadCompanyProfiles(_companyProfileFilePath); UserProfiles = LoadUserProfiles(_userProfileFilePath); DataProviders = LoadUserProviders(UserProfiles); NewAccountViewModel.WhenNewProfileAdded.Subscribe((newProfile) => { if (UserProfiles.Contains(newProfile)) { var profile = UserProfiles.FirstOrDefault((p) => p.Equals(newProfile)); profile.Accounts = profile.Accounts.Union(newProfile.Accounts).ToList(); } else { UserProfiles.Add(newProfile); } SaveUserProfile(); }); }