diff --git a/AuthenticationExample/App.config b/AuthenticationExample/App.config
index 37f69cf..c359fe8 100644
--- a/AuthenticationExample/App.config
+++ b/AuthenticationExample/App.config
@@ -7,7 +7,7 @@
-
+
@@ -21,6 +21,10 @@
+
+
+
+
diff --git a/AuthenticationExample/AuthenticationExample.csproj b/AuthenticationExample/AuthenticationExample.csproj
index baf260c..1438e3c 100644
--- a/AuthenticationExample/AuthenticationExample.csproj
+++ b/AuthenticationExample/AuthenticationExample.csproj
@@ -14,8 +14,6 @@
4
true
-
-
AnyCPU
@@ -48,44 +46,20 @@
bin\x64\Release\
-
- ..\packages\DotNetZip.1.13.7\lib\net40\DotNetZip.dll
+
+ ..\packages\DotNetZip.1.16.0\lib\net40\DotNetZip.dll
-
- ..\packages\EngineIoClientDotNet.1.0.7\lib\net45\EngineIoClientDotNet.dll
+
+ ..\packages\Finsemble.7.1.0\lib\net452\Finsemble.dll
-
- ..\packages\EventHook.1.4.105\lib\net45\EventHook.dll
+
+ ..\packages\Microsoft.IdentityModel.Logging.6.16.0\lib\net45\Microsoft.IdentityModel.Logging.dll
-
- ..\packages\Finsemble.6.6.3\lib\net452\Finsemble.dll
+
+ ..\packages\Microsoft.IdentityModel.Tokens.6.16.0\lib\net45\Microsoft.IdentityModel.Tokens.dll
-
- ..\packages\Microsoft.IdentityModel.Logging.6.12.1\lib\net45\Microsoft.IdentityModel.Logging.dll
-
-
- ..\packages\Microsoft.IdentityModel.Tokens.6.12.1\lib\net45\Microsoft.IdentityModel.Tokens.dll
-
-
- ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll
-
-
- ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll
-
-
- ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll
-
-
- ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll
-
-
- ..\packages\Nito.AsyncEx.4.0.1\lib\net45\Nito.AsyncEx.dll
-
-
- ..\packages\Nito.AsyncEx.4.0.1\lib\net45\Nito.AsyncEx.Concurrent.dll
-
-
- ..\packages\Nito.AsyncEx.4.0.1\lib\net45\Nito.AsyncEx.Enlightenment.dll
+
+ ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
..\packages\PInvoke.Windows.Core.0.6.49\lib\net20\PInvoke.Windows.Core.dll
@@ -94,12 +68,8 @@
..\packages\SuperSocket.ClientEngine.Core.0.10.0\lib\net45\SuperSocket.ClientEngine.dll
-
- ..\packages\System.Collections.Immutable.1.7.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll
-
-
@@ -163,11 +133,4 @@
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
\ No newline at end of file
diff --git a/AuthenticationExample/Properties/AssemblyInfo.cs b/AuthenticationExample/Properties/AssemblyInfo.cs
index 982086d..f5f0826 100644
--- a/AuthenticationExample/Properties/AssemblyInfo.cs
+++ b/AuthenticationExample/Properties/AssemblyInfo.cs
@@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("6.6.3.0")]
-[assembly: AssemblyFileVersion("6.6.3.0")]
+[assembly: AssemblyVersion("7.1.0.0")]
+[assembly: AssemblyFileVersion("7.1.0.0")]
diff --git a/AuthenticationExample/packages.config b/AuthenticationExample/packages.config
index 028abcf..0dda042 100644
--- a/AuthenticationExample/packages.config
+++ b/AuthenticationExample/packages.config
@@ -1,19 +1,12 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
\ No newline at end of file
diff --git a/FDC3WPFExample/App.config b/FDC3WPFExample/App.config
index 37f69cf..c359fe8 100644
--- a/FDC3WPFExample/App.config
+++ b/FDC3WPFExample/App.config
@@ -7,7 +7,7 @@
-
+
@@ -21,6 +21,10 @@
+
+
+
+
diff --git a/FDC3WPFExample/FDC3WPFExample.csproj b/FDC3WPFExample/FDC3WPFExample.csproj
index 95d0ba6..589c80a 100644
--- a/FDC3WPFExample/FDC3WPFExample.csproj
+++ b/FDC3WPFExample/FDC3WPFExample.csproj
@@ -14,8 +14,6 @@
4
true
-
-
AnyCPU
@@ -48,44 +46,20 @@
bin\x64\Release\
-
- ..\packages\DotNetZip.1.13.7\lib\net40\DotNetZip.dll
+
+ ..\packages\DotNetZip.1.16.0\lib\net40\DotNetZip.dll
-
- ..\packages\EngineIoClientDotNet.1.0.7\lib\net45\EngineIoClientDotNet.dll
+
+ ..\packages\Finsemble.7.1.0\lib\net452\Finsemble.dll
-
- ..\packages\EventHook.1.4.105\lib\net45\EventHook.dll
+
+ ..\packages\Microsoft.IdentityModel.Logging.6.16.0\lib\net45\Microsoft.IdentityModel.Logging.dll
-
- ..\packages\Finsemble.6.6.3\lib\net452\Finsemble.dll
+
+ ..\packages\Microsoft.IdentityModel.Tokens.6.16.0\lib\net45\Microsoft.IdentityModel.Tokens.dll
-
- ..\packages\Microsoft.IdentityModel.Logging.6.12.1\lib\net45\Microsoft.IdentityModel.Logging.dll
-
-
- ..\packages\Microsoft.IdentityModel.Tokens.6.12.1\lib\net45\Microsoft.IdentityModel.Tokens.dll
-
-
- ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll
-
-
- ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll
-
-
- ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll
-
-
- ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll
-
-
- ..\packages\Nito.AsyncEx.4.0.1\lib\net45\Nito.AsyncEx.dll
-
-
- ..\packages\Nito.AsyncEx.4.0.1\lib\net45\Nito.AsyncEx.Concurrent.dll
-
-
- ..\packages\Nito.AsyncEx.4.0.1\lib\net45\Nito.AsyncEx.Enlightenment.dll
+
+ ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
..\packages\PInvoke.Windows.Core.0.6.49\lib\net20\PInvoke.Windows.Core.dll
@@ -94,12 +68,7 @@
..\packages\SuperSocket.ClientEngine.Core.0.10.0\lib\net45\SuperSocket.ClientEngine.dll
-
- ..\packages\System.Collections.Immutable.1.7.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll
-
-
-
@@ -152,6 +121,7 @@
FinsembleInput.xaml
+
MainWindow.xaml
Code
@@ -191,11 +161,4 @@
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
\ No newline at end of file
diff --git a/FDC3WPFExample/MainWindow.xaml b/FDC3WPFExample/MainWindow.xaml
index 42deb2b..5734f08 100644
--- a/FDC3WPFExample/MainWindow.xaml
+++ b/FDC3WPFExample/MainWindow.xaml
@@ -8,7 +8,7 @@
xmlns:customControls="clr-namespace:FDC3WPFExample.CustomControls"
xmlns:Custom="http://schemas.microsoft.com/winfx/2006/xaml/presentation/ribbon" xmlns:Finsemble1="clr-namespace:ChartIQ.Finsemble.HeaderControl;assembly=Finsemble" x:Class="FDC3WPFExample.MainWindow"
mc:Ignorable="d"
- Title="MainWindow" Height="600"
+ Title="MainWindow" Height="700"
Width="600" WindowStyle="None"
Background="{x:Null}">
@@ -19,18 +19,171 @@
ResizeBorderThickness="4"
GlassFrameThickness="0"/>
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -47,50 +200,107 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
diff --git a/FDC3WPFExample/MainWindow.xaml.cs b/FDC3WPFExample/MainWindow.xaml.cs
index cd76931..b26b325 100644
--- a/FDC3WPFExample/MainWindow.xaml.cs
+++ b/FDC3WPFExample/MainWindow.xaml.cs
@@ -1,16 +1,14 @@
using ChartIQ.Finsemble;
using Newtonsoft.Json.Linq;
using System;
-using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
-using ChartIQ.Finsemble.Models;
using ChartIQ.Finsemble.TitlebarService.Models;
using ChartIQ.Finsemble.FDC3.Types;
-using Newtonsoft.Json;
using Microsoft.IdentityModel.Tokens;
using System.Windows.Interop;
+using ChartIQ.Finsemble.FDC3.Interfaces;
namespace FDC3WPFExample
{
@@ -31,6 +29,8 @@ public partial class MainWindow : Window
Q = "4R0RUlCnmZRzEw9sqjwxMuvNM1BTSubvMvG0VIlBkYbCn9MOdwurBPxrYqnUcbw-q-qzQy6st6a4L-EAZSnfD3FEEFKeINOJK06l0EwjcLeP8B4YQ-bxd9UroXpl9ACiMqHzyvJCNOpw8A22nbjKVnVhW1E17F-LFAJoWBetYA0",
QI = "PODgpJrXxPAp72v_O0fNfAhWjHLeTk9TfLARl9lzPpYIoYR5tgP1Y_A-3feH_xtCfkzcCskfXIerQlY9lVmqs-eGEYjfuuPVYIruN4OsskMY1nz-h_14clyUmUwfCQJDV4qjcAzf80IMu53jYEW1BydRf90snRjk1dYgSq_qtTQ",
};
+ private IChannel AppChannel;
+ private IListener AppChannelListener;
///
/// The MainWindow is created by the App so that we can get command line arguments passed from Finsemble.
@@ -87,7 +87,6 @@ private void Finsemble_Connected(object sender, EventArgs e)
//Set window title
FinsembleHeader.GetHandlingService().Title = "FDC3 WPF Example Component";
- IntentToRaise.TextBox.Text = "ViewChart";
FSBL.ConfigClient.GetValue(new JObject { ["field"] = "finsemble.components" }, (routerClient, response) =>
{
@@ -125,10 +124,9 @@ private void Finsemble_Connected(object sender, EventArgs e)
{
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();
+ await SaveStateAsync(DroppedData.Content.ToString());
});
}
};
@@ -146,10 +144,9 @@ private void Finsemble_Connected(object sender, EventArgs e)
{
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();
+ await SaveStateAsync(ticker);
});
}
else if (context == null)
@@ -168,6 +165,16 @@ private void Finsemble_Connected(object sender, EventArgs e)
FSBL.Logger.Error(new JToken[] { "FDC3 Client is not enabled" });
}
+ // setup default AppChannel
+ AppChannelInput.TextBox.Text = "ExampleAppChannel";
+ SetupAppChannel();
+
+ // setup default contexts
+ SetupDefaultContexts();
+
+ // setup a list of available intents
+ LoadAvailableIntents();
+
this.Show();
});
@@ -178,7 +185,68 @@ private void Finsemble_Connected(object sender, EventArgs e)
FSBL.Logger.Perf.OnLog += Logger_OnLog;
}
- private async void SpawnComponent_Click(object sender, RoutedEventArgs e)
+ private void SetupDefaultContexts()
+ {
+ // load all contexts
+ foreach (var item in DefaultData.DefaultContexts)
+ {
+ ContextTemplatesDropDown.ItemsComboBox.Items.Add(item.Key);
+ }
+
+ ContextTemplatesDropDown.ItemsComboBox.SelectionChanged += (object s, System.Windows.Controls.SelectionChangedEventArgs selectionEvent) =>
+ {
+ var contextType = ContextTemplatesDropDown.ItemsComboBox.SelectedValue as string;
+ ContextTextBox.Text = DefaultData.DefaultContexts[contextType].Value.ToString();
+ };
+
+ // choose most popular
+ if (DefaultData.DefaultContexts.ContainsKey("fdc3.instrument"))
+ {
+ ContextTemplatesDropDown.ItemsComboBox.SelectedItem = "fdc3.instrument";
+ }
+ else
+ {
+ ContextTextBox.Text = @"{ }";
+ }
+ }
+
+ private async void LoadAvailableIntents()
+ {
+ var intents = await FSBL.FDC3Client.DesktopAgentClient.FindIntentsByContext(null);
+ if (intents != null && intents.Length > 0)
+ {
+ foreach (var intent in intents)
+ {
+ IntentsDropDown.ItemsComboBox.Items.Add(intent.Intent.Name);
+ }
+ }
+ }
+
+ private async void SetupAppChannel()
+ {
+ // Don't update channel if it has the same id
+ if (AppChannelInput.TextBox.Text == AppChannel?.Id)
+ {
+ return;
+ }
+
+ if (AppChannelListener != null)
+ {
+ AppChannelListener.Unsubscribe();
+ }
+ // NOTE: it possible to listen to multiple channels simultaneously, but that we do not in this example
+ AppChannel = await FSBL.FDC3Client.DesktopAgentClient.GetOrCreateChannel(AppChannelInput.TextBox.Text);
+ AppChannelListener = AppChannel.AddContextListener((context) =>
+ {
+ Application.Current.Dispatcher.Invoke(delegate //main thread
+ {
+ DroppedData.Content = context.Id?["ticker"]?.ToString();
+ DroppedDataSource.Content = $"context received via App channel: {AppChannel.Id}";
+ });
+ });
+ }
+
+ private async void OpenComponent_Click(object sender, RoutedEventArgs e)
{
object selected = ComponentSelect.ItemsComboBox.SelectedValue;
if (selected != null)
@@ -191,18 +259,12 @@ private async void SpawnComponent_Click(object sender, RoutedEventArgs e)
//open
var targetApp = new TargetApp(componentName);
- var context = new Context(new JObject
+ var context = GetContext();
+ if (context != null)
{
- ["type"] = "fdc3.instrument",
- ["name"] = DataToSend.TextBox.Text,
- ["id"] = new JObject
- {
- ["ticker"] = DataToSend.TextBox.Text
- }
- });
-
- var openError = await FSBL.FDC3Client.DesktopAgentClient.Open(targetApp, context);
- if (openError.HasValue) MessageBox.Show(openError.ToString());
+ var openError = await FSBL.FDC3Client.DesktopAgentClient.Open(targetApp, context);
+ if (openError.HasValue) MessageBox.Show(openError.ToString());
+ }
}
else
{
@@ -211,35 +273,42 @@ private async void SpawnComponent_Click(object sender, RoutedEventArgs e)
}
}
- private void Send_Click(object sender, RoutedEventArgs e)
+ private void SendSystemContext_Click(object sender, RoutedEventArgs e)
{
if (FSBL.FDC3Client is object)
{
//FDC3 Usage example
- //Broadcast
- var context = new Context(new JObject
- {
- ["type"] = "fdc3.instrument",
- ["name"] = DataToSend.TextBox.Text,
- ["id"] = new JObject
- {
- ["ticker"] = DataToSend.TextBox.Text
- }
- });
+ //Broadcast via system channels
+ var context = GetContext();
- FSBL.FDC3Client.DesktopAgentClient.Broadcast(context);
+ if (context != null)
+ {
+ FSBL.FDC3Client.DesktopAgentClient.Broadcast(context);
+ }
}
else
{
FSBL.Logger.Error(new JToken[] { "FDC3 Client is not enabled" });
}
+ }
- Application.Current.Dispatcher.Invoke(async delegate //main thread
+ private void SendApp_Click(object sender, RoutedEventArgs e)
+ {
+ if (FSBL.FDC3Client is object)
{
- DroppedData.Content = DataToSend.TextBox.Text;
- DroppedDataSource.Content = "via Text entry";
- await SaveStateAsync();
- });
+ SetupAppChannel();
+ //FDC3 Usage example
+ //Broadcast via app channel
+ var context = GetContext();
+ if (context != null)
+ {
+ AppChannel.Broadcast(context);
+ }
+ }
+ else
+ {
+ FSBL.Logger.Error(new JToken[] { "FDC3 Client is not enabled" });
+ }
}
private async void RaiseIntent_Click(object sender, RoutedEventArgs e)
@@ -248,32 +317,34 @@ private async void RaiseIntent_Click(object sender, RoutedEventArgs e)
{
//FDC3 Usage example
//RaiseIntent
-
- if (!String.IsNullOrEmpty(DataToSend.TextBox.Text))
+ var context = GetContext();
+ if (context != null)
{
- var context = new Context(new JObject
- {
- ["type"] = "fdc3.instrument",
- ["name"] = DataToSend.TextBox.Text,
- ["id"] = new JObject
- {
- ["ticker"] = DataToSend.TextBox.Text
- }
- });
- await FSBL.FDC3Client.DesktopAgentClient.RaiseIntent(IntentToRaise.TextBox.Text, context, null);
+ await FSBL.FDC3Client.DesktopAgentClient.RaiseIntent(IntentsDropDown.ItemsComboBox.SelectedItem as string, context, null);
}
}
else
{
FSBL.Logger.Error(new JToken[] { "FDC3 Client is not enabled" });
}
+ }
- await Application.Current.Dispatcher.Invoke(async delegate //main thread
+ private async void RaiseIntentForContext_Click(object sender, RoutedEventArgs e)
+ {
+ if (FSBL.FDC3Client is object)
{
- DroppedData.Content = DataToSend.TextBox.Text;
- DroppedDataSource.Content = "via Text entry";
- await SaveStateAsync();
- });
+ //FDC3 Usage example
+ //RaiseIntentForContext
+ var context = GetContext();
+ if (context != null)
+ {
+ await FSBL.FDC3Client.DesktopAgentClient.RaiseIntentForContext(context, null);
+ }
+ }
+ else
+ {
+ FSBL.Logger.Error(new JToken[] { "FDC3 Client is not enabled" });
+ }
}
#region Other FDC3 examples
@@ -281,10 +352,10 @@ await Application.Current.Dispatcher.Invoke(async delegate //main thread
//var context = new Context(new JObject
//{
// ["type"] = "fdc3.instrument",
- // ["name"] = DataToSend.TextBox.Text,
+ // ["name"] = "Microsoft",
// ["id"] = new JObject
// {
- // ["ticker"] = DataToSend.TextBox.Text
+ // ["ticker"] = "MSFT"
// }
//});
//var intentResolution = await FSBL.FDC3Client.DesktopAgentClient.RaiseIntent("ViewChart", context, null);
@@ -358,14 +429,14 @@ private void MainWindow_Closing(object sender, System.ComponentModel.CancelEvent
}*/
}
- private async Task SaveStateAsync()
+ private async Task SaveStateAsync(string valueToSave)
{
try
{
await FSBL.WindowClient.SetComponentState(new JObject
{
["field"] = "symbol",
- ["value"] = DataToSend.TextBox.Text
+ ["value"] = valueToSave
});
}
catch (ApplicationException e)
@@ -384,12 +455,11 @@ private async void InitializeFromStateOrSpawnData()
try
{
JToken state = await FSBL.WindowClient.GetComponentState(new JObject { ["field"] = "symbol" });
- string symbolTxt = state == null ? null : state.ToString();
+ string symbolTxt = state == null ? null : state["data"]?.ToString();
if (!string.IsNullOrEmpty(symbolTxt) && !symbolTxt.Equals("{}"))
{
Application.Current.Dispatcher.Invoke(delegate //main thread
{
- DataToSend.TextBox.Text = symbolTxt;
DroppedData.Content = symbolTxt;
DroppedDataSource.Content = "via component state";
});
@@ -404,17 +474,15 @@ private async void InitializeFromStateOrSpawnData()
symbolTxt = r.response == null ? null : r.response?["symbol"]?.ToString();
if (!string.IsNullOrEmpty(symbolTxt) && !symbolTxt.Equals("{}"))
{
- DataToSend.TextBox.Text = symbolTxt;
DroppedData.Content = symbolTxt;
DroppedDataSource.Content = "via SpawnData";
}
else
{
- DataToSend.TextBox.Text = "MSFT";
DroppedData.Content = "MSFT";
DroppedDataSource.Content = "via default value";
}
- await SaveStateAsync();
+ await SaveStateAsync(DroppedData.Content.ToString());
});
});
}
@@ -424,5 +492,25 @@ private async void InitializeFromStateOrSpawnData()
FSBL.Logger.Warn(new JToken[] { "InitializeFromStateOrSpawnData Error, it is likely no state was found", e.Message, e.StackTrace });
}
}
+
+ private Context GetContext()
+ {
+ try
+ {
+ var context = new Context(JObject.Parse(ContextTextBox.Text));
+ if (string.IsNullOrEmpty(context.Type))
+ {
+ DroppedDataSource.Content = "Failed to parse intent context. It should have a Type property." + "\n";
+ return null;
+ }
+
+ return context;
+ }
+ catch
+ {
+ DroppedDataSource.Content = "Failed to parse intent context" + "\n";
+ return null;
+ }
+ }
}
}
diff --git a/FDC3WPFExample/Properties/AssemblyInfo.cs b/FDC3WPFExample/Properties/AssemblyInfo.cs
index fa2d1ef..134d8b5 100644
--- a/FDC3WPFExample/Properties/AssemblyInfo.cs
+++ b/FDC3WPFExample/Properties/AssemblyInfo.cs
@@ -49,5 +49,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("6.6.3.0")]
-[assembly: AssemblyFileVersion("6.6.3.0")]
+[assembly: AssemblyVersion("7.1.0.0")]
+[assembly: AssemblyFileVersion("7.1.0.0")]
diff --git a/FDC3WPFExample/packages.config b/FDC3WPFExample/packages.config
index 028abcf..fbe7ed0 100644
--- a/FDC3WPFExample/packages.config
+++ b/FDC3WPFExample/packages.config
@@ -1,19 +1,11 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
\ No newline at end of file
diff --git a/FreestandingWPFExample/FreestandingWPFExample.csproj b/FreestandingWPFExample/FreestandingWPFExample.csproj
index 560af6a..dce2e15 100644
--- a/FreestandingWPFExample/FreestandingWPFExample.csproj
+++ b/FreestandingWPFExample/FreestandingWPFExample.csproj
@@ -5,13 +5,13 @@
net5.0-windows
true
AnyCPU;x64
- 6.6.3.0
- 6.6.3.0
- 6.6.3
+ 7.1.0.0
+ 7.1.0.0
+ 7.0.1
-
+
diff --git a/MultiWindowExample/App.config b/MultiWindowExample/App.config
index 3ffaea1..6e5db75 100644
--- a/MultiWindowExample/App.config
+++ b/MultiWindowExample/App.config
@@ -7,7 +7,7 @@
-
+
@@ -21,6 +21,10 @@
+
+
+
+
diff --git a/MultiWindowExample/MultiWindowExample.csproj b/MultiWindowExample/MultiWindowExample.csproj
index 5d8bdc0..c3e7c9b 100644
--- a/MultiWindowExample/MultiWindowExample.csproj
+++ b/MultiWindowExample/MultiWindowExample.csproj
@@ -14,8 +14,6 @@
4
true
-
-
AnyCPU
@@ -48,44 +46,20 @@
bin\x64\Release\
-
- ..\packages\DotNetZip.1.13.7\lib\net40\DotNetZip.dll
+
+ ..\packages\DotNetZip.1.16.0\lib\net40\DotNetZip.dll
-
- ..\packages\EngineIoClientDotNet.1.0.7\lib\net45\EngineIoClientDotNet.dll
+
+ ..\packages\Finsemble.7.1.0\lib\net452\Finsemble.dll
-
- ..\packages\EventHook.1.4.105\lib\net45\EventHook.dll
+
+ ..\packages\Microsoft.IdentityModel.Logging.6.16.0\lib\net45\Microsoft.IdentityModel.Logging.dll
-
- ..\packages\Finsemble.6.6.3\lib\net452\Finsemble.dll
+
+ ..\packages\Microsoft.IdentityModel.Tokens.6.16.0\lib\net45\Microsoft.IdentityModel.Tokens.dll
-
- ..\packages\Microsoft.IdentityModel.Logging.6.12.1\lib\net45\Microsoft.IdentityModel.Logging.dll
-
-
- ..\packages\Microsoft.IdentityModel.Tokens.6.12.1\lib\net45\Microsoft.IdentityModel.Tokens.dll
-
-
- ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll
-
-
- ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll
-
-
- ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll
-
-
- ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll
-
-
- ..\packages\Nito.AsyncEx.4.0.1\lib\net45\Nito.AsyncEx.dll
-
-
- ..\packages\Nito.AsyncEx.4.0.1\lib\net45\Nito.AsyncEx.Concurrent.dll
-
-
- ..\packages\Nito.AsyncEx.4.0.1\lib\net45\Nito.AsyncEx.Enlightenment.dll
+
+ ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
..\packages\PInvoke.Windows.Core.0.6.49\lib\net20\PInvoke.Windows.Core.dll
@@ -94,12 +68,8 @@
..\packages\SuperSocket.ClientEngine.Core.0.10.0\lib\net45\SuperSocket.ClientEngine.dll
-
- ..\packages\System.Collections.Immutable.1.7.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll
-
-
@@ -187,11 +157,4 @@
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
\ No newline at end of file
diff --git a/MultiWindowExample/Properties/AssemblyInfo.cs b/MultiWindowExample/Properties/AssemblyInfo.cs
index e8e1646..9d5f827 100644
--- a/MultiWindowExample/Properties/AssemblyInfo.cs
+++ b/MultiWindowExample/Properties/AssemblyInfo.cs
@@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("6.6.3.0")]
-[assembly: AssemblyFileVersion("6.6.3.0")]
+[assembly: AssemblyVersion("7.1.0.0")]
+[assembly: AssemblyFileVersion("7.1.0.0")]
diff --git a/MultiWindowExample/packages.config b/MultiWindowExample/packages.config
index 028abcf..0dda042 100644
--- a/MultiWindowExample/packages.config
+++ b/MultiWindowExample/packages.config
@@ -1,19 +1,12 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
\ No newline at end of file
diff --git a/WPFExample/App.config b/WPFExample/App.config
index 37f69cf..c359fe8 100644
--- a/WPFExample/App.config
+++ b/WPFExample/App.config
@@ -7,7 +7,7 @@
-
+
@@ -21,6 +21,10 @@
+
+
+
+
diff --git a/WPFExample/App.xaml.cs b/WPFExample/App.xaml.cs
index 794cd8d..a4238c2 100644
--- a/WPFExample/App.xaml.cs
+++ b/WPFExample/App.xaml.cs
@@ -1,36 +1,51 @@
using ChartIQ.Finsemble;
+using System;
using System.Diagnostics;
using System.Windows;
+using System.IO;
namespace WPFExample
{
- ///
- /// Interaction logic for App.xaml
- ///
- public partial class App : Application
- {
- private MainWindow mainWindow = null;
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ private MainWindow mainWindow = null;
- protected override void OnStartup(StartupEventArgs e)
- {
- Debug.Print("OnStartup");
+ protected override void OnStartup(StartupEventArgs e)
+ {
+ Debug.Print("OnStartup");
#if DEBUG
Debugger.Launch();
#endif
- mainWindow = new MainWindow(e.Args); // send command line arguments to main window.
- }
+ mainWindow = new MainWindow(e.Args); // send command line arguments to main window.
+ }
- private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
- {
+ private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
+ {
#if DEBUG
Debugger.Launch();
#endif
+ LogUnhandledException(e.Exception);
+ Finsemble.DispatcherUnhandledException(mainWindow, e);
- Finsemble.DispatcherUnhandledException(mainWindow, e);
+ Debug.Print($"An Unhandled Exception has occurred. Exception: {e.Exception}");
+ Shutdown();
+ }
- Debug.Print($"An Unhandled Exception has occurred. Exception: {e.Exception}");
- Shutdown();
- }
- }
+ private void LogUnhandledException(Exception e)
+ {
+ using (StreamWriter sw = new StreamWriter("Critical exceptions.log", true))
+ {
+ sw.WriteLine($"{DateTime.Now.ToUniversalTime()} - {e.Message}");
+ sw.WriteLine(e.StackTrace);
+ sw.WriteLine();
+ sw.Close();
+ }
+
+ if (e.InnerException != null) LogUnhandledException(e.InnerException);
+ }
+ }
}
diff --git a/WPFExample/Properties/AssemblyInfo.cs b/WPFExample/Properties/AssemblyInfo.cs
index dfe7b81..6f14108 100644
--- a/WPFExample/Properties/AssemblyInfo.cs
+++ b/WPFExample/Properties/AssemblyInfo.cs
@@ -49,5 +49,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("6.6.3.0")]
-[assembly: AssemblyFileVersion("6.6.3.0")]
+[assembly: AssemblyVersion("7.1.0.0")]
+[assembly: AssemblyFileVersion("7.1.0.0")]
diff --git a/WPFExample/WPFExample.csproj b/WPFExample/WPFExample.csproj
index 6f3a4d5..61274fc 100644
--- a/WPFExample/WPFExample.csproj
+++ b/WPFExample/WPFExample.csproj
@@ -14,8 +14,6 @@
4
true
-
-
AnyCPU
@@ -48,44 +46,20 @@
bin\x64\Release\
-
- ..\packages\DotNetZip.1.13.7\lib\net40\DotNetZip.dll
+
+ ..\packages\DotNetZip.1.16.0\lib\net40\DotNetZip.dll
-
- ..\packages\EngineIoClientDotNet.1.0.7\lib\net45\EngineIoClientDotNet.dll
+
+ ..\packages\Finsemble.7.1.0\lib\net452\Finsemble.dll
-
- ..\packages\EventHook.1.4.105\lib\net45\EventHook.dll
+
+ ..\packages\Microsoft.IdentityModel.Logging.6.16.0\lib\net45\Microsoft.IdentityModel.Logging.dll
-
- ..\packages\Finsemble.6.6.3\lib\net452\Finsemble.dll
+
+ ..\packages\Microsoft.IdentityModel.Tokens.6.16.0\lib\net45\Microsoft.IdentityModel.Tokens.dll
-
- ..\packages\Microsoft.IdentityModel.Logging.6.12.1\lib\net45\Microsoft.IdentityModel.Logging.dll
-
-
- ..\packages\Microsoft.IdentityModel.Tokens.6.12.1\lib\net45\Microsoft.IdentityModel.Tokens.dll
-
-
- ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll
-
-
- ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll
-
-
- ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll
-
-
- ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll
-
-
- ..\packages\Nito.AsyncEx.4.0.1\lib\net45\Nito.AsyncEx.dll
-
-
- ..\packages\Nito.AsyncEx.4.0.1\lib\net45\Nito.AsyncEx.Concurrent.dll
-
-
- ..\packages\Nito.AsyncEx.4.0.1\lib\net45\Nito.AsyncEx.Enlightenment.dll
+
+ ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
..\packages\PInvoke.Windows.Core.0.6.49\lib\net20\PInvoke.Windows.Core.dll
@@ -94,12 +68,7 @@
..\packages\SuperSocket.ClientEngine.Core.0.10.0\lib\net45\SuperSocket.ClientEngine.dll
-
- ..\packages\System.Collections.Immutable.1.7.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll
-
-
-
@@ -189,11 +158,4 @@
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
\ No newline at end of file
diff --git a/WPFExample/packages.config b/WPFExample/packages.config
index 028abcf..fbe7ed0 100644
--- a/WPFExample/packages.config
+++ b/WPFExample/packages.config
@@ -1,19 +1,11 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
\ No newline at end of file
diff --git a/WPFExampleCore/App.xaml.cs b/WPFExampleCore/App.xaml.cs
index 6e69c2d..be1406a 100644
--- a/WPFExampleCore/App.xaml.cs
+++ b/WPFExampleCore/App.xaml.cs
@@ -1,11 +1,6 @@
-using Finsemble.WPF.Core;
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
+using System;
using System.Diagnostics;
-using System.Linq;
-using System.Threading.Tasks;
+using System.IO;
using System.Windows;
namespace WPFExampleCore
@@ -32,7 +27,22 @@ private void Application_DispatcherUnhandledException(object sender, System.Wind
#if DEBUG
Debugger.Launch();
#endif
+ LogUnhandledException(e.Exception);
Debug.Print($"An Unhandled Exception has occurred. Exception: {e.Exception}");
+ Shutdown();
+ }
+
+ private void LogUnhandledException(Exception e)
+ {
+ using (StreamWriter sw = new StreamWriter("Critical exceptions.log", true))
+ {
+ sw.WriteLine($"{DateTime.Now.ToUniversalTime()} - {e.Message}");
+ sw.WriteLine(e.StackTrace);
+ sw.WriteLine();
+ sw.Close();
+ }
+
+ if (e.InnerException != null) LogUnhandledException(e.InnerException);
}
}
}
diff --git a/WPFExampleCore/MainWindow.xaml.cs b/WPFExampleCore/MainWindow.xaml.cs
index 609651c..3ee4f4a 100644
--- a/WPFExampleCore/MainWindow.xaml.cs
+++ b/WPFExampleCore/MainWindow.xaml.cs
@@ -45,7 +45,7 @@ public MainWindow(string[] args)
FSBL = new FinsembleWPF(this, handle.ToString("X"), args); // Finsemble needs the command line arguments to connect and also this Window handle to manage snapping, docking etc.
FSBL.Connected += Finsemble_Connected;
FSBL.Disconnected += FSBL_Disconnected;
- var connectTask = FSBL.Connect("WPFExampleCore", JWK);
+ var connectTask = FSBL.Connect(FSBL.AppName ?? "WPFExampleCore", JWK);
}
private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
diff --git a/WPFExampleCore/WPFExampleCore.csproj b/WPFExampleCore/WPFExampleCore.csproj
index 2e69ccc..bf2468d 100644
--- a/WPFExampleCore/WPFExampleCore.csproj
+++ b/WPFExampleCore/WPFExampleCore.csproj
@@ -5,7 +5,7 @@
net5.0-windows
true
AnyCPU;x64
- 6.6.3
+ 7.1.0
@@ -13,7 +13,7 @@
-
+
diff --git a/WPFMultiWindowExampleCore/WPFMultiWindowExampleCore.csproj b/WPFMultiWindowExampleCore/WPFMultiWindowExampleCore.csproj
index 5a32caa..6902909 100644
--- a/WPFMultiWindowExampleCore/WPFMultiWindowExampleCore.csproj
+++ b/WPFMultiWindowExampleCore/WPFMultiWindowExampleCore.csproj
@@ -6,11 +6,11 @@
true
WPFMultiWindowExampleCore.AppStartup
AnyCPU;x64
- 6.6.3
+ 7.1.0
-
+
diff --git a/WindowlessExample.Core/WindowlessExample.Core.csproj b/WindowlessExample.Core/WindowlessExample.Core.csproj
index 3ec988f..90f3fff 100644
--- a/WindowlessExample.Core/WindowlessExample.Core.csproj
+++ b/WindowlessExample.Core/WindowlessExample.Core.csproj
@@ -4,11 +4,11 @@
WinExe
net5.0
AnyCPU;x64
- 6.6.3
+ 7.1.0
-
+
diff --git a/WindowlessExample/App.config b/WindowlessExample/App.config
index 37f69cf..c359fe8 100644
--- a/WindowlessExample/App.config
+++ b/WindowlessExample/App.config
@@ -7,7 +7,7 @@
-
+
@@ -21,6 +21,10 @@
+
+
+
+
diff --git a/WindowlessExample/Properties/AssemblyInfo.cs b/WindowlessExample/Properties/AssemblyInfo.cs
index a1d5b14..eeefef2 100644
--- a/WindowlessExample/Properties/AssemblyInfo.cs
+++ b/WindowlessExample/Properties/AssemblyInfo.cs
@@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("6.6.3.0")]
-[assembly: AssemblyFileVersion("6.6.3.0")]
+[assembly: AssemblyVersion("7.1.0.0")]
+[assembly: AssemblyFileVersion("7.1.0.0")]
diff --git a/WindowlessExample/WindowlessExample.csproj b/WindowlessExample/WindowlessExample.csproj
index 0165345..b0720fe 100644
--- a/WindowlessExample/WindowlessExample.csproj
+++ b/WindowlessExample/WindowlessExample.csproj
@@ -14,8 +14,6 @@
4
true
-
-
AnyCPU
@@ -48,45 +46,18 @@
bin\x64\Release\
-
- ..\packages\DotNetZip.1.13.7\lib\net40\DotNetZip.dll
-
-
- ..\packages\EngineIoClientDotNet.1.0.7\lib\net45\EngineIoClientDotNet.dll
-
-
- ..\packages\EventHook.1.4.105\lib\net45\EventHook.dll
-
-
- ..\packages\Finsemble.6.6.3\lib\net452\Finsemble.dll
+
+ ..\packages\Finsemble.7.1.0\lib\net452\Finsemble.dll
-
- ..\packages\Microsoft.IdentityModel.Logging.6.12.1\lib\net45\Microsoft.IdentityModel.Logging.dll
-
-
- ..\packages\Microsoft.IdentityModel.Tokens.6.12.1\lib\net45\Microsoft.IdentityModel.Tokens.dll
-
-
- ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll
+
+ ..\packages\Microsoft.IdentityModel.Logging.6.16.0\lib\net45\Microsoft.IdentityModel.Logging.dll
-
- ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll
+
+ ..\packages\Microsoft.IdentityModel.Tokens.6.16.0\lib\net45\Microsoft.IdentityModel.Tokens.dll
-
- ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll
-
-
- ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll
-
-
- ..\packages\Nito.AsyncEx.4.0.1\lib\net45\Nito.AsyncEx.dll
-
-
- ..\packages\Nito.AsyncEx.4.0.1\lib\net45\Nito.AsyncEx.Concurrent.dll
-
-
- ..\packages\Nito.AsyncEx.4.0.1\lib\net45\Nito.AsyncEx.Enlightenment.dll
+
+ ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
..\packages\PInvoke.Windows.Core.0.6.49\lib\net20\PInvoke.Windows.Core.dll
@@ -96,11 +67,6 @@
-
- ..\packages\System.Collections.Immutable.1.7.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll
-
-
-
..\packages\WebSocket4Net.0.15.2\lib\net45\WebSocket4Net.dll
@@ -138,11 +104,4 @@
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
\ No newline at end of file
diff --git a/WindowlessExample/packages.config b/WindowlessExample/packages.config
index 028abcf..f649a40 100644
--- a/WindowlessExample/packages.config
+++ b/WindowlessExample/packages.config
@@ -1,19 +1,10 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
\ No newline at end of file
diff --git a/WinformExample/App.config b/WinformExample/App.config
index fc3e0c6..8001b96 100644
--- a/WinformExample/App.config
+++ b/WinformExample/App.config
@@ -11,7 +11,7 @@
-
+
@@ -21,6 +21,10 @@
+
+
+
+
diff --git a/WinformExample/FormExample.Designer.cs b/WinformExample/FormExample.Designer.cs
index c25ae4a..1dc2c29 100644
--- a/WinformExample/FormExample.Designer.cs
+++ b/WinformExample/FormExample.Designer.cs
@@ -45,12 +45,6 @@ private void InitializeComponent()
this.MessagesRichBox = new System.Windows.Forms.RichTextBox();
this.MessagesLabel = new System.Windows.Forms.Label();
this.ComponentDropDown = new WinformExample.Controls.DropDown();
- this.GroupButton6 = new WinformExample.Controls.RoundedButton();
- this.GroupButton5 = new WinformExample.Controls.RoundedButton();
- this.GroupButton4 = new WinformExample.Controls.RoundedButton();
- this.GroupButton3 = new WinformExample.Controls.RoundedButton();
- this.GroupButton2 = new WinformExample.Controls.RoundedButton();
- this.GroupButton1 = new WinformExample.Controls.RoundedButton();
this.DragNDropEmittingButton = new WinformExample.Controls.RoundedButton();
this.DockingButton = new WinformExample.Controls.RoundedButton();
this.AlwaysOnTopButton = new WinformExample.Controls.RoundedButton();
@@ -105,8 +99,8 @@ private void InitializeComponent()
//
// panel1
//
- this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.panel1.BackgroundImage = global::WinformExample.Properties.Resources.winformsLogo;
this.panel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.panel1.Location = new System.Drawing.Point(31, 11);
@@ -143,9 +137,9 @@ private void InitializeComponent()
//
// MessagesRichBox
//
- this.MessagesRichBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.MessagesRichBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.MessagesRichBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(23)))), ((int)(((byte)(26)))), ((int)(((byte)(32)))));
this.MessagesRichBox.ForeColor = System.Drawing.Color.White;
this.MessagesRichBox.Location = new System.Drawing.Point(15, 410);
@@ -170,8 +164,8 @@ private void InitializeComponent()
//
// ComponentDropDown
//
- this.ComponentDropDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.ComponentDropDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.ComponentDropDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(34)))), ((int)(((byte)(38)))), ((int)(((byte)(47)))));
this.ComponentDropDown.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable;
this.ComponentDropDown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
@@ -184,117 +178,6 @@ private void InitializeComponent()
this.ComponentDropDown.Size = new System.Drawing.Size(203, 31);
this.ComponentDropDown.TabIndex = 35;
//
- // GroupButton6
- //
- this.GroupButton6.ButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(162)))), ((int)(((byte)(0)))));
- this.GroupButton6.CornerRadius = 15;
- this.GroupButton6.ImageMargins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
- this.GroupButton6.Location = new System.Drawing.Point(134, 10);
- this.GroupButton6.Margin = new System.Windows.Forms.Padding(2);
- this.GroupButton6.Name = "GroupButton6";
- this.GroupButton6.OnHoverButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(220)))), ((int)(((byte)(59)))));
- this.GroupButton6.OnHoverTextColor = System.Drawing.Color.Black;
- this.GroupButton6.Size = new System.Drawing.Size(22, 24);
- this.GroupButton6.TabIndex = 33;
- this.GroupButton6.Text = "6";
- this.GroupButton6.TextColor = System.Drawing.Color.White;
- this.GroupButton6.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
- this.GroupButton6.UseEllipse = true;
- this.GroupButton6.UseVisualStyleBackColor = true;
- this.GroupButton6.Visible = false;
- //
- // GroupButton5
- //
- this.GroupButton5.ButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(172)))), ((int)(((byte)(255)))));
- this.GroupButton5.CornerRadius = 15;
- this.GroupButton5.ImageMargins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
- this.GroupButton5.Location = new System.Drawing.Point(114, 10);
- this.GroupButton5.Margin = new System.Windows.Forms.Padding(2);
- this.GroupButton5.Name = "GroupButton5";
- this.GroupButton5.OnHoverButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(101)))), ((int)(((byte)(228)))), ((int)(((byte)(243)))));
- this.GroupButton5.OnHoverTextColor = System.Drawing.Color.Black;
- this.GroupButton5.Size = new System.Drawing.Size(22, 24);
- this.GroupButton5.TabIndex = 32;
- this.GroupButton5.Text = "5";
- this.GroupButton5.TextColor = System.Drawing.Color.White;
- this.GroupButton5.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
- this.GroupButton5.UseEllipse = true;
- this.GroupButton5.UseVisualStyleBackColor = true;
- this.GroupButton5.Visible = false;
- //
- // GroupButton4
- //
- this.GroupButton4.ButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(98)))), ((int)(((byte)(98)))));
- this.GroupButton4.CornerRadius = 15;
- this.GroupButton4.ImageMargins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
- this.GroupButton4.Location = new System.Drawing.Point(94, 10);
- this.GroupButton4.Margin = new System.Windows.Forms.Padding(2);
- this.GroupButton4.Name = "GroupButton4";
- this.GroupButton4.OnHoverButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(140)))), ((int)(((byte)(140)))));
- this.GroupButton4.OnHoverTextColor = System.Drawing.Color.Black;
- this.GroupButton4.Size = new System.Drawing.Size(22, 24);
- this.GroupButton4.TabIndex = 31;
- this.GroupButton4.Text = "4";
- this.GroupButton4.TextColor = System.Drawing.Color.White;
- this.GroupButton4.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
- this.GroupButton4.UseEllipse = true;
- this.GroupButton4.UseVisualStyleBackColor = true;
- this.GroupButton4.Visible = false;
- //
- // GroupButton3
- //
- this.GroupButton3.ButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(137)))), ((int)(((byte)(216)))), ((int)(((byte)(3)))));
- this.GroupButton3.CornerRadius = 15;
- this.GroupButton3.ImageMargins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
- this.GroupButton3.Location = new System.Drawing.Point(75, 10);
- this.GroupButton3.Margin = new System.Windows.Forms.Padding(2);
- this.GroupButton3.Name = "GroupButton3";
- this.GroupButton3.OnHoverButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(189)))), ((int)(((byte)(255)))), ((int)(((byte)(55)))));
- this.GroupButton3.OnHoverTextColor = System.Drawing.Color.Black;
- this.GroupButton3.Size = new System.Drawing.Size(22, 24);
- this.GroupButton3.TabIndex = 30;
- this.GroupButton3.Text = "3";
- this.GroupButton3.TextColor = System.Drawing.Color.White;
- this.GroupButton3.UseEllipse = true;
- this.GroupButton3.UseVisualStyleBackColor = true;
- this.GroupButton3.Visible = false;
- //
- // GroupButton2
- //
- this.GroupButton2.ButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(223)))), ((int)(((byte)(53)))));
- this.GroupButton2.CornerRadius = 15;
- this.GroupButton2.ImageMargins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
- this.GroupButton2.Location = new System.Drawing.Point(56, 10);
- this.GroupButton2.Margin = new System.Windows.Forms.Padding(2);
- this.GroupButton2.Name = "GroupButton2";
- this.GroupButton2.OnHoverButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(123)))));
- this.GroupButton2.OnHoverTextColor = System.Drawing.Color.Black;
- this.GroupButton2.Size = new System.Drawing.Size(22, 24);
- this.GroupButton2.TabIndex = 29;
- this.GroupButton2.Text = "2";
- this.GroupButton2.TextColor = System.Drawing.Color.White;
- this.GroupButton2.UseEllipse = true;
- this.GroupButton2.UseVisualStyleBackColor = true;
- this.GroupButton2.Visible = false;
- //
- // GroupButton1
- //
- this.GroupButton1.ButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(124)))), ((int)(((byte)(119)))), ((int)(((byte)(174)))));
- this.GroupButton1.CornerRadius = 15;
- this.GroupButton1.ImageMargins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
- this.GroupButton1.Location = new System.Drawing.Point(36, 10);
- this.GroupButton1.Margin = new System.Windows.Forms.Padding(2);
- this.GroupButton1.Name = "GroupButton1";
- this.GroupButton1.OnHoverButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(185)))), ((int)(((byte)(240)))));
- this.GroupButton1.OnHoverTextColor = System.Drawing.Color.Black;
- this.GroupButton1.Size = new System.Drawing.Size(22, 24);
- this.GroupButton1.TabIndex = 28;
- this.GroupButton1.Text = "1";
- this.GroupButton1.TextColor = System.Drawing.Color.White;
- this.GroupButton1.UseEllipse = true;
- this.GroupButton1.UseVisualStyleBackColor = true;
- this.GroupButton1.Visible = false;
- //
// DragNDropEmittingButton
//
this.DragNDropEmittingButton.ButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(34)))), ((int)(((byte)(38)))), ((int)(((byte)(47)))));
@@ -397,8 +280,8 @@ private void InitializeComponent()
//
// DataToSendInput
//
- this.DataToSendInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.DataToSendInput.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.DataToSendInput.AutoSize = true;
this.DataToSendInput.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(23)))), ((int)(((byte)(26)))), ((int)(((byte)(32)))));
this.DataToSendInput.ForeColor = System.Drawing.Color.White;
@@ -429,8 +312,8 @@ private void InitializeComponent()
//
// panel2
//
- this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.panel2.Controls.Add(this.panel1);
this.panel2.Controls.Add(this.DataLabel);
this.panel2.Controls.Add(this.SourceLabel);
@@ -448,12 +331,6 @@ private void InitializeComponent()
this.ClientSize = new System.Drawing.Size(550, 576);
this.Controls.Add(this.panel2);
this.Controls.Add(this.ComponentDropDown);
- this.Controls.Add(this.GroupButton6);
- this.Controls.Add(this.GroupButton5);
- this.Controls.Add(this.GroupButton4);
- this.Controls.Add(this.GroupButton3);
- this.Controls.Add(this.GroupButton2);
- this.Controls.Add(this.GroupButton1);
this.Controls.Add(this.DragNDropEmittingButton);
this.Controls.Add(this.DockingButton);
this.Controls.Add(this.AlwaysOnTopButton);
@@ -492,12 +369,6 @@ private void InitializeComponent()
private Controls.RoundedButton AlwaysOnTopButton;
private Controls.RoundedButton DockingButton;
private Controls.RoundedButton DragNDropEmittingButton;
- private Controls.RoundedButton GroupButton1;
- private Controls.RoundedButton GroupButton2;
- private Controls.RoundedButton GroupButton3;
- private Controls.RoundedButton GroupButton4;
- private Controls.RoundedButton GroupButton5;
- private Controls.RoundedButton GroupButton6;
private Controls.DropDown ComponentDropDown;
private Panel panel2;
}
diff --git a/WinformExample/FormExample.cs b/WinformExample/FormExample.cs
index fb6eca2..84842ce 100644
--- a/WinformExample/FormExample.cs
+++ b/WinformExample/FormExample.cs
@@ -19,6 +19,8 @@ namespace WinformExample
public partial class FormExample : Form
{
private SortedDictionary LinkerGroups = new SortedDictionary();
+ const int LinkerPillWidth = 22;
+ const int LinkerPillHeight = 24;
private System.Drawing.Text.PrivateFontCollection finfont = new System.Drawing.Text.PrivateFontCollection();
private JsonWebKey JWK = new JsonWebKey()
@@ -80,9 +82,6 @@ private async void FinsembleConnected(object sender, EventArgs e)
if (FSBL.LinkerClient != null)
{
- //setup linker channels
- FSBL.LinkerClient.GetAllChannels(HandleLinkerChannelLabels);
-
// Listen to Linker state change to render connected channels
FSBL.LinkerClient.OnStateChange(HandleLinkerStateChange);
@@ -91,11 +90,6 @@ private async void FinsembleConnected(object sender, EventArgs e)
}
else //use default FDC3 client
{
- //setup linker channels
- var systemChannels = await FSBL.FDC3Client.DesktopAgentClient.GetSystemChannels();
- var data = new JArray(systemChannels.Select(x => new JObject { ["name"] = x.Id }));
- HandleLinkerChannelLabels(null, new FinsembleEventArgs(null, data));
-
FSBL.FDC3Client.StateChanged += HandleLinkerStateChange;
//setting initial state of linked channels
@@ -187,35 +181,6 @@ private void Logger_OnLog(object sender, JObject log)
}
}
- private void HandleLinkerChannelLabels(object sender, FinsembleEventArgs args)
- {
- this.Invoke(new Action(() =>
- {
- if (args.error == null)
- {
- var groupLabels = new RoundedButton[] { GroupButton1, GroupButton2, GroupButton3, GroupButton4, GroupButton5, GroupButton6 };
- var allChannels = args.response as JArray;
- int labelcount = 0;
- foreach (JObject item in allChannels)
- {
- var theLabel = groupLabels[labelcount++];
- theLabel.Visible = false;
- if (!LinkerGroups.ContainsKey(item["name"].ToString()))
- LinkerGroups.Add(item["name"].ToString(), theLabel);
- //limit channels to ones we enough labels for
- if (labelcount == groupLabels.Length)
- {
- break;
- }
- }
- }
- else
- {
- FSBL.Logger.Error(new JToken[] { "Error when retrieving linker channels: ", args.error.ToString() });
- }
- }));
- }
-
private void HandleLinkerStateChange(Object sender, FinsembleEventArgs response)
{
this.Invoke(new Action(() =>
@@ -230,39 +195,92 @@ private void HandleLinkerStateChange(Object sender, FinsembleEventArgs response)
var channels = response.response["channels"] as JArray;
var allChannels = response.response["allChannels"] as JArray;
+
+ if (LinkerGroups.Count == 0)
+ {
+ // setup linker channels only once
+ CreateLinkerPills(allChannels);
+ }
+
foreach (JObject obj in allChannels)
{
- LinkerGroups[obj["name"].ToString()].Visible = false;
- LinkerGroups[obj["name"].ToString()].BackColor = ColorTranslator.FromHtml(obj["color"].ToString());
+ var channelName = obj["name"].ToString();
+ var channelColor = obj["color"].ToString();
+ LinkerGroups[channelName].Visible = false;
+ LinkerGroups[channelName].BackColor = ColorTranslator.FromHtml(channelColor);
}
foreach (JValue channel in channels)
{
- LinkerGroups[channel.Value.ToString()].Visible = true;
+ var channelName = channel.Value.ToString();
+ LinkerGroups[channelName].Visible = true;
}
- var visiblePillsAfterChange = LinkerGroups.Count(x => x.Value.Visible);
AlignAllLinkerPills();
- DragNDropEmittingButton.Location = new Point(DragNDropEmittingButton.Location.X + CalculateDragNDropLeftMarginShift(visiblePillsBeforeChange, visiblePillsAfterChange), DragNDropEmittingButton.Location.Y);
+
+ var visiblePillsAfterChange = LinkerGroups.Count(x => x.Value.Visible);
+ var marginShift = CalculateDragNDropLeftMarginShift(visiblePillsBeforeChange, visiblePillsAfterChange);
+ DragNDropEmittingButton.Location = new Point(DragNDropEmittingButton.Location.X + marginShift, DragNDropEmittingButton.Location.Y);
}
}));
}
- private void AlignAllLinkerPills()
+ private void CreateLinkerPills(JArray allChannels)
{
- var initialX = GroupButton1.Location.X;
- var counter = 0;
+ this.Invoke(new Action(() =>
+ {
+ int positionX = 0;
+ const int positionY = 10;
+
+
+ var colorConverter = new ColorConverter();
+ foreach (var channel in allChannels)
+ {
+ if (!LinkerGroups.ContainsKey(channel["name"].ToString()))
+ {
+ var label = channel["label"].ToString();
- foreach (var visiblePill in LinkerGroups.Where(x => x.Value.Visible))
+ var button = new RoundedButton()
+ {
+ CornerRadius = 15,
+ ImageMargins = new System.Drawing.Printing.Margins(0, 0, 0, 0),
+ Margin = new Padding(2),
+ Name = $"GroupButton{label.Replace(" ", "_")}",
+ Visible = false,
+ UseEllipse = true,
+ UseVisualStyleBackColor = true,
+ TextColor = Color.White,
+ Size = new Size(LinkerPillWidth, LinkerPillHeight),
+ Text = label,
+ ButtonColor = (Color)colorConverter.ConvertFromString(channel["color"].ToString()),
+ OnHoverTextColor = Color.Black,
+ OnHoverButtonColor = Color.DarkOliveGreen,
+ Location = new Point(positionX, positionY)
+ };
+
+ this.Controls.Add(button);
+
+ positionX += LinkerPillWidth;
+ LinkerGroups.Add(channel["name"].ToString(), button);
+ }
+ }
+ }));
+ }
+
+ private void AlignAllLinkerPills()
+ {
+ var initialX = LinkerButton.Location.X + LinkerButton.Width + 2;
+ var visiblePills = LinkerGroups.Where(x => x.Value.Visible).ToArray();
+ for (int i = 0; i < visiblePills.Count(); i++)
{
- visiblePill.Value.Location = new Point(initialX + (counter * (GroupButton1.Width)), visiblePill.Value.Location.Y);
- ++counter;
+ var button = visiblePills[i].Value;
+ button.Location = new Point(initialX + (i * LinkerPillWidth), button.Location.Y);
}
}
private int CalculateDragNDropLeftMarginShift(int visiblePillsBeforeShift, int visiblePillsAfterShift)
{
- return (visiblePillsAfterShift - visiblePillsBeforeShift) * (GroupButton1.Width + 2);
+ return (visiblePillsAfterShift - visiblePillsBeforeShift) * (LinkerPillWidth + 2);
}
private void HandleWindowGrouping(object s, FinsembleEventArgs res)
@@ -576,8 +594,8 @@ private async void LaunchButton_Click(object sender, EventArgs e)
if (selected == null) return;
var componentName = selected.ToString();
-
- if(FSBL.FDC3Client != null)
+
+ if (FSBL.FDC3Client != null)
{
var targetApp = new TargetApp() { Name = componentName };
var context = new Context(new JObject
diff --git a/WinformExample/Program.cs b/WinformExample/Program.cs
index c8bf2a3..3ebb05f 100644
--- a/WinformExample/Program.cs
+++ b/WinformExample/Program.cs
@@ -1,9 +1,6 @@
-using ChartIQ.Finsemble;
-using Newtonsoft.Json.Linq;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
+using System;
+using System.IO;
+using System.Threading;
using System.Windows.Forms;
namespace WinformExample
@@ -18,11 +15,39 @@ static class Program
static void Main()
{
string[] args = Environment.GetCommandLineArgs();
+
+ Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
+ Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
+ AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
+
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormExample(args));
}
+ static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
+ {
+ LogUnhandledException(e.Exception);
+ Application.Exit();
+ }
+
+ static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
+ {
+ LogUnhandledException(e.ExceptionObject as Exception);
+ Application.Exit();
+ }
+ static void LogUnhandledException(Exception e)
+ {
+ using (StreamWriter sw = new StreamWriter("Critical exceptions.log", true))
+ {
+ sw.WriteLine($"{DateTime.Now.ToUniversalTime()} - {e.Message}");
+ sw.WriteLine(e.StackTrace);
+ sw.WriteLine();
+ sw.Close();
+ }
+
+ if (e.InnerException != null) LogUnhandledException(e.InnerException);
+ }
}
}
diff --git a/WinformExample/Properties/AssemblyInfo.cs b/WinformExample/Properties/AssemblyInfo.cs
index a1905d1..abd1bbe 100644
--- a/WinformExample/Properties/AssemblyInfo.cs
+++ b/WinformExample/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("6.6.3.0")]
-[assembly: AssemblyFileVersion("6.6.3.0")]
+[assembly: AssemblyVersion("7.1.0.0")]
+[assembly: AssemblyFileVersion("7.1.0.0")]
diff --git a/WinformExample/WinformExample.csproj b/WinformExample/WinformExample.csproj
index cc1e9fa..d915e78 100644
--- a/WinformExample/WinformExample.csproj
+++ b/WinformExample/WinformExample.csproj
@@ -47,23 +47,17 @@
bin\x64\Release\
-
- ..\packages\DotNetZip.1.13.7\lib\net40\DotNetZip.dll
+
+ ..\packages\DotNetZip.1.16.0\lib\net40\DotNetZip.dll
-
- ..\packages\EngineIoClientDotNet.1.0.7\lib\net45\EngineIoClientDotNet.dll
+
+ ..\packages\Finsemble.7.1.0\lib\net452\Finsemble.dll
-
- ..\packages\EventHook.1.4.105\lib\net45\EventHook.dll
+
+ ..\packages\Microsoft.IdentityModel.Logging.6.16.0\lib\net45\Microsoft.IdentityModel.Logging.dll
-
- ..\packages\Finsemble.6.6.3\lib\net452\Finsemble.dll
-
-
- ..\packages\Microsoft.IdentityModel.Logging.6.12.1\lib\net45\Microsoft.IdentityModel.Logging.dll
-
-
- ..\packages\Microsoft.IdentityModel.Tokens.6.12.1\lib\net45\Microsoft.IdentityModel.Tokens.dll
+
+ ..\packages\Microsoft.IdentityModel.Tokens.6.16.0\lib\net45\Microsoft.IdentityModel.Tokens.dll
..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll
@@ -74,17 +68,8 @@
..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll
-
- ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll
-
-
- ..\packages\Nito.AsyncEx.4.0.1\lib\net45\Nito.AsyncEx.dll
-
-
- ..\packages\Nito.AsyncEx.4.0.1\lib\net45\Nito.AsyncEx.Concurrent.dll
-
-
- ..\packages\Nito.AsyncEx.4.0.1\lib\net45\Nito.AsyncEx.Enlightenment.dll
+
+ ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
..\packages\PInvoke.Windows.Core.0.6.49\lib\net20\PInvoke.Windows.Core.dll
@@ -95,11 +80,7 @@
..\packages\SuperSocket.ClientEngine.Core.0.10.0\lib\net45\SuperSocket.ClientEngine.dll
-
- ..\packages\System.Collections.Immutable.1.7.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll
-
-
diff --git a/WinformExample/packages.config b/WinformExample/packages.config
index 61c9ec2..266dede 100644
--- a/WinformExample/packages.config
+++ b/WinformExample/packages.config
@@ -1,19 +1,14 @@
-
-
-
-
+
+
-
-
-
-
+
+
+
-
-
\ No newline at end of file
diff --git a/WinformExampleCore/MainForm.Designer.cs b/WinformExampleCore/MainForm.Designer.cs
index 4695543..a53715d 100644
--- a/WinformExampleCore/MainForm.Designer.cs
+++ b/WinformExampleCore/MainForm.Designer.cs
@@ -36,12 +36,6 @@ private void InitializeComponent()
this.AlwaysOnTopButton = new WinformExampleCore.Controls.RoundedButton();
this.DockingButton = new WinformExampleCore.Controls.RoundedButton();
this.LinkerButton = new WinformExampleCore.Controls.RoundedButton();
- this.GroupButton1 = new WinformExampleCore.Controls.RoundedButton();
- this.GroupButton2 = new WinformExampleCore.Controls.RoundedButton();
- this.GroupButton3 = new WinformExampleCore.Controls.RoundedButton();
- this.GroupButton4 = new WinformExampleCore.Controls.RoundedButton();
- this.GroupButton5 = new WinformExampleCore.Controls.RoundedButton();
- this.GroupButton6 = new WinformExampleCore.Controls.RoundedButton();
this.panel1 = new System.Windows.Forms.Panel();
this.DataLabel = new System.Windows.Forms.Label();
this.SourceLabel = new System.Windows.Forms.Label();
@@ -135,120 +129,6 @@ private void InitializeComponent()
this.LinkerButton.UseVisualStyleBackColor = true;
this.LinkerButton.Click += new System.EventHandler(this.LinkerButton_Click);
//
- // GroupButton1
- //
- this.GroupButton1.ButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(124)))), ((int)(((byte)(119)))), ((int)(((byte)(174)))));
- this.GroupButton1.CornerRadius = 15;
- this.GroupButton1.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
- this.GroupButton1.ImageMargins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
- this.GroupButton1.Location = new System.Drawing.Point(43, 19);
- this.GroupButton1.Margin = new System.Windows.Forms.Padding(4);
- this.GroupButton1.Name = "GroupButton1";
- this.GroupButton1.OnHoverButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(190)))), ((int)(((byte)(185)))), ((int)(((byte)(240)))));
- this.GroupButton1.OnHoverTextColor = System.Drawing.Color.Black;
- this.GroupButton1.Size = new System.Drawing.Size(15, 24);
- this.GroupButton1.TabIndex = 28;
- this.GroupButton1.Text = "1";
- this.GroupButton1.TextColor = System.Drawing.Color.White;
- this.GroupButton1.UseEllipse = false;
- this.GroupButton1.UseVisualStyleBackColor = true;
- this.GroupButton1.Visible = false;
- //
- // GroupButton2
- //
- this.GroupButton2.ButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(223)))), ((int)(((byte)(53)))));
- this.GroupButton2.CornerRadius = 15;
- this.GroupButton2.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
- this.GroupButton2.ImageMargins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
- this.GroupButton2.Location = new System.Drawing.Point(66, 19);
- this.GroupButton2.Margin = new System.Windows.Forms.Padding(4);
- this.GroupButton2.Name = "GroupButton2";
- this.GroupButton2.OnHoverButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(223)))), ((int)(((byte)(53)))));
- this.GroupButton2.OnHoverTextColor = System.Drawing.Color.Black;
- this.GroupButton2.Size = new System.Drawing.Size(15, 24);
- this.GroupButton2.TabIndex = 29;
- this.GroupButton2.Text = "2";
- this.GroupButton2.TextColor = System.Drawing.Color.White;
- this.GroupButton2.UseEllipse = true;
- this.GroupButton2.UseVisualStyleBackColor = true;
- this.GroupButton2.Visible = false;
- //
- // GroupButton3
- //
- this.GroupButton3.ButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(137)))), ((int)(((byte)(216)))), ((int)(((byte)(3)))));
- this.GroupButton3.CornerRadius = 15;
- this.GroupButton3.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
- this.GroupButton3.ImageMargins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
- this.GroupButton3.Location = new System.Drawing.Point(89, 19);
- this.GroupButton3.Margin = new System.Windows.Forms.Padding(4);
- this.GroupButton3.Name = "GroupButton3";
- this.GroupButton3.OnHoverButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(137)))), ((int)(((byte)(216)))), ((int)(((byte)(3)))));
- this.GroupButton3.OnHoverTextColor = System.Drawing.Color.Black;
- this.GroupButton3.Size = new System.Drawing.Size(15, 24);
- this.GroupButton3.TabIndex = 30;
- this.GroupButton3.Text = "3";
- this.GroupButton3.TextColor = System.Drawing.Color.White;
- this.GroupButton3.UseEllipse = true;
- this.GroupButton3.UseVisualStyleBackColor = true;
- this.GroupButton3.Visible = false;
- //
- // GroupButton4
- //
- this.GroupButton4.ButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(98)))), ((int)(((byte)(98)))));
- this.GroupButton4.CornerRadius = 15;
- this.GroupButton4.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
- this.GroupButton4.ImageMargins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
- this.GroupButton4.Location = new System.Drawing.Point(112, 19);
- this.GroupButton4.Margin = new System.Windows.Forms.Padding(4);
- this.GroupButton4.Name = "GroupButton4";
- this.GroupButton4.OnHoverButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(254)))), ((int)(((byte)(98)))), ((int)(((byte)(98)))));
- this.GroupButton4.OnHoverTextColor = System.Drawing.Color.Black;
- this.GroupButton4.Size = new System.Drawing.Size(15, 24);
- this.GroupButton4.TabIndex = 31;
- this.GroupButton4.Text = "4";
- this.GroupButton4.TextColor = System.Drawing.Color.White;
- this.GroupButton4.UseEllipse = true;
- this.GroupButton4.UseVisualStyleBackColor = true;
- this.GroupButton4.Visible = false;
- //
- // GroupButton5
- //
- this.GroupButton5.ButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(172)))), ((int)(((byte)(255)))));
- this.GroupButton5.CornerRadius = 15;
- this.GroupButton5.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
- this.GroupButton5.ImageMargins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
- this.GroupButton5.Location = new System.Drawing.Point(135, 19);
- this.GroupButton5.Margin = new System.Windows.Forms.Padding(4);
- this.GroupButton5.Name = "GroupButton5";
- this.GroupButton5.OnHoverButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(172)))), ((int)(((byte)(255)))));
- this.GroupButton5.OnHoverTextColor = System.Drawing.Color.Black;
- this.GroupButton5.Size = new System.Drawing.Size(15, 24);
- this.GroupButton5.TabIndex = 32;
- this.GroupButton5.Text = "5";
- this.GroupButton5.TextColor = System.Drawing.Color.White;
- this.GroupButton5.UseEllipse = true;
- this.GroupButton5.UseVisualStyleBackColor = true;
- this.GroupButton5.Visible = false;
- //
- // GroupButton6
- //
- this.GroupButton6.ButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(162)))), ((int)(((byte)(0)))));
- this.GroupButton6.CornerRadius = 15;
- this.GroupButton6.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.6F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
- this.GroupButton6.ImageMargins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
- this.GroupButton6.Location = new System.Drawing.Point(158, 19);
- this.GroupButton6.Margin = new System.Windows.Forms.Padding(4);
- this.GroupButton6.Name = "GroupButton6";
- this.GroupButton6.OnHoverButtonColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(162)))), ((int)(((byte)(0)))));
- this.GroupButton6.OnHoverTextColor = System.Drawing.Color.Black;
- this.GroupButton6.Size = new System.Drawing.Size(15, 24);
- this.GroupButton6.TabIndex = 33;
- this.GroupButton6.Text = "6";
- this.GroupButton6.TextColor = System.Drawing.Color.White;
- this.GroupButton6.UseEllipse = true;
- this.GroupButton6.UseVisualStyleBackColor = true;
- this.GroupButton6.Visible = false;
- //
// panel1
//
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@@ -455,12 +335,6 @@ private void InitializeComponent()
this.Controls.Add(this.SpawnLabel);
this.Controls.Add(this.SendButton);
this.Controls.Add(this.SendASymbolLabel);
- this.Controls.Add(this.GroupButton6);
- this.Controls.Add(this.GroupButton5);
- this.Controls.Add(this.GroupButton4);
- this.Controls.Add(this.GroupButton3);
- this.Controls.Add(this.GroupButton2);
- this.Controls.Add(this.GroupButton1);
this.Controls.Add(this.LinkerButton);
this.Controls.Add(this.DockingButton);
this.Controls.Add(this.AlwaysOnTopButton);
@@ -480,12 +354,6 @@ private void InitializeComponent()
private Controls.RoundedButton AlwaysOnTopButton;
private Controls.RoundedButton DockingButton;
private Controls.RoundedButton LinkerButton;
- private Controls.RoundedButton GroupButton1;
- private Controls.RoundedButton GroupButton2;
- private Controls.RoundedButton GroupButton5;
- private Controls.RoundedButton GroupButton3;
- private Controls.RoundedButton GroupButton4;
- private Controls.RoundedButton GroupButton6;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label DataLabel;
private System.Windows.Forms.Label SourceLabel;
diff --git a/WinformExampleCore/MainForm.cs b/WinformExampleCore/MainForm.cs
index 5b543ff..bcff1a3 100644
--- a/WinformExampleCore/MainForm.cs
+++ b/WinformExampleCore/MainForm.cs
@@ -20,6 +20,8 @@ public partial class MainForm : Form
private string[] _startupArgs;
private FinsembleWinform _bridge;
private IListener _contextListenter;
+ const int LinkerPillWidth = 15;
+ const int LinkerPillHeight = 24;
private SortedDictionary LinkerGroups = new SortedDictionary();
private System.Drawing.Text.PrivateFontCollection finfont = new System.Drawing.Text.PrivateFontCollection();
@@ -38,7 +40,7 @@ public partial class MainForm : Form
public MainForm(string[] args)
{
InitializeComponent();
-
+
this.Visible = false;
_startupArgs = args;
}
@@ -46,7 +48,7 @@ public MainForm(string[] args)
private void MainForm_Load(object sender, EventArgs e)
{
this.Visible = false;
-
+
MessagesRichBox.SendToBack();
DataToSendInput.EnterKeyPressed += DataToSendInput_EnterKeyPressed; ;
@@ -67,43 +69,19 @@ private async void Finsemble_Connected(object sender, EventArgs e)
_bridge.Clients.Logger.OnLog += Logger_OnLog;
_bridge.Clients.Logger.Log(new JToken[] { "Winform Example Core connected to Finsemble." });
-
+
// Handle Window grouping
_bridge.Clients.RouterClient.Subscribe("Finsemble.WorkspaceService.groupUpdate", HandleWindowGrouping);
#region FDC3
+ // Listen to Fdc3Client state change to render connected channels
+ _bridge.Clients.Fdc3Client.StateChanged += Fdc3Client_StateChanged; ;
+ // Show joined channels
+ Fdc3Client_StateChanged(null, _bridge.Clients.Fdc3Client.LastStateChangedArgs);
- if (_bridge.Clients.Fdc3Client != null)
- {
- //Setup channels
- var systemChannels = await _bridge.Clients.Fdc3Client.DesktopAgentClient.GetSystemChannels();
- SetUpLinkerChannels(systemChannels);
-
- // Listen to Fdc3Client state change to render connected channels
- _bridge.Clients.Fdc3Client.StateChanged += Fdc3Client_StateChanged; ;
- // Show joined channels
- Fdc3Client_StateChanged(null, _bridge.Clients.Fdc3Client.LastStateChangedArgs);
-
- // Example for Fdc3Client subscribe to specific context. The "*" for subscription to all contexts.
- _contextListenter = _bridge.Clients.Fdc3Client.DesktopAgentClient.AddContextListener("fdc3.instrument", HandleContext);
- }
-
- #endregion
-
- #region Linker Client
-
- if (_bridge.Clients.LinkerClient != null)
- {
- //setup linker channels
- _bridge.Clients.LinkerClient.GetAllChannels(HandleLinkerChannelLabels);
-
- // Listen to Linker state change to render connected channels
- _bridge.Clients.LinkerClient.OnStateChange(Fdc3Client_StateChanged);
-
- // Example for LinkerClient subscribe
- _bridge.Clients.LinkerClient.Subscribe("symbol", HandleLinkerData);
- }
+ // Example for Fdc3Client subscribe to specific context. The "*" for subscription to all contexts.
+ _contextListenter = _bridge.Clients.Fdc3Client.DesktopAgentClient.AddContextListener("fdc3.instrument", HandleContext);
#endregion
@@ -259,62 +237,16 @@ private async void HandleComponentsList()
_bridge.Clients.Logger.Error(new JToken[] { "Error when receiving spawnable component list: ", ex.ToString() });
}
}
- private void HandleLinkerChannelLabels(object sender, FinsembleEventArgs args)
- {
- this.Invoke(new Action(() =>
- {
- if (args.error == null)
- {
- var groupLabels = new Button[] { GroupButton1, GroupButton2, GroupButton3, GroupButton4, GroupButton5, GroupButton6 };
- var allChannels = args.response as JArray;
- int labelcount = 0;
- foreach (JObject item in allChannels)
- {
- var theLabel = groupLabels[labelcount++];
- theLabel.Visible = false;
- if (!LinkerGroups.ContainsKey(item["name"].ToString()))
- LinkerGroups.Add(item["name"].ToString(), theLabel);
- //limit channels to ones we enough labels for
- if (labelcount == groupLabels.Length)
- {
- break;
- }
- }
- }
- else
- {
- _bridge.Clients.Logger.Error(new JToken[] { "Error when retrieving linker channels: ", args.error.ToString() });
- }
- }));
- }
-
- private void HandleLinkerData(object sender, FinsembleEventArgs response)
- {
- this.Invoke(new Action(() =>
- {
- if (response.error != null)
- {
- _bridge.Clients.Logger.Error(new JToken[] { "Error when receiving linker data: ", response.error.ToString() });
- }
- else if (response.response != null)
- {
- string value = response.response?["data"]?.ToString();
- DataLabel.Text = value;
- SourceLabel.Text = "via Linker";
- DataToSendInput.Text = value;
- }
- }));
- }
private void HandleContext(Context context)
{
_bridge.Clients.Logger.Debug($"Context received: {context.Value}");
-
+
if (context == null)
{
- _bridge.Clients.Logger.Error(new JToken[] { "Error when receiving context. Context is null "});
+ _bridge.Clients.Logger.Error(new JToken[] { "Error when receiving context. Context is null " });
}
- else
+ else
{
string value = context.Name;
SourceLabel.Text = "via FDC3";
@@ -373,15 +305,30 @@ private void Fdc3Client_StateChanged(object sender, FinsembleEventArgs response)
var channels = response.response["channels"] as JArray;
var allChannels = response.response["allChannels"] as JArray;
+
+ if (LinkerGroups.Count == 0)
+ {
+ // setup linker channels only once
+ CreateLinkerPills(allChannels);
+ }
+
foreach (JObject obj in allChannels)
{
- LinkerGroups[obj["name"].ToString()].Visible = false;
- LinkerGroups[obj["name"].ToString()].BackColor = ColorTranslator.FromHtml(obj["color"].ToString());
+ var key = obj["name"]?.ToString();
+ if (key != null && LinkerGroups.ContainsKey(key))
+ {
+ LinkerGroups[key].Visible = false;
+ LinkerGroups[key].BackColor = ColorTranslator.FromHtml(obj["color"].ToString());
+ }
}
foreach (JValue channel in channels)
{
- LinkerGroups[channel.Value.ToString()].Visible = true;
+ var key = channel.Value?.ToString();
+ if (key != null && LinkerGroups.ContainsKey(key))
+ {
+ LinkerGroups[key].Visible = true;
+ }
}
var visiblePillsAfterChange = LinkerGroups.Count(x => x.Value.Visible);
@@ -392,21 +339,62 @@ private void Fdc3Client_StateChanged(object sender, FinsembleEventArgs response)
}));
}
- private void AlignAllLinkerPills()
+ private void CreateLinkerPills(JArray allChannels)
{
- var initialX = GroupButton1.Location.X;
- var counter = 0;
+ this.Invoke(new Action(() =>
+ {
+ int positionX = 0;
+ const int positionY = 19;
- foreach (var visiblePill in LinkerGroups.Where(x => x.Value.Visible))
+
+ var colorConverter = new ColorConverter();
+ foreach (var channel in allChannels)
+ {
+ if (!LinkerGroups.ContainsKey(channel["name"].ToString()))
+ {
+ var label = channel["label"].ToString();
+
+ var button = new Controls.RoundedButton()
+ {
+ CornerRadius = 15,
+ ImageMargins = new System.Drawing.Printing.Margins(0, 0, 0, 0),
+ Margin = new Padding(2),
+ Name = $"GroupButton{label.Replace(" ", "_")}",
+ Visible = false,
+ UseEllipse = true,
+ UseVisualStyleBackColor = true,
+ TextColor = Color.White,
+ Size = new Size(LinkerPillWidth, LinkerPillHeight),
+ Text = label,
+ ButtonColor = (Color)colorConverter.ConvertFromString(channel["color"].ToString()),
+ OnHoverTextColor = Color.Black,
+ OnHoverButtonColor = Color.DarkOliveGreen,
+ Location = new Point(positionX, positionY)
+ };
+
+ this.Controls.Add(button);
+
+ positionX += LinkerPillWidth;
+ LinkerGroups.Add(channel["name"].ToString(), button);
+ }
+ }
+ }));
+ }
+
+ private void AlignAllLinkerPills()
+ {
+ var initialX = LinkerButton.Location.X + LinkerButton.Width + 2;
+ var visiblePills = LinkerGroups.Where(x => x.Value.Visible).ToArray();
+ for (int i = 0; i < visiblePills.Count(); i++)
{
- visiblePill.Value.Location = new Point(initialX + (counter * (GroupButton1.Width)), visiblePill.Value.Location.Y);
- ++counter;
+ var button = visiblePills[i].Value;
+ button.Location = new Point(initialX + (i * LinkerPillWidth), button.Location.Y);
}
}
private int CalculateDragNDropLeftMarginShift(int visiblePillsBeforeShift, int visiblePillsAfterShift)
{
- return (visiblePillsAfterShift - visiblePillsBeforeShift) * (GroupButton1.Width + 2);
+ return (visiblePillsAfterShift - visiblePillsBeforeShift) * (LinkerPillWidth + 2);
}
private void HandlePubSub(object sender, FinsembleEventArgs args)
@@ -438,31 +426,6 @@ private void HandlePubSub(object sender, FinsembleEventArgs args)
}));
}
- private void SetUpLinkerChannels(IChannel[] systemChannels)
- {
- this.Invoke(new Action(() =>
- {
- if (systemChannels != null)
- {
- var groupLabels = new Button[] { GroupButton1, GroupButton2, GroupButton3, GroupButton4, GroupButton5, GroupButton6 };
- int labelcount = 0;
- foreach (IChannel channel in systemChannels)
- {
- var theLabel = groupLabels[labelcount++];
- theLabel.Visible = false;
- LinkerGroups.Add(channel.Id, theLabel);
-
- //limit channels to ones we enough labels for
- if (labelcount == groupLabels.Length) break;
- }
- }
- else
- {
- _bridge.Clients.Logger.Error(new JToken[] { "Error when retrieving system channels."});
- }
- }));
- }
-
private void HandleWindowGrouping(object sender, FinsembleEventArgs args)
{
this.Invoke(new Action(() =>
@@ -525,39 +488,21 @@ private void LoadAndSetButtonsFont()
private void LinkerButton_Click(object sender, EventArgs e)
{
- if (_bridge.Clients.LinkerClient != null)
- {
- _bridge.Clients.LinkerClient.OpenLinkerWindow();
- }
- else
- {
- _bridge.Clients.Util.OpenLinkerWindow();
- }
+ _bridge.Clients.Util.OpenLinkerWindow();
}
private void SendButton_Click(object sender, EventArgs e)
{
- if (_bridge.Clients.LinkerClient != null)
- {
- _bridge.Clients.LinkerClient.Publish(new JObject
- {
- ["dataType"] = "symbol",
- ["data"] = DataToSendInput.Text
- });
- }
- else
+ var param = new JObject
{
- var param = new JObject
+ ["type"] = "fdc3.instrument",
+ ["name"] = DataToSendInput.Text,
+ ["id"] = new JObject
{
- ["type"] = "fdc3.instrument",
- ["name"] = DataToSendInput.Text,
- ["id"] = new JObject
- {
- ["ticker"] = DataToSendInput.Text
- }
- };
- _bridge.Clients.Fdc3Client.DesktopAgentClient.Broadcast(new Context(param));
- }
+ ["ticker"] = DataToSendInput.Text
+ }
+ };
+ _bridge.Clients.Fdc3Client.DesktopAgentClient.Broadcast(new Context(param));
}
private void UpdateAlwaysOnTopButton(bool isAlwaysOnTop)
@@ -602,7 +547,7 @@ private async void LaunchButton_Click(object sender, EventArgs e)
if (selected == null) return;
var componentName = selected.ToString();
-
+
var targetApp = new TargetApp() { Name = componentName };
var context = new Context(new JObject
{
diff --git a/WinformExampleCore/Program.cs b/WinformExampleCore/Program.cs
index 67442a5..7b67c6a 100644
--- a/WinformExampleCore/Program.cs
+++ b/WinformExampleCore/Program.cs
@@ -1,9 +1,7 @@
using System;
-using System.Collections.Generic;
using System.Diagnostics;
-using System.Linq;
+using System.IO;
using System.Threading;
-using System.Threading.Tasks;
using System.Windows.Forms;
namespace WinformExampleCore
@@ -20,8 +18,9 @@ static void Main()
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
+ Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
- Application.ThreadException += Application_ThreadException;
+ AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
#if DEBUG
Debugger.Launch();
@@ -32,10 +31,30 @@ static void Main()
Application.Run(new MainForm(args));
}
- private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
+ static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
{
+ LogUnhandledException(e.Exception);
Debug.Print($"An Unhandled Exception has occurred. Exception: {e.Exception}");
Application.Exit();
}
+
+ static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
+ {
+ LogUnhandledException(e.ExceptionObject as Exception);
+ Application.Exit();
+ }
+
+ static void LogUnhandledException(Exception e)
+ {
+ using (StreamWriter sw = new StreamWriter("Critical exceptions.log", true))
+ {
+ sw.WriteLine($"{DateTime.Now.ToUniversalTime()} - {e.Message}");
+ sw.WriteLine(e.StackTrace);
+ sw.WriteLine();
+ sw.Close();
+ }
+
+ if (e.InnerException != null) LogUnhandledException(e.InnerException);
+ }
}
}
diff --git a/WinformExampleCore/WinformExampleCore.csproj b/WinformExampleCore/WinformExampleCore.csproj
index a1cdb3d..1758a52 100644
--- a/WinformExampleCore/WinformExampleCore.csproj
+++ b/WinformExampleCore/WinformExampleCore.csproj
@@ -5,7 +5,7 @@
net5.0-windows
true
AnyCPU;x64
- 6.6.3
+ 7.1.0
@@ -23,7 +23,7 @@
-
+
diff --git a/WinformMultiWindowExample/App.config b/WinformMultiWindowExample/App.config
index 660d916..69a09b8 100644
--- a/WinformMultiWindowExample/App.config
+++ b/WinformMultiWindowExample/App.config
@@ -11,7 +11,11 @@
-
+
+
+
+
+
diff --git a/WinformMultiWindowExample/Properties/AssemblyInfo.cs b/WinformMultiWindowExample/Properties/AssemblyInfo.cs
index 3315191..37ed7ce 100644
--- a/WinformMultiWindowExample/Properties/AssemblyInfo.cs
+++ b/WinformMultiWindowExample/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("6.6.3.0")]
-[assembly: AssemblyFileVersion("6.6.3.0")]
+[assembly: AssemblyVersion("7.1.0.0")]
+[assembly: AssemblyFileVersion("7.1.0.0")]
diff --git a/WinformMultiWindowExample/WinformMultiWindowExample.csproj b/WinformMultiWindowExample/WinformMultiWindowExample.csproj
index 076f253..fbd8ab4 100644
--- a/WinformMultiWindowExample/WinformMultiWindowExample.csproj
+++ b/WinformMultiWindowExample/WinformMultiWindowExample.csproj
@@ -47,23 +47,17 @@
bin\x64\Release\
-
- ..\packages\DotNetZip.1.13.7\lib\net40\DotNetZip.dll
+
+ ..\packages\DotNetZip.1.16.0\lib\net40\DotNetZip.dll
-
- ..\packages\EngineIoClientDotNet.1.0.7\lib\net45\EngineIoClientDotNet.dll
+
+ ..\packages\Finsemble.7.1.0\lib\net452\Finsemble.dll
-
- ..\packages\EventHook.1.4.105\lib\net45\EventHook.dll
+
+ ..\packages\Microsoft.IdentityModel.Logging.6.16.0\lib\net45\Microsoft.IdentityModel.Logging.dll
-
- ..\packages\Finsemble.6.6.3\lib\net452\Finsemble.dll
-
-
- ..\packages\Microsoft.IdentityModel.Logging.6.12.1\lib\net45\Microsoft.IdentityModel.Logging.dll
-
-
- ..\packages\Microsoft.IdentityModel.Tokens.6.12.1\lib\net45\Microsoft.IdentityModel.Tokens.dll
+
+ ..\packages\Microsoft.IdentityModel.Tokens.6.16.0\lib\net45\Microsoft.IdentityModel.Tokens.dll
..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll
@@ -75,17 +69,8 @@
..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll
-
- ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll
-
-
- ..\packages\Nito.AsyncEx.4.0.1\lib\net45\Nito.AsyncEx.dll
-
-
- ..\packages\Nito.AsyncEx.4.0.1\lib\net45\Nito.AsyncEx.Concurrent.dll
-
-
- ..\packages\Nito.AsyncEx.4.0.1\lib\net45\Nito.AsyncEx.Enlightenment.dll
+
+ ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
..\packages\PInvoke.Windows.Core.0.6.49\lib\net20\PInvoke.Windows.Core.dll
@@ -94,11 +79,7 @@
..\packages\SuperSocket.ClientEngine.Core.0.10.0\lib\net45\SuperSocket.ClientEngine.dll
-
- ..\packages\System.Collections.Immutable.1.7.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll
-
-
diff --git a/WinformMultiWindowExample/packages.config b/WinformMultiWindowExample/packages.config
index 028abcf..032d2d5 100644
--- a/WinformMultiWindowExample/packages.config
+++ b/WinformMultiWindowExample/packages.config
@@ -1,19 +1,14 @@
-
-
-
-
+
+
-
-
-
-
+
+
+
-
-
\ No newline at end of file
diff --git a/WinformMultiWindowExampleCore/WinformMultiWindowExampleCore.csproj b/WinformMultiWindowExampleCore/WinformMultiWindowExampleCore.csproj
index 5ca246b..15abb3c 100644
--- a/WinformMultiWindowExampleCore/WinformMultiWindowExampleCore.csproj
+++ b/WinformMultiWindowExampleCore/WinformMultiWindowExampleCore.csproj
@@ -5,11 +5,11 @@
net5.0-windows
true
AnyCPU;x64
- 6.6.3
+ 7.1.0
-
+