public static void ShowEditorWindow(long flowDocId, SQLiteConnection connection, SpellcheckDictionary spellcheckDictionary, string title, string search = null) { try { if (!_windows.ContainsKey(flowDocId)) { sql.FlowDocument flowDoc = new sql.FlowDocument(connection); flowDoc.id = flowDocId; flowDoc.Load(); FlowDocumentEditorWindow wnd = new FlowDocumentEditorWindow(flowDoc); wnd._spellcheckDictionary = spellcheckDictionary; _windows[flowDocId] = wnd; } _windows[flowDocId].Title = title; _windows[flowDocId].Show(); _windows[flowDocId].Activate(); _windows[flowDocId].Focus(); if (!string.IsNullOrWhiteSpace(search)) { _windows[flowDocId].PerformSearch(search); } } catch (CryptographicException) { MessageBox.Show("Invalid password", "Invalid password", MessageBoxButton.OK, MessageBoxImage.Error); } catch (ApplicationException) { MessageBox.Show("This entry is encrypted. A password is required to open it.", "Password Required", MessageBoxButton.OK, MessageBoxImage.Error); } }
public FlowDocumentViewModel(sql.FlowDocument model, Window owner) { Model = model; Owner = owner; WordCount = Model.WordCount; SearchResults = new BindingList <TextRange>(); loadFlowDocument(); }
public FlowDocumentEditorWindow(sql.FlowDocument doc) { InitializeComponent(); _viewModel = new FlowDocumentViewModel(doc, this); _viewModel.PropertyChanged += _viewModel_PropertyChanged; }