protected void btnGenerate_Click(object sender, EventArgs e)
        {
            StronglyTypedWebResources Exp = new StronglyTypedWebResources(Request.PhysicalApplicationPath);
            string OutputFile             = this.Server.MapPath(this.txtOutputFile.Text);
            string Output = "";

#if (OnlineDemo )
            OutputFile = Server.MapPath("~/_classes/Resources.cs");
            if (Path.GetExtension(OutputFile).ToLower() != ".cs")
            {
                this.lblGenetatedCode.Text = "Only C# output is supported for this resource demo.";
                return;
            }
#endif
            Output += "Output file: " + OutputFile + "\r\n\r\n";

            if (this.lstExportFrom.SelectedValue == "ResX")
            {
                Output += Exp.CreateClassFromFromAllGlobalResXResources("AppResources", OutputFile);
            }
            else
            {
                Output += Exp.CreateClassFromAllDatabaseResources("AppResources", OutputFile);
            }

            this.lblGenetatedCode.Text = Output;
        }
示例#2
0
        protected void btnGenerateStronglyTypedResources_Click(object sender, EventArgs e)
        {
            var config = DbResourceConfiguration.Current;

            StronglyTypedWebResources strongTypes =
                new StronglyTypedWebResources(Context.Request.PhysicalApplicationPath);

            strongTypes.CreateClassFromAllDatabaseResources(config.ResourceBaseNamespace,
                                                            HttpContext.Current.Server.MapPath(config.StronglyTypedGlobalResource));

            if (string.IsNullOrEmpty(strongTypes.ErrorMessage))
            {
                ErrorDisplay.ShowMessage(string.Format(WebUtils.LRes("StronglyTypedGlobalResourcesCreated"),
                                                       config.ResourceBaseNamespace));
            }
            else
            {
                ErrorDisplay.ShowMessage(WebUtils.LRes("StronglyTypedGlobalResourcesFailed"));
            }
        }