diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-30 12:35:00 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-30 12:35:00 +0300 |
| commit | 7171e1a3b7579420f2060798c649088d70565401 (patch) | |
| tree | 5033e86d5ad91234194a1e0b2306a690d133cd11 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI | |
| parent | c7c4975fd0010fc666c467105a39b1cd93cb818d (diff) | |
| download | Tango-7171e1a3b7579420f2060798c649088d70565401.tar.gz Tango-7171e1a3b7579420f2060798c649088d70565401.zip | |
Implemented In-Memory Transport Adapter.
Implemented Embedded In-Memory Emulator.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
10 files changed, 124 insertions, 17 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/external-bridge-emulator.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/external-bridge-emulator.png Binary files differnew file mode 100644 index 000000000..cb159d4a6 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/external-bridge-emulator.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index 224cd3199..1865bfb2f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("3.3.39.18238")] +[assembly: AssemblyVersion("3.3.40.18238")] [assembly: ComVisible(false)]
\ No newline at end of file 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 17bf57f56..29bb459ee 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -19,6 +19,8 @@ using Tango.Integration.ExternalBridge; using Tango.MachineStudio.Common.EventLogging; using Tango.BL.Enumerations; using Tango.Core.DI; +using Tango.BL.Entities; +using Tango.BL; namespace Tango.MachineStudio.UI.StudioApplication { @@ -55,22 +57,23 @@ namespace Tango.MachineStudio.UI.StudioApplication public bool IsShuttingDown { get; private set; } /// <summary> - /// The connected machine + /// Occurs when the connected machine property has changed. /// </summary> - private IExternalBridgeClient _connectedMachine; + public event EventHandler<IExternalBridgeClient> ConnectedMachineChanged; /// <summary> - /// Occurs when the connected machine property has changed. + /// Gets or sets the machine. /// </summary> - public event EventHandler<IExternalBridgeClient> ConnectedMachineChanged; + public Machine Machine { get; private set; } + private IExternalBridgeClient _connectedMachine; /// <summary> /// Gets or sets the currently connected machine if any. /// </summary> public IExternalBridgeClient ConnectedMachine { get { return _connectedMachine; } - set + private set { _connectedMachine = value; RaisePropertyChangedAuto(); @@ -270,9 +273,31 @@ namespace Tango.MachineStudio.UI.StudioApplication } } + /// <summary> + /// Raises the application ready event. + /// </summary> public void NotifyApplicationReady() { TangoIOC.Default.GetAllInstancesByBase<IStudioViewModel>().ToList().ForEach(x => x.OnApplicationReady()); } + + /// <summary> + /// Sets the connected machine. + /// </summary> + /// <param name="connectedMachine">The connected machine.</param> + public void SetConnectedMachine(IExternalBridgeClient connectedMachine) + { + if (connectedMachine != null) + { + Machine = ObservablesStaticCollections.Instance.Machines.SingleOrDefault(x => x.SerialNumber == connectedMachine.SerialNumber); + ConnectedMachine = connectedMachine; + ConnectedMachine.SetMachine(Machine); + } + else + { + Machine = null; + ConnectedMachine = null; + } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs index 6225e1480..8f67a21c2 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs @@ -196,7 +196,7 @@ namespace Tango.MachineStudio.UI.TFS if (app.ConnectedMachine != null) { - Machine machine = app.ConnectedMachine.Machine; + Machine machine = app.Machine; sysModel.Machine = machine; sysModel.EmbeddedVersion = app.ConnectedMachine.DeviceInformation.Version; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj index ed3d0e5fc..3cab71602 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -369,6 +369,10 @@ <Project>{38197109-8610-4d3f-92b9-16d48df94d7c}</Project> <Name>Tango.DAL.Remote</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.Emulations\Tango.Emulations.csproj"> + <Project>{63561e19-ff5a-414b-a5ef-e30711543e1d}</Project> + <Name>Tango.Emulations</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.Integration\Tango.Integration.csproj"> <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project> <Name>Tango.Integration</Name> @@ -481,6 +485,7 @@ <Resource Include="Images\settings.png" /> </ItemGroup> <ItemGroup> + <Resource Include="Images\external-bridge-emulator.png" /> <EmbeddedResource Include="..\..\Versioning\ChangeLog.txt"> <Link>ChangeLog.txt</Link> </EmbeddedResource> @@ -571,7 +576,7 @@ copy /Y "$(SolutionDir)Referenced Assemblies\Microsoft.WITDataStore32.dll" "$(Ta </Target> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_BuildVersioningStyle="None.None.Increment.DeltaBaseYearDayOfYear" BuildVersion_UpdateFileVersion="True" BuildVersion_DetectChanges="True" BuildVersion_UseGlobalSettings="False" /> + <UserProperties BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="True" BuildVersion_UpdateFileVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.DeltaBaseYearDayOfYear" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs index 60447f37a..51b7168ed 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs @@ -4,8 +4,11 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.Core.Commands; +using Tango.Emulations.ExternalBridge; using Tango.Integration.ExternalBridge; +using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Notifications; +using Tango.Settings; using Tango.SharedUI; namespace Tango.MachineStudio.UI.ViewModels @@ -16,6 +19,8 @@ namespace Tango.MachineStudio.UI.ViewModels /// <seealso cref="Tango.MachineStudio.Common.Notifications.DialogViewVM" /> public class MachineConnectionViewVM : DialogViewVM { + private EmulatorExternalBridge _emulator; + private ExternalBridgeScanner _scanner; /// <summary> /// Gets or sets the machine scanner. @@ -63,6 +68,9 @@ namespace Tango.MachineStudio.UI.ViewModels } } + /// <summary> + /// Invokes the <see cref="E:Tango.SharedUI.DialogViewVM.Canceled" /> event. + /// </summary> protected override void Cancel() { Scanner.Stop(); @@ -76,6 +84,17 @@ namespace Tango.MachineStudio.UI.ViewModels { base.OnShow(); Scanner.AvailableMachines.Clear(); + + if (SettingsManager.Default.GetOrCreate<MachineStudioSettings>().UseExternalBridgeEmulator) + { + if (_emulator != null) + { + _emulator.Disconnect(); + } + _emulator = new EmulatorExternalBridge(); + } + + Scanner.AvailableMachines.Add(_emulator); Scanner.Start(); } } 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 ee4435832..31b2181ea 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -388,7 +388,7 @@ namespace Tango.MachineStudio.UI.ViewModels InvalidateRelayCommands(); String serial = ApplicationManager.ConnectedMachine.SerialNumber; await ApplicationManager.ConnectedMachine.Disconnect(); - ApplicationManager.ConnectedMachine = null; + ApplicationManager.SetConnectedMachine(null); _eventLogger.Log("Disconnected from machine " + serial); PostMessage(new MachineConnectionChangedMessage() { Machine = null }); @@ -459,13 +459,13 @@ namespace Tango.MachineStudio.UI.ViewModels Intent = PMR.Integration.ExternalBridgeLoginIntent.Override, }); - ApplicationManager.ConnectedMachine = x.SelectedMachine; + ApplicationManager.SetConnectedMachine(x.SelectedMachine); (x.SelectedMachine as IExternalBridgeSecureClient).SessionClosed += (_, __) => { InvokeUI(() => { _notificationProvider.ShowError("The remote machine has closed the current session. Machine disconnected."); - ApplicationManager.ConnectedMachine = null; + ApplicationManager.SetConnectedMachine(null); }); }; PostMessage(new MachineConnectionChangedMessage() { Machine = x.SelectedMachine }); @@ -506,7 +506,7 @@ namespace Tango.MachineStudio.UI.ViewModels await x.SelectedMachine.Connect(); x.SelectedMachine.SerialNumber = vm.SelectedMachine.SerialNumber; - ApplicationManager.ConnectedMachine = x.SelectedMachine; + ApplicationManager.SetConnectedMachine(x.SelectedMachine); PostMessage(new MachineConnectionChangedMessage() { Machine = x.SelectedMachine }); _eventLogger.Log(String.Format("Successfully connected to machine {0} via USB", x.SelectedMachine.SerialNumber)); @@ -556,8 +556,8 @@ namespace Tango.MachineStudio.UI.ViewModels { using (ObservablesContext db = ObservablesContext.CreateDefault()) { - var config = db.Adapter.GetConfiguration(s => s.Guid == ApplicationManager.ConnectedMachine.Machine.ConfigurationGuid); - var hw = db.Adapter.GetHardwareVersionByMachine(ApplicationManager.ConnectedMachine.Machine.Guid); + var config = db.Adapter.GetConfiguration(s => s.Guid == ApplicationManager.Machine.ConfigurationGuid); + var hw = db.Adapter.GetHardwareVersionByMachine(ApplicationManager.Machine.Guid); await ApplicationManager.ConnectedMachine.UploadHardwareConfiguration(hw, config); } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml index 319fa3596..26790c67d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml @@ -6,6 +6,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:integration="clr-namespace:Tango.Integration.ExternalBridge;assembly=Tango.Integration" xmlns:integ="clr-namespace:Tango.Integration.Operation;assembly=Tango.Integration" + xmlns:emulations="clr-namespace:Tango.Emulations.ExternalBridge;assembly=Tango.Emulations" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" @@ -38,6 +39,10 @@ <DataTemplate DataType="{x:Type integration:ExternalBridgeUsbClient}"> <Image Source="/Images/external-bridge-usb.png" Width="48" Height="48" RenderOptions.BitmapScalingMode="Fant"></Image> </DataTemplate> + + <DataTemplate DataType="{x:Type emulations:EmulatorExternalBridge}"> + <Image Source="/Images/external-bridge-emulator.png" Width="48" Height="48" RenderOptions.BitmapScalingMode="Fant"></Image> + </DataTemplate> </ContentControl.Resources> </ContentControl> @@ -131,6 +136,39 @@ <ToggleButton IsChecked="{Binding EnableEventsNotification}" HorizontalAlignment="Left"></ToggleButton> </controls:TableGrid> </DataTemplate> + + <DataTemplate DataType="{x:Type emulations:EmulatorExternalBridge}"> + <controls:TableGrid RowHeight="22"> + <TextBlock FontWeight="SemiBold" Text="Address:" /> + <TextBlock Text="{Binding Adapter.Address}" /> + <TextBlock FontWeight="SemiBold" Text="Serial Number:" /> + <TextBlock Text="{Binding SerialNumber}" /> + <TextBlock FontWeight="SemiBold" Text="Name:" /> + <TextBlock Text="{Binding Machine.Name}" /> + <TextBlock FontWeight="SemiBold" Text="Organization:" /> + <TextBlock Text="{Binding Machine.Organization.Name}" /> + <TextBlock FontWeight="SemiBold" Text="Total Bytes Sent:" /> + <TextBlock Text="{Binding Adapter.TotalBytesSent,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}" /> + <TextBlock FontWeight="SemiBold" Text="Total Bytes Received:" /> + <TextBlock Text="{Binding Adapter.TotalBytesReceived,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}" /> + <TextBlock FontWeight="SemiBold" Text="Transfer Rate:" /> + <TextBlock> + <Run Text="{Binding Adapter.TransferRate,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}"></Run> + <Run Text="/ sec"></Run> + </TextBlock> + <TextBlock FontWeight="SemiBold" Text="Diagnostics Frame Rate:" /> + <TextBlock> + <Run Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.DiagnosticsFrameProvider.FrameRate,Mode=OneWay,IsAsync=True}"></Run> + <Run Text="/ sec"></Run> + </TextBlock> + <TextBlock FontWeight="SemiBold" Text="Enable Diagnostics:" /> + <ToggleButton IsChecked="{Binding EnableDiagnostics}" HorizontalAlignment="Left"></ToggleButton> + <TextBlock FontWeight="SemiBold" Text="Enable Embedded Debug Logs:" /> + <ToggleButton IsChecked="{Binding EnableEmbeddedDebugging}" HorizontalAlignment="Left"></ToggleButton> + <TextBlock FontWeight="SemiBold" Text="Enable Events:" /> + <ToggleButton IsChecked="{Binding EnableEventsNotification}" HorizontalAlignment="Left"></ToggleButton> + </controls:TableGrid> + </DataTemplate> </ContentControl.Resources> </ContentControl> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml index 5f8cca8fe..180a2a8e0 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml @@ -7,6 +7,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:integration="clr-namespace:Tango.Integration.ExternalBridge;assembly=Tango.Integration" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:emulations="clr-namespace:Tango.Emulations.ExternalBridge;assembly=Tango.Emulations" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" Width="600" Height="400" Background="White" DataContext="{Binding MachineConnectionViewVM, Source={StaticResource Locator}}"> @@ -95,6 +96,25 @@ </StackPanel> </DockPanel> </DataTemplate> + <DataTemplate DataType="{x:Type emulations:EmulatorExternalBridge}"> + <DockPanel> + <StackPanel Orientation="Vertical" VerticalAlignment="Center" DockPanel.Dock="Right" ToolTip="Allow incoming diagnostics data"> + <ToggleButton IsChecked="{Binding EnableDiagnostics}" VerticalAlignment="Center"></ToggleButton> + <TextBlock VerticalAlignment="Center" FontSize="10">Diagnostics</TextBlock> + </StackPanel> + <StackPanel Orientation="Horizontal"> + <Image Source="/Images/external-bridge-emulator.png" Width="38" Height="38" RenderOptions.BitmapScalingMode="Fant"></Image> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="11"> + <Run Text="External Bridge Emulator"></Run> + </TextBlock> + <TextBlock FontSize="11"> + <Run FontWeight="Bold">Address:</Run> <Run Text="{Binding Adapter.Address,Mode=OneWay}"></Run> + </TextBlock> + </StackPanel> + </StackPanel> + </DockPanel> + </DataTemplate> </ListBox.Resources> </ListBox> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml index 9a494f862..67bdf81ed 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -15,7 +15,7 @@ xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" xmlns:commonConverters="clr-namespace:Tango.MachineStudio.Common.Converters;assembly=Tango.MachineStudio.Common" mc:Ignorable="d" - d:DesignHeight="720" d:DesignWidth="1270" Background="Transparent" DataContext="{Binding MainViewVM, Source={StaticResource Locator}}"> + d:DesignHeight="720" d:DesignWidth="1270" Background="Transparent" DataContext="{Binding MainViewVM, Source={StaticResource Locator}}" x:Name="control"> <UserControl.Resources> <converters:StringEllipsisConverter x:Key="StringEllipsisConverter" /> @@ -161,7 +161,7 @@ </StackPanel> </Button> <Separator/> - <Button IsEnabled="{Binding IsModuleLoaded}" Command="{Binding OpenModuleInWindowCommand}" CommandParameter="{Binding CurrentModule}"> + <Button IsEnabled="{Binding IsModuleLoaded}" Command="{Binding OpenModuleInWindowCommand,Mode=TwoWay}" CommandParameter="{Binding CurrentModule}"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon Kind="ArrowTopRight" Width="24" Height="24" /> <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Open Module In New Window</TextBlock> @@ -440,7 +440,7 @@ <StackPanel Grid.Row="2" Margin="8" HorizontalAlignment="Right" Orientation="Horizontal"> <materialDesign:PopupBox Padding="2,0,2,0" Style="{StaticResource MaterialDesignToolPopupBox}"> <StackPanel> - <Button Command="{Binding RelativeSource={RelativeSource AncestorType=local:MainView},Path=DataContext.OpenModuleInWindowCommand}" CommandParameter="{Binding}"> + <Button Command="{Binding Source={x:Reference control},Path=DataContext.OpenModuleInWindowCommand}" CommandParameter="{Binding}"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon Kind="ArrowTopRight" Width="24" Height="24" /> <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Start in new window</TextBlock> |
