public async Task LoadNew(InkCanvas inkCanvas, InkCanvas goals, CommentModel commentModel, AnimationModel animationModel) { if (projectFolder != null) { var files = await projectFolder.GetFilesAsync(); foreach (StorageFile file in files) { if (file.Name.Equals("InkFile.gif")) { IRandomAccessStream stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read); using (var inputStream = stream.GetInputStreamAt(0)) { await inkCanvas.InkPresenter.StrokeContainer.LoadAsync(inputStream); } stream.Dispose(); } else if (file.Name.Equals("GoalsFile.gif")) { IRandomAccessStream stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read); using (var inputStream = stream.GetInputStreamAt(0)) { await goals.InkPresenter.StrokeContainer.LoadAsync(inputStream); } stream.Dispose(); } else if (file.Name.Equals("comments.txt")) { string text = await FileIO.ReadTextAsync(file); string[] components = text.Split('\n'); foreach (string component in components) { if (component.Length > 0) { Comment c = Deserialize <Comment>(component); commentModel.Add(c); Debug.WriteLine(commentModel.GetComments().Count()); } } } else if (file.Name.Equals("animations.txt")) { string text = await FileIO.ReadTextAsync(file); string[] components = text.Split('\n'); foreach (string component in components) { if (component.Length > 0) { Animation a = Deserialize <Animation>(component); animationModel.Add(a); } } } } foreach (StorageFile file in files) { if (file.Name.StartsWith("CommentInk")) { IRandomAccessStream stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read); using (var inputStream = stream.GetInputStreamAt(0)) { // first get the # of the ink Regex re = new Regex(@"\d+"); Match m = re.Match(file.Name); int inkPos = int.Parse(m.Value); // we will need to have better error handling // then set it commentModel.GetComments()[inkPos].ic = new Windows.UI.Input.Inking.InkStrokeContainer(); await commentModel.GetComments()[inkPos].ic.LoadAsync(inputStream); } } } } }