protected virtual void Dispose(bool disposing) { if (!_disposed) { if (disposing) // dispose of managed resources { Tracer.WriteTraceMethodLine(); PageSettingsDataSource.Save(PageSettings); PageSettings = null; PageTemplate = null; } _disposed = true; } }
private void UnbindTemplate(Templates.IPageTemplatePresenter template) { Tracer.WriteTraceMethodLine(); var model = PageSettings; model.ColorChanged -= template.ChangeColor; model.RuleLinesHorizontalColorChanged -= template.ChangeRuleLinesHorizontalColor; model.RuleLinesHorizontalSpacingChanged -= template.ChangeRuleLinesHorizontalSpacing; model.RuleLinesMarginColorChanged -= template.ChangeRuleLinesMarginColor; model.RuleLinesVisibleChanged -= template.ChangeRuleLinesVisible; model.TitleChanged -= template.ChangeTitle; }
private void BindTemplate(OneNote.IApplication application) { var template = PageTemplate; if (template != null) { UnbindTemplate(template); } var model = PageSettings; template = TemplateFactory.CreatePageTemplate(application); model.ColorChanged += template.ChangeColor; model.RuleLinesHorizontalColorChanged += template.ChangeRuleLinesHorizontalColor; model.RuleLinesHorizontalSpacingChanged += template.ChangeRuleLinesHorizontalSpacing; model.RuleLinesMarginColorChanged += template.ChangeRuleLinesMarginColor; model.RuleLinesVisibleChanged += template.ChangeRuleLinesVisible; model.TitleChanged += template.ChangeTitle; PageTemplate = template; Tracer.WriteTraceMethodLine(); }