private static void AddToParent(string parentId, UIElement child) { if (parentId == "root") { var nativeRoot = FreStageSharp.GetRootView() as FreNativeRoot; nativeRoot?.AddChild(child); } else { var nativeView = Children[parentId].Item2 as FreNativeSprite; nativeView?.AddChild(child); } }
private FREObject RunStringTests(FREContext ctx, uint argc, FREObject[] argv) { Trace(@"***********Start String test***********"); if (argv[0] == FREObject.Zero) { return(FREObject.Zero); } try { var airString = argv[0].AsString(); Trace("String passed from AIR:", airString); SendEvent("MY_EVENT", "this is a test"); } catch (Exception e) { Console.WriteLine($@"caught in C#: type: {e.GetType()} message: {e.Message}"); } //nativeRoot is actually created as a pointer when we call NativeStage.add() from AIRNativeANE var nativeRoot = FreStageSharp.GetRootView() as FreNativeRoot; var myEllipse = new Ellipse(); var mySolidColorBrush = new SolidColorBrush { Color = FromArgb(255, 255, 255, 0) }; // Describes the brush's color using RGB values. // Each value has a range of 0-255. myEllipse.Fill = mySolidColorBrush; myEllipse.StrokeThickness = 2; myEllipse.Stroke = Black; // Set the width and height of the Ellipse. myEllipse.Width = 200; myEllipse.Height = 100; nativeRoot?.AddChild(myEllipse); const string sharpString = "I am a string from C#"; return(sharpString.ToFREObject()); }