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.º 2
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();
            };
        }