private void MAddImageBtn_Click(object sender, RoutedEventArgs e) { if (mAddImageSession != null) { mAddImageSession.stopSession(); mAddImageSession.closeSession(); mAddImageSession = null; mAddImageTxtBlk.Text = "Add Image"; mVideoTopologyInputMixerNodes.Add(mImageVideoTopologyInputMixerNode); var lVideoMixerControlRelease = mCaptureManager.createVideoMixerControl(); if (lVideoMixerControlRelease != null) { lVideoMixerControlRelease.flush(mImageVideoTopologyInputMixerNode); } mImageVideoTopologyInputMixerNode = null; m_CameraPanel.IsEnabled = true; return; } var lOpenFileDialog = new Microsoft.Win32.OpenFileDialog(); lOpenFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); lOpenFileDialog.Filter = "Image files (*.png, *.gif)|*.png;*.gif"; bool l_result = (bool)lOpenFileDialog.ShowDialog(); if (l_result && File.Exists(lOpenFileDialog.FileName)) { var lICaptureProcessor = ImageCaptureProcessor.createCaptureProcessor(lOpenFileDialog.FileName); if (lICaptureProcessor == null) { return; } object lImageSourceSource = null; mSourceControl.createSourceFromCaptureProcessor( lICaptureProcessor, out lImageSourceSource); var lVideoTopologyInputMixerNode = mVideoTopologyInputMixerNodes[0]; mImageVideoTopologyInputMixerNode = lVideoTopologyInputMixerNode; mVideoTopologyInputMixerNodes.RemoveAt(0); object lImageSourceSourceNode = null; mSourceControl.createSourceNodeFromExternalSourceWithDownStreamConnection( lImageSourceSource, 0, 0, lVideoTopologyInputMixerNode, out lImageSourceSourceNode); object[] lSourceNodes = { lImageSourceSourceNode }; mAddImageSession = mISessionControl.createSession(lSourceNodes); if (mAddImageSession != null) { mAddImageTxtBlk.Text = "Remove Camera"; } mAddImageSession.startSession(0, Guid.Empty); var lVideoMixerControl = mCaptureManager.createVideoMixerControl(); if (lVideoMixerControl != null) { lVideoMixerControl.setPosition(lVideoTopologyInputMixerNode, 0.5f, 1.0f, 0.0f, 0.5f); } //if (lVideoMixerControl != null) // lVideoMixerControl.setSrcPosition(lVideoTopologyInputMixerNode, 0.0f, 0.5f, 0.0f, 0.5f); if (lVideoMixerControl != null) { lVideoMixerControl.setOpacity(lVideoTopologyInputMixerNode, 0.5f); } m_CameraPanel.IsEnabled = false; } }