Building resx at run time!

Hi everyone,
following off from : 
Older Post
I have two xml files, I decided to read them and construct a resx on the run like this:
XmlTextReader reader = new XmlTextReader("Finnish.xml");
ResXResourceWriter writer = new ResXResourceWriter("Resource.fi-FI.resx");
string key = string.Empty;
string value = string.Empty;
while (reader.Read())
if (reader.NodeType == XmlNodeType.Element && reader.Name == "Data")
key = reader.GetAttribute("Key");
while (reader.Read())
if (reader.NodeType == XmlNodeType.Text)
value = reader.Value;
break;
writer.AddResource(key, value);
writer.Generate();
writer.Close();
This works and I see the Resource.fi-Fi.resx being created in the debug folder. (I will extend this to read two xml later)
But how do I use that resx? Do I need to add it to the project in some way?
Happy to Help :) 

OK so my final and working code:
public partial class MainWindow : Window
List<string> listFiles = new List<string>();
public MainWindow()
InitializeComponent();
/// <summary>
/// Language selection changed
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
listFiles.Clear();
//Gather English or Finnish files depending on the selection
if (ComboBoxLanguage.SelectedIndex == 0)
listFiles.Add("English1.xml");
listFiles.Add("English2.xml");
else if (ComboBoxLanguage.SelectedIndex == 1)
listFiles.Add("Finnish1.xml");
listFiles.Add("Finnish2.xml");
SetLanguage();
/// <summary>
/// Load the language xml files and build ResourceDictionary xaml file
/// </summary>
private void SetLanguage()
var rd = new ResourceDictionary();
rd.Source = new Uri(@"English.xaml", UriKind.Relative);
//For all the language files
foreach (string file in listFiles)
var reader = new XmlTextReader("..\\..\\" + file);
string key = string.Empty;
string value = string.Empty;
//Read the key and value from xml
while (reader.Read())
if (reader.NodeType == XmlNodeType.Element && (reader.Name == "Data" || reader.Name == "data"))
if (reader.Name == "Data")
key = reader.GetAttribute("Key");
if (reader.Name == "data")
key = reader.GetAttribute("name");
while (reader.Read())
if (reader.NodeType == XmlNodeType.Text)
value = reader.Value;
//Add or update the xaml file with key vaakye pairs
if (rd.Contains(key))
rd[key] = value;
else
rd.Add(key, value);
break;
reader.Close();
//Write to xaml file
var settings = new XmlWriterSettings {Indent = true};
var writer = XmlWriter.Create(@"English.xaml", settings);
System.Windows.Markup.XamlWriter.Save(rd, writer);
writer.Close();
//Merge the dynamically built ResourceDictionary with the application's existing resources.
Resources.MergedDictionaries.Add(rd);
This will load two xml files depending on the language selected, read them ( I have Data, Key and name in the xml structure so change this part of code according to your xml) and construct a xaml file and them merge it with the Application's ResourceDictionaries. 
Thank you everyone for your help :)
Please Mark as Answered If this answers your question Or
UnMark as Answered if it did not.
Happy to Help :)
My Site

Similar Messages

  • LabVIEW 2011SP1 Error building installer: LabVIEW Run-Time Engine 2013 is missing 3 dependencies???

    I'm having a problem building an installer in LabVIEW 2011SP1.
    It's been a while since I've tried to build an installer but it used to work fine and building executables is still working fine.
    Now when I try to build the installer I get "The build was unsuccessful."
    Possible reasons: Error generating preview for My Application 3.1.7.
    Details:
    Visit the Request Support page at ni.com/ask to learn more about resolving this problem. Use the following information as a reference:
    CDK_Build_Invoke.vi.ProxyCaller >> CDK_Build_Invoke.vi >> CDK_Engine_Main.vi >> IB_MSI.lvclass:Build.vi >> IB_MSI.lvclass:Engine_InitializeDistribution.vi >> IB_MSI.lvclass:Report_Preview_Error.vi >> IB_Source_Container.lvclass:Report_Preview_Error.vi
    Loading product deployment information
    *** WARNING ***
    NI LabVIEW Run-Time Engine 2013 is missing 3 dependencies. This product, or other products that depend upon NI LabVIEW Run-Time Engine 2013, may not function properly while the dependencies are missing.  Visit ni.com/info and enter the Info Code "" for more information.
    *** Error: An internal error occurred for which the cause is unknown. (Error code -41)
    *** Error Details:
    Error in MDF API function: _MDFCommon_GetNextLogMessage
    Error in MDF::GetInstance - MDF static instance is not initialized!
    *** End Error Report
    Loading product deployment information
    *** WARNING ***
    NI LabVIEW Run-Time Engine 2013 is missing 3 dependencies. This product, or other products that depend upon NI LabVIEW Run-Time Engine 2013, may not function properly while the dependencies are missing.  Visit ni.com/info and enter the Info Code "" for more information.
    The really strange thing about this is that I'm using LabVIEW 2011SP1, I don't even have LabVIEW 2013 installed, not even the runtime.
    Where is the problem? Why is it even complaining about LabVIEW 2013? Has anyone seen this before?
    Troy
    CLDEach snowflake in an avalanche pleads not guilty. - Stanislaw J. Lec
    I haven't failed, I've found 10,000 ways that don't work - Thomas Edison
    Beware of the man who won't be bothered with details. - William Feather
    The greatest of faults is to be conscious of none. - Thomas Carlyle
    Solved!
    Go to Solution.

    I do have the LabVIEW 2013 discs but didn't install it.
    I checked in Control Panel > Programs and Features > National Instruments Software and the LabVIEW 2013 Run-Time is not listed there.
    I also checked in MAX > Software and I must have missed it the first time I looked. LabVIEW Run-Time 2013 is listed there after all.
    Now I remember installing VISA 5.4 to get rid of a nasty bug. It must have installed the 2013 Run-Time when I did that.
    So now I need to distribute 2 runtimes with my application?!?!
    Troy
    CLDEach snowflake in an avalanche pleads not guilty. - Stanislaw J. Lec
    I haven't failed, I've found 10,000 ways that don't work - Thomas Edison
    Beware of the man who won't be bothered with details. - William Feather
    The greatest of faults is to be conscious of none. - Thomas Carlyle

  • Folder of application builder(*.exe) with run-time DLL

    My application consists of main.vi, subvi folder, and example folder.
    In addition, I have to add the run-time libraries for add-on tool kit (advanced signal processing, lvwa.dll) which should be located in the root folder.
    (For exe application, can I set the location of DLLs to not the root folder but "DLL folder"?)
    In my several trials, I can't maintain the hierachy of "example folder".
    Instead of my intension, the NI application builder copied the files in the folder to the support directory.
    Can I locate the "example folder" to the root folder by using NI application builder?
    In summary, I want to get the folder structure by application builder.
    main.exe, DLL folder, Example Folder.
    메시지가 08-08-2008 01:30 AM에 labmaster에 의해 편집되었음

    Hey Labmaster,
    What version of LabVIEW are you using?
    I am not too clear as to what you are trying to do. You can create folders and add anything from your project when creating an installer under the Source Files section in its properties.
    It might be easier if you'd attach a screen shot of what you are doing or trying to do.
    Aashish M
    Applications Engineer
    National Instruments
    http://www.ni.com/support/

  • Can't retrieve username using expression builder on a run time data control

    Here's the scenario:
    1. I added a Data Control resource in WebCenter Spaces, which has one paramater to get: username.
    2. I added the Data Control in Oracle Composer, and selected the return method to show as a read only form.
    3. In adding the Return method, under DC Parameters I have to get the username and place it on my parameter, ie: arg0 = username. arg0 is my data control parameter.
    I tried using every possible code there is in the Expression Editor to retrieve the username, but I keep getting null when I test it. I've tried *#{securityContext.userName}*, *#{webCenterProfile[securityContext.userName].userName}*. I also tried creating a page parameter, and use it like this: *#{bindings.myUsername}*, but still won't work. Its always null.
    How do I retrieve the username and bind it to the parameter of my data control using expression editor? Please help. Thanks.
    Edited by: aeriaL18 on Aug 13, 2012 12:15 PM

    Hi ,
    I believe this should be posted to Webcenter Portal forum : WebCenter Portal
    Thanks
    Srinath

  • LabVIEW 8 run time

    Am upgrading from 7.0 to 8. Is Run Time compiled with the .exe during
    the build? Does Run Time install with the .exe on the target machine?
    Are there any hoops to jump through during the build, or target
    installations?
    Instructions for 8 Run Time seem to be slim.
    newbieDLD

    The run-time engine isn't really compiled with your built application since it's a separate program. You can, however, include the installer as part of your build so that when you deploy your application you will also distribute the run-time engine with it. From the LabVIEW documentation:
    If you use the Application Builder to build an installer for an application or shared library, you can add the LabVIEW Run-Time Engine to the installer build. From the Additional Installers page of the Installer Properties dialog box, place a checkmark in the NI LabVIEW Run-Time Engine checkbox in the National Instruments Installers to Include listbox.
    Generally, the run-time engine is a separate install, and the installer for it is included on the LabVIEW CD, or you can download it from NI: http://digital.ni.com/softlib.nsf/websearch/1F1EBEA6D03A67E6862570A400531F97?opendocument&node=13206...
    -Saverio

  • How to build sql query for view object at run time

    Hi,
    I have a LOV on my form that is created from a view object.
    View object is read-only and is created from a SQL query.
    SQL query consists of few input parameters and table joins.
    My scenario is such that if input parameters are passed, i have to join extra tables, otherwise, only one table can fetch the results I need.
    Can anyone please suggest, how I can solve this? I want to build the query for view object at run time based on the values passed to input parameters.
    Thanks
    Srikanth Addanki

    As I understand you want to change the query at run time.
    If this is what you want, you can use setQuery Method then use executeQuery.
    http://download.oracle.com/docs/cd/B14099_19/web.1012/b14022/oracle/jbo/server/ViewObjectImpl.html#setQuery_java_lang_String_

  • Building an Application in Windows to be used in Linux (with the Run-Time Engine)

    Hi All,
    I have an LabVIEW project I have developed in a Windows environment.  I can create an Application (.exe) using the Build Specification -> Application Builder which works fine on the development platform.
    I now want to distribute the application to a Linux Environment.  The OS is openSUSE v10.3 (with GNOME).  I have downloaded the two rpm files needed for the run-time engine and installed them, as per here:http://digital.ni.com/softlib.nsf/websearch/97E14BA3E0C14A89862572C300567733?opendocument&node=13207...
    Now, the question is; how do I create an Application in Windows which can be used on the Linux Box?  According to the Application Builder instructions, it's simply a case of removing the .exe extension in the Target File Name options, however, this gives an error "Invalid Extension."
    If I do create an exe and manually remove the extention is doesn't work on the Linux enviroment (typing ./application).
    Has anyone had experiance of this?
    Many Thanks for Any Help,
    Oliver
    Windows XP SP 2
    Labview 8.2.1
    openSUSE v10.3 (with GNOME)
    LabVIEW Run-time Engine Version 8.2.1 for Linux

    The cross-platform nature of LabVIEW refers more to the code than to the executable.
    LV (given the appropriate development version) can compile the same source code into a Windows (using LV for Windows), Linux (using LV for Linux) or Mac (using LV for Mac) program.
    This means you will still have three versions of your program, one for each platform.
    If you want to distribute VIs (without block diagrams), you will also need different versions of these as without the block diagram, they cannot be re-compiled for a new platform.
    Shane.
    Say hello to my little friend.
    RFC 2323 FHE-Compliant

  • I have trouble in building stand-alone application, "you must intall Labview run-time engine on any computer on which you want to run this application"

    I have installed the LabVIEW 7.0 run time engine and checked all in the advanced setup on the installer setup slide. but I still get such a message saying that the target computer needs to have LabVIEW 7.0 run-time engine. What I want is a real stand-alone application even without having labview ... I used to think that's due to my program contains MATLAB nodes. But this is not true, since even without Matlab, it's still wrong. Please help, thanks!!!

    As was stated elsewhere, you have the option of building the runtime engine into your application when you build it. However, you can also create a "runtime engine application" by simply opening the application builder and doing a build without adding any source code files. The result is a small program (named lvrt.exe) that can run any LabVIEW code--whether or not its built into an executable.
    Such an application can be helpful if you are wanting to install several LV-based applications on the same computer in that it reduces the amount of redundant code on disk. All you have to do is make sure that Windows on the target computer associates the llb and vi file extensions with the runtime engine program.
    It can also be helpful during testing to run test code that isn't built into an executable.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Get report file name in oracle report builder at run time

    Dear All,
    Is there any way to get the report file name in oracle report builder at run time?
    for example "HR_REP012.REP"
    i need this very important...
    Regards,
    Yousef
    Edited by: Yousef_m on Jun 2, 2012 5:18 AM

    Hello,
    Did you try the builtin SRW.GET_REPORT_NAME built-in function ?
    Example
    function AfterPForm return boolean is
    my_var varchar2(80);
    BEGIN
    SRW.GET_REPORT_NAME(my_var);
    SRW.MESSAGE(0,'Report Filename = '||my_var);
    RETURN (TRUE);
    END;
    Regards

  • Applicatio​n builder e run time

    To distribute my software created by application builder , I use "set up generator" program because I can use special colors, pictures and so on. Instead to run lvruntimeeng.msi (30Mb)separately, can I use only specific files (dll or something like that) ?

    gubi,
    installing the Runtime Engine on the target machine is the suggested procedure to make your LabVIEW Applications work correctly, and, most important, it is the only procedure supported by National Instruments.
    Technically speaking, there is a chance that your application would work only by copying the DLLs that are stored on your development system under
    Program Files\National Instruments\Shared\LabVIEW Run-Time\X.X
    to an identical path in your target machine.
    Again, this is not a supported procedure since copying DLLs may let your application start and work, but in front of any unexpected behaviour (e.g. errors, controls missing etc.) you will be on your own.
    Best Regards,
    AlessioD
    National Instruments

  • Application builder-run time error

    I cannot run my exe file I have always the following message , see attachment.
    What can be the problem?
    Attachments:
    run-time engine error.jpg ‏42 KB

    Is the run-time engine installed? A LV EXE can not run without the RTE.
    When you build an EXE, you have the option to create an installer, which will also install the RTE. If you build an EXE with no VI defined, it should build an installer with only the RTE.
    Alternatively, you can try looking for the RTE installer on your LV CD or on this site.
    Try to take over the world!

  • Run-Time errors using DAQmx and Borland C++ Builder 5.0

    I've written a simple program on MS Visual C++ 6.0 to test my PCI-6014 board and it works fine.
    I copied the code to Borland C++ builder 5.0 and had some linker problems with the .lib files that where solved with borland's "coff2omf".
    Now I've been getting run-time errors when I use the function DAQmxCreateAIVoltageChan()... The error code is -50251: "The specified software component is not available. The component was not loaded".
    But I'm sure that the code is right, since it works fine on MS Visual C++ 6.0!
    That the part of the code where I'm getting the error:
    iErro = DAQmxCreateTask("", &thTask);
    iErro = DAQmxCreateAIVoltageChan(thTask, "Dev1/ai0", "", DAQmx_Val_Diff, -10.0, 10.0, DAQmx_Val_Volts, NU
    LL);
    Thanks for the help,
    Marcelo

    Hello
    Borland enables certain types of exceptions by default which are initially disable in MSVC. You will need to refer to the documentation for Borland Builder on how to disable floating point exceptions. I believe you can do it by adding the following statement to your initialization code, but you should double check this:
    _control87(MCW_EM, MCW_EM);
    These exceptions get thrown because we are doing some floating point initialization underneath. This is not an indication of a bug or a problem of any sort. Apparently you have to this for alot of libraries to work correctly with Borland (OpenGL etc...)
    Hope this helps
    Bilal Durrani
    NI
    Bilal Durrani
    NI

  • App Builder/Run Time Install Broke?

    I have full up version of LabView 5.1.1, running on Win98.
    I went through the Application Building Example on page 12 of the
    Application Buidler release notes.
    I then installed the sample app on another Win98 box. The application
    installation went OK until it ran the install for the LabVIEW runtime.
    Then I got the following error:
    "Setup Initialization Error
    Setup requires a different version of Windows. Check to make sure that
    you are running Setup on the Windows platform for which it is intended.
    Error 102."
    I also get this same error if I run the LabVIEW runtime install
    directly.
    As I said, both machines are Win98. I'm stumped. Any ideas?
    Mike T

    I am not sure if this is your exact problem but you might try it . I found
    with the run time in 5.1 would not install properly . On the target machine
    I did a runtime engine install from the APP builder disk , not from the 5.1
    disk . Then things seem to get sorted out after that . I still haven't been
    able to do a stand alone disk that installs the runtime engine and
    application together yet. More for the lack of trying after I got a work
    around (I hope?) . That was with win95 and 5.1 , not sure if the same sort
    of thing will be true for 5.1.1 and win 98.
    Hope that helps
    "Mike T" wrote in message
    news:[email protected]..
    > I have full up version of LabView 5.1.1, running on Win98.
    >
    > I went through the Application B
    uilding Example on page 12 of the
    > Application Buidler release notes.
    >
    > I then installed the sample app on another Win98 box. The application
    > installation went OK until it ran the install for the LabVIEW runtime.
    > Then I got the following error:
    >
    > "Setup Initialization Error
    >
    > Setup requires a different version of Windows. Check to make sure that
    > you are running Setup on the Windows platform for which it is intended.
    >
    > Error 102."
    >
    > I also get this same error if I run the LabVIEW runtime install
    > directly.
    >
    > As I said, both machines are Win98. I'm stumped. Any ideas?
    >
    > --
    > Mike T

  • Run time error running Vision Builder AI inspection from TestStand

    Hello,
    I have TestStand 3.1 and Vision Builder for AI v2.6.1.
    I would like to run from TestStand a Vision Builder Program or steps. For to achieve that, I have followed the instructions on Application Note 215, Running a Vision Builder AI Inspection from TestStand.
    After installation, the option in TestStand InsertStep>NI Vision Builder AI>Inspection works properly.
    But when try to execute a step with that inspection, and whatever operation of that one, the result is the following error:
    Run-Time Error
       Details: Error executing substep 'Post'.
    An error occurred calling 'ExecuteStep' in '_NIVBAITestStandSteps' of 'NIVBAITestStandAPI'.
       Error Code: -2147417851; User defined code. Possible System Error: The server sent an exception.
      At this point really I don´t know what to do, and I don't find any extra help apart of application note.
      I will appreciate some suggestion.
    Gonzalo.

    Hello,
    I've found some more information that may help.  Since these TestStand steps are simply call a DLL with an exported ActiveX API, path issues may exist.  In fact, the overwhelming number of times this error appears, paths seems to be the case. I am not sure why the error is an indication of a path issue, but that seems to be the case.  I would recommend that you would reregister the DLL, this time in the same directory as the example sequence.  To do this:
    - Unregister the current DLL by going to Start Menu>>Run, and typing: regsvr32 /u NIVBAITestStandAPI.dll
    - Move the DLL from the system32 folder to the folder in which the example sequence is saved.
    - Reregister the DLL from the run command (regsvr32 <folder path>\NIVBAITestStandAPI.dll)
    - Restart TestStand if it is open
    I apologize for not having any concrete answers, but this one is proving tough without me being able to replicate the issue.
    crisR

  • Building run-time command in Forms 5

    How do I build a command syntax at run-time in Forms 5?
    E.g., I want to call a stored procedure from a trigger in a
    Form. But the name of the stored procedure has to be selected
    from a table at run-time.
    null

    Use an errorpage which can print the stacktrace to the response.
              Sha Liu wrote:
              > I was annoyed but this weird message of weblogic for two days:
              >
              > From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
              > 10.5.1 500 Internal Server Error
              > The server encountered an unexpected condition which prevented it from
              > fulfilling the request.
              >
              > And there's no exceptions or any error messages in the stack trace of server
              > console.
              > Then I tried to write a simple JSP to test if Weblogic will properly display
              > some run-time exceptions.
              > My JSP is like this:
              >
              > <% Integer i = null; System.out.println(i.toString()); %>
              > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
              > <html>
              > </script>
              > <head>
              > </head>
              > <body>
              > test
              > </body>
              > </html>
              >
              > And I found it fails!
              > Is it a bug of weblogic or I need to configure something to enable the
              > catching the run-time exceptions?
              >
              > My weblogic is 5.1 applied SP5.
              >
              > Sha Liu
              Tom
              | Thomas Preston |
              | Vacation.com, Inc. |
              | Engineering Department |
              | 617.654.8432 |
              | http://www.vacation.com |
              

Maybe you are looking for