I had a problem. I need to display the image from the camera using api lifecam. As an example, I chose this code.

https://social.msdn.microsoft.com/Forums/vstudio/en-US/a491751a-649a-4afc-86a2-32f22c53822d/programming-with-microsoft-hd-lifecam?forum=csharpgeneral

Loaded libraries

Microsoft.LifeCam.Camera.dll Microsoft.LifeCam.Framework.dll Microsoft.LifeCam.Streamer.dll

<Window x:Class="LifeCamWPF.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="379" Width="736" xmlns:camera="clr-namespace:Microsoft.LifeCam;assembly=Microsoft.LifeCam.Camera" xmlns:foo="clr-namespace:Microsoft.LifeCam;assembly=Microsoft.LifeCam.Streamer"> <Grid> <foo:PreviewView Name="preview" Margin="13,12,10,33"/> <Button Name="button" Content="Button" HorizontalAlignment="Left" Margin="10,0,0,8" Width="75" Click="Button_Click_1" Height="20" VerticalAlignment="Bottom"/> <ComboBox Margin="0,0,13,8" Height="22" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="278"/> </Grid> </Window> 

Then for your code, do something like:

 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace LifeCamWPF { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { bool running = false; Microsoft.LifeCam.Streamer streamer; const string stop = "Stop"; const string start = "Start"; public MainWindow() { InitializeComponent(); running = false; button.Content = start; } private void Button_Click_1(object sender, RoutedEventArgs e) { if (running) { running = false; button.Content = start; streamer.Stop(); streamer.Dispose(); } else { running = true; button.Content = stop; var cameras = new Microsoft.LifeCam.CameraList(); preview.RenderTransformOrigin = new Point(0.5, 0.5); streamer = new Microsoft.LifeCam.Streamer(cameras[0], preview, false); streamer.Start(); } } } } 

but unfortunately I get a compiler error

Anonymous of type 'System.Windows.Markup.XamlParseException' occurred in the user code

Additional information: 'Set connectionId threw an exception.' Line number '6' and line position '9'.

In the xaml code on

xmlns: foo = "clr-namespace: Microsoft.LifeCam; assembly = Microsoft.LifeCam.Streamer"

In addition, there is a project on git https://github.com/ms-iot/samples/tree/develop/WebcamApp/CS of this camera

But I can't even run it, it requires Win 10 sdk and UWP, which is not yet downloadable

My sistemki VS2015 enterprise, win7 32 bit

How to fix this problem really need to run this camera?

    1 answer 1

    The problem was solved by installing UWP