private AimAnnotationComponentWpfControl(AimAnnotationComponent component)
        {
            Component = component;
            InitializeComponent();

            InitializeAnnotationTypeCombo();
            InitializeTemplateControl();

            _buttonCreateAnnotation.IsEnabled = Component.CreateAnnotationEnabled;

            Component.TemplateTreeSet += OnTemplateTreeSet;
            Component.PropertyChanged += ComponentPropertyChanged;


            _buttonCreateAnnotation.IsEnabled = Component.CreateAnnotationEnabled;
            _buttonResetAnnotation.IsEnabled  = Component.ResetButtonEnabled;
            _buttonUserInfo.IsEnabled         = Component.UserInfoButtonEnabled;
            if (Component.CreateAnnotationEnabled)
            {
                _buttonWhyIsTemplateIncomplete.Visibility = Visibility.Hidden;
            }

            _btnExtension1.Visibility = Visibility.Hidden;

            try
            {
                // Create extension points that use this component
                AimAnnotationExtensionPoint xp = new AimAnnotationExtensionPoint();
                Object[] extensions            = xp.CreateExtensions();
                if (extensions.Length > 0)
                {
                    IAimAnnotationExtension extension = (IAimAnnotationExtension)extensions[0];
                    extension.Component       = Component;
                    _btnExtension1.Content    = extension.ButtonText;
                    _btnExtension1.Click     += extension.OnButtonClick;
                    _btnExtension1.Visibility = Visibility.Visible;
                    _btnExtension1.IsEnabled  = false;
                }
            }
            catch (NotSupportedException ex)
            {
                Platform.Log(LogLevel.Error, ex, "Failed to create AimAnnotationExtension", null);
            }
        }
        public TemplateControl(AimAnnotationComponent component)
        {
            Platform.CheckForNullReference(component, "component");

            _component = component;
            InitializeComponent();

            _bindingSource = new BindingSource();
            _bindingSource.DataSource = _component;

            _tboxAnnotationName.DataBindings.Add("Enabled", _bindingSource, "AnnotationModuleEnabled", true, DataSourceUpdateMode.OnPropertyChanged);
            _tboxAnnotationName.DataBindings.Add("Text", _bindingSource, "AnnotationName", true, DataSourceUpdateMode.OnPropertyChanged);

            _componentContainerControl.DataBindings.Add("SelectedTemplate", _bindingSource, "SelectedAimTemplate", true, DataSourceUpdateMode.OnPropertyChanged);
            _componentContainerControl.DataBindings.Add("SelectedAnatomicEntities", _bindingSource, "SelectedAnatomicEntities", true, DataSourceUpdateMode.OnPropertyChanged);
            _componentContainerControl.DataBindings.Add("SelectedImagingObservations", _bindingSource, "SelectedImagingObservations", true, DataSourceUpdateMode.OnPropertyChanged);
            _componentContainerControl.DataBindings.Add("SelectedInferences", _bindingSource, "SelectedInferences", true, DataSourceUpdateMode.OnPropertyChanged);
            _componentContainerControl.DataBindings.Add("IsValid", _bindingSource, "IsAimTemplateValid", true, DataSourceUpdateMode.OnPropertyChanged);

            _btnCreateAnnotation.DataBindings.Add("Enabled", _bindingSource, "CreateAnnotationEnabled", true, DataSourceUpdateMode.OnPropertyChanged);
            _btnCreateAnnotation.EnabledChanged += BtnCreateAnnotationEnabledChanged;

            _component.AnnotationCreated += OnAnnotationCreated;

            try
            {
                var xp = new AimAnnotationExtensionPoint();
                var extensions = xp.CreateExtensions();
                if (extensions.Length > 0)
                {
                    var extension = (IAimAnnotationExtension)extensions[0];
                    extension.Component = _component;
                    _btnExtension1.Text = extension.ButtonText;
                    _btnExtension1.Click += extension.OnButtonClick;
                    _btnExtension1.Enabled = false;
                    _extensionControls.Add(_btnExtension1);
                }
            }
            catch (NotSupportedException ex)
            {
                Platform.Log(LogLevel.Error, ex, "Failed to create AimAnnotationExtension", null);
            }
        }
        public TemplateControl(AimAnnotationComponent component)
        {
            Platform.CheckForNullReference(component, "component");

            _component = component;
            InitializeComponent();

            _bindingSource            = new BindingSource();
            _bindingSource.DataSource = _component;

            _tboxAnnotationName.DataBindings.Add("Enabled", _bindingSource, "AnnotationModuleEnabled", true, DataSourceUpdateMode.OnPropertyChanged);
            _tboxAnnotationName.DataBindings.Add("Text", _bindingSource, "AnnotationName", true, DataSourceUpdateMode.OnPropertyChanged);

            _componentContainerControl.DataBindings.Add("SelectedTemplate", _bindingSource, "SelectedAimTemplate", true, DataSourceUpdateMode.OnPropertyChanged);
            _componentContainerControl.DataBindings.Add("SelectedAnatomicEntities", _bindingSource, "SelectedAnatomicEntities", true, DataSourceUpdateMode.OnPropertyChanged);
            _componentContainerControl.DataBindings.Add("SelectedImagingObservations", _bindingSource, "SelectedImagingObservations", true, DataSourceUpdateMode.OnPropertyChanged);
            _componentContainerControl.DataBindings.Add("SelectedInferences", _bindingSource, "SelectedInferences", true, DataSourceUpdateMode.OnPropertyChanged);
            _componentContainerControl.DataBindings.Add("IsValid", _bindingSource, "IsAimTemplateValid", true, DataSourceUpdateMode.OnPropertyChanged);

            _btnCreateAnnotation.DataBindings.Add("Enabled", _bindingSource, "CreateAnnotationEnabled", true, DataSourceUpdateMode.OnPropertyChanged);
            _btnCreateAnnotation.EnabledChanged += BtnCreateAnnotationEnabledChanged;

            _component.AnnotationCreated += OnAnnotationCreated;

            try
            {
                var xp         = new AimAnnotationExtensionPoint();
                var extensions = xp.CreateExtensions();
                if (extensions.Length > 0)
                {
                    var extension = (IAimAnnotationExtension)extensions[0];
                    extension.Component    = _component;
                    _btnExtension1.Text    = extension.ButtonText;
                    _btnExtension1.Click  += extension.OnButtonClick;
                    _btnExtension1.Enabled = false;
                    _extensionControls.Add(_btnExtension1);
                }
            }
            catch (NotSupportedException ex)
            {
                Platform.Log(LogLevel.Error, ex, "Failed to create AimAnnotationExtension", null);
            }
        }
        private AimAnnotationComponentWpfControl(AimAnnotationComponent component)
        {
            Component = component;
            InitializeComponent();

            InitializeAnnotationTypeCombo();
            InitializeTemplateControl();

            _buttonCreateAnnotation.IsEnabled = Component.CreateAnnotationEnabled;

            Component.TemplateTreeSet += OnTemplateTreeSet;
            Component.PropertyChanged += ComponentPropertyChanged;

            _buttonCreateAnnotation.IsEnabled = Component.CreateAnnotationEnabled;
            _buttonResetAnnotation.IsEnabled = Component.ResetButtonEnabled;
            _buttonUserInfo.IsEnabled = Component.UserInfoButtonEnabled;
            if (Component.CreateAnnotationEnabled)
                _buttonWhyIsTemplateIncomplete.Visibility = Visibility.Hidden;

            _btnExtension1.Visibility = Visibility.Hidden;

            try
            {
                // Create extension points that use this component
                AimAnnotationExtensionPoint xp = new AimAnnotationExtensionPoint();
                Object[] extensions = xp.CreateExtensions();
                if (extensions.Length > 0)
                {
                    IAimAnnotationExtension extension = (IAimAnnotationExtension)extensions[0];
                    extension.Component = Component;
                    _btnExtension1.Content = extension.ButtonText;
                    _btnExtension1.Click += extension.OnButtonClick;
                    _btnExtension1.Visibility = Visibility.Visible;
                    _btnExtension1.IsEnabled = false;
                }
            }
            catch (NotSupportedException ex)
            {
                Platform.Log(LogLevel.Error, ex, "Failed to create AimAnnotationExtension", null);
            }
        }
        public override void Start()
        {
            base.Start();

            _localDataStoreEventBroker = LocalDataStoreActivityMonitor.CreatEventBroker();
            _localDataStoreEventBroker.SopInstanceImported += OnSopInstanceImported;
            AimSettings.Default.PropertyChanged            += OnAimSettingsChanged;

            try
            {
                // Create extension points that use this component
                var xp = new AimAnnotationExtensionPoint();
                foreach (var obj in xp.CreateExtensions())
                {
                    var extension = (IAimAnnotationExtension)obj;
                    extension.Component = this;
                }
            }
            catch (NotSupportedException)
            {
            }
        }