private void addDocToRDVMs(ReadDocument doc) { var docvm = new ReadDocumentViewModel(doc); _rdvms.Add(docvm); // When remove is requested remove the document from the manager, whih will inturn remove the docvm docvm.RequestClose = (s, e) => { _docsMan.Remove(doc); }; //set the new document as selected Document = docvm; }
/// <summary> /// Helper function that tries to remove a ReadDocumentViewModel. /// </summary> /// <param name="rdvm">The ReadDocumentViewModel</param> private void tryRemoveRDVM(ReadDocumentViewModel rdvm) { if (rdvm == null) { return; } // Stop reading if it was reading the closing document if (_readDoc == rdvm) { _reader.StopReading(); } // Remove the viewmodel if it exists if (_rdvms.Contains(rdvm)) { _rdvms.Remove(rdvm); } }
void PlayCmdExecuted(object target, ExecutedRoutedEventArgs e) { _readDoc = _doc; _reader.StartReading(_readDoc.Selection.Start); updateReadText(); }