Example #1
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);
                });
            });
        }