aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-12-11 19:43:35 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-12-11 19:43:35 +0200
commit48f781d037a83c51fdd555fb6c9d1c2b4e424efe (patch)
treec13666e1ecb34dca68a8755af5c69534a493951f /Software/Visual_Studio
parent1952756022f71729aab3cea304d039f9b340b5d2 (diff)
downloadTango-48f781d037a83c51fdd555fb6c9d1c2b4e424efe.tar.gz
Tango-48f781d037a83c51fdd555fb6c9d1c2b4e424efe.zip
Working on PPC hotspot and external bridge.
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs6
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs7
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj6
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs97
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml13
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/IConnectivityProvider.cs18
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/PPCExternalBridgeService.cs8
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs22
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Scripting/CmdCommand.cs60
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj1
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs72
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs2
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml4
-rw-r--r--Software/Visual_Studio/Tango.BL/Entities/Machine.cs60
-rw-r--r--Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs2
-rw-r--r--Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx6
-rw-r--r--Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram148
-rw-r--r--Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs69
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml2
-rw-r--r--Software/Visual_Studio/Tango.Transport/TransporterBase.cs257
20 files changed, 554 insertions, 306 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs
index 6303b1ac8..ccedde974 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs
@@ -362,6 +362,12 @@ namespace Tango.MachineStudio.UI.StudioApplication
if (connectedMachine != null)
{
Machine = ObservablesStaticCollections.Instance.Machines.SingleOrDefault(x => x.SerialNumber == connectedMachine.SerialNumber);
+
+ if (Machine == null)
+ {
+ throw new NullReferenceException($"The specified machine '{connectedMachine.SerialNumber}' could not be found on the database.");
+ }
+
ConnectedMachine = connectedMachine;
ConnectedMachine.SetMachine(Machine);
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
index 70378a4d5..d1f9cda64 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
@@ -453,6 +453,13 @@ namespace Tango.MachineStudio.UI.ViewModels
if (x.SelectedMachine.RequiresAuthentication)
{
+ //Check machine exist on my database first
+ if (!ObservablesStaticCollections.Instance.Machines.ToList().Exists(y => y.SerialNumber == x.SelectedMachine.SerialNumber))
+ {
+ _notificationProvider.ShowError( $"The specified machine '{x.SelectedMachine.SerialNumber}' could not be found on the database.");
+ return;
+ }
+
_notificationProvider.ShowModalDialog<MachineLoginViewVM>(async (login) =>
{
using (NotificationProvider.PushTaskItem("Connecting to machine " + x.SelectedMachine.ToString() + "..."))
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj
index 9d44a6a63..e8d5b49d6 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj
@@ -121,6 +121,10 @@
<Project>{b112d89a-a106-41ae-a0c1-4abc84c477f5}</Project>
<Name>Tango.DragAndDrop</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\..\Tango.Integration\Tango.Integration.csproj">
+ <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project>
+ <Name>Tango.Integration</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\..\Tango.Logging\Tango.Logging.csproj">
<Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project>
<Name>Tango.Logging</Name>
@@ -160,7 +164,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs
index 6bbe1c47b..267012e2e 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
+using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -43,6 +44,33 @@ namespace Tango.PPC.MachineSettings.ViewModels
set { _selectedJobTypes = value; RaisePropertyChangedAuto(); }
}
+ private bool _enableHotSpot;
+ public bool EnableHotSpot
+ {
+ get { return _enableHotSpot; }
+ set { _enableHotSpot = value; RaisePropertyChangedAuto(); OnEnableHotSpotChanged(); }
+ }
+
+ private String _hotSpotPassword;
+ public String HotSpotPassword
+ {
+ get { return _hotSpotPassword; }
+ set { _hotSpotPassword = value; RaisePropertyChangedAuto(); }
+ }
+
+ private bool _enableExternalBridge;
+ public bool EnableExternalBridge
+ {
+ get { return _enableExternalBridge; }
+ set { _enableExternalBridge = value; RaisePropertyChangedAuto(); OnEnableExternalBridgeChanged(); }
+ }
+
+ private String _externalBridgePassword;
+ public String ExternalBridgePassword
+ {
+ get { return _externalBridgePassword; }
+ set { _externalBridgePassword = value; RaisePropertyChangedAuto(); }
+ }
#endregion
@@ -73,10 +101,25 @@ namespace Tango.PPC.MachineSettings.ViewModels
private async void Save()
{
- Machine.SupportedJobTypes = SelectedJobTypes.SynchedSource.ToList();
- Machine.ShallowCopyTo(MachineProvider.Machine);
- await MachineProvider.SaveMachine();
- await NavigationManager.NavigateBack();
+ if (Validate())
+ {
+ Machine.SupportedJobTypes = SelectedJobTypes.SynchedSource.ToList();
+ Machine.ShallowCopyTo(MachineProvider.Machine);
+
+ Settings.EnableHotSpot = EnableHotSpot;
+ Settings.HotSpotPassword = HotSpotPassword;
+ Settings.EnableExternalBridge = EnableExternalBridge;
+ Settings.ExternalBridgePassword = ExternalBridgePassword;
+ Settings.Save();
+
+ await MachineProvider.SaveMachine();
+ await NavigationManager.NavigateBack();
+ }
+ }
+
+ protected override void OnValidating()
+ {
+ base.OnValidating();
}
/// <summary>
@@ -94,8 +137,54 @@ namespace Tango.PPC.MachineSettings.ViewModels
Machine = new Machine();
MachineProvider.Machine.ShallowCopyTo(Machine);
RaisePropertyChanged(nameof(Machine));
+ _enableHotSpot = ConnectivityProvider.IsHotspotActive;
+ RaisePropertyChanged(nameof(EnableHotSpot));
+
SelectedJobTypes = new SelectedObjectCollection<JobTypes>(Enum.GetValues(typeof(JobTypes)).Cast<JobTypes>().ToObservableCollection(), Machine.SupportedJobTypes.ToObservableCollection());
}
+
+ private async void OnEnableHotSpotChanged()
+ {
+ if (EnableHotSpot)
+ {
+ if (HotSpotPassword == null || HotSpotPassword.Length < 8 || HotSpotPassword.Length > 16)
+ {
+ await NotificationProvider.ShowError("Hot spot requires a password of 8 to 16 characters.");
+ _enableHotSpot = false;
+ RaisePropertyChanged(nameof(EnableHotSpot));
+ return;
+ }
+
+ try
+ {
+ await ConnectivityProvider.EnableHotSpot(HotSpotPassword);
+ }
+ catch
+ {
+ await NotificationProvider.ShowError("An error occurred while trying to activate the hot spot network. Please check your device settings and try again.");
+ _enableHotSpot = false;
+ }
+ }
+ else
+ {
+ try
+ {
+ await ConnectivityProvider.DisableHotSpot();
+ }
+ catch
+ {
+ await NotificationProvider.ShowError("An error occurred while trying to deactivate the hot spot network.");
+ _enableHotSpot = true;
+ }
+ }
+
+ RaisePropertyChanged(nameof(EnableHotSpot));
+ }
+
+ private void OnEnableExternalBridgeChanged()
+ {
+ ExternalBridgeService.Enabled = EnableExternalBridge;
+ }
}
}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
index 4823f0811..7a64891c9 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml
@@ -43,6 +43,15 @@
<touch:TouchExpander Header="Connectivity" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}">
<StackPanel Margin="10 30 10 10">
<connectivity:AvailableWiFiConnectionsControl DataContext="{Binding ConnectivityProvider}" />
+
+ <controls:TableGrid Margin="10" RowHeight="60" MakeFirstColumnVerticalAlignmentBottom="False" TextElement.FontSize="{StaticResource TangoDefaultFontSize}">
+ <TextBlock VerticalAlignment="Center">Enable Hot Spot</TextBlock>
+ <touch:TouchToggleSlider Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Margin="0 0 110 0" Width="90" IsChecked="{Binding EnableHotSpot}"></touch:TouchToggleSlider>
+
+
+ <TextBlock VerticalAlignment="Bottom">Hot Spot Password</TextBlock>
+ <touch:TouchTextBox IsPassword="True" Watermark="•••••••" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" Text="{Binding HotSpotPassword}" KeyboardContainer="{Binding ElementName=Container}"></touch:TouchTextBox>
+ </controls:TableGrid>
</StackPanel>
</touch:TouchExpander>
@@ -50,10 +59,10 @@
<touch:TouchExpander Margin="0 20 0 0" Header="External Bridge" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}">
<controls:TableGrid Margin="10" RowHeight="70" MakeFirstColumnVerticalAlignmentBottom="False" TextElement.FontSize="{StaticResource TangoDefaultFontSize}">
<TextBlock VerticalAlignment="Center">Enable External Bridge Service</TextBlock>
- <touch:TouchToggleSlider Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Margin="0 0 110 0" Width="90" IsChecked="{Binding Machine.EnableExternalBridge}"></touch:TouchToggleSlider>
+ <touch:TouchToggleSlider Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Margin="0 0 110 0" Width="90" IsChecked="{Binding EnableExternalBridge}"></touch:TouchToggleSlider>
<TextBlock VerticalAlignment="Bottom">External Bridge Password</TextBlock>
- <touch:TouchTextBox IsPassword="True" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" Text="{Binding Machine.ExternalBridgePassword}" KeyboardContainer="{Binding ElementName=Container}"></touch:TouchTextBox>
+ <touch:TouchTextBox IsPassword="True" Watermark="•••••••" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" Text="{Binding ExternalBridgePassword}" KeyboardContainer="{Binding ElementName=Container}"></touch:TouchTextBox>
</controls:TableGrid>
</touch:TouchExpander>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/IConnectivityProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/IConnectivityProvider.cs
index 85c25128a..077f05110 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/IConnectivityProvider.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/IConnectivityProvider.cs
@@ -79,5 +79,23 @@ namespace Tango.PPC.Common.Connectivity
/// <param name="network">The network.</param>
/// <returns></returns>
void Disconnect(WiFiNetwork network);
+
+ /// <summary>
+ /// Gets a value indicating whether the hot spot network is active.
+ /// </summary>
+ bool IsHotspotActive { get; }
+
+ /// <summary>
+ /// Enables the hot spot.
+ /// </summary>
+ /// <param name="password">The password.</param>
+ /// <returns></returns>
+ Task EnableHotSpot(String password);
+
+ /// <summary>
+ /// Disables the hot spot.
+ /// </summary>
+ /// <returns></returns>
+ Task DisableHotSpot();
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/PPCExternalBridgeService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/PPCExternalBridgeService.cs
index 2f2956e9b..c50202e86 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/PPCExternalBridgeService.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/PPCExternalBridgeService.cs
@@ -30,15 +30,11 @@ namespace Tango.PPC.Common.ExternalBridge
{
applicationManager.ApplicationReady += (_, __) =>
{
+ var settings = SettingsManager.Default.GetOrCreate<PPCSettings>();
MachineOperator = machineProvider.MachineOperator;
Machine = machineProvider.Machine;
- Enabled = machineProvider.Machine.EnableExternalBridge;
+ Enabled = settings.EnableExternalBridge;
};
-
- TangoMessenger.Default.Register<MachineSettingsSavedMessage>((msg) =>
- {
- Enabled = msg.Machine.EnableExternalBridge;
- });
}
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs
index a1d3555e3..b6ab9c163 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs
@@ -61,6 +61,26 @@ namespace Tango.PPC.Common
public String EmbeddedComPort { get; set; }
/// <summary>
+ /// Gets or sets a value indicating whether [enable external bridge].
+ /// </summary>
+ public bool EnableExternalBridge { get; set; }
+
+ /// <summary>
+ /// Gets or sets the external bridge password.
+ /// </summary>
+ public String ExternalBridgePassword { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether [enable hot spot].
+ /// </summary>
+ public bool EnableHotSpot { get; set; }
+
+ /// <summary>
+ /// Gets or sets the hot spot password.
+ /// </summary>
+ public String HotSpotPassword { get; set; }
+
+ /// <summary>
/// Initializes a new instance of the <see cref="PPCSettings"/> class.
/// </summary>
public PPCSettings()
@@ -71,6 +91,8 @@ namespace Tango.PPC.Common
UpdateServiceAddress = "http://twine01/PPCUpdateService/PPCUpdateService.svc";
MachineServiceAddress = "http://twine01/MachineService";
EmbeddedComPort = null;
+ ExternalBridgePassword = "Aa123456";
+ HotSpotPassword = "Aa123456";
}
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Scripting/CmdCommand.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Scripting/CmdCommand.cs
new file mode 100644
index 000000000..2ee0d83d9
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Scripting/CmdCommand.cs
@@ -0,0 +1,60 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core;
+
+namespace Tango.PPC.Common.Scripting
+{
+ public class CmdCommand : ExtendedObject
+ {
+ private Process _process;
+
+ public String Arguments { get; set; }
+
+ public TimeSpan Timeout { get; set; }
+
+ public CmdCommand(String processName, String arguments)
+ {
+ Timeout = TimeSpan.FromSeconds(5);
+
+ _process = new Process();
+ _process.StartInfo.CreateNoWindow = true;
+ _process.StartInfo.FileName = processName;
+ _process.StartInfo.UseShellExecute = false;
+ _process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
+ _process.StartInfo.RedirectStandardError = true;
+ _process.StartInfo.RedirectStandardOutput = true;
+ _process.StartInfo.Arguments = arguments;
+ Arguments = arguments;
+ }
+
+ public Task Run()
+ {
+ return Task.Factory.StartNew(() =>
+ {
+ LogManager.Log($"Starting process {_process.StartInfo.FileName} with arguments {Arguments}...");
+ _process.Start();
+ _process.WaitForExit((int)Timeout.TotalMilliseconds);
+
+ if (_process.HasExited)
+ {
+ LogManager.Log($"Process exited with exit code {_process.ExitCode}.");
+ LogManager.Log($"Process Standard Output:\n{_process.StandardOutput.ReadToEnd()}");
+ LogManager.Log($"Process Standard Error:\n{_process.StandardError.ReadToEnd()}");
+ if (_process.ExitCode != 0)
+ {
+ throw new IOException($"The process {_process.StartInfo.FileName} has exited with the code {_process.ExitCode}.");
+ }
+ }
+ else
+ {
+ throw new TimeoutException($"The process {_process.StartInfo.FileName} has not exited within the given timeout of {Timeout.TotalSeconds} seconds.");
+ }
+ });
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj
index 19295cce3..b9d9c7620 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj
@@ -158,6 +158,7 @@
<Compile Include="PPCModuleAttribute.cs" />
<Compile Include="PPCModuleBase.cs" />
<Compile Include="Printing\IPrintingManager.cs" />
+ <Compile Include="Scripting\CmdCommand.cs" />
<Compile Include="Storage\DefaultStorageProvider.cs" />
<Compile Include="Storage\IStorageProvider.cs" />
<Compile Include="Threading\IDispatcherProvider.cs" />
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs
index a3420fb01..fbc619e12 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs
@@ -17,6 +17,7 @@ using Tango.PPC.Common.Application;
using Tango.PPC.Common.Connection;
using Tango.PPC.Common.Connectivity;
using Tango.PPC.Common.Notifications;
+using Tango.PPC.Common.Scripting;
using Tango.Settings;
using Tango.WiFi;
@@ -26,6 +27,7 @@ namespace Tango.PPC.UI.Connectivity
{
private Wifi _wifi;
private INotificationProvider _notification;
+ private IMachineProvider _machineProvider;
/// <summary>
/// Occurs when the connectivity provider state has changed (e.g network connected/disconnected).
@@ -42,6 +44,16 @@ namespace Tango.PPC.UI.Connectivity
set { _isConnected = value; RaisePropertyChangedAuto(); }
}
+ private bool _isHotspoActive;
+ /// <summary>
+ /// Gets a value indicating whether the hot spot network is active.
+ /// </summary>
+ public bool IsHotspotActive
+ {
+ get { return _isHotspoActive; }
+ set { _isHotspoActive = value; RaisePropertyChangedAuto(); }
+ }
+
/// <summary>
/// Gets the available WiFi networks.
/// </summary>
@@ -70,9 +82,10 @@ namespace Tango.PPC.UI.Connectivity
/// <summary>
/// Initializes a new instance of the <see cref="DefaultConnectivityProvider"/> class.
/// </summary>
- public DefaultConnectivityProvider(IPPCApplicationManager applicationManager, INotificationProvider notificationProvider)
+ public DefaultConnectivityProvider(IPPCApplicationManager applicationManager, INotificationProvider notificationProvider, IMachineProvider machineProvider)
{
_notification = notificationProvider;
+ _machineProvider = machineProvider;
AvailableWiFiNetworks = new ObservableCollection<WiFiNetwork>();
AvailableWiFiNetworks.EnableCrossThreadOperations();
@@ -125,6 +138,18 @@ namespace Tango.PPC.UI.Connectivity
{
await Connect(auto_connect_network);
}
+
+ if (settings.EnableHotSpot)
+ {
+ try
+ {
+ await EnableHotSpot(settings.HotSpotPassword);
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error starting on application startup.");
+ }
+ }
});
}
@@ -264,5 +289,50 @@ namespace Tango.PPC.UI.Connectivity
IsConnected = connected;
ConnectionStateChanged?.Invoke(this, new ConnectionStateEventArgs() { IsConnected = connected });
}
+
+ /// <summary>
+ /// Enables the hot spot.
+ /// </summary>
+ /// <param name="password">The password.</param>
+ /// <returns></returns>
+ public async Task EnableHotSpot(string password)
+ {
+ if (!IsHotspotActive)
+ {
+ try
+ {
+ CmdCommand command = new CmdCommand("netsh", $"wlan set hostednetwork mode=allow ssid='{"Tango_" + _machineProvider.Machine.SerialNumber}' key='{password}'");
+ await command.Run();
+ IsHotspotActive = true;
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error activating hot spot.");
+ throw;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Disables the hot spot.
+ /// </summary>
+ /// <returns></returns>
+ public async Task DisableHotSpot()
+ {
+ if (IsHotspotActive)
+ {
+ try
+ {
+ CmdCommand command = new CmdCommand("netsh", "wlan stop hosted network");
+ await command.Run();
+ IsHotspotActive = false;
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error deactivating hot spot.");
+ throw;
+ }
+ }
+ }
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs
index 3b672411d..a8faeea7b 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs
@@ -132,7 +132,7 @@ namespace Tango.PPC.UI.ViewModels
{
LogManager.Log($"External bridge connection request received.\n{e.ToJsonString()}");
- if (e.Request.Password == MachineProvider.Machine.ExternalBridgePassword)
+ if (e.Request.Password == Settings.ExternalBridgePassword)
{
e.Confirmed = true;
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml
index 3436bb3bb..e684f4969 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml
@@ -59,6 +59,10 @@
</touch:TouchIcon.Style>
</touch:TouchIcon>
+ <touch:TouchIcon Margin="10 0 0 0" Width="18" Height="18" VerticalAlignment="Center" Foreground="{StaticResource TangoSuccessBrush}" Icon="AccessPointNetwork" Visibility="{Binding ConnectivityProvider.IsHotspotActive,Converter={StaticResource BooleanToVisibilityConverter}}" />
+
+ <touch:TouchIcon Margin="10 0 0 0" Width="18" Height="18" VerticalAlignment="Center" Foreground="{StaticResource TangoSuccessBrush}" Icon="Bridge" Visibility="{Binding ExternalBridgeService.Enabled,Converter={StaticResource BooleanToVisibilityConverter}}" />
+
<ItemsControl ItemsSource="{Binding NotificationProvider.TaskBarItems}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
diff --git a/Software/Visual_Studio/Tango.BL/Entities/Machine.cs b/Software/Visual_Studio/Tango.BL/Entities/Machine.cs
index 76f31a085..438bf33b5 100644
--- a/Software/Visual_Studio/Tango.BL/Entities/Machine.cs
+++ b/Software/Visual_Studio/Tango.BL/Entities/Machine.cs
@@ -31,10 +31,6 @@ namespace Tango.BL.Entities
public event EventHandler<DateTime> ProductionDateChanged;
- public event EventHandler<Boolean> EnableExternalBridgeChanged;
-
- public event EventHandler<String> ExternalBridgePasswordChanged;
-
public event EventHandler<String> TargetJobTypesChanged;
public event EventHandler<Double> DefaultSegmentLengthChanged;
@@ -227,62 +223,6 @@ namespace Tango.BL.Entities
}
}
- protected Boolean _enableexternalbridge;
-
- /// <summary>
- /// Gets or sets the machine enable external bridge.
- /// </summary>
-
- [Column("ENABLE_EXTERNAL_BRIDGE")]
-
- public Boolean EnableExternalBridge
- {
- get
- {
- return _enableexternalbridge;
- }
-
- set
- {
- if (_enableexternalbridge != value)
- {
- _enableexternalbridge = value;
-
- EnableExternalBridgeChanged?.Invoke(this, value);
-
- RaisePropertyChanged(nameof(EnableExternalBridge));
- }
- }
- }
-
- protected String _externalbridgepassword;
-
- /// <summary>
- /// Gets or sets the machine external bridge password.
- /// </summary>
-
- [Column("EXTERNAL_BRIDGE_PASSWORD")]
-
- public String ExternalBridgePassword
- {
- get
- {
- return _externalbridgepassword;
- }
-
- set
- {
- if (_externalbridgepassword != value)
- {
- _externalbridgepassword = value;
-
- ExternalBridgePasswordChanged?.Invoke(this, value);
-
- RaisePropertyChanged(nameof(ExternalBridgePassword));
- }
- }
- }
-
protected String _defaultrmlguid;
/// <summary>
diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs
index f724c459e..bb1d92f52 100644
--- a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs
+++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs
@@ -32,8 +32,6 @@ namespace Tango.DAL.Remote.DB
public string ORGANIZATION_GUID { get; set; }
public string MACHINE_VERSION_GUID { get; set; }
public string CONFIGURATION_GUID { get; set; }
- public bool ENABLE_EXTERNAL_BRIDGE { get; set; }
- public string EXTERNAL_BRIDGE_PASSWORD { get; set; }
public string DEFAULT_RML_GUID { get; set; }
public string TARGET_JOB_TYPES { get; set; }
public string DEFAULT_COLOR_SPACE_GUID { get; set; }
diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx
index 23c098bf8..e4de437f9 100644
--- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx
+++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx
@@ -699,8 +699,6 @@
<Property Name="ORGANIZATION_GUID" Type="varchar" MaxLength="36" Nullable="false" />
<Property Name="MACHINE_VERSION_GUID" Type="varchar" MaxLength="36" Nullable="false" />
<Property Name="CONFIGURATION_GUID" Type="varchar" MaxLength="36" Nullable="false" />
- <Property Name="ENABLE_EXTERNAL_BRIDGE" Type="bit" Nullable="false" />
- <Property Name="EXTERNAL_BRIDGE_PASSWORD" Type="varchar" MaxLength="100" />
<Property Name="DEFAULT_RML_GUID" Type="varchar" MaxLength="36" />
<Property Name="TARGET_JOB_TYPES" Type="varchar" MaxLength="50" />
<Property Name="DEFAULT_COLOR_SPACE_GUID" Type="varchar" MaxLength="36" />
@@ -3787,8 +3785,6 @@
<Property Name="ORGANIZATION_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" />
<Property Name="MACHINE_VERSION_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" />
<Property Name="CONFIGURATION_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" />
- <Property Name="ENABLE_EXTERNAL_BRIDGE" Type="Boolean" Nullable="false" />
- <Property Name="EXTERNAL_BRIDGE_PASSWORD" Type="String" MaxLength="100" FixedLength="false" Unicode="false" />
<Property Name="DEFAULT_RML_GUID" Type="String" MaxLength="36" FixedLength="false" Unicode="false" />
<Property Name="TARGET_JOB_TYPES" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="DEFAULT_COLOR_SPACE_GUID" Type="String" MaxLength="36" FixedLength="false" Unicode="false" />
@@ -6055,8 +6051,6 @@
<ScalarProperty Name="DEFAULT_COLOR_SPACE_GUID" ColumnName="DEFAULT_COLOR_SPACE_GUID" />
<ScalarProperty Name="TARGET_JOB_TYPES" ColumnName="TARGET_JOB_TYPES" />
<ScalarProperty Name="DEFAULT_RML_GUID" ColumnName="DEFAULT_RML_GUID" />
- <ScalarProperty Name="EXTERNAL_BRIDGE_PASSWORD" ColumnName="EXTERNAL_BRIDGE_PASSWORD" />
- <ScalarProperty Name="ENABLE_EXTERNAL_BRIDGE" ColumnName="ENABLE_EXTERNAL_BRIDGE" />
<ScalarProperty Name="CONFIGURATION_GUID" ColumnName="CONFIGURATION_GUID" />
<ScalarProperty Name="MACHINE_VERSION_GUID" ColumnName="MACHINE_VERSION_GUID" />
<ScalarProperty Name="ORGANIZATION_GUID" ColumnName="ORGANIZATION_GUID" />
diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram
index b3d27e68b..a1a2ab2cf 100644
--- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram
+++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram
@@ -5,81 +5,81 @@
<!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams>
<Diagram DiagramId="f9ae01d708754bbd997add25a4bacc79" Name="Diagram1">
- <EntityTypeShape EntityType="RemoteModel.ACTION_TYPES" Width="1.5" PointX="10.25" PointY="58.375" />
- <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="0.75" PointY="43.75" />
- <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="0.75" PointY="1.25" />
- <EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="36.25" />
- <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="0.75" PointY="4.375" />
- <EntityTypeShape EntityType="RemoteModel.BRUSH_STOPS" Width="1.5" PointX="13" PointY="21.5" />
- <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="8" PointY="59.75" />
- <EntityTypeShape EntityType="RemoteModel.CAT" Width="1.5" PointX="10.5" PointY="20" />
- <EntityTypeShape EntityType="RemoteModel.CCT" Width="1.5" PointX="5.25" PointY="41.5" />
- <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS" Width="1.5" PointX="10.75" PointY="32.375" />
- <EntityTypeShape EntityType="RemoteModel.COLOR_SPACES" Width="1.5" PointX="3" PointY="26.5" />
- <EntityTypeShape EntityType="RemoteModel.CONFIGURATION" Width="1.5" PointX="3" PointY="2.125" />
+ <EntityTypeShape EntityType="RemoteModel.ACTION_TYPES" Width="1.5" PointX="8.25" PointY="69.875" />
+ <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="0.75" PointY="52.125" />
+ <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="0.75" PointY="41.25" />
+ <EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="44.125" />
+ <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="0.75" PointY="7.25" />
+ <EntityTypeShape EntityType="RemoteModel.BRUSH_STOPS" Width="1.5" PointX="12.75" PointY="20.875" />
+ <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="9" PointY="39.5" />
+ <EntityTypeShape EntityType="RemoteModel.CAT" Width="1.5" PointX="5.25" PointY="25.375" />
+ <EntityTypeShape EntityType="RemoteModel.CCT" Width="1.5" PointX="5.25" PointY="46.5" />
+ <EntityTypeShape EntityType="RemoteModel.COLOR_CATALOGS" Width="1.5" PointX="10.5" PointY="17.625" />
+ <EntityTypeShape EntityType="RemoteModel.COLOR_SPACES" Width="1.5" PointX="3" PointY="35.75" />
+ <EntityTypeShape EntityType="RemoteModel.CONFIGURATION" Width="1.5" PointX="3" PointY="7.5" />
<EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="0.75" PointY="48" />
- <EntityTypeShape EntityType="RemoteModel.CUSTOMER" Width="1.5" PointX="5.25" PointY="29.625" />
- <EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="8" PointY="56.5" />
- <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="7.375" />
- <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES" Width="1.5" PointX="10.25" PointY="1.5" />
- <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_ACTIONS" Width="1.5" PointX="12.5" PointY="2.375" />
- <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_CATEGORIES" Width="1.5" PointX="8" PointY="32.125" />
- <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_GROUPS" Width="1.5" PointX="8" PointY="5.75" />
- <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="0.75" PointY="23.875" />
- <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHS" Width="1.5" PointX="0.75" PointY="20.5" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_BLOWER_TYPES" Width="1.5" PointX="0.75" PointY="52.75" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_BLOWERS" Width="1.5" PointX="3" PointY="35.375" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_BREAK_SENSOR_TYPES" Width="1.5" PointX="3.75" PointY="51.75" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_BREAK_SENSORS" Width="1.5" PointX="6" PointY="37.375" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCER_TYPES" Width="1.5" PointX="10.75" PointY="54.75" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCERS" Width="1.5" PointX="13" PointY="38.625" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTOR_TYPES" Width="1.5" PointX="7.75" PointY="41.625" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTORS" Width="1.5" PointX="10" PointY="38.25" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROL_TYPES" Width="1.5" PointX="10.75" PointY="50.75" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROLS" Width="1.5" PointX="13" PointY="30.75" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_SPEED_SENSOR_TYPES" Width="1.5" PointX="0.75" PointY="56.75" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_SPEED_SENSORS" Width="1.5" PointX="3" PointY="39.375" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="39.125" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDER_TYPES" Width="1.5" PointX="7.75" PointY="66.75" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDERS" Width="1.5" PointX="10" PointY="46.5" />
- <EntityTypeShape EntityType="RemoteModel.HTML_PAGES" Width="1.5" PointX="8" PointY="1.875" />
- <EntityTypeShape EntityType="RemoteModel.IDS_PACK_FORMULAS" Width="1.5" PointX="8" PointY="53.125" />
- <EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="10.25" PointY="6.875" />
- <EntityTypeShape EntityType="RemoteModel.JOB_RUNS" Width="1.5" PointX="9.75" PointY="27.875" />
- <EntityTypeShape EntityType="RemoteModel.JOB" Width="1.5" PointX="7.5" PointY="16.875" />
- <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="0.75" PointY="29.75" />
- <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES" Width="1.5" PointX="8" PointY="9.125" />
- <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES_RMLS" Width="1.5" PointX="10.25" PointY="16.25" />
- <EntityTypeShape EntityType="RemoteModel.MACHINE_STUDIO_VERSIONS" Width="1.5" PointX="7.5" PointY="70.375" />
- <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="3" PointY="30.25" />
- <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="5.25" PointY="18.25" />
- <EntityTypeShape EntityType="RemoteModel.MACHINES_CONFIGURATIONS" Width="1.5" PointX="7.5" PointY="13.375" />
- <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="12.5" PointY="16" />
- <EntityTypeShape EntityType="RemoteModel.MEDIA_COLORS" Width="1.5" PointX="0.75" PointY="32.625" />
- <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="0.75" PointY="16" />
- <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="0.75" PointY="13" />
- <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="0.75" PointY="26.75" />
- <EntityTypeShape EntityType="RemoteModel.MID_TANK_TYPES" Width="1.5" PointX="8" PointY="62.75" />
- <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="3" PointY="46" />
- <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="8.25" PointY="78.25" />
- <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES" Width="1.5" PointX="7.5" PointY="45.625" />
- <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES_GROUPS" Width="1.5" PointX="5.25" PointY="47.25" />
- <EntityTypeShape EntityType="RemoteModel.RML" Width="1.5" PointX="3" PointY="17.625" />
- <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="8.25" PointY="74.25" />
- <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="10.5" PointY="74.25" />
- <EntityTypeShape EntityType="RemoteModel.SEGMENT" Width="1.5" PointX="9.75" PointY="24.375" />
- <EntityTypeShape EntityType="RemoteModel.SPOOL_TYPES" Width="1.5" PointX="3" PointY="12.875" />
- <EntityTypeShape EntityType="RemoteModel.sysdiagram" Width="1.5" PointX="2.75" PointY="7.75" />
- <EntityTypeShape EntityType="RemoteModel.TANGO_VERSIONS" Width="1.5" PointX="7.5" PointY="27.125" />
- <EntityTypeShape EntityType="RemoteModel.TECH_CONTROLLERS" Width="1.5" PointX="4.75" PointY="7.75" />
- <EntityTypeShape EntityType="RemoteModel.TECH_DISPENSERS" Width="1.5" PointX="12.75" PointY="5.75" />
- <EntityTypeShape EntityType="RemoteModel.TECH_HEATERS" Width="1.5" PointX="12.75" PointY="8.75" />
- <EntityTypeShape EntityType="RemoteModel.TECH_IOS" Width="1.5" PointX="14.75" PointY="0.75" />
- <EntityTypeShape EntityType="RemoteModel.TECH_MONITORS" Width="1.5" PointX="12.75" PointY="11.75" />
- <EntityTypeShape EntityType="RemoteModel.TECH_VALVES" Width="1.5" PointX="14.75" PointY="5.75" />
- <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="5.25" PointY="12.25" />
- <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="10.5" PointY="12.25" />
- <EntityTypeShape EntityType="RemoteModel.WINDING_METHODS" Width="1.5" PointX="5.25" PointY="26.5" />
+ <EntityTypeShape EntityType="RemoteModel.CUSTOMER" Width="1.5" PointX="6" PointY="17.625" />
+ <EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="9" PointY="42.375" />
+ <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="10.375" />
+ <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES" Width="1.5" PointX="8.25" PointY="3.875" />
+ <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_ACTIONS" Width="1.5" PointX="10.5" PointY="0.75" />
+ <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_CATEGORIES" Width="1.5" PointX="6" PointY="40.625" />
+ <EntityTypeShape EntityType="RemoteModel.EVENT_TYPES_GROUPS" Width="1.5" PointX="6" PointY="4.5" />
+ <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="0.75" PointY="32.25" />
+ <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHS" Width="1.5" PointX="0.75" PointY="35.25" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_BLOWER_TYPES" Width="1.5" PointX="6.75" PointY="61.625" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_BLOWERS" Width="1.5" PointX="9" PointY="13.25" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_BREAK_SENSOR_TYPES" Width="1.5" PointX="12.75" PointY="30.625" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_BREAK_SENSORS" Width="1.5" PointX="15" PointY="8.375" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCER_TYPES" Width="1.5" PointX="0.75" PointY="57" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_DANCERS" Width="1.5" PointX="3" PointY="1.625" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTOR_TYPES" Width="1.5" PointX="9.75" PointY="35.625" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_MOTORS" Width="1.5" PointX="12" PointY="4.25" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROL_TYPES" Width="1.5" PointX="11.75" PointY="39.625" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_PID_CONTROLS" Width="1.5" PointX="14" PointY="12.75" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_SPEED_SENSOR_TYPES" Width="1.5" PointX="0.75" PointY="60.625" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_SPEED_SENSORS" Width="1.5" PointX="3" PointY="14.375" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="14.125" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDER_TYPES" Width="1.5" PointX="6.75" PointY="57.625" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_WINDERS" Width="1.5" PointX="9" PointY="9.5" />
+ <EntityTypeShape EntityType="RemoteModel.HTML_PAGES" Width="1.5" PointX="6" PointY="8.25" />
+ <EntityTypeShape EntityType="RemoteModel.IDS_PACK_FORMULAS" Width="1.5" PointX="9" PointY="57.875" />
+ <EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="11.25" PointY="12.25" />
+ <EntityTypeShape EntityType="RemoteModel.JOB_RUNS" Width="1.5" PointX="10.5" PointY="27.25" />
+ <EntityTypeShape EntityType="RemoteModel.JOB" Width="1.5" PointX="8.25" PointY="22.25" />
+ <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="0.75" PointY="21.5" />
+ <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES" Width="1.5" PointX="3" PointY="18.5" />
+ <EntityTypeShape EntityType="RemoteModel.LIQUID_TYPES_RMLS" Width="1.5" PointX="5.25" PointY="21.5" />
+ <EntityTypeShape EntityType="RemoteModel.MACHINE_STUDIO_VERSIONS" Width="1.5" PointX="8.25" PointY="65.75" />
+ <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="3" PointY="32.25" />
+ <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="5.25" PointY="29.875" />
+ <EntityTypeShape EntityType="RemoteModel.MACHINES_CONFIGURATIONS" Width="1.5" PointX="7.5" PointY="32.75" />
+ <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="10.5" PointY="31.25" />
+ <EntityTypeShape EntityType="RemoteModel.MEDIA_COLORS" Width="1.5" PointX="0.75" PointY="25.625" />
+ <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="0.75" PointY="38.125" />
+ <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="0.75" PointY="18.5" />
+ <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="0.75" PointY="29.375" />
+ <EntityTypeShape EntityType="RemoteModel.MID_TANK_TYPES" Width="1.5" PointX="9" PointY="45.75" />
+ <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="3" PointY="50.25" />
+ <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="14" PointY="38.75" />
+ <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES" Width="1.5" PointX="7.5" PointY="50.5" />
+ <EntityTypeShape EntityType="RemoteModel.PROCESS_PARAMETERS_TABLES_GROUPS" Width="1.5" PointX="5.25" PointY="52.125" />
+ <EntityTypeShape EntityType="RemoteModel.RML" Width="1.5" PointX="3" PointY="23" />
+ <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="14" PointY="34.625" />
+ <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="16.25" PointY="34.75" />
+ <EntityTypeShape EntityType="RemoteModel.SEGMENT" Width="1.5" PointX="10.5" PointY="23.75" />
+ <EntityTypeShape EntityType="RemoteModel.SPOOL_TYPES" Width="1.5" PointX="3" PointY="39.375" />
+ <EntityTypeShape EntityType="RemoteModel.sysdiagram" Width="1.5" PointX="14.75" PointY="20.125" />
+ <EntityTypeShape EntityType="RemoteModel.TANGO_VERSIONS" Width="1.5" PointX="8.25" PointY="17.875" />
+ <EntityTypeShape EntityType="RemoteModel.TECH_CONTROLLERS" Width="1.5" PointX="16.75" PointY="16.125" />
+ <EntityTypeShape EntityType="RemoteModel.TECH_DISPENSERS" Width="1.5" PointX="16.75" PointY="20.125" />
+ <EntityTypeShape EntityType="RemoteModel.TECH_HEATERS" Width="1.5" PointX="17.75" PointY="6.125" />
+ <EntityTypeShape EntityType="RemoteModel.TECH_IOS" Width="1.5" PointX="14.75" PointY="23.125" />
+ <EntityTypeShape EntityType="RemoteModel.TECH_MONITORS" Width="1.5" PointX="16.75" PointY="23.125" />
+ <EntityTypeShape EntityType="RemoteModel.TECH_VALVES" Width="1.5" PointX="18.75" PointY="9.125" />
+ <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="6" PointY="11.75" />
+ <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="16.25" PointY="12.625" />
+ <EntityTypeShape EntityType="RemoteModel.WINDING_METHODS" Width="1.5" PointX="6" PointY="36.875" />
<AssociationConnector Association="RemoteModel.FK_EVENTS_ACTIONS_ACTIONS" />
<AssociationConnector Association="RemoteModel.FK_ORGANIZATIONS_ADDRESSES" />
<AssociationConnector Association="RemoteModel.FK_USERS_ADDRESSES" />
diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs
index 99d841dd6..19e0b2910 100644
--- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs
+++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs
@@ -285,14 +285,17 @@ namespace Tango.Integration.ExternalBridge
{
if (IsInSession)
{
- ClearQueues();
- await SendRequest<ExternalBridgeLogoutRequest, ExternalBridgeLogoutResponse>(new ExternalBridgeLogoutRequest());
+ await SendRequest<ExternalBridgeLogoutRequest, ExternalBridgeLogoutResponse>(new ExternalBridgeLogoutRequest(), TimeSpan.FromSeconds(0.5));
}
}
catch (Exception ex)
{
LogManager.Log(ex, "Error sending an external bridge log out request.");
}
+ finally
+ {
+ ClearQueues();
+ }
OnClientDisconnected();
}
@@ -305,22 +308,25 @@ namespace Tango.Integration.ExternalBridge
{
IsInSession = false;
- try
+ if (MachineOperator.State == TransportComponentState.Connected)
{
- await MachineOperator.SendRequest(new StopDiagnosticsRequest());
- }
- catch (Exception ex)
- {
- LogManager.Log(ex);
- }
+ try
+ {
+ await MachineOperator.SendRequest(new StopDiagnosticsRequest());
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex);
+ }
- try
- {
- await MachineOperator.SendRequest(new StopDebugLogRequest());
- }
- catch (Exception ex)
- {
- LogManager.Log(ex);
+ try
+ {
+ await MachineOperator.SendRequest(new StopDebugLogRequest());
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex);
+ }
}
ClientDisconnected?.Invoke(this, new EventArgs());
@@ -343,10 +349,32 @@ namespace Tango.Integration.ExternalBridge
protected virtual async void OnAnyRequest(MessageContainer container)
{
+ if (MachineOperator.Status == MachineStatuses.Disconnected)
+ {
+ try
+ {
+ await SendErrorResponse(new Exception("Machine operator is disconnected."), container.Token);
+ }
+ catch { }
+
+ return;
+ }
+
if (!container.Continuous)
{
- var response = await MachineOperator.SendRequest(container);
- await SendResponse(response);
+ try
+ {
+ var response = await MachineOperator.SendRequest(container);
+ await SendResponse(response);
+ }
+ //catch (TimeoutException)
+ //{
+
+ //}
+ catch (Exception ex)
+ {
+ await SendErrorResponse(ex, container.Token);
+ }
}
else
{
@@ -374,13 +402,16 @@ namespace Tango.Integration.ExternalBridge
{
try
{
- ClearQueues();
await SendResponse<ExternalBridgeLogoutResponse>(new ExternalBridgeLogoutResponse(), container.Token);
}
catch (Exception ex)
{
LogManager.Log(ex);
}
+ finally
+ {
+ ClearQueues();
+ }
OnClientDisconnected();
}
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml
index da999385f..a64d9e89e 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml
@@ -37,7 +37,7 @@
<DockPanel>
<Border DockPanel.Dock="Bottom" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=(Validation.HasError),Converter={StaticResource BooleanToVisibilityConverter}}">
<Canvas>
- <TextBlock FontSize="12" Foreground="{StaticResource TangoValidationErrorBrush}" Margin="0 5 0 0" TextWrapping="Wrap" Text="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=(Validation.Errors).CurrentItem.ErrorContent}"></TextBlock>
+ <TextBlock FontSize="12" Width="{Binding RelativeSource={RelativeSource AncestorType=Border},Path=ActualWidth}" Foreground="{StaticResource TangoValidationErrorBrush}" Margin="0 5 0 0" TextWrapping="Wrap" Text="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=(Validation.Errors).CurrentItem.ErrorContent}"></TextBlock>
</Canvas>
</Border>
<DockPanel>
diff --git a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs
index 35f60f76c..05a892b37 100644
--- a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs
+++ b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs
@@ -722,6 +722,11 @@ namespace Tango.Transport
/// <exception cref="InvalidOperationException">Matching request token was not found!</exception>
public Task SendResponse<Response>(TangoMessage<Response> response, String token, bool? completed = null, ErrorCode? errorCode = null, String errorMessage = null) where Response : IMessage<Response>
{
+ if (_pushThread == null || _pushThread.ThreadState == ThreadState.Aborted)
+ {
+ throw new InvalidOperationException("Transporter push thread is not in a running state.");
+ }
+
response.Container.Token = token;
if (completed.HasValue)
@@ -848,60 +853,57 @@ namespace Tango.Transport
{
while (State == TransportComponentState.Connected)
{
- while (Adapter != null)
+ TransportMessageBase message = _sendingQueue.BlockDequeue();
+
+ if (_sendingQueue.Count > MaxMessageBufferCount)
{
- TransportMessageBase message = _sendingQueue.BlockDequeue();
+ var toDropItems = _sendingQueue.Where(x => x.Message.GetType() == message.GetType()).ToList();
- if (_sendingQueue.Count > MaxMessageBufferCount)
+ foreach (var item in toDropItems)
{
- var toDropItems = _sendingQueue.Where(x => x.Message.GetType() == message.GetType()).ToList();
-
- foreach (var item in toDropItems)
- {
- TransportMessageBase toDrop = _sendingQueue.BlockDequeue();
- }
-
- if (toDropItems.Count > 0)
- {
- LogManager.Log(String.Format("Dropped {0} outgoing messages of type {1}.", toDropItems.Count, message.Message.GetType()), LogCategory.Warning);
- }
+ TransportMessageBase toDrop = _sendingQueue.BlockDequeue();
}
- try
+ if (toDropItems.Count > 0)
{
- if (Adapter.State == TransportComponentState.Connected)
- {
- if (message.Token.Length != MESSAGE_TOKEN_LENGTH)
- {
- message.SetException(LogManager.Log(new InvalidOperationException("Invalid message token length: " + message.Token)));
- continue;
- }
+ LogManager.Log(String.Format("Dropped {0} outgoing messages of type {1}.", toDropItems.Count, message.Message.GetType()), LogCategory.Warning);
+ }
+ }
- Adapter.Write(message.Serialize());
- LogManager.Log("Message sent on adapter: " + Adapter.Address + "...", LogCategory.Debug, message.Message);
- }
- else
+ try
+ {
+ if (Adapter.State == TransportComponentState.Connected)
+ {
+ if (message.Token.Length != MESSAGE_TOKEN_LENGTH)
{
- LogManager.Log("Could not send message " + message.Message.GetType().Name + ". Adapter is disconnected.", LogCategory.Warning);
+ message.SetException(LogManager.Log(new InvalidOperationException("Invalid message token length: " + message.Token)));
+ continue;
}
- if (message.Direction == TransportMessageDirection.Request)
- {
- lock (_pendingRequests)
- {
- _pendingRequests.Add(message);
- }
- }
- else
+ Adapter.Write(message.Serialize());
+ LogManager.Log("Message sent on adapter: " + Adapter.Address + "...", LogCategory.Debug, message.Message);
+ }
+ else
+ {
+ LogManager.Log("Could not send message " + message.Message.GetType().Name + ". Adapter is disconnected.", LogCategory.Warning);
+ }
+
+ if (message.Direction == TransportMessageDirection.Request)
+ {
+ lock (_pendingRequests)
{
- message.SetResult(true, true);
+ _pendingRequests.Add(message);
}
}
- catch (Exception ex)
+ else
{
- message.SetException(ex);
+ message.SetResult(true, true);
}
}
+ catch (Exception ex)
+ {
+ message.SetException(ex);
+ }
}
}
catch (ThreadAbortException)
@@ -927,134 +929,131 @@ namespace Tango.Transport
{
while (State == TransportComponentState.Connected)
{
- while (Adapter != null)
- {
- byte[] data = _arrivedResponses.BlockDequeue();
+ byte[] data = _arrivedResponses.BlockDequeue();
- LogManager.Log("Message received on adapter: " + Adapter.Address, LogCategory.Debug);
+ LogManager.Log("Message received on adapter: " + Adapter.Address, LogCategory.Debug);
- LogManager.Log("Parsing message container...", LogCategory.Debug);
- MessageContainer container = Encoder.DecodeContainer(data);
+ LogManager.Log("Parsing message container...", LogCategory.Debug);
+ MessageContainer container = Encoder.DecodeContainer(data);
- LogManager.Log("Message was identified as " + container.Type + ".", LogCategory.Debug);
+ LogManager.Log("Message was identified as " + container.Type + ".", LogCategory.Debug);
- if (container.Token.Length != MESSAGE_TOKEN_LENGTH)
- {
- LogManager.Log("Invalid message token length received: " + container.Token, LogCategory.Error);
- continue;
- }
+ if (container.Token.Length != MESSAGE_TOKEN_LENGTH)
+ {
+ LogManager.Log("Invalid message token length received: " + container.Token, LogCategory.Error);
+ continue;
+ }
- LogManager.Log("Searching for pending request token: " + container.Token, LogCategory.Debug);
+ LogManager.Log("Searching for pending request token: " + container.Token, LogCategory.Debug);
- TransportMessageBase request = null;
- lock (_pendingRequests)
- {
- request = _pendingRequests.ToList().SingleOrDefault(x => x.Token == container.Token);
- }
+ TransportMessageBase request = null;
+ lock (_pendingRequests)
+ {
+ request = _pendingRequests.ToList().SingleOrDefault(x => x.Token == container.Token);
+ }
- if (request != null)
- {
- LogManager.Log("Found pending request: " + (request.Message.GetType().IsGenericType ? request.Message.GetType().GetGenericArguments()[0].Name : request.Message.GetType().Name), LogCategory.Debug);
+ if (request != null)
+ {
+ LogManager.Log("Found pending request: " + (request.Message.GetType().IsGenericType ? request.Message.GetType().GetGenericArguments()[0].Name : request.Message.GetType().Name), LogCategory.Debug);
- if (!request.IsContinuous)
- {
- LogManager.Log("Pending request was identified as 'single response'. Removing pending request.", LogCategory.Debug);
+ if (!request.IsContinuous)
+ {
+ LogManager.Log("Pending request was identified as 'single response'. Removing pending request.", LogCategory.Debug);
- _pendingRequests.Remove(request);
+ _pendingRequests.Remove(request);
- try
+ try
+ {
+ if (container.Error == ErrorCode.None)
{
- if (container.Error == ErrorCode.None)
- {
- var message = Encoder.Decode(data);
- LogManager.Log("Parsing inner response message and setting pending request task result...", LogCategory.Debug, message);
- request.SetResult(message, true);
- LogManager.Log("Message enquirer released...", LogCategory.Debug);
- }
- else
- {
- request.SetException(LogManager.Log(new ResponseErrorException(container), LogCategory.Warning));
- }
+ var message = Encoder.Decode(data);
+ LogManager.Log("Parsing inner response message and setting pending request task result...", LogCategory.Debug, message);
+ request.SetResult(message, true);
+ LogManager.Log("Message enquirer released...", LogCategory.Debug);
}
- catch (Exception ex)
+ else
{
- request.SetException(LogManager.Log(ex, "Error parsing response message."));
+ request.SetException(LogManager.Log(new ResponseErrorException(container), LogCategory.Warning));
}
}
- else
+ catch (Exception ex)
{
- LogManager.Log("Pending request was identified as 'continuous response'. keeping pending request.", LogCategory.Debug);
+ request.SetException(LogManager.Log(ex, "Error parsing response message."));
+ }
+ }
+ else
+ {
+ LogManager.Log("Pending request was identified as 'continuous response'. keeping pending request.", LogCategory.Debug);
- try
+ try
+ {
+ if (container.Error == ErrorCode.None)
{
- if (container.Error == ErrorCode.None)
- {
- var message = Encoder.Decode(data);
+ var message = Encoder.Decode(data);
- LogManager.Log("Parsing inner response message and invoking continuous response callback...", LogCategory.Debug, message);
+ LogManager.Log("Parsing inner response message and invoking continuous response callback...", LogCategory.Debug, message);
- if (container.Completed)
- {
- LogManager.Log("Continuous sequence completed.", LogCategory.Debug);
- }
- request.SetResult(message, container.Completed);
- }
- else if (container.Error == ErrorCode.ContinuousResponseAborted)
+ if (container.Completed)
{
- String m = "Continuous response " + container.Type + " has been aborted: " + container.Error.ToString();
- LogManager.Log(m, LogCategory.Info);
- request.SetException(new ContinuousResponseAbortedException(m));
- }
- else
- {
- LogManager.Log("Continuous response has returned with error: " + container.Error.ToString(), LogCategory.Warning);
- request.SetException(new ResponseErrorException(container));
+ LogManager.Log("Continuous sequence completed.", LogCategory.Debug);
}
+ request.SetResult(message, container.Completed);
}
- catch (Exception ex)
+ else if (container.Error == ErrorCode.ContinuousResponseAborted)
{
- LogManager.Log(ex, "Error parsing response message.");
+ String m = "Continuous response " + container.Type + " has been aborted: " + container.Error.ToString();
+ LogManager.Log(m, LogCategory.Info);
+ request.SetException(new ContinuousResponseAbortedException(m));
+ }
+ else
+ {
+ LogManager.Log("Continuous response has returned with error: " + container.Error.ToString(), LogCategory.Warning);
+ request.SetException(new ResponseErrorException(container));
}
}
- }
- else
- {
- if (container.Type.ToString().EndsWith("Response"))
+ catch (Exception ex)
{
- LogManager.Log(String.Format("A response message with no awaiting request was identified. {0}, Token: {1}. Message ignored.", container.Type, container.Token), LogCategory.Warning);
- continue;
+ LogManager.Log(ex, "Error parsing response message.");
}
+ }
+ }
+ else
+ {
+ if (container.Type.ToString().EndsWith("Response"))
+ {
+ LogManager.Log(String.Format("A response message with no awaiting request was identified. {0}, Token: {1}. Message ignored.", container.Type, container.Token), LogCategory.Warning);
+ continue;
+ }
- LogManager.Log("Message was identified as a new request message: " + container.Type.ToString(), LogCategory.Debug);
+ LogManager.Log("Message was identified as a new request message: " + container.Type.ToString(), LogCategory.Debug);
- try
+ try
+ {
+ LogManager.Log("Saving request token: " + container.Token, LogCategory.Debug);
+ _pendingResponses.Add(container.Token, new PendingResponse(container.Continuous));
+
+ if (container.Type == MessageType.KeepAliveRequest)
+ {
+ LogManager.Log("Submitting keep alive response...", LogCategory.Debug);
+ SendResponse<KeepAliveResponse>(new KeepAliveResponse(), container.Token);
+ }
+ else
{
- LogManager.Log("Saving request token: " + container.Token, LogCategory.Debug);
- _pendingResponses.Add(container.Token, new PendingResponse(container.Continuous));
+ LogManager.Log("Invoking RequestReceived event...", LogCategory.Debug, container);
- if (container.Type == MessageType.KeepAliveRequest)
+ try
{
- LogManager.Log("Submitting keep alive response...", LogCategory.Debug);
- SendResponse<KeepAliveResponse>(new KeepAliveResponse(), container.Token);
+ Task.Factory.StartNew(() => OnRequestReceived(container));
}
- else
+ catch
{
- LogManager.Log("Invoking RequestReceived event...", LogCategory.Debug, container);
-
- try
- {
- Task.Factory.StartNew(() => OnRequestReceived(container));
- }
- catch
- {
- //Ignore any exceptions that may raise on the client side..
- }
+ //Ignore any exceptions that may raise on the client side..
}
}
- catch (Exception ex)
- {
- LogManager.Log(ex);
- }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex);
}
}
}