public async void CloseDocument(BaseDocumentViewModel document) { // TODO: Check if not saved int index = OpenDocuments.IndexOf(document); if (index != -1) { OpenDocuments.RemoveAt(index); if (index < OpenDocuments.Count) { CurrentDocument = OpenDocuments[index]; } else { CurrentDocument = OpenDocuments.LastOrDefault(); } if (document.Token != null) { await SaveFileTokensAsync(); } } }
private async void AddAndSelectDocument(BaseDocumentViewModel doc) { AddDocument(doc); CurrentDocument = OpenDocuments.LastOrDefault(); await SaveFileTokensAsync(); }
private void AddDocument(BaseDocumentViewModel doc) { OpenDocuments.Add(doc); doc.OnRequestClose += Doc_OnRequestClose; doc.OnRequestSaveFileTokens += Doc_OnRequestSaveFileTokens; }
protected override async Task <BaseDocumentViewModel> LoadFromFileAsync(StorageFile file, string token, PropertiesViewModel properties, bool isSaveable) { return(await BaseDocumentViewModel.CreateFromFileAsync <BlocksDocumentViewModel>(file, token, properties, isSaveable)); }