public App() { this.Startup += this.Application_Startup; this.Exit += this.Application_Exit; this.UnhandledException += this.Application_UnhandledException; InitializeComponent(); _vbscript = new VbscriptHost(); }
private void MyButton_Click(object sender, RoutedEventArgs e) { VbscriptHost vbscript = ((App)Application.Current).VBScript; ScriptScope scope = vbscript.CreateScope(); scope.SetVariable("page", this); //this.MyButton.Content = "Clicked"; string code = "page.MyButton.Content = \"Clicked\""; CompiledCode compiled = vbscript.Compile(code); compiled.Execute(scope); }