private void SetActiveTool(EditReportToolBase tool) { if (_selectedTool == tool) { return; } if (ReportingSettings.Default == null) { return; } _selectedTool = tool; if (_selectedTool == _editReportWithImagesTool) { ReportingSettings.Default.ShouldOpenImages = true; this.Context.UnregisterDropHandler(typeof(Folders.Reporting.DraftFolder), _editReportWithoutImagesTool); this.Context.RegisterDropHandler(typeof(Folders.Reporting.DraftFolder), _editReportWithImagesTool); this.Context.UnregisterDoubleClickHandler( (IClickAction)CollectionUtils.SelectFirst( this.Actions, a => a is IClickAction && a.ActionID.EndsWith("withoutImagesContext"))); this.Context.RegisterDoubleClickHandler( (IClickAction)CollectionUtils.SelectFirst( this.Actions, a => a is IClickAction && a.ActionID.EndsWith("withImagesContext"))); } else { ReportingSettings.Default.ShouldOpenImages = false; this.Context.UnregisterDropHandler(typeof(Folders.Reporting.DraftFolder), _editReportWithImagesTool); this.Context.RegisterDropHandler(typeof(Folders.Reporting.DraftFolder), _editReportWithoutImagesTool); this.Context.UnregisterDoubleClickHandler( (IClickAction)CollectionUtils.SelectFirst( this.Actions, a => a is IClickAction && a.ActionID.EndsWith("withImagesContext"))); this.Context.RegisterDoubleClickHandler( (IClickAction)CollectionUtils.SelectFirst( this.Actions, a => a is IClickAction && a.ActionID.EndsWith("withoutImagesContext"))); } ReportingSettings.Default.Save(); EventsHelper.Fire(ActiveToolChanged, this, EventArgs.Empty); }
private void SetActiveTool(EditReportToolBase tool) { if (_selectedTool == tool) return; if (ReportingSettings.Default == null) return; _selectedTool = tool; if (_selectedTool == _editReportWithImagesTool) { ReportingSettings.Default.ShouldOpenImages = true; this.Context.UnregisterDropHandler(typeof(Folders.Reporting.DraftFolder), _editReportWithoutImagesTool); this.Context.RegisterDropHandler(typeof(Folders.Reporting.DraftFolder), _editReportWithImagesTool); this.Context.UnregisterDoubleClickHandler( (IClickAction)CollectionUtils.SelectFirst( this.Actions, a => a is IClickAction && a.ActionID.EndsWith("withoutImagesContext"))); this.Context.RegisterDoubleClickHandler( (IClickAction)CollectionUtils.SelectFirst( this.Actions, a => a is IClickAction && a.ActionID.EndsWith("withImagesContext"))); } else { ReportingSettings.Default.ShouldOpenImages = false; this.Context.UnregisterDropHandler(typeof(Folders.Reporting.DraftFolder), _editReportWithImagesTool); this.Context.RegisterDropHandler(typeof(Folders.Reporting.DraftFolder), _editReportWithoutImagesTool); this.Context.UnregisterDoubleClickHandler( (IClickAction)CollectionUtils.SelectFirst( this.Actions, a => a is IClickAction && a.ActionID.EndsWith("withImagesContext"))); this.Context.RegisterDoubleClickHandler( (IClickAction)CollectionUtils.SelectFirst( this.Actions, a => a is IClickAction && a.ActionID.EndsWith("withoutImagesContext"))); } ReportingSettings.Default.Save(); EventsHelper.Fire(ActiveToolChanged, this, EventArgs.Empty); }