private void CreateBufferControls() { m_BufferManager = new BufferPluginManager(); m_Buffers = m_BufferManager.GetInstances(); foreach (BufferInstance buffer in m_Buffers) { BufferParameter filterParam = new BufferParameter(XrayImage_Panel, m_History); try { buffer.Instance.Initialize(filterParam); Buffer_ToolBar.Items.Add(buffer.Instance.ToolBarItem); Button button = buffer.Instance.ToolBarItem as Button; if (button != null) { button.Click += new RoutedEventHandler(BufferButton_Clicked); } } catch { //TODO: Error Logs } } }
public BufferInstances GetInstances() { BufferInstances instances = new BufferInstances(); foreach (string fileName in base.m_PluginAssemblies) { Assembly filterAssembly = Assembly.LoadFrom(fileName); foreach (Type assemblyType in filterAssembly.GetTypes()) { Type typeInterface = assemblyType.GetInterface("IBuffer", true); if (assemblyType.IsPublic && !assemblyType.IsAbstract && typeInterface != null) { BufferInstance newBuffer = new BufferInstance(); newBuffer.Instance = Activator.CreateInstance(assemblyType) as IBuffer; if (newBuffer.Instance != null) { instances.Add(newBuffer); } newBuffer = null; } typeInterface = null; } filterAssembly = null; } return(instances); }
private void CreateBufferControls () { m_BufferManager = new BufferPluginManager(); m_Buffers = m_BufferManager.GetInstances(); foreach (BufferInstance buffer in m_Buffers) { BufferParameter filterParam = new BufferParameter(XrayImage_Panel, m_History); try { buffer.Instance.Initialize(filterParam); Buffer_ToolBar.Items.Add(buffer.Instance.ToolBarItem); Button button = buffer.Instance.ToolBarItem as Button; if (button != null) { button.Click += new RoutedEventHandler(BufferButton_Clicked); } } catch { //TODO: Error Logs } } }