-
Say I have a shared project
And then 3 different Projects, say
Is there a way to pass additional parameters? I couldn't find an examples on how to do this, eg something like this...
I want to pass some custom data from each individual project into the shared project but thought manipulating the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
One possible way could be to use the overload of The code would look something like this namespace SomeProject.Win;
static class Program
{
[STAThread]
public static void Main(string[] args) => BuildAvaloniaApp(new SomeAdditionalClass()).StartWithClassicDesktopLifetime(args);
public static AppBuilder BuildAvaloniaApp(SomeAdditionalClass args)
=> AppBuilder.Configure<App>(() => new App(args))
.UsePlatformDetect()
#if DEBUG
.LogToTrace()
#endif
.WithInterFont();
} You could also use the namespace SomeProject.Win;
static class Program
{
[STAThread]
public static void Main(string[] args) => BuildAvaloniaApp(new SomeAdditionalClass()).StartWithClassicDesktopLifetime(args);
public static AppBuilder BuildAvaloniaApp(SomeAdditionalClass args)
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.AfterSetup(b => ((App)ab.Instance).Args = args)
#if DEBUG
.LogToTrace()
#endif
.WithInterFont();
} |
Beta Was this translation helpful? Give feedback.
One possible way could be to use the overload of
AppBuilder.Configure<App>()
. The overload takes aFunc<TApp>
which would allow you to pass the extra args into the constructor of the App.The code would look something like this
You could also use the
AfterSetup()
callb…