private async void WebControl_OnNavigationStarting(object?sender, CoreWebView2NavigationStartingEventArgs e) { if (e.Uri.StartsWith("https://mbnk.app")) { await Task.Delay(100); var path = Application.ResourceAssembly.Location.Replace( "Monoboard.dll", "Resources/JS/qrCodeMessages.js"); var script = await File.ReadAllTextAsync(path); await WebControl.ExecuteScriptAsync(script); await Task.Delay(5000); WebControl?.CoreWebView2.Navigate("https://api.monobank.ua/"); } else if (e.Uri.StartsWith("https://api.monobank.ua/")) { await Task.Delay(100); var path = Application.ResourceAssembly.Location.Replace( "Monoboard.dll", "Resources/JS/qrCodeVisualFormatter.js"); var script = await File.ReadAllTextAsync(path); await WebControl.ExecuteScriptAsync(script); } }
void Logout() { UiHelper.TryOnUiThread(() => { try { WebControl.ExecuteScriptAsync("window.w6Cheat.api.logout();"); } catch (InvalidOperationException ex) { MainLog.Logger.FormattedWarnException(ex, "Could not logout of the webpage"); } }); }
private async void WebControl_OnSizeChanged(object sender, SizeChangedEventArgs e) { if (!IsReady) { return; } if (WebControl.ActualWidth < 960 && WebControl.Source.OriginalString.Contains("api.monobank")) { await WebControl.ExecuteScriptAsync("document.querySelector('.core').style.alignItems='initial';"); } else { await WebControl.ExecuteScriptAsync("document.querySelector('.core').style.alignItems='center';"); } }