public void SaveResumeInResumes(Resume.Resume cv) { var temp = FindResume(cv.Name); if (temp != null) { Resumes.Remove(temp); Resumes.Insert(0, cv); } else { Resumes.Insert(0, cv); } }
public async void RemoveResume(Resume.Resume cv) { var temp = FindResume(cv.Name); if (temp != null) //si c'est un cv et pas un template { var storagelist = await FileManagement.GetResumeFoldersList(); foreach (var stlist in storagelist) { var files = await stlist.GetFilesAsync(); foreach (var file in files) { if (file.Name == cv.Name) { await file.DeleteAsync(); } } } Resumes.Remove(cv); } }
private async void Open_Import(object sender, RoutedEventArgs e) { FileOpenPicker openPicker = new FileOpenPicker() { ViewMode = PickerViewMode.Thumbnail, SuggestedStartLocation = PickerLocationId.DocumentsLibrary }; openPicker.FileTypeFilter.Add(".cv"); var ImportCV = await openPicker.PickSingleFileAsync(); if (ImportCV != null) { StorageFolder folder = await FileManagement.GetLocalResumeFolder(); await ImportCV.CopyAsync(folder, ImportCV.Name, NameCollisionOption.ReplaceExisting); var cv = await FileManagement.Read_file(Path.GetFileNameWithoutExtension(ImportCV.Name), folder); bool exist = false; foreach (Resume.Resume r in Resumes) { if (r.Name == cv.Name) { Resumes.Remove(r); Resumes.Insert(0, cv); exist = true; break; } } if (!exist) { Resumes.Add(cv); } } Window.Current.Content = new StartPage(); }