Ejemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();

            var runtimeOptions = new Openfin.Desktop.RuntimeOptions()
            {
                Version = "9.*"
            };

            if (App.OpenFinPort != 0)
            {
                runtimeOptions.Port = App.OpenFinPort;
                runtimeOptions.PortDiscoveryMode     = Openfin.Desktop.PortDiscoveryMode.None;
                runtimeOptions.RuntimeConnectOptions = Openfin.Desktop.RuntimeConnectOptions.UseExternal;
            }

            var runtimeInstance = Openfin.Desktop.Runtime.GetRuntimeInstance(runtimeOptions);

            runtimeInstance.Connected    += OpenFinRuntime_Connected;
            runtimeInstance.Disconnected += OpenFinRuntime_Disconnected;

            runtimeInstance.Connect(() =>
            {
                if (!string.IsNullOrEmpty(App.OpenFinUuid))
                {
                    var appToEmbed = OpenFinGlobals.RuntimeInstance.WrapApplication(App.OpenFinUuid);
                    WebContents.Initialize(OpenFinGlobals.RuntimeInstance.Options, appToEmbed.getWindow());
                }
            });

            Task.Run(new Action(PingAppLauncherLoop));
        }
Ejemplo n.º 2
0
        public ReceiverViewModel()
        {
            var exePath        = System.Reflection.Assembly.GetExecutingAssembly().Location;
            var exeDir         = System.IO.Path.GetDirectoryName(exePath);
            var runtimeOptions = new Openfin.Desktop.RuntimeOptions
            {
                UUID = "receiver-uuid",
                EnableRemoteDevTools = false,
                RemoteDevToolsPort   = 9090,
                AssetsPath           = exeDir + "\\Assets"
            };

            var runtime = Openfin.Desktop.Runtime.GetRuntimeInstance(runtimeOptions);

            runtime.Error += (sender, e) =>
            {
                Console.Write(e);
            };

            runtime.Connect(() =>
            {
                // Initialize the communication channel after the runtime has connected
                // but before launching any applications or EmbeddedViews
                dataMessageChannel = new MessageChannel(runtime.InterApplicationBus, "user-data");
                dataMessageChannel.MessageReceived += DataMessageChannel_MessageReceived;
            });
        }
        public MainWindow()
        {
            InitializeComponent();
            //Runtime options is how we set up the OpenFin Runtime environment

            var runtimeOptions = new Openfin.Desktop.RuntimeOptions
            {
                Version = version,
                EnableRemoteDevTools = true,
                RemoteDevToolsPort   = 9090
            };

            var runtime = Openfin.Desktop.Runtime.GetRuntimeInstance(runtimeOptions);

            runtime.Error += (sender, e) =>
            {
                Console.Write(e);
            };

            runtime.Connect(() =>
            {
                // Initialize the communication channel after the runtime has connected
                // but before launching any applications or EmbeddedViews
                dataMessageChannel = new MessageChannel(runtime.InterApplicationBus, "hyper-grid-uuid", "user-data");
            });

            //Initialize the grid view by passing the runtime Options and the ApplicationOptions
            var fileUri = new Uri(System.IO.Path.GetFullPath(@"..\..\web-content\index.html")).ToString();

            OpenFinEmbeddedView.Initialize(runtimeOptions, new Openfin.Desktop.ApplicationOptions("hyper-grid", "hyper-grid-uuid", fileUri));

            //Once the grid is ready get the data and populate the list box.
            OpenFinEmbeddedView.Ready += (sender, e) =>
            {
                //set up the data
                peopleData = PeopleData.Get();
                var peopleInStates = (from person in peopleData
                                      group person by person.BirthState into stateGroup
                                      select new
                {
                    StateName = stateGroup.First().BirthState,
                    People = stateGroup
                })
                                     .OrderBy(p => p.StateName)
                                     .ToList();

                //Any Interactions with the UI must be done in the right thread.
                Openfin.WPF.Utils.InvokeOnUiThreadIfRequired(this, () => peopleInStates.ForEach(state => StatesBox.Items.Add(state.StateName)));

                var t = new System.Threading.Thread(() =>
                {
                    dataMessageChannel.SendData(peopleData);
                });
                t.Start();
            };
        }
Ejemplo n.º 4
0
        public MainWindow()
        {
            InitializeComponent();

            //Runtime options is how we set up the OpenFin Runtime environment

            var runtimeOptions = new Openfin.Desktop.RuntimeOptions
            {
                Version = version,
                EnableRemoteDevTools = true,
                RemoteDevToolsPort   = 9090
            };

            var runtime = Openfin.Desktop.Runtime.GetRuntimeInstance(runtimeOptions);

            runtime.Error += (sender, e) =>
            {
                Console.Write(e);
            };

            runtime.Connect(() =>
            {
                // Initialize the communication channel after the runtime has connected
                // but before launching any applications or EmbeddedViews
                dataMessageChannel = new MessageChannel(runtime.InterApplicationBus, uuid, topic);
            });

            //Initialize the grid view by passing the runtime Options and the ApplicationOptions
            var fileUri = new Uri(System.IO.Path.GetFullPath(@"web-content\test-ang\index.html")).ToString();

            OpenFinEmbeddedView.Initialize(runtimeOptions, new Openfin.Desktop.ApplicationOptions(subscriptionName, uuid, fileUri));

            //Once the grid is ready get the data and populate the list box.
            OpenFinEmbeddedView.Ready += (sender, e) =>
            {
                var t = new System.Threading.Thread(() =>
                {
                    while (true)
                    {
                        Thread.Sleep(2000);
                        var str = Guid.NewGuid();
                        dataMessageChannel.SendData(str.ToString());
                    }
                });
                t.Start();
            };
        }
Ejemplo n.º 5
0
        public MainWindow()
        {
            InitializeComponent();

            this.Title = AppName + " - OpenFin...";

            DataContext = _symbols;

            var runtimeOptions = new Openfin.Desktop.RuntimeOptions
            {
                Version = "beta"
            };

            _runtime        = Openfin.Desktop.Runtime.GetRuntimeInstance(runtimeOptions);
            _runtime.Error += (sender, e) =>
            {
                Console.Write(e);
                var time = DateTime.Now.ToString("hh:mm:ss");
                this.MessagesHistory.Text = "OpenFin connecting... failed at " + time + "\n" + e.ToString();
                this.Title = AppName + " - OpenFin Failed";
            };

            _runtime.Connect(() =>
            {
                Console.WriteLine("connected to openfin");

                this.Dispatcher.Invoke(() =>
                {
                    var time = DateTime.Now.ToString("hh:mm:ss");
                    this.MessagesHistory.Text = "OpenFin connecting... done at " + time;
                    this.Title = AppName + " - OpenFin Connected";
                    this.StockList.IsEnabled = true;
                });

                // creating Openfin App
                var guid       = Guid.NewGuid().ToString();
                var appOptions = new Openfin.Desktop.ApplicationOptions("IGFinTickerWPFDemo", "IGFinTickerWPFDemo-" + guid, "https://www.infragistics.com/openfin");
                _appOptions    = appOptions;
                var app        = _runtime.CreateApplication(appOptions);

                app.Run(() =>
                {
                    Console.WriteLine("The application is now running!");
                    _runtime.InterApplicationBus.subscribe("*", "FDC3", onMessageRecived);
                });
            });
        }
        public Form1()
        {
            InitializeComponent();
            Metrics = new PerformanceMetrics();

            InitializeComponent();

            RuntimeOptions = new Openfin.Desktop.RuntimeOptions
            {
                Version = "alpha",
                EnableRemoteDevTools = true,
                RemoteDevToolsPort = 9090,
                Arguments = "--noerrdialogs --disable-legacy-window --v1"
            };

            var timer = new System.Timers.Timer(2000);
            timer.Elapsed += PerformanceMonitorTimer;
            timer.Start();
        }
Ejemplo n.º 7
0
        public Form1()
        {
            InitializeComponent();

            var uriPath = new Uri(Path.Combine(Environment.CurrentDirectory, "index.html")).AbsoluteUri;

            var runtimeOptions = new Openfin.Desktop.RuntimeOptions
            {
                Version = "alpha"
            };

            var appOptions = new Openfin.Desktop.ApplicationOptions("drag-drop", "drag-drop-uuid", uriPath);

            embeddedView1.Initialize(runtimeOptions, appOptions);

            embeddedView1.OnReady += (sender, e) =>
            {
                embeddedView1.OpenfinWindow.showDeveloperTools();
            };
                
        }
Ejemplo n.º 8
0
        public MainWindow()
        {
            InitializeComponent();
            // TODO is version relevant/used?  do need to provide LicenseKey, SupportInformation?
            // http://cdn.openfin.co/docs/csharp/latest/OpenfinDesktop/html/6A71B701.htm
            var runtimeOptions = new Openfin.Desktop.RuntimeOptions
            {
                Version = "stable",
                UUID    = "8651D4BB-5B58-4AE6-9984-3E6DB1641E7D"
            };

            openfin = Openfin.Desktop.Runtime.GetRuntimeInstance(runtimeOptions);
            openfin.Disconnected   += Openfin_RuntimeDisconnected;
            openfin.ConnectTimeout += Openfin_ConnectTimeout;
            openfin.Connect(() =>
            {
                var provider              = new SerialPortProvider(openfin);
                provider.ClientConnected += SerialPortProvider_ClientConnected;
                provider.OpenAsync();
            });
        }