How First.Second.Third get the namespace application from code with a namespace for example First.Second.Third ? You need to get the application namespace from the plugin (they are different) to access the current instance of the class. Of course, you can manually enter, but I have a script for 50 similar applications that have a different namespace (mandatory), so I would like to do it programmatically.
The bottom line comes down to that of this line:

 var mainPage = (((App)Application.Current).RootPage); 

do this:

 var mainPage = (((my.namespace.App)Application.Current).RootPage); 

It is possible to pass the desired namespace to the argument of the function that uses this string, but (the habit of js) does not work here in inserting a type to insert a variable that will be substituted at the right time and will make everything nice ((

    1 answer 1

    You are doing something wrong. Well, you got a string with the namespace of the application, what will you do with it?

    Disactivate Java habits, C # is a completely different language.


    To begin with, answer the question: why do you assume that Application has a RootPage field? Documentation does not seem to guarantee this.


    No, no, “no time to learn” is not an argument.

    If the Application Classes are under your control, let them implement a common interface.

     interface IStxApplication { Window RootWindow { get; } } 
    • I made it myself. This is an exceptional situation - I'll do it and immediately get rid of js)))) In general, I only need # for this project and it is very urgent, because there is no time to learn it. And at hand there is no person who understands it. I have mastered what looks like Java, but some differences just put me in a stump X_X - stx
    • Oh, thank you very much) I will definitely find the time)) - stx