public MainPage() { this.InitializeComponent(); var setup = new ScriptRuntimeSetup(); setup.HostType = typeof(DlrHost); setup.AddRubySetup(); var runtime = Ruby.CreateRuntime(setup); this.engine = Ruby.GetEngine(runtime); this.scope = engine.CreateScope(); this.scope.SetVariable("Main", this); runtime.LoadAssembly(typeof(object).GetTypeInfo().Assembly); runtime.LoadAssembly(typeof(TextSetOptions).GetTypeInfo().Assembly); runtime.LoadAssembly(typeof(TextAlignment).GetTypeInfo().Assembly); string outputText = @" box = main.find_name('OutputBox') p box.text_alignment box.text_alignment = Windows::UI::Xaml::TextAlignment.Right p box.text_alignment "; InputBox.IsSpellCheckEnabled = false; OutputBox.IsSpellCheckEnabled = false; InputBox.Document.SetText(TextSetOptions.None, outputText); // http://msdn.microsoft.com/en-us/library/windows/apps/br211377.aspx IInspectable insp = (IInspectable)InputBox.Document; string winTypeName; insp.GetRuntimeClassName(out winTypeName); Guid[] iids; int iidCount; insp.GetIids(out iidCount, out iids); // winTypeName = "Windows.Foundation.Collections.IIterator`1<Windows.Foundation.Collections.IMapView`2<Windows.Foundation.Collections.IVector`1<String>, String>>"; var parts = ParseWindowsTypeName(winTypeName); Type type = MakeWindowsType(parts); var guid = type.GetTypeInfo().GUID; }
protected override object CreateObject(IntPtr externalComObject, CreateObjectFlags flags) { IObjectReference objRef = ComWrappersSupport.GetObjectReferenceForInterface(externalComObject); if (objRef.TryAs <IInspectable.Vftbl>(out var inspectableRef) == 0) { IInspectable inspectable = new IInspectable(inspectableRef); string runtimeClassName = inspectable.GetRuntimeClassName(noThrow: true); if (runtimeClassName == null) { // If the external IInspectable has not implemented GetRuntimeClassName, // we use the Inspectable wrapper directly. return(inspectable); } return(ComWrappersSupport.GetTypedRcwFactory(runtimeClassName)(inspectable)); }