/// <summary>
        /// Gets the name of the C# code behind file.
        /// </summary>
        public static string GetSamplesCodeBehindFileName(this SampleModel model, Language language = Language.CSharp)
        {
            if (language == Language.CSharp)
            {
                return(string.Format("{0}.xaml.cs", model.GetSampleName(language)));
            }

            return(string.Format("{0}.xaml.vb", model.GetSampleName(language)));
        }
        /// <summary>
        /// Creates a new control from sample.
        /// </summary>
        /// <param name="sampleModel">Sample that is transformed into a control</param>
        /// <returns>Sample as a control.</returns>
        public Control SampleToControl(SampleModel sampleModel)
        {
            var fullTypeAsString = string.Format("{0}.{1}", sampleModel.SampleNamespace,
                sampleModel.GetSampleName(_selectedLanguage));
            var sampleType = _samplesAssembly.GetType(fullTypeAsString);

            var item = sampleType.GetConstructor(new Type[] { }).Invoke(new object[] { });

           return (Control)item;
        }
 /// <summary>
 /// Check if the sample has a type registered.
 /// </summary>
 /// <param name="sampleModel">SampleModel that is checked.</param>
 /// <returns>Returns true if the type if found. False otherwice.</returns>
 private bool DoesSampleTypeExists(SampleModel sampleModel)
 {
     var fullTypeAsString = string.Format("{0}.{1}", sampleModel.SampleNamespace,
        sampleModel.GetSampleName(_selectedLanguage));
     var sampleType = _samplesAssembly.GetType(fullTypeAsString);
     if (sampleType == null)
         return false;
     return true;
 }
 /// <summary>
 /// Gets the name of C# the xaml file.
 /// </summary>
 public static string GetSamplesXamlFileName(this SampleModel model, Language language = Language.CSharp)
 {
     return(string.Format("{0}.xaml", model.GetSampleName(language)));
 }
 /// <summary>
 /// Creates a new control from sample.
 /// </summary>
 /// <param name="sampleModel">Sample that is transformed into a control</param>
 /// <returns>Sample as a control.</returns>
 public Control SampleToControl(SampleModel sampleModel)
 {
     var fullTypeAsString = string.Format("{0}.{1}", sampleModel.SampleNamespace,
         sampleModel.GetSampleName(_selectedLanguage));
     var sampleType = _samplesAssembly.GetType(fullTypeAsString);
     var item = Activator.CreateInstance(sampleType);
     return (Control)item;
 }