示例#1
0
        public MainWindow()
        {
            InitializeComponent();

            // Initialize the portfolios
            var portfolios = new string[] { "High-risk", "Moderate", "Low-risk" };

            lbPortfolios.ItemsSource = portfolios;

            this.glue = new Glue42();
            this.glue.Initialize("DotNetApp", useContexts: true);

            // Initialize Window Stickiness and read from config:
            var swOptions = this.glue.GlueWindows?.GetStartupOptions() ?? new GlueWindowOptions();

            swOptions.WithChannelSupport(true);
            this.glue.GlueWindows?.RegisterWindow(this, swOptions)
            .ContinueWith(r =>
            {
                glueWindow       = r.Result;
                glueWindow.Title = "Glue42 Bloomberg Net App";
                glueWindow.ChannelContext.Subscribe(new LambdaGlueChannelEventHandler <string>(
                                                        (context, channel, instrument) =>
                                                        Dispatcher.BeginInvoke((Action)(() => tbBBG.Text = instrument)),
                                                        (context, channel, arg3) => Dispatcher.BeginInvoke((Action)(() => tbBBG.Text =
                                                                                                                        context.GetValue <string>(
                                                                                                                            instrumentFieldPath_,
                                                                                                                            ChannelLevel.Root)))), instrumentFieldPath_, ChannelLevel.Root);
            });
        }
示例#2
0
        public MainWindow()
        {
            var gwOptions = App.Glue.GlueWindows?.GetStartupOptions() ?? new GlueWindowOptions();

            gwOptions.WithType(GlueWindowType.Tab);
            gwOptions.WithTitle("SignalApp");

            // register the window and save the result
            App.Glue.GlueWindows?.RegisterWindow(this, gwOptions)?.ContinueWith(t =>
            {
                if (t.IsCompleted)
                {
                    GlueWindow = t.Result;
                }
            }, TaskScheduler.FromCurrentSynchronizationContext());

            InitializeComponent();
        }
示例#3
0
        public void Initialize(MainWindow context, State state, Glue42 glue, GDStartingContext startingContext,
                               IGlueWindow glueWindow)
        {
            // The method is invoked when the window is restored
            var colorAsString = state?.RectangleColor ?? "#FFFFFF";
            var color         = (Color)ColorConverter.ConvertFromString(colorAsString);
            var items         = ColorSelector.Items;

            Dispatcher.Invoke(() =>
            {
                for (int i = 0; i < items.Count; i++)
                {
                    var rectangle  = items[i] as Rectangle;
                    var colorBrush = rectangle.Fill as SolidColorBrush;

                    if (colorBrush.Color == color)
                    {
                        ColorSelector.SelectedIndex = i;
                    }
                }

                ColorRectangle.Fill = new SolidColorBrush(color);
            });
        }
 public void Initialize(MainWindow context, SymbolState state, Glue42 glue, GDStartingContext startingContext, IGlueWindow glueWindow)
 {
     // Invoked when the window is restored
     Dispatcher.Invoke(() =>
     {
         Symbol.Text = state?.ActiveSymbol ?? SymbolOneName;
     });
 }