示例#1
0
        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();
                }
            }
        }
示例#2
0
 private async void AddAndSelectDocument(BaseDocumentViewModel doc)
 {
     AddDocument(doc);
     CurrentDocument = OpenDocuments.LastOrDefault();
     await SaveFileTokensAsync();
 }
示例#3
0
 private void AddDocument(BaseDocumentViewModel doc)
 {
     OpenDocuments.Add(doc);
     doc.OnRequestClose          += Doc_OnRequestClose;
     doc.OnRequestSaveFileTokens += Doc_OnRequestSaveFileTokens;
 }
示例#4
0
 protected override async Task <BaseDocumentViewModel> LoadFromFileAsync(StorageFile file, string token, PropertiesViewModel properties, bool isSaveable)
 {
     return(await BaseDocumentViewModel.CreateFromFileAsync <BlocksDocumentViewModel>(file, token, properties, isSaveable));
 }