Faced such a problem: I accept callback from the site and process it
public partial class MainWindow : Window { private readonly CallbackObjectForJs _callBackObjectForJs; private readonly CallbackObjectSaveSettings _callbackObjectSaveSettings; private static XmlHelper _xmlhelper; public MainWindow() { InitializeComponent(); _xmlhelper = new XmlHelper(); var hostInterface = new HostInterface(this); Browser.RegisterAsyncJsObject("hostInterface", hostInterface); Browser.ConsoleMessage += (s, e) => { Debug.WriteLine($"BROWSERCONSOLE: {e.Source}:{e.Line} - {e.Message}"); }; _callBackObjectForJs = new CallbackObjectForJs(); _callbackObjectSaveSettings = new CallbackObjectSaveSettings(); Browser.RegisterAsyncJsObject("callbackObj", _callBackObjectForJs); Browser.RegisterAsyncJsObject("callbackObj", _callbackObjectSaveSettings); } public class CallbackObjectForJs { public void showMessage(string msg) { MessageBox.Show(msg); } } public class CallbackObjectSaveSettings { public void showMessage(string msg) { MessageBox.Show(msg); } public void getAuthUser(string login, string password) { _xmlhelper.UpdateSettingValue("user_login", login); _xmlhelper.UpdateSettingValue("user_password", UserDataProtected.Shifrovka(password, "wsprod")); userBarGrid.Visibility = true; // ОШИБКА Требуется указать ссылку на объект } } } After that, I want to run the loadUserData () method, but getAuthUser swears at a non-static method (indicated by public static void loadUserData, the internal code begins to swear). Tell me, please, how to solve it? Thank!
myGrid.Visible = trueor something like that will suit you. What does it have to do with non-static methods I do not understand :) - tym32167