Exemplo n.º 1
0
    private void wireMember(IBaseView view, MemberInfo match, MethodInfo method)
    {
        var matchingMemberType = ((PropertyInfo)match).PropertyType;

        if (matchingMemberType == typeof(Button))
        {
            var matchingButton = view.Get <Button>(match.Name);
            var eventHandler   = (EventHandler)EventHandler.CreateDelegate(typeof(EventHandler), this, method);
            matchingButton.Click += eventHandler;
        }
        if (matchingMemberType == typeof(ListBox))
        {
            var matchinListBox = view.Get <ListBox>(match.Name);
            var eventHandler   = (EventHandler)EventHandler.CreateDelegate(typeof(EventHandler), this, method);
            matchinListBox.SelectedIndexChanged += eventHandler;
        }
    }