コード例 #1
0
        /// <summary>
        /// Creates the given sample.
        /// </summary>
        /// <param name="sampleInfo">The sample information.</param>
        public SampleBase CreateSample(SampleDescription sampleInfo)
        {
            sampleInfo.EnsureNotNull(nameof(sampleInfo));

            var actSample = m_sampleTypes.First((actTuple) => actTuple.Item1 == sampleInfo);

            return(Activator.CreateInstance(actSample.Item2) as SampleBase);
        }
コード例 #2
0
        /// <summary>
        /// Applies the given sample to the given RenderLoop.
        /// </summary>
        /// <param name="renderLoop">The render loop.</param>
        /// <param name="sampleDesc">The sample to be applied.</param>
        public SampleBase ApplySample(RenderLoop renderLoop, SampleDescription sampleDesc)
        {
            renderLoop.EnsureNotNull(nameof(renderLoop));
            sampleDesc.EnsureNotNull(nameof(sampleDesc));

            SampleBase sample = Activator.CreateInstance(sampleDesc.SampleClass) as SampleBase;

            sample.OnStartupAsync(renderLoop);
            return(sample);
        }