public static async Task<Note> CreateFromStorageFileAsync(StorageFile sf) { var n = new Note(); var docProps = await sf.Properties.GetDocumentPropertiesAsync(); var imgProps = await sf.Properties.GetImagePropertiesAsync(); var kind = sf.DisplayName.Contains("txt") ? NoteKind.Txt : sf.DisplayName.Contains("img") ? NoteKind.Img : NoteKind.Vmo; n.File = sf; n.CreationDate = imgProps.DateTaken.DateTime; n.NoteName = string.IsNullOrWhiteSpace(docProps.Title) ? null : docProps.Title; n.NoteDescription = string.IsNullOrWhiteSpace(docProps.Comment) ? null : docProps.Comment; n.Kind = kind; return n; }
public static async Task DeleteNoteAsync(Note n) { await n.File.DeleteAsync(StorageDeleteOption.PermanentDelete); }