Beispiel #1
0
        private void HandleEvent(KStudioEvent eventObj, EventTypePluginData data, EventType eventType)
        {
            Debug.Assert(data != null);

            if (eventObj != null)
            {
                if ((eventObj.EventStreamDataTypeId == KStudioEventStreamDataTypeIds.Ir) ||
                    (eventObj.EventStreamDataTypeId == HackKStudioEventStreamDataTypeIds.IrMonitor))
                {
                    bool doDataEvent    = false;
                    bool doVisibleEvent = false;

                    lock (this.lockObj)
                    {
                        bool isSelectedData = (this.selectedData == data);

                        HGlobalBuffer newSharedFrame = eventObj.GetRetainableEventDataBuffer();
                        doVisibleEvent     = isSelectedData && (newSharedFrame == null) != (data.sharedIrFrame == null);
                        data.sharedIrFrame = newSharedFrame;

                        uint newWidth  = nui.Constants.STREAM_IR_WIDTH;
                        uint newHeight = nui.Constants.STREAM_IR_HEIGHT;

                        if ((newWidth != data.imageWidth) || (newHeight != data.imageHeight))
                        {
                            viz.Context context = null;
                            if (this.pluginService != null)
                            {
                                context = this.pluginService.GetContext(eventType);
                            }

                            data.imageWidth  = newWidth;
                            data.imageHeight = newHeight;

                            IrPlugin.CreateTextures(data, context);
                        }

                        if (IrPlugin.UpdateSelectedPixelValue(data))
                        {
                            doDataEvent = isSelectedData;
                        }
                    }

                    if (doVisibleEvent)
                    {
                        this.RaisePropertyChanged("HasSelected2DPixelData");
                    }

                    if (doDataEvent)
                    {
                        this.RaisePropertyChanged("Selected2DPixelIrIntensity");
                    }
                }
            }
        }
Beispiel #2
0
        public void InitializeRender(EventType eventType, viz.Context context)
        {
            switch (eventType)
            {
            case EventType.Monitor:
                Debug.Assert(this.monitorData != null);
                IrPlugin.CreateTextures(this.monitorData, context);
                break;

            case EventType.Inspection:
                Debug.Assert(this.inspectionData != null);
                IrPlugin.CreateTextures(this.inspectionData, context);
                break;
            }
        }