-
Given a ToolWindow I created with a webView2 component inside, there are some methods interacting with the webView instance in App.xaml.cs that I need to call from outter classes, for example a Command class. Obviously doing App app = new(); from the Command class sets the WebView2 to null. Also tried to make App.xaml.cs singleton class but didnt work either. Sorry if the question is too dumb but I find myself a bit lost in this topic. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
As I mentioned, the solution was pretty much dumb. Only thing I did was implement a Singleton initialization in App class; private static App _instance; (will implement synclocks for concurrency problems) //wherever your App ToolWindow is completely initialized Now access App.Instance from everywhere Apologies for the thread, I'll mark it as solved. |
Beta Was this translation helpful? Give feedback.
As I mentioned, the solution was pretty much dumb.
Only thing I did was implement a Singleton initialization in App class;
private static App _instance;
(will implement synclocks for concurrency problems)
public static aXetChatControl Instance
{
get
{
return _instance;
}
}
//wherever your App ToolWindow is completely initialized
_instance = this;
Now access App.Instance from everywhere
Apologies for the thread, I'll mark it as solved.