예제 #1
0
        public static object createAction(IServiceProvider provider, Action method)
        {
            string s = ExtensionTool.getDestinationType(provider).Name;

            switch (ExtensionTool.getDestinationType(provider).Name)
            {
            case "ICommand":
                return((object)(new RelayCommand(param => method())));

            case "Delegate":
                return(ExtensionTool.createDelegate(ExtensionTool.getDestinationType(provider), (object sender, object args) => method()));

            case "EventHandler":
                return(ExtensionTool.createDelegate(ExtensionTool.getDestinationType(provider), (object sender, object args) => method()));

            case "MouseButtonEventHandler":
                return(ExtensionTool.createDelegate(ExtensionTool.getDestinationType(provider), (object sender, object args) => method()));

            case "RoutedEventHandler":
                return(ExtensionTool.createDelegate(ExtensionTool.getDestinationType(provider), (object sender, object args) => method()));

            default:
                return(null);
            }
        }
예제 #2
0
        public static object createEventAction(IServiceProvider provider, Action <object> method)
        {
            switch (ExtensionTool.getDestinationType(provider).Name)
            {
            case "ICommand":
                return(null);

            case "Delegate":
                return(ExtensionTool.createDelegate(ExtensionTool.getDestinationType(provider), (object sender, object args) => method(args)));

            default:
                return(null);
            }
        }