/// <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[] { }); }
/// <summary/> public override void Init(Variation v) { base.Init(v); v.AssertExistenceOf("ClassName", "Namespace", "CanInherit", "Assembly"); this.className = v["ClassName"]; this.nameSpace = v["Namespace"]; string inherit = v["CanInherit"]; string asm = v["Assembly"]; dotnetPath = v["DotnetPath"]; // We define this for local testing if we don't use avalon.msi if (dotnetPath == null) { try { dotnetPath = EnvironmentWrapper.GetEnvironmentVariable("LAPI"); } catch (System.Security.SecurityException ex) { AddFailure("Could not access the Environment variable: LAPI"); Log("Exception: " + ex); } if (dotnetPath == null) { throw new ApplicationException("LAPI is not defined. I can't find my binaries."); } } Log("DotnetPath = " + dotnetPath); TrustedAssembly assembly = TrustedAssembly.LoadFile(TrustedPath.Combine(dotnetPath, asm)); this.type = assembly.GetType(nameSpace + "." + className); if (type == null) { throw new ApplicationException(nameSpace + "." + className + " was not found in " + asm); } this.classGenerator = new ClassGenerator(type); this.canInherit = StringConverter.ToBool(inherit); }
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)); } }