public void SetFinsemble(Finsemble fsbl) { this.fsbl = fsbl; Application.Current.Dispatcher.Invoke(() => { FinsembleHeader.SetBridge(fsbl); // The Header Control needs a connected finsemble instance //Styling the Finsemble Header FinsembleHeader.SetActiveBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#22262F"))); FinsembleHeader.SetInactiveBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#22262F"))); FinsembleHeader.SetButtonHoverBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4"))); FinsembleHeader.SetInactiveButtonHoverBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4"))); FinsembleHeader.SetCloseButtonHoverBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F26666"))); FinsembleHeader.SetInactiveCloseButtonHoverBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F26666"))); FinsembleHeader.SetDockingButtonDockedBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4"))); FinsembleHeader.SetTitleForeground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ACB2C0"))); FinsembleHeader.SetButtonForeground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ACB2C0"))); FinsembleHeader.SetButtonFont(null, 8, FontStyles.Normal, FontWeights.Normal); FinsembleHeader.SetTitleFont(null, 12, FontStyles.Normal, FontWeights.SemiBold); fsbl.DragAndDropClient.SetScrim(Scrim); // The Scrim Label Control is used for drag and drop. Show(); }); }
public void SetFinsemble(Finsemble fsbl) { this.fsbl = fsbl; Application.Current.Dispatcher.Invoke(() => { FinsembleHeader.SetBridge(fsbl); // The Header Control needs a connected finsemble instance // Styling the Finsemble Header FinsembleHeader.SetActiveBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3C4C58"))); FinsembleHeader.SetInactiveBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#303D47"))); FinsembleHeader.SetButtonHoverBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#005BC5"))); FinsembleHeader.SetInactiveButtonHoverBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#004BA3"))); FinsembleHeader.SetCloseButtonHoverBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#D30E2D"))); FinsembleHeader.SetInactiveCloseButtonHoverBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#D30E2D"))); FinsembleHeader.SetDockingButtonDockedBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#005BC5"))); FinsembleHeader.SetTitleForeground(new SolidColorBrush(Colors.White)); FinsembleHeader.SetButtonForeground(new SolidColorBrush(Colors.White)); FinsembleHeader.SetButtonFont(null, 14, FontStyles.Normal, FontWeights.Normal); FinsembleHeader.SetTitleFont(null, 14, FontStyles.Normal, FontWeights.Normal); fsbl.DragAndDropClient.SetScrim(Scrim); // The Scrim Label Control is used for drag and drop. Show(); }); }
private void Finsemble_Connected(object sender, EventArgs e) { Debug.WriteLine("FSBL connected"); Application.Current.Dispatcher.Invoke(() => { FinsembleHeader.SetBridge(FSBL); // The Header Control needs a connected finsemble instance ////Set window title FinsembleHeader.GetHandlingService().Title = this.LabelWindowName.Content.ToString(); //Styling the Finsemble Header FinsembleHeader.GetHandlingService().ActiveBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#22262F")); FinsembleHeader.GetHandlingService().InactiveBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#22262F")); FinsembleHeader.GetHandlingService().ButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4")); FinsembleHeader.GetHandlingService().InactiveButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4")); FinsembleHeader.GetHandlingService().CloseButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F26666")); FinsembleHeader.GetHandlingService().InactiveCloseButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F26666")); FinsembleHeader.GetHandlingService().DockingButtonDockedBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4")); FinsembleHeader.GetHandlingService().TitleForeground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ACB2C0")); FinsembleHeader.GetHandlingService().ButtonForeground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ACB2C0")); FinsembleHeader.GetHandlingService().ButtonFont = new TitlebarFontConfiguration() { FontFamily = null, FontSize = 8, FontStyle = FontStyles.Normal, FontWeight = FontWeights.Normal }; FinsembleHeader.GetHandlingService().TitleFont = new TitlebarFontConfiguration() { FontFamily = null, FontSize = 12, FontStyle = FontStyles.Normal, FontWeight = FontWeights.SemiBold }; FSBL.Clients.DragAndDropClient.SetScrim(Scrim); // The Scrim Label Control is used for drag and drop. Show(); }); Debug.Print($"The window \"{this.LabelWindowName.Content}\" is connected to Finsemble."); }
private void Finsemble_Connected(object sender, EventArgs e) { Application.Current.Dispatcher.Invoke(delegate //main thread { // Initialize this Window and show it InitializeComponent(); // Initialize after Finsemble is connected FinsembleHeader.SetBridge(FSBL); // The Header Control needs a connected finsemble instance //Styling the Finsemble Header FinsembleHeader.GetHandlingService().ActiveBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#22262F")); FinsembleHeader.GetHandlingService().InactiveBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#22262F")); FinsembleHeader.GetHandlingService().ButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4")); FinsembleHeader.GetHandlingService().InactiveButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4")); FinsembleHeader.GetHandlingService().CloseButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F26666")); FinsembleHeader.GetHandlingService().InactiveCloseButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F26666")); FinsembleHeader.GetHandlingService().DockingButtonDockedBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4")); FinsembleHeader.GetHandlingService().TitleForeground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ACB2C0")); FinsembleHeader.GetHandlingService().ButtonForeground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ACB2C0")); FinsembleHeader.GetHandlingService().ButtonFont = new TitlebarFontConfiguration() { FontFamily = null, FontSize = 8, FontStyle = FontStyles.Normal, FontWeight = FontWeights.Normal }; FinsembleHeader.GetHandlingService().TitleFont = new TitlebarFontConfiguration() { FontFamily = null, FontSize = 12, FontStyle = FontStyles.Normal, FontWeight = FontWeights.SemiBold }; //Set window title FinsembleHeader.GetHandlingService().Title = "Notify Example Component"; this.Show(); }); }
public void SetFinsemble(Finsemble fsbl) { this.fsbl = fsbl; Application.Current.Dispatcher.Invoke(() => { FinsembleHeader.SetBridge(fsbl); // The Header Control needs a connected finsemble instance //Styling the Finsemble Header FinsembleHeader.GetHandlingService().ActiveBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#22262F")); FinsembleHeader.GetHandlingService().InactiveBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#22262F")); FinsembleHeader.GetHandlingService().ButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4")); FinsembleHeader.GetHandlingService().InactiveButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4")); FinsembleHeader.GetHandlingService().CloseButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F26666")); FinsembleHeader.GetHandlingService().InactiveCloseButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F26666")); FinsembleHeader.GetHandlingService().DockingButtonDockedBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4")); FinsembleHeader.GetHandlingService().TitleForeground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ACB2C0")); FinsembleHeader.GetHandlingService().ButtonForeground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ACB2C0")); FinsembleHeader.GetHandlingService().ButtonFont = new TitlebarFontConfiguration() { FontFamily = null, FontSize = 8, FontStyle = FontStyles.Normal, FontWeight = FontWeights.Normal }; FinsembleHeader.GetHandlingService().TitleFont = new TitlebarFontConfiguration() { FontFamily = null, FontSize = 12, FontStyle = FontStyles.Normal, FontWeight = FontWeights.SemiBold }; fsbl.DragAndDropClient.SetScrim(Scrim); // The Scrim Label Control is used for drag and drop. Show(); }); }
private void Finsemble_Connected(object sender, EventArgs e) { Application.Current.Dispatcher.Invoke(delegate //main thread { // Initialize this Window and show it InitializeComponent(); // Initialize after Finsemble is connected FinsembleHeader.SetBridge(FSBL); // The Header Control needs a connected finsemble instance //Styling the Finsemble Header FinsembleHeader.SetActiveBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3C4C58"))); FinsembleHeader.SetInactiveBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#303D47"))); FinsembleHeader.SetButtonHoverBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#005BC5"))); FinsembleHeader.SetInactiveButtonHoverBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#004BA3"))); FinsembleHeader.SetCloseButtonHoverBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#D30E2D"))); FinsembleHeader.SetInactiveCloseButtonHoverBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#D30E2D"))); FinsembleHeader.SetDockingButtonDockedBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#005BC5"))); FinsembleHeader.SetTitleForeground(new SolidColorBrush(Colors.White)); FinsembleHeader.SetButtonForeground(new SolidColorBrush(Colors.White)); FinsembleHeader.SetButtonFont(null, 14, FontStyles.Normal, FontWeights.Normal); FinsembleHeader.SetTitleFont(null, 14, FontStyles.Normal, FontWeights.Normal); FSBL.DragAndDropClient.SetScrim(Scrim); // The Scrim Label Control is used for drag and drop. // Receivers for dropped data. FSBL.DragAndDropClient.AddReceivers(new List <KeyValuePair <string, EventHandler <FinsembleEventArgs> > >() { new KeyValuePair <string, EventHandler <FinsembleEventArgs> >("symbol", (s, args) => { var data = args.response["data"]?["symbol"]?["symbol"]; if (data != null) { Application.Current.Dispatcher.Invoke((Action) delegate //main thread { DroppedData.Content = data.ToString(); DataToSend.Text = data.ToString(); SaveState(); }); } ; }) }); // Emitters for data that can be dragged using the drag icon. FSBL.DragAndDropClient.SetEmitters(new List <KeyValuePair <string, DragAndDropClient.emitter> >() { new KeyValuePair <string, DragAndDropClient.emitter>("symbol", () => { //set state on drag so correct symbol is displayed Application.Current.Dispatcher.Invoke(delegate //main thread { DroppedData.Content = DataToSend.Text; SaveState(); }); return(new JObject { ["symbol"] = DataToSend.Text, ["description"] = "Symbol " + DataToSend.Text }); }) }); FSBL.ConfigClient.GetValue(new JObject { ["field"] = "finsemble.components" }, (routerClient, response) => { if (response.error != null) { Logger.Error(response.error); return; } var components = (JObject)response.response?["data"]; foreach (var property in components?.Properties()) { object value = components?[property.Name]?["foreign"]?["components"]?["App Launcher"]?["launchableByUser"]; if ((value != null) && bool.Parse(value.ToString())) { Application.Current.Dispatcher.Invoke(delegate //main thread { ComponentSelect.Items.Add(property.Name); }); } } }); //restore state if one exists UpdateDisplayData(); //Programmatically link to a colour channel //FSBL.LinkerClient.LinkToChannel("group2", null, (s, a) => { }); this.Show(); }); // Subscribe to Finsemble Linker Channels FSBL.RPC("LinkerClient.subscribe", new List <JToken> { "symbol" }, (error, response) => { Application.Current.Dispatcher.Invoke(delegate //main thread { DataToSend.Text = response?["data"]?.ToString(); DroppedData.Content = response?["data"]?.ToString(); SaveState(); }); }); // Logging to the Finsemble Central Console /*FSBL.RPC("Logger.error", new List<JToken> { * "Error Test" * }); * * FSBL.RPC("Logger.log", new List<JToken> { * "Log Test" * }); * * FSBL.RPC("Logger.debug", new List<JToken> { * "Debug Test" * }); * * FSBL.RPC("Logger.info", new List<JToken> { * "Info Test" * }); * * FSBL.RPC("Logger.verbose", new List<JToken> { * "Verbose Test" * }); */ }
private void Finsemble_Connected(object sender, EventArgs e) { Application.Current.Dispatcher.Invoke(delegate //main thread { // Initialize this Window and show it InitializeComponent(); // Initialize after Finsemble is connected FinsembleHeader.SetBridge(FSBL); // The Header Control needs a connected finsemble instance //Styling the Finsemble Header FinsembleHeader.SetActiveBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#22262F"))); FinsembleHeader.SetInactiveBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#22262F"))); FinsembleHeader.SetButtonHoverBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4"))); FinsembleHeader.SetInactiveButtonHoverBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4"))); FinsembleHeader.SetCloseButtonHoverBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F26666"))); FinsembleHeader.SetInactiveCloseButtonHoverBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F26666"))); FinsembleHeader.SetDockingButtonDockedBackground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4"))); FinsembleHeader.SetTitleForeground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ACB2C0"))); FinsembleHeader.SetButtonForeground(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ACB2C0"))); FinsembleHeader.SetButtonFont(null, 8, FontStyles.Normal, FontWeights.Normal); FinsembleHeader.SetTitleFont(null, 12, FontStyles.Normal, FontWeights.SemiBold); //Set window title FinsembleHeader.SetTitle("WPF Example Component"); FSBL.DragAndDropClient.SetScrim(Scrim); // The Scrim Label Control is used for drag and drop. // Receivers for dropped data. FSBL.DragAndDropClient.AddReceivers(new List <KeyValuePair <string, EventHandler <FinsembleEventArgs> > >() { new KeyValuePair <string, EventHandler <FinsembleEventArgs> >("symbol", (s, args) => { var data = args.response["data"]?["symbol"]; if (data != null) { //Check if we received an object (so data.symbol.symbol) or a string (data.symbol) to support variations in the format if (data.HasValues) { data = data?["symbol"]; } Application.Current.Dispatcher.Invoke((Action) delegate //main thread { Application.Current.Dispatcher.Invoke((Action) delegate //main thread { DroppedData.Content = data.ToString(); DataToSend.Text = data.ToString(); DroppedDataSource.Content = "via Drag and Drop"; SaveState(); }); }); } }) }); // Emitters for data that can be dragged using the drag icon. FSBL.DragAndDropClient.SetEmitters(new List <KeyValuePair <string, DragAndDropClient.emitter> >() { new KeyValuePair <string, DragAndDropClient.emitter>("symbol", () => { //set state on drag so correct symbol is displayed Application.Current.Dispatcher.Invoke(delegate //main thread { DroppedData.Content = DataToSend.Text; SaveState(); }); return(new JObject { ["symbol"] = DataToSend.Text, ["description"] = "Symbol " + DataToSend.Text }); }) }); FSBL.ConfigClient.GetValue(new JObject { ["field"] = "finsemble.components" }, (routerClient, response) => { if (response.error != null) { Logger.Error(response.error); return; } var components = (JObject)response.response?["data"]; foreach (var property in components?.Properties()) { object value = components?[property.Name]?["foreign"]?["components"]?["App Launcher"]?["launchableByUser"]; if ((value != null) && bool.Parse(value.ToString())) { Application.Current.Dispatcher.Invoke(delegate //main thread { ComponentSelect.Items.Add(property.Name); }); } } }); //FSBL.LinkerClient.LinkToChannel("group2", null, (s, a) => { }); //restore state if one exists UpdateDisplayData(); this.Show(); }); // Subscribe to Finsemble Linker Channels FSBL.RPC("LinkerClient.subscribe", new List <JToken> { "symbol" }, (error, response) => { Application.Current.Dispatcher.Invoke(delegate //main thread { DataToSend.Text = response?["data"]?.ToString(); DroppedData.Content = response?["data"]?.ToString(); DroppedDataSource.Content = "via Linker"; SaveState(); }); }); //Subscribe to a PubSub topic //N.B. You must add a PubSub responder before publishing or subscribing to any topic that doesn't start with 'Finsemble' // This is not currently supported in the .Net RouterClient implementation and will need to done in a Finsemble HTML5 service Subscribe_to_pubsub(); // Logging to the Finsemble Central Console /*FSBL.RPC("Logger.error", new List<JToken> { * "Error Test" * }); * * FSBL.RPC("Logger.log", new List<JToken> { * "Log Test" * }); * * FSBL.RPC("Logger.debug", new List<JToken> { * "Debug Test" * }); * * FSBL.RPC("Logger.info", new List<JToken> { * "Info Test" * }); * * FSBL.RPC("Logger.verbose", new List<JToken> { * "Verbose Test" * }); */ ////Sample code to execute LauncherClient.getActiveDescriptors() //FSBL.LauncherClient.getActiveDescriptors((s, args) => //{ // System.Diagnostics.Debug.Write(args.response.ToString()); //}); }
private void Finsemble_Connected(object sender, EventArgs e) { Application.Current.Dispatcher.Invoke(delegate //main thread { // Initialize this Window and show it InitializeComponent(); // Initialize after Finsemble is connected FinsembleHeader.SetBridge(FSBL); // The Header Control needs a connected finsemble instance //Styling the Finsemble Header FinsembleHeader.GetHandlingService().ActiveBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#22262F")); FinsembleHeader.GetHandlingService().InactiveBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#22262F")); FinsembleHeader.GetHandlingService().ButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4")); FinsembleHeader.GetHandlingService().InactiveButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4")); FinsembleHeader.GetHandlingService().CloseButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F26666")); FinsembleHeader.GetHandlingService().InactiveCloseButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F26666")); FinsembleHeader.GetHandlingService().DockingButtonDockedBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4")); FinsembleHeader.GetHandlingService().TitleForeground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ACB2C0")); FinsembleHeader.GetHandlingService().ButtonForeground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ACB2C0")); FinsembleHeader.GetHandlingService().ButtonFont = new TitlebarFontConfiguration() { FontFamily = null, FontSize = 8, FontStyle = FontStyles.Normal, FontWeight = FontWeights.Normal }; FinsembleHeader.GetHandlingService().TitleFont = new TitlebarFontConfiguration() { FontFamily = null, FontSize = 12, FontStyle = FontStyles.Normal, FontWeight = FontWeights.SemiBold }; //Set window title FinsembleHeader.GetHandlingService().Title = "FDC3 WPF Example Component"; IntentToRaise.TextBox.Text = "ViewChart"; FSBL.ConfigClient.GetValue(new JObject { ["field"] = "finsemble.components" }, (routerClient, response) => { if (response.error != null) { return; } var components = (JObject)response.response?["data"]; foreach (var property in components?.Properties()) { object value = components?[property.Name]?["foreign"]?["components"]?["App Launcher"]?["launchableByUser"]; if ((value != null) && bool.Parse(value.ToString())) { //TODO: filter down to only FDC3 enabled components Application.Current.Dispatcher.Invoke(delegate //main thread { ComponentSelect.ItemsComboBox.Items.Add(property.Name); }); } } }); //restore state if one exists InitializeFromStateOrSpawnData(); if (FSBL.FDC3Client is object) { //Context handler ContextHandler contextHandler = (context) => { FSBL.Logger.Log(new JToken[] { "context received by contextHandler.", context.Value.ToString() }); if (context.Type.Equals("fdc3.instrument")) { Application.Current.Dispatcher.Invoke(async delegate //main thread { DataToSend.TextBox.Text = context.Id?["ticker"]?.ToString(); DroppedData.Content = context.Id?["ticker"]?.ToString(); DroppedDataSource.Content = "context shared via FDC3"; await SaveStateAsync(); }); } }; FSBL.FDC3Client.DesktopAgentClient.AddContextListener(contextHandler); //To add a filtered context listener //FSBL.FDC3Client.DesktopAgentClient.AddContextListener("fdc3.instrument", contextHandler); //Intent handler ContextHandler intentHandler = (context) => { FSBL.Logger.Log(new JToken[] { "context received by intentHandler.", context.Value.ToString() }); if (context.Type != null && context.Type.Equals("fdc3.instrument")) { Application.Current.Dispatcher.Invoke(async delegate //main thread { string ticker = context.Id?["ticker"]?.ToString(); FSBL.Logger.Log(new JToken[] { "updating state to ticker:" + ticker }); DataToSend.TextBox.Text = ticker; DroppedData.Content = ticker; DroppedDataSource.Content = "context shared via FDC3 intent"; await SaveStateAsync(); }); } else if (context == null) { FSBL.Logger.Log(new JToken[] { "null context received by intentHandler." }); } else { FSBL.Logger.Log(new JToken[] { "unrecognized context type received by intentHandler.", context.ToString() }); } }; FSBL.FDC3Client.DesktopAgentClient.AddIntentListener("ViewChart", intentHandler); } else { FSBL.Logger.Error(new JToken[] { "FDC3 Client is not enabled" }); } this.Show(); }); FSBL.Logger.OnLog += Logger_OnLog; FSBL.Logger.System.OnLog += Logger_OnLog; FSBL.Logger.Perf.OnLog += Logger_OnLog; }
private void Finsemble_Connected(object sender, EventArgs e) { Application.Current.Dispatcher.Invoke(delegate //main thread { // Initialize this Window and show it InitializeComponent(); // Initialize after Finsemble is connected FinsembleHeader.SetBridge(FSBL); // The Header Control needs a connected finsemble instance //Styling the Finsemble Header FinsembleHeader.GetHandlingService().ActiveBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#22262F")); FinsembleHeader.GetHandlingService().InactiveBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#22262F")); FinsembleHeader.GetHandlingService().ButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4")); FinsembleHeader.GetHandlingService().InactiveButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4")); FinsembleHeader.GetHandlingService().CloseButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F26666")); FinsembleHeader.GetHandlingService().InactiveCloseButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F26666")); FinsembleHeader.GetHandlingService().DockingButtonDockedBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4")); FinsembleHeader.GetHandlingService().TitleForeground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ACB2C0")); FinsembleHeader.GetHandlingService().ButtonForeground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ACB2C0")); FinsembleHeader.GetHandlingService().ButtonFont = new TitlebarFontConfiguration() { FontFamily = null, FontSize = 8, FontStyle = FontStyles.Normal, FontWeight = FontWeights.Normal }; FinsembleHeader.GetHandlingService().TitleFont = new TitlebarFontConfiguration() { FontFamily = null, FontSize = 12, FontStyle = FontStyles.Normal, FontWeight = FontWeights.SemiBold }; //Set window title FinsembleHeader.GetHandlingService().Title = "WPF Example Component"; FSBL.DragAndDropClient.SetScrim(Scrim); // The Scrim Label Control is used for drag and drop. // Receivers for dropped data. FSBL.DragAndDropClient.AddReceivers(new List <KeyValuePair <string, EventHandler <FinsembleEventArgs> > >() { new KeyValuePair <string, EventHandler <FinsembleEventArgs> >("symbol", (s, args) => { var data = args.response["data"]?["symbol"]; if (data != null) { //Check if we received an object (so data.symbol.symbol) or a string (data.symbol) to support variations in the format if (data.HasValues) { data = data?["symbol"]; } Application.Current.Dispatcher.Invoke((Action) delegate //main thread { Application.Current.Dispatcher.Invoke((Action)async delegate //main thread { DroppedData.Content = data.ToString(); DataToSend.Text = data.ToString(); DroppedDataSource.Content = "via Drag and Drop"; await SaveStateAsync(); }); }); } }) }); // Emitters for data that can be dragged using the drag icon. FSBL.DragAndDropClient.SetEmitters(new List <KeyValuePair <string, DragAndDropClient.emitter> >() { new KeyValuePair <string, DragAndDropClient.emitter>("symbol", () => { //set state on drag so correct symbol is displayed Application.Current.Dispatcher.Invoke(async delegate //main thread { DroppedData.Content = DataToSend.Text; await SaveStateAsync(); }); return(new JObject { ["symbol"] = DataToSend.Text, ["description"] = "Symbol " + DataToSend.Text }); }) }); //Subscribe to a PubSub topic //N.B. You must add a PubSub responder before publishing or subscribing to any topic that doesn't start with 'Finsemble' // This is not currently supported in the .Net RouterClient implementation and will need to done in a Finsemble HTML5 service Subscribe_to_pubsub(); FSBL.ConfigClient.GetValue(new JObject { ["field"] = "finsemble.components" }, (routerClient, response) => { if (response.error != null) { return; } var components = (JObject)response.response?["data"]; foreach (var property in components?.Properties()) { object value = components?[property.Name]?["foreign"]?["components"]?["App Launcher"]?["launchableByUser"]; if ((value != null) && bool.Parse(value.ToString())) { Application.Current.Dispatcher.Invoke(delegate //main thread { ComponentSelect.Items.Add(property.Name); }); } } }); //FSBL.LinkerClient.LinkToChannel("group2", null, (s, a) => { }); //restore state if one exists UpdateDisplayData(); this.Show(); }); if (FSBL.FDC3Client is object) { //FDC3 Usage example Application.Current.Dispatcher.Invoke(delegate //main thread { FDC3Label.Visibility = Visibility.Visible; }); //Context handler EventHandler <JObject> contextHandler = (s, context) => { FSBL.Logger.Log(new JToken[] { "WPF FDC3 Usage Example, context received by contextHandler.", context }); if (context["type"].ToString().Equals("fdc3.instrument")) { Application.Current.Dispatcher.Invoke(async delegate //main thread { DataToSend.Text = context?["id"]?["ticker"]?.ToString(); DroppedData.Content = context?["id"]?["ticker"]?.ToString(); DroppedDataSource.Content = "context shared via FDC3"; await SaveStateAsync(); }); } }; FSBL.FDC3Client.fdc3.addContextListener(contextHandler); //FSBL.FDC3Client.fdc3.addContextListener("fdc3.instrument", contextHandler); EventHandler <JObject> intentHandler = (s, context) => { FSBL.Logger.Log(new JToken[] { "WPF FDC3 Usage Example: context received by intentHandler.", context }); if (context["type"].ToString().Equals("fdc3.instrument")) { Application.Current.Dispatcher.Invoke(async delegate //main thread { DataToSend.Text = context?["id"]?["ticker"]?.ToString(); DroppedData.Content = context?["id"]?["ticker"]?.ToString(); DroppedDataSource.Content = "context shared via FDC3 intent"; await SaveStateAsync(); }); } }; FSBL.FDC3Client.fdc3.addIntentListener("ViewChart", intentHandler); } else { //Use Default linker //Subscribe to Finsemble Linker Channels FSBL.LinkerClient.Subscribe("symbol", (error, response) => { Application.Current.Dispatcher.Invoke(async delegate //main thread { DataToSend.Text = response.response?["data"]?.ToString(); DroppedData.Content = response.response?["data"]?.ToString(); DroppedDataSource.Content = "via Linker"; await SaveStateAsync(); }); }); } // Logging to the Finsemble Central Console /* * FSBL.Logger.Error(new JToken[] {"Error Test"}); * * FSBL.Logger.Log(new JToken[] {"Log Test"}); * * FSBL.Logger.Debug(new JToken[] {"Debug Test"}); * * FSBL.Logger.Info(new JToken[] {"Info Test"}); * * FSBL.Logger.Verbose(new JToken[] {"Verbose Test"}); */ ////Sample code to execute LauncherClient.getActiveDescriptors() //FSBL.LauncherClient.getActiveDescriptors((s, args) => //{ // System.Diagnostics.Debug.Write(args.response.ToString()); //}); }
private void Finsemble_Connected(object sender, EventArgs e) { Application.Current.Dispatcher.Invoke(delegate //main thread { // Initialize this Window and show it InitializeComponent(); // Initialize after Finsemble is connected FinsembleHeader.SetBridge(FSBL); // The Header Control needs a connected finsemble instance //Styling the Finsemble Header /* * FinsembleHeader.SetActiveBackground(new SolidColorBrush(Colors.Red)); * FinsembleHeader.SetInactiveBackground(new SolidColorBrush(Colors.DarkRed)); * FinsembleHeader.SetButtonHoverBackground(new SolidColorBrush(Colors.Purple)); * FinsembleHeader.SetInactiveButtonHoverBackground(new SolidColorBrush(Colors.Yellow)); * FinsembleHeader.SetCloseButtonHoverBackground(new SolidColorBrush(Colors.SeaShell)); * FinsembleHeader.SetInactiveCloseButtonHoverBackground(new SolidColorBrush(Colors.BurlyWood)); * FinsembleHeader.SetDockingButtonDockedBackground(new SolidColorBrush(Colors.BlanchedAlmond)); * FinsembleHeader.SetTitleForeground(new SolidColorBrush(Colors.LightGoldenrodYellow)); * FinsembleHeader.SetButtonForeground(new SolidColorBrush(Colors.LightSalmon)); */ FSBL.dragAndDropClient.SetScrim(Scrim); // The Scrim Label Control is used for drag and drop. // Receivers for dropped data. FSBL.dragAndDropClient.AddReceivers(new List <KeyValuePair <string, EventHandler <FinsembleEventArgs> > >() { new KeyValuePair <string, EventHandler <FinsembleEventArgs> >("symbol", (s, args) => { var data = args.response["data"]?["symbol"]?["symbol"]; if (data != null) { Application.Current.Dispatcher.Invoke((Action) delegate //main thread { DroppedData.Content = data.ToString(); DataToSend.Text = data.ToString(); }); } ; }) }); // Emitters for data that can be dragged using the drag icon. FSBL.dragAndDropClient.SetEmitters(new List <KeyValuePair <string, DragAndDropClient.emitter> >() { new KeyValuePair <string, DragAndDropClient.emitter>("symbol", () => { return(new JObject { ["symbol"] = DataToSend.Text, ["description"] = "Symbol " + DataToSend.Text }); }) }); this.Show(); }); // Subscribe to Finsemble Linker Channels FSBL.RPC("LinkerClient.subscribe", new List <JToken> { "symbol" }, (error, response) => { Application.Current.Dispatcher.Invoke(delegate //main thread { DataToSend.Text = response?["data"]?.ToString(); DroppedData.Content = response?["data"]?.ToString(); }); }); // Logging to the Finsemble Central Console /*FSBL.RPC("Logger.error", new List<JToken> { * "Error Test" * }); * * FSBL.RPC("Logger.log", new List<JToken> { * "Log Test" * }); * * FSBL.RPC("Logger.debug", new List<JToken> { * "Debug Test" * }); * * FSBL.RPC("Logger.info", new List<JToken> { * "Info Test" * }); * * FSBL.RPC("Logger.verbose", new List<JToken> { * "Verbose Test" * }); */ }
private void Finsemble_Connected(object sender, EventArgs e) { Application.Current.Dispatcher.Invoke(async delegate //main thread { // Initialize after Finsemble is connected InitializeComponent(); // The Header Control needs a connected finsemble instance FinsembleHeader.SetBridge(FSBL); #region Styling the Finsemble Header FinsembleHeader.GetHandlingService().ActiveBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#22262F")); FinsembleHeader.GetHandlingService().InactiveBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#22262F")); FinsembleHeader.GetHandlingService().ButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4")); FinsembleHeader.GetHandlingService().InactiveButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4")); FinsembleHeader.GetHandlingService().CloseButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F26666")); FinsembleHeader.GetHandlingService().InactiveCloseButtonHoverBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#F26666")); FinsembleHeader.GetHandlingService().DockingButtonDockedBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0A8CF4")); FinsembleHeader.GetHandlingService().TitleForeground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ACB2C0")); FinsembleHeader.GetHandlingService().ButtonForeground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ACB2C0")); FinsembleHeader.GetHandlingService().ButtonFont = new TitlebarFontConfiguration() { FontFamily = null, FontSize = 8, FontStyle = FontStyles.Normal, FontWeight = FontWeights.Normal }; FinsembleHeader.GetHandlingService().TitleFont = new TitlebarFontConfiguration() { FontFamily = null, FontSize = 12, FontStyle = FontStyles.Normal, FontWeight = FontWeights.SemiBold }; //Set window title FinsembleHeader.GetHandlingService().Title = "WPF Example Core Component"; #endregion #region Drag And Drop FSBL.Clients.DragAndDropClient.SetScrim(Scrim); // The Scrim Label Control is used for drag and drop. // Receivers for dropped data. FSBL.Clients.DragAndDropClient.AddReceivers(new List <KeyValuePair <string, EventHandler <FinsembleEventArgs> > >() { new KeyValuePair <string, EventHandler <FinsembleEventArgs> >("symbol", (s, args) => { var data = args.response["data"]?["symbol"]; if (data != null) { //Check if we received an object (so data.symbol.symbol) or a string (data.symbol) to support variations in the format if (data.HasValues) { data = data?["symbol"]; } Application.Current.Dispatcher.Invoke((Action) delegate //main thread { Application.Current.Dispatcher.Invoke((Action)async delegate //main thread { DroppedData.Content = data.ToString(); DataToSend.TextBox.Text = data.ToString(); DroppedDataSource.Content = "via Drag and Drop"; await SaveStateAsync(); }); }); } }) }); // Emitters for data that can be dragged using the drag icon. FSBL.Clients.DragAndDropClient.SetEmitters(new List <KeyValuePair <string, DragAndDropClient.emitter> >() { new KeyValuePair <string, DragAndDropClient.emitter>("symbol", () => { //set state on drag so correct symbol is displayed Application.Current.Dispatcher.Invoke(async delegate //main thread { DroppedData.Content = DataToSend.TextBox.Text; await SaveStateAsync(); }); return(new JObject { ["symbol"] = DataToSend.TextBox.Text, ["description"] = "Symbol " + DataToSend.TextBox.Text }); }) }); #endregion //Subscribe to a PubSub topic //N.B. You must add a PubSub responder before publishing or subscribing to any topic that doesn't start with 'Finsemble' // This is not currently supported in the .Net RouterClient implementation and will need to done in a Finsemble HTML5 service SubscribeToPubSub(); SetUpFinsembleComponents(); await UpdateDisplayData(); this.Show(); }); #region communication through channels if (FSBL.Clients.Fdc3Client is object) { FDC3Label.Visibility = Visibility.Visible; ContextHandler contextHandler = (context) => { FSBL.Clients.Logger.Log(new JToken[] { "WPF Core FDC3 Usage Example, context received by contextHandler.", context.Value }); if (context.Type.Equals("fdc3.instrument")) { Application.Current.Dispatcher.Invoke(async delegate //main thread { DataToSend.TextBox.Text = context.Id?["ticker"]?.ToString(); DroppedData.Content = context.Id?["ticker"]?.ToString(); DroppedDataSource.Content = "context shared via FDC3"; await SaveStateAsync(); }); } }; FSBL.Clients.Fdc3Client.DesktopAgentClient.AddContextListener("fdc3.instrument", contextHandler); ContextHandler intentHandler = (context) => { FSBL.Clients.Logger.Log(new JToken[] { "WPF Core FDC3 Usage Example: context received by intentHandler.", context.Value }); if (context.Type != null && context.Type.Equals("fdc3.instrument")) { Application.Current.Dispatcher.Invoke(async delegate //main thread { DataToSend.TextBox.Text = context.Id?["ticker"]?.ToString(); DroppedData.Content = context.Id?["ticker"]?.ToString(); DroppedDataSource.Content = "context shared via FDC3 intent"; await SaveStateAsync(); }); } }; FSBL.Clients.Fdc3Client.DesktopAgentClient.AddIntentListener("ViewChart", intentHandler); } else { //Use Default linker //Subscribe to Finsemble Linker Channels FSBL.Clients.LinkerClient?.Subscribe("symbol", (error, response) => { Application.Current.Dispatcher.Invoke(async delegate //main thread { DataToSend.TextBox.Text = response.response?["data"]?.ToString(); DroppedData.Content = response.response?["data"]?.ToString(); DroppedDataSource.Content = "via Linker"; await SaveStateAsync(); }); }); } #endregion #region Logging FSBL.Clients.Logger.OnLog += Logger_OnLog; FSBL.Clients.Logger.System.OnLog += Logger_OnLog; FSBL.Clients.Logger.Perf.OnLog += Logger_OnLog; // Example: Logging to the Finsemble Central Console /* * FSBL.Logger.Error(new JToken[] {"Error Test"}); * * FSBL.Logger.Log(new JToken[] {"Log Test"}); * * FSBL.Logger.Debug(new JToken[] {"Debug Test"}); * * FSBL.Logger.Info(new JToken[] {"Info Test"}); * * FSBL.Logger.Verbose(new JToken[] {"Verbose Test"}); */ #endregion }