public void SaveProfile() { if (!System.IO.Directory.Exists(ConfigDirectory)) { System.IO.Directory.CreateDirectory(ConfigDirectory); } var x = new LauncherProfileCollection(); x.ProfileList = LauncherVM.LauncherProfileList.ToList(); x.SelectedProfileKey = LauncherVM.SelectedLauncherProfile.Key; var SelectedItem = x.ProfileList.Single(y => y.Key == x.SelectedProfileKey); SelectedItem.ProfileName = LauncherVM.ProfileName; SelectedItem.Dob = LauncherVM.Dob; SelectedItem.DvaNumber = LauncherVM.DvaNumber; SelectedItem.Family = LauncherVM.Family; SelectedItem.Gender = LauncherVM.Gender; SelectedItem.Ihi = LauncherVM.Ihi; SelectedItem.MedicareNumber = LauncherVM.MedicareNumber; SerializerSupport.SerializeTo(PatientProfileFilePath, x, x.GetType()); LoadProfiles(); }
public void LoadProfiles() { LauncherProfileCollection LoadedProfiles = SerializerSupport.DeserializeFrom <LauncherProfileCollection>(PatientProfileFilePath); if (LoadedProfiles != null) { var LauncherProfileList = new System.Collections.ObjectModel.ObservableCollection <LauncherProfile>(LoadedProfiles.ProfileList); LauncherVM.SelectedProfileName = LoadedProfiles.ProfileList.Single(x => x.Key == LoadedProfiles.SelectedProfileKey).ProfileName; LauncherVM.LauncherProfileList = LauncherProfileList; LauncherVM.SelectedLauncherProfile = LoadedProfiles.ProfileList.Single(x => x.Key == LoadedProfiles.SelectedProfileKey); LauncherVM.ProfileName = LauncherVM.SelectedLauncherProfile.ProfileName; LauncherVM.Dob = LauncherVM.Dob; LauncherVM.DvaNumber = LauncherVM.SelectedLauncherProfile.DvaNumber; LauncherVM.Family = LauncherVM.SelectedLauncherProfile.Family; LauncherVM.Gender = LauncherVM.SelectedLauncherProfile.Gender; LauncherVM.Ihi = LauncherVM.SelectedLauncherProfile.Ihi; LauncherVM.MedicareNumber = LauncherVM.SelectedLauncherProfile.MedicareNumber; } else { NewProfile(); } }