diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MachineConnectionIcon.xaml.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MachineConnectionIcon.xaml.cs | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MachineConnectionIcon.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MachineConnectionIcon.xaml.cs new file mode 100644 index 000000000..6f754e306 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MachineConnectionIcon.xaml.cs @@ -0,0 +1,94 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.BL.Enumerations; +using Tango.Emulations.ExternalBridge; +using Tango.Integration.ExternalBridge; + +namespace Tango.MachineStudio.Common.Controls +{ + public enum ExternalBridgeClientType + { + Usb, + Tcp, + Wifi, + SignalR, + Emulator, + } + + /// <summary> + /// Interaction logic for MachineConnectionIcon.xaml + /// </summary> + public partial class MachineConnectionIcon : UserControl + { + public MachineTypes MachineType + { + get { return (MachineTypes)GetValue(MachineTypeProperty); } + set { SetValue(MachineTypeProperty, value); } + } + public static readonly DependencyProperty MachineTypeProperty = + DependencyProperty.Register("MachineType", typeof(MachineTypes), typeof(MachineConnectionIcon), new PropertyMetadata(MachineTypes.TS1800)); + + public IExternalBridgeClient ExternalBridgeClient + { + get { return (IExternalBridgeClient)GetValue(ExternalBridgeClientProperty); } + set { SetValue(ExternalBridgeClientProperty, value); } + } + public static readonly DependencyProperty ExternalBridgeClientProperty = + DependencyProperty.Register("ExternalBridgeClient", typeof(IExternalBridgeClient), typeof(MachineConnectionIcon), new PropertyMetadata((d,e) => (d as MachineConnectionIcon).OnExternalBridgeClientChanged())); + + public ExternalBridgeClientType ExternalBridgeClientType + { + get { return (ExternalBridgeClientType)GetValue(ExternalBridgeClientTypeProperty); } + set { SetValue(ExternalBridgeClientTypeProperty, value); } + } + public static readonly DependencyProperty ExternalBridgeClientTypeProperty = + DependencyProperty.Register("ExternalBridgeClientType", typeof(ExternalBridgeClientType), typeof(MachineConnectionIcon), new PropertyMetadata(ExternalBridgeClientType.Usb)); + + private void OnExternalBridgeClientChanged() + { + if (ExternalBridgeClient != null) + { + if (ExternalBridgeClient.GetType() == typeof(ExternalBridgeUsbClient)) + { + ExternalBridgeClientType = ExternalBridgeClientType.Usb; + } + else if (ExternalBridgeClient.GetType() == typeof(ExternalBridgeTcpFirmwareClient)) + { + ExternalBridgeClientType = ExternalBridgeClientType.Tcp; + MachineType = MachineTypes.Eureka; + } + else if (ExternalBridgeClient.GetType() == typeof(ExternalBridgeTcpClient)) + { + ExternalBridgeClientType = ExternalBridgeClientType.Wifi; + MachineType = ExternalBridgeClient.MachineType; + } + else if (ExternalBridgeClient.GetType() == typeof(ExternalBridgeSignalRClient)) + { + ExternalBridgeClientType = ExternalBridgeClientType.SignalR; + MachineType = ExternalBridgeClient.MachineType; + } + else if (ExternalBridgeClient.GetType() == typeof(EmulatorExternalBridge)) + { + ExternalBridgeClientType = ExternalBridgeClientType.Emulator; + } + } + } + + public MachineConnectionIcon() + { + InitializeComponent(); + } + } +} |
