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);
                });
            });
        }
        public MainWindow()
        {
            InitializeComponent();

            btn_new_window.IsEnabled = false;
            System.Diagnostics.Stopwatch connectTimer = new System.Diagnostics.Stopwatch();
            runtime = Openfin.Desktop.Runtime.GetRuntimeInstance(new Openfin.Desktop.RuntimeOptions() { Version = "alpha" });

            connectTimer.Start();
            runtime.Connect(() =>
            {
                Openfin.WPF.Utils.InvokeOnUiThreadIfRequired(this, () =>
                {
                    btn_new_window.IsEnabled = true;
                    connectTimer.Stop();
                    lbl_time.Content = $"{connectTimer.Elapsed.TotalSeconds} seconds";
                });
            });
        }
Example #3
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();
            });
        }