示例#1
0
        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;
        }
示例#2
0
        /// <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);
            }
        }
示例#3
0
 void PlayCmdExecuted(object target, ExecutedRoutedEventArgs e)
 {
     _readDoc = _doc;
     _reader.StartReading(_readDoc.Selection.Start);
     updateReadText();
 }