public void InitializeStream(int resolutionWidth, int resolutionHeight, float framesPerSecond) { // Creating a SDK session Session = PXCMSession.CreateInstance(); // Creating the SenseManager SenseManager = Session.CreateSenseManager(); if (SenseManager == null) { Status_pipeline = "Failed to create an SDK pipeline object"; //Console.WriteLine("Failed to create the SenseManager object."); return; } else { Status_pipeline = "Pipeline created"; } foreach (var stream in StreamType) { // Enabling the stream pxcmStatus enableStreamStatus = SenseManager.EnableStream(stream, resolutionWidth, resolutionHeight, framesPerSecond); if (enableStreamStatus != pxcmStatus.PXCM_STATUS_NO_ERROR) { throw new InvalidRealSenseStatusException(enableStreamStatus, string.Format("Failed to enable the {0} stream. Return code: {1}", StreamType, enableStreamStatus)); } } }