protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) { base.OnPropertyChanged(e); if (e.Property.Name != nameof(DocumentTitle) || StateFullDocument is null || _documentTitle == DocumentTitle) { return; } _documentTitle = DocumentTitle; if (DocumentTitle.Contains(Constants.TempFileExtension)) { return; } CacheChanges(); DocumentStyles.Update(Document.Styles); StateFullDocument.NewDocument(TemporalFilePath); var args = new DocumentUpdatedEventArgs(StateFullDocument.State, ViewDocumentTitle); DocumentStateChanged?.Invoke(this, args); }
private void OnLoaded(object sender, RoutedEventArgs e) { CacheChanges(); StateFullDocument = new StateFullDocument(TemporalFilePath, this); _documentTitle = DocumentTitle; DocumentSaved += OnDocumentSaved; DocumentStyles.Update(Document.Styles); }