コード例 #1
0
ファイル: Form1.cs プロジェクト: alyssabrouse/EmbeddedOpenFin
        public Form1()
        {
            InitializeComponent();
            this.lblConnectionStatus.Text = "Connecting...";
            //Runtime options is how we set up the OpenFin Runtime environment,
            var runtimeOptions = new RuntimeOptions {
                Version = "stable",
                EnableRemoteDevTools = true,
                RemoteDevToolsPort   = 9090
            };

            //Create our two embedded view controlls.
            chartEmbeddedView = new EmbeddedView();

            //Add the embedded view controlls to each tabPage
            panel1.Controls.Add(chartEmbeddedView);

            //Initialize the chart view by passing the runtime Options and the ApplicationOptions
            chartEmbeddedView.Initialize(runtimeOptions, new ApplicationOptions(
                                             ConfigurationManager.AppSettings["OpenFinApp-Name"],
                                             ConfigurationManager.AppSettings["OpenFinApp-UUID"],
                                             ConfigurationManager.AppSettings["OpenFinApp-Url"]));

            //We can get the instance of the singleton runtime object by usig the GetRuntimeInstance function and passing
            var openFinRuntime = Runtime.GetRuntimeInstance(runtimeOptions);

            chartEmbeddedView.Ready += (sender, e) =>
            {
                //Update the conection status:
                Utils.InvokeOnUiThreadIfRequired(this, () => { this.lblConnectionStatus.Text = "Connected"; });

                //subscribe to chart-click messages from the chartEmbeddedView
                openFinRuntime.InterApplicationBus.subscribe(chartEmbeddedView.OpenfinApplication.getUuid(), "chart-click", (senderUuid, topic, data) =>
                {
                    var dataAsJObject = JObject.FromObject(data);
                    Utils.InvokeOnUiThreadIfRequired(this, () => {
                        label5.Text = string.Format("Key:{0}, {1} at {2}", dataAsJObject.GetValue("key"), dataAsJObject.GetValue("y"), dataAsJObject.GetValue("x"));
                    });
                });
            };
        }
コード例 #2
0
        public Form1()
        {
            InitializeComponent();

            // Connect to the runtime
            var runtimeOptions = new Fin.RuntimeOptions
            {
                Version = "beta",
                EnableRemoteDevTools = true,
                RemoteDevToolsPort   = 9090
            };

            _runtime = Fin.Runtime.GetRuntimeInstance(runtimeOptions);
            _runtime.Connect(RuntimeConnectedCallback);


            var appOptions = new Fin.ApplicationOptions("webproj", "webproj", "file:///C:/OpenfinPOC/OpenFinInteroperatability/OpenFinInteroperatability/webproj/public/index.html");

            embeddedview = new EmbeddedView();
            panel1.Controls.Add(embeddedview);
            embeddedview.Initialize(runtimeOptions, appOptions);

            embeddedview.OnReady += embeddedView_OnReady;
        }