private void FileWatcherServiceAttributeChangedEvent(object sender, SledFileWatcherServiceEventArgs e) { var sd = e.Document as SledDocument; if (sd == null) return; // Don't mess with hidden documents if (sd.Hidden) return; // Toggle readonly status of document sd.IsReadOnly = !sd.IsReadOnly; // If document is dirty and its now readonly then we have a problem // and need to bring up the readonly resolution form. if (!sd.IsReadOnly || !sd.Dirty) return; using (var form = new SledReadOnlyDocResolutionForm()) { form.SledDocument = sd; form.TryOptionEvent += FormTryOptionEvent; form.ShowDialog(m_mainForm); } }