private void btnGenerate_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            var host = new RazorEngine();

            string strSchema = txtSchema.Text;

            if (strSchema == string.Empty || !IsValidJson(strSchema))
            {
                System.Windows.Forms.MessageBox.Show("Please provide invalid Json schema.");
            }

            JToken        jToken  = JToken.Parse(strSchema);
            CustomContext context = new CustomContext();

            context.Type = jToken["type"].ToString();
            ParseJosonToContext(context, jToken);

            DTE        dte          = UIGeneratorPackage.GetGlobalService(typeof(DTE)) as DTE;
            Properties templatePros = dte.get_Properties("UI Generator Setting", "HTML Template");

            string strTemplate = templatePros.Item("MarkupTemplate").Value.ToString();

            string result = host.RenderTemplate(
                strTemplate, context, inferModelType: true
                );

            if (result == null)
            {
                System.Windows.Forms.MessageBox.Show(host.ErrorMessage, "Template Execution Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            txtGenerated.Text = result;
        }
        /// <summary>
        /// Get the completely swagger json
        /// </summary>
        public void GetSwaggerJson()
        {
            try
            {
                if (SwaggerJson == string.Empty)
                {
                    DTE         dte         = UIGeneratorPackage.GetGlobalService(typeof(DTE)) as DTE;
                    Properties  swaggerPros = dte.get_Properties("UI Generator Setting", "Swagger Setting");
                    string      baseURL     = swaggerPros.Item("SwaggerBaseURL").Value.ToString();
                    WebRequest  request     = WebRequest.Create(baseURL);
                    WebResponse response    = request.GetResponse();
                    Stream      dataStream  = response.GetResponseStream();
                    string      strJson     = string.Empty;
                    using (StreamReader reader = new StreamReader(dataStream, Encoding.UTF8))
                    {
                        SwaggerJson = reader.ReadToEnd();
                    }
                    response.Close();
                }

                //SetupAPIs();
                JToken jToken = JToken.Parse(SwaggerJson);
                //JToken jPathToken = jToken.SelectToken("paths");
                List <string> apiList = new List <string>();

                foreach (KeyValuePair <string, JToken> subObj in (JObject)jToken["paths"])
                {
                    apiList.Add(subObj.Key);
                }
                cbxAPIs.ItemsSource   = apiList;
                cbxAPIs.SelectedIndex = 1;
            }
            catch (Exception)
            {
                System.Windows.Forms.MessageBox.Show("Can not get schema from server, please check the swagger docs address.");
            }
        }