Add existing item to solution at runtime in wpf -
i creating resource file @ runtime in wpf.
it being created , displayed in resource folder, not showing in solution, after refreshing folder.
when manually (add exsiting item), being added.
how add solution whenever being created?
my code is:
public void laguageculture(string languageid) { try { sqlparameter[] param = new sqlparameter[1]; param[0] = new sqlparameter("@lagid", languageid); //languageid =3 var dsresources = sqlhelper.executedataset(_objsqlconnection, "sproc_getresourcenames", param); string culturecode = string.empty; if (dsresources.tables[1].rows.count > 0) { culturecode = dsresources.tables[1].rows[0][0].tostring(); } fileinfo file = new fileinfo(system.windows.forms.application.startuppath.replace("\\bin\\debug", "") + "\\resources\\englishresource." + culturecode + ".resx"); // culture code en-us if (!file.exists) { var resx = new resxresourcewriter(system.windows.forms.application.startuppath.replace("\\bin\\debug", "") + "\\resources\\englishresource." + culturecode + ".resx"); if (dsresources.tables[0].rows.count > 0) { (var = 0; < dsresources.tables[0].rows.count; i++) { resx.addresource(dsresources.tables[0].rows["resourcename"].tostring(), dsresources.tables[0].rows["resourcevalue"].tostring()); } } resx.generate(); //application.current.resources.add(culturecode + ".resx", resx); resx.close(); } system.threading.thread.currentthread.currentculture = cultureinfo.createspecificculture(culturecode); system.threading.thread.currentthread.currentuiculture = cultureinfo.createspecificculture(culturecode); } catch (exception) { throw; } }
you have programmatically add lines in .csproj (which xml file).
maybe :
<embeddedresource include="resources\englishresource.en-us.resx"> <generator>publicresxfilecodegenerator</generator> </embeddedresource>
Comments
Post a Comment