/// <summary/> public static void WaitForCompleteRender() { Type hwndTargetType = typeof(HwndTarget); TrustedAssembly mcasm = TrustedAssembly.GetAssembly(hwndTargetType); TrustedType mcType = mcasm.GetType("System.Windows.Media.MediaContext"); object mediaContext = mcType.InvokeMember("From", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.InvokeMethod, null, null, new object[] { System.Windows.Threading.Dispatcher.CurrentDispatcher }); mcType.InvokeMember("CompleteRender", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod, null, mediaContext, new object[] { }); }
private Type GetAnimationType(Type baseType) { if (baseType.IsValueType) { if (baseType.Name == "Matrix3D") { // Matrix3DAnimation does not exist in Avalon, so use the one that we created return(typeof(Matrix3DAnimation)); } else { TrustedAssembly presentationCore = TrustedAssembly.GetAssembly(typeof(Animatable)); return(PT.Untrust(presentationCore.GetType("System.Windows.Media.Animation." + baseType.Name + "Animation"))); } } else { // Reference-type animations do not exist in Avalon, so use the one that we created return(typeof(DiscreteAnimation)); } }