/// <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); }
/// <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 otherwise.</returns> private bool DoesSampleTypeExists(SampleModel sampleModel) { var fullTypeAsString = string.Format("{0}.{1}", sampleModel.SampleNamespace, sampleModel.GetSampleName()); var sampleType = _samplesAssembly.GetType(fullTypeAsString); if (sampleType == null) { return(false); } return(true); }