コード例 #1
0
        public override void Load(IServiceProvider provider)
        {
            var inputInspector = default(InspectBuilder);
            var workflow       = (ExpressionBuilderGraph)provider.GetService(typeof(ExpressionBuilderGraph));
            var context        = (ITypeVisualizerContext)provider.GetService(typeof(ITypeVisualizerContext));

            if (workflow != null && context != null)
            {
                inputInspector = workflow.Where(node => node.Value == context.Source)
                                 .Select(node => workflow.Predecessors(node)
                                         .Select(p => p.Value as InspectBuilder)
                                         .FirstOrDefault())
                                 .FirstOrDefault();
            }

            if (inputInspector != null && inputInspector.ObservableType == typeof(IplImage))
            {
                inputHandle = inputInspector.Output.Merge().Subscribe(value => input = (IplImage)value);
                base.Load(provider);
            }
            else
            {
                textVisualizer = new ObjectTextVisualizer();
                textVisualizer.Load(provider);
            }
        }
コード例 #2
0
        public override void Load(IServiceProvider provider)
        {
            var imageInput = VisualizerHelper.ImageInput(provider);

            if (imageInput != null)
            {
                inputHandle = imageInput.Subscribe(value => input = (IplImage)value);
                base.Load(provider);
            }
            else
            {
                textVisualizer = new ObjectTextVisualizer();
                textVisualizer.Load(provider);
            }
        }
コード例 #3
0
        public override void Unload()
        {
            if (canvas != null)
            {
                canvas.Close();
                canvas = null;
            }

            if (inputHandle != null)
            {
                inputHandle.Dispose();
                inputHandle = null;
            }

            if (textVisualizer != null)
            {
                textVisualizer.Unload();
                textVisualizer = null;
            }
            else
            {
                base.Unload();
            }
        }