@args -lib:'{ProgramFiles|ProgramFiles(x86)}\Reference Assemblies\Microsoft\Framework\.NETFramework\{@latest}' @ref 'System.Xml' @ref 'WindowsBase' @ref 'PresentationCore' @ref 'PresentationFramework' @ref 'System.Xaml' use System.ComponentModel use System.Windows use System.Windows.Controls use System.Windows.Controls.Primitives use System.Windows.Data use System.Windows.Input sig RoutedMethod(sender, args as RoutedEventArgs) class X def main pass def addMenuItem(header as String, inputGestureText as String? = nil, command as RoutedCommand? = nil, handler as RoutedMethod? = nil) as MenuItem mi = MenuItem(header=header) if inputGestureText, mi.inputGestureText = inputGestureText if handler, listen mi.click, RoutedEventHandler(handler) # <--- instantiate a delegate return mi