Beispiel #1
0
        private void InitializeProviderCollection()
        {
            InputProviderLogic providerLogic = mainLogic.InputProviderLogic;

            foreach (InputProviderInfo pair in providerLogic.AvailableProviders)
            {
                InputProviderModel model = new InputProviderModel(pair.Id, pair.Name, pair.HasConfiguration);
                Providers.Add(model);
                if (model.Id == providerLogic.SelectedProviderId)
                {
                    SelectedProvider = model;
                }
            }
        }
Beispiel #2
0
        //internal void InputHandler(int width, int height, int bitPerPixel, byte[] pixels)
        //{
        //    Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate
        //    {
        //        InputImage = GetImageSource(width, height, bitPerPixel, pixels);
        //    });
        //}

        //internal void OutputHandler(int width, int height, int bitPerPixel, byte[] pixels)
        //{
        //    Dispatcher.Invoke(DispatcherPriority.Normal, (Action)delegate
        //    {
        //        OutputImage = GetImageSource(width, height, bitPerPixel, pixels);
        //    });
        //}

        //private BitmapSource GetImageSource(int width, int height, int bitPerPixel, byte[] pixels)
        //{
        //    PixelFormat pixelFormat = PixelFormats.Bgr24;
        //    if (bitPerPixel == 8)
        //        pixelFormat = PixelFormats.Gray8;
        //    if (bitPerPixel == 32)
        //        pixelFormat = PixelFormats.Bgr32;
        //    return BitmapSource.Create(width, height, 96, 96, pixelFormat, null, pixels, pixelFormat.GetStride(width));
        //}

        private void SelectedProviderChanged(DependencyPropertyChangedEventArgs e)
        {
            InputProviderModel newValue = (InputProviderModel)e.NewValue;

            mainLogic.InputProviderLogic.SelectedProviderId = newValue.Id;
        }