diff options
| author | Roy <roy.mail.net@gmail.com> | 2017-12-07 23:09:17 +0200 |
|---|---|---|
| committer | Roy <roy.mail.net@gmail.com> | 2017-12-07 23:09:17 +0200 |
| commit | b457125866deb830b379cf3873e5cda3975b077a (patch) | |
| tree | b5a17fcd198a160abbff688ce0f84057fd51c000 /Software | |
| parent | ab99fb80dfc78c31b1e6cf8d5e4a8458978f4ddc (diff) | |
| download | Tango-b457125866deb830b379cf3873e5cda3975b077a.tar.gz Tango-b457125866deb830b379cf3873e5cda3975b077a.zip | |
Fixed issue with protobuf nuget.
Some improvements on Stubs GUI.
Diffstat (limited to 'Software')
13 files changed, 84 insertions, 16 deletions
diff --git a/Software/Visual_Studio/Tango.Serialization/Tango.Serialization.csproj b/Software/Visual_Studio/Tango.Serialization/Tango.Serialization.csproj index 910444743..3aafcadc7 100644 --- a/Software/Visual_Studio/Tango.Serialization/Tango.Serialization.csproj +++ b/Software/Visual_Studio/Tango.Serialization/Tango.Serialization.csproj @@ -30,8 +30,8 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> - <Reference Include="Google.Protobuf, Version=3.5.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> - <HintPath>..\packages\Google.Protobuf.3.5.0\lib\net45\Google.Protobuf.dll</HintPath> + <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> + <HintPath>..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath> </Reference> <Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> diff --git a/Software/Visual_Studio/Tango.Serialization/packages.config b/Software/Visual_Studio/Tango.Serialization/packages.config index dbb73d29f..4f345323a 100644 --- a/Software/Visual_Studio/Tango.Serialization/packages.config +++ b/Software/Visual_Studio/Tango.Serialization/packages.config @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="Google.Protobuf" version="3.5.0" targetFramework="net46" /> + <package id="Google.Protobuf" version="3.4.1" targetFramework="net46" /> <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net46" /> </packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs index 8c7efd67e..24a0f6119 100644 --- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs @@ -71,6 +71,25 @@ namespace Tango.MachineEM.UI.ViewModels set { _selectedStub = value; RaisePropertyChanged(nameof(SelectedStub)); } } + private List<String> _ports; + /// <summary> + /// Gets or sets the ports. + /// </summary> + public List<String> Ports + { + get { return _ports; } + set { _ports = value; RaisePropertyChanged(nameof(Ports)); } + } + + private String _selectedPort; + /// <summary> + /// Gets or sets the selected port. + /// </summary> + public String SelectedPort + { + get { return _selectedPort; } + set { _selectedPort = value; RaisePropertyChanged(nameof(SelectedPort)); } + } #endregion @@ -143,6 +162,22 @@ namespace Tango.MachineEM.UI.ViewModels ClearCommand = new RelayCommand(() => Log = String.Empty); AvailableStubs = StubBase.GetAvailableStubs(StubDirection.ToMobile); + + Ports = new List<string>() + { + "TCP", + "COM1", + "COM2", + "COM3", + "COM4", + "COM5", + "COM6", + "COM7", + "COM8", + "COM9", + }; + + SelectedPort = Ports.First(); } #endregion @@ -168,9 +203,16 @@ namespace Tango.MachineEM.UI.ViewModels /// </summary> private async void Start() { - TcpServer = new TcpServer(9999); - TcpServer.ClientConnected += TcpServer_ClientConnected; - TcpServer.Start(); + if (SelectedPort == Ports.First()) + { + TcpServer = new TcpServer(9999); + TcpServer.ClientConnected += TcpServer_ClientConnected; + TcpServer.Start(); + } + else + { + Emulator.Transporter.Adapters.Add(new UsbTransportAdapter(SelectedPort)); + } await Emulator.Start(); InvalidateRelayCommands(); } @@ -180,7 +222,10 @@ namespace Tango.MachineEM.UI.ViewModels /// </summary> private async void Stop() { - TcpServer.Stop(); + if (TcpServer != null) + { + TcpServer.Stop(); + } await Emulator.Stop(); InvalidateRelayCommands(); } diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml index c2068acf7..b48001a02 100644 --- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml @@ -10,6 +10,10 @@ xmlns:local="clr-namespace:Tango.MachineEM.UI.Views" mc:Ignorable="d" d:DesignHeight="720" d:DesignWidth="1000" Foreground="Gainsboro"> + + <UserControl.Resources> + <converters:BooleanInverseConverter x:Key="BooleanInverseConverter"></converters:BooleanInverseConverter> + </UserControl.Resources> <Grid> <Grid> <Grid.RowDefinitions> @@ -133,6 +137,7 @@ </Grid> <Grid x:Name="gridActions" Grid.Row="1" Background="#151515" Margin="5"> <StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Margin="5"> + <ComboBox IsEnabled="{Binding Emulator.IsStarted,Converter={StaticResource BooleanInverseConverter}}" MinWidth="140" Margin="5" BorderThickness="0" ItemsSource="{Binding Ports}" SelectedItem="{Binding SelectedPort}"></ComboBox> <Button Margin="5" MinWidth="100" Style="{StaticResource AccentedSquareButtonStyle}" mahapps:ButtonHelper.PreserveTextCase="True" BorderThickness="0" Command="{Binding StopCommand}"> <StackPanel Orientation="Horizontal"> <fa:ImageAwesome Icon="Stop" Width="16"></fa:ImageAwesome> diff --git a/Software/Visual_Studio/Utilities/Tango.Stubs.CLI/Program.cs b/Software/Visual_Studio/Utilities/Tango.Stubs.CLI/Program.cs index fb046277d..9895e6993 100644 --- a/Software/Visual_Studio/Utilities/Tango.Stubs.CLI/Program.cs +++ b/Software/Visual_Studio/Utilities/Tango.Stubs.CLI/Program.cs @@ -106,7 +106,7 @@ namespace Tango.Stubs.CLI if (DateTime.Now > startTime.AddSeconds(2)) { - PrintError("Response has filed to arrive after 2 seconds."); + PrintError("Response has failed to arrive after 2 seconds."); } } diff --git a/Software/Visual_Studio/Utilities/Tango.Stubs.CLI/Tango.Stubs.CLI.csproj b/Software/Visual_Studio/Utilities/Tango.Stubs.CLI/Tango.Stubs.CLI.csproj index 5b859e405..e99dc0e70 100644 --- a/Software/Visual_Studio/Utilities/Tango.Stubs.CLI/Tango.Stubs.CLI.csproj +++ b/Software/Visual_Studio/Utilities/Tango.Stubs.CLI/Tango.Stubs.CLI.csproj @@ -32,8 +32,8 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> - <Reference Include="Google.Protobuf, Version=3.5.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> - <HintPath>..\..\packages\Google.Protobuf.3.5.0\lib\net45\Google.Protobuf.dll</HintPath> + <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath> </Reference> <Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <HintPath>..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> diff --git a/Software/Visual_Studio/Utilities/Tango.Stubs.CLI/packages.config b/Software/Visual_Studio/Utilities/Tango.Stubs.CLI/packages.config index dbb73d29f..4f345323a 100644 --- a/Software/Visual_Studio/Utilities/Tango.Stubs.CLI/packages.config +++ b/Software/Visual_Studio/Utilities/Tango.Stubs.CLI/packages.config @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="Google.Protobuf" version="3.5.0" targetFramework="net46" /> + <package id="Google.Protobuf" version="3.4.1" targetFramework="net46" /> <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net46" /> </packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/Utilities/Tango.Stubs.UI/StubManager.cs b/Software/Visual_Studio/Utilities/Tango.Stubs.UI/StubManager.cs index 4f5761cb0..8bfb0db7c 100644 --- a/Software/Visual_Studio/Utilities/Tango.Stubs.UI/StubManager.cs +++ b/Software/Visual_Studio/Utilities/Tango.Stubs.UI/StubManager.cs @@ -94,7 +94,9 @@ namespace Tango.Stubs.UI if (DateTime.Now > startTime.AddSeconds(2)) { + done = true; OnFailed(new TimeoutException("Response has filed to arrive after 2 seconds.")); + return; } } diff --git a/Software/Visual_Studio/Utilities/Tango.Stubs.UI/Tango.Stubs.UI.csproj b/Software/Visual_Studio/Utilities/Tango.Stubs.UI/Tango.Stubs.UI.csproj index c89c273c2..3f34928b3 100644 --- a/Software/Visual_Studio/Utilities/Tango.Stubs.UI/Tango.Stubs.UI.csproj +++ b/Software/Visual_Studio/Utilities/Tango.Stubs.UI/Tango.Stubs.UI.csproj @@ -37,8 +37,8 @@ <Reference Include="FontAwesome.WPF, Version=4.7.0.37774, Culture=neutral, PublicKeyToken=0758b07a11a4f466, processorArchitecture=MSIL"> <HintPath>..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll</HintPath> </Reference> - <Reference Include="Google.Protobuf, Version=3.5.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> - <HintPath>..\..\packages\Google.Protobuf.3.5.0\lib\net45\Google.Protobuf.dll</HintPath> + <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> + <HintPath>..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath> </Reference> <Reference Include="MahApps.Metro, Version=1.5.0.23, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL"> <HintPath>..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll</HintPath> diff --git a/Software/Visual_Studio/Utilities/Tango.Stubs.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/Utilities/Tango.Stubs.UI/ViewModels/MainViewVM.cs index f73a43b54..5939dfd95 100644 --- a/Software/Visual_Studio/Utilities/Tango.Stubs.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/Utilities/Tango.Stubs.UI/ViewModels/MainViewVM.cs @@ -50,7 +50,7 @@ namespace Tango.Stubs.UI.ViewModels HighlightTypes = new ObservableCollection<Type>(); HighlightTypes.Add(typeof(StubManager)); - _adapter = new UsbTransportAdapter("COM9"); + _adapter = new UsbTransportAdapter("COM2"); _adapter.Connect().Wait(); } @@ -87,6 +87,7 @@ namespace Tango.Stubs.UI.ViewModels private void Manager_Completed(object sender, string response) { + Log += "Response Received:" + Environment.NewLine; Log += response + Environment.NewLine; } diff --git a/Software/Visual_Studio/Utilities/Tango.Stubs.UI/Views/MainView.xaml b/Software/Visual_Studio/Utilities/Tango.Stubs.UI/Views/MainView.xaml index 5062e4951..9f1c15947 100644 --- a/Software/Visual_Studio/Utilities/Tango.Stubs.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/Utilities/Tango.Stubs.UI/Views/MainView.xaml @@ -105,7 +105,7 @@ </Grid.RowDefinitions> <TextBlock Foreground="Gainsboro" VerticalAlignment="Center" Margin="5 0 0 0">Response</TextBlock> <Grid Background="Black" Grid.Row="1"> - <TextBox Background="Transparent" Text="{Binding Log}" BorderThickness="0" AcceptsReturn="True" VerticalScrollBarVisibility="Visible" Padding="5" IsReadOnly="True" TextWrapping="Wrap" FontSize="11" Foreground="Gainsboro"></TextBox> + <TextBox x:Name="txtLog" TextChanged="TextBox_TextChanged" Background="Transparent" Text="{Binding Log}" BorderThickness="0" AcceptsReturn="True" VerticalScrollBarVisibility="Visible" Padding="5" IsReadOnly="True" TextWrapping="Wrap" FontSize="11" Foreground="Gainsboro"></TextBox> </Grid> </Grid> </Grid> diff --git a/Software/Visual_Studio/Utilities/Tango.Stubs.UI/Views/MainView.xaml.cs b/Software/Visual_Studio/Utilities/Tango.Stubs.UI/Views/MainView.xaml.cs index 5320d4eff..c0919217f 100644 --- a/Software/Visual_Studio/Utilities/Tango.Stubs.UI/Views/MainView.xaml.cs +++ b/Software/Visual_Studio/Utilities/Tango.Stubs.UI/Views/MainView.xaml.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; @@ -24,5 +25,19 @@ namespace Tango.Stubs.UI.Views { InitializeComponent(); } + + private void TextBox_TextChanged(object sender, TextChangedEventArgs e) + { + Task.Factory.StartNew(() => + { + Thread.Sleep(100); + + this.Dispatcher.Invoke(() => + { + txtLog.SelectionStart = txtLog.Text.Length; + txtLog.ScrollToEnd(); + }); + }); + } } } diff --git a/Software/Visual_Studio/Utilities/Tango.Stubs.UI/packages.config b/Software/Visual_Studio/Utilities/Tango.Stubs.UI/packages.config index cde827aa1..02f1a5c8d 100644 --- a/Software/Visual_Studio/Utilities/Tango.Stubs.UI/packages.config +++ b/Software/Visual_Studio/Utilities/Tango.Stubs.UI/packages.config @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <packages> <package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net46" /> - <package id="Google.Protobuf" version="3.5.0" targetFramework="net46" /> + <package id="Google.Protobuf" version="3.4.1" targetFramework="net46" /> <package id="MahApps.Metro" version="1.5.0" targetFramework="net46" /> <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net46" /> </packages>
\ No newline at end of file |
