Fixed invalidcast exception on setting twframe to capability.

This commit is contained in:
soukoku
2015-02-20 17:45:02 -05:00
parent 20a8305214
commit 59e8b996de
4 changed files with 12 additions and 7 deletions

View File

@@ -8,6 +8,7 @@ using System.Collections;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Interop;
@@ -91,6 +92,10 @@ namespace Tester.WPF
}
catch (Exception ex)
{
if (ex is TargetInvocationException)
{
ex = ex.InnerException;
}
ModernMessageBox.Show(this, ex.Message, "Cannot Set", MessageBoxButton.OK, MessageBoxImage.Error);
}
}

View File

@@ -29,9 +29,9 @@ namespace Tester.WPF
{
_wrapper = wrapProperty.GetGetMethod().Invoke(ds, null);
var wrapperType = _wrapper.GetType();
_getMethod = wrapperType.GetMethod("Get");
_getMethod = wrapperType.GetMethod("GetValues");
_getCurrentMethod = wrapperType.GetMethod("GetCurrent");
_setMethod = wrapperType.GetMethods().FirstOrDefault(m => m.Name == "Set");
_setMethod = wrapperType.GetMethods().FirstOrDefault(m => m.Name == "SetValue");
}
var supportTest = ds.CapQuerySupport(cap);