diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls')
2 files changed, 92 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MachineConnectionIcon.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MachineConnectionIcon.xaml new file mode 100644 index 000000000..e43a30e6d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MachineConnectionIcon.xaml @@ -0,0 +1,13 @@ +<UserControl x:Class="Tango.MachineStudio.Common.Controls.MachineConnectionIcon" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:local="clr-namespace:Tango.MachineStudio.Common.Controls" + mc:Ignorable="d" + d:DesignHeight="45" d:DesignWidth="45"> + <Grid> + <Image Margin="0 5 5 0" Source="../Images/machine_new_small.png" RenderOptions.BitmapScalingMode="Fant"></Image> + + </Grid> +</UserControl> 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..72b9af55f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MachineConnectionIcon.xaml.cs @@ -0,0 +1,79 @@ +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 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(ExternalBridgeTcpClient)) + { + ExternalBridgeClientType = ExternalBridgeClientType.Tcp; + } + else if (ExternalBridgeClient.GetType() == typeof(ExternalBridgeSignalRClient)) + { + ExternalBridgeClientType = ExternalBridgeClientType.SignalR; + } + else if (ExternalBridgeClient.GetType() == typeof(EmulatorExternalBridge)) + { + ExternalBridgeClientType = ExternalBridgeClientType.Emulator; + } + } + } + + public MachineConnectionIcon() + { + InitializeComponent(); + } + } +} |
