Exemplo n.º 1
0
        private async void MainPage_OnLoaded(object sender, RoutedEventArgs e)
        {
            Console.OnLog += Console_OnLog;

            try
            {
                host = new ChakraHost();
            }
            catch (Exception ex)
            {
                JsConsole.Text = ex.Message;
            }

            try
            {
                // simple palette
                //await ReadAndExecute("sample.js");

                // animating rect
                //await ReadAndExecute("paper-full.js");
                //await ReadAndExecute("papersample.js");

                // tadpoles
                await host.ReadAndExecute("paper-full.js", "paperjs-refs");
                await host.ReadAndExecute("tadpoles.js", "paperjs-refs");

                this.timer.Start();
            }
            catch (Exception ex)
            {
                Log(ex.Message);
            }
        }
Exemplo n.º 2
0
        public JsEngine(SdSource s)
        {
            source = s;
            engine = new ChakraHost();

            //if (s != null) {
            //    engine.RegisterFunction("print", (args) =>
            //    {
            //        //if (args.Length > 0) {
            //        //    Util.log(source, "JsEngine.print", args[0].ConvertToString().ToString());
            //        //}
            //    });
            //}
        }
Exemplo n.º 3
0
        private async void CDC_OnLoaded(object sender, RoutedEventArgs e)
        {
            WaitGrid.Visibility = Visibility.Visible;
            Console.OnLog += Console_OnLog;

            CommunicationManager.RegisterType(typeof(People[]));
            CommunicationManager.OnObjectReceived = (data) =>
            {
                var peopleList = (People[])data;
                peopleCollection = new ObservableCollection<People>(peopleList);

                peopleCollection.CollectionChanged += PeopleCollection_CollectionChanged;

                GridView.ItemsSource = peopleCollection;
                WaitGrid.Visibility = Visibility.Collapsed;
            };

            try
            {
                host = new ChakraHost();
            }
            catch (Exception ex)
            {
                JsConsole.Text = ex.Message;
            }

            try
            {
                await ReadAndExecute("cdc.js");
                await ReadAndExecute("azuremobileservices.js");
                await ReadAndExecute("cdc-azuremobileservices.js");
                await ReadAndExecute("sample.js");
            }
            catch (Exception ex)
            {
                Log(ex.Message);
            }
        }
Exemplo n.º 4
0
 public JsEngine() {
     engine = new ChakraHost();
 }