diff options
| author | Avi Levkovich <avi@twine-s.com> | 2019-05-22 10:04:30 +0300 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2019-05-22 10:04:30 +0300 |
| commit | 00286559dbcb233f43709f776e4e0dc383ddc577 (patch) | |
| tree | 00811a3cd2056cebbafb52425916f06b619bbaf9 /Software/Visual_Studio | |
| parent | ce9b5061ed59521e5a7109ba7b652070bc981c94 (diff) | |
| parent | 0818e1de49a495cc057e9291f626f998ae97c095 (diff) | |
| download | Tango-00286559dbcb233f43709f776e4e0dc383ddc577.tar.gz Tango-00286559dbcb233f43709f776e4e0dc383ddc577.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio')
35 files changed, 532 insertions, 94 deletions
diff --git a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt Binary files differindex 6d87e9201..a603ff06b 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt +++ b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt diff --git a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip index a0e982786..2b29263f5 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip +++ b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip @@ -18,10 +18,10 @@ <ROW Property="ARPNOREPAIR" Value="1" MultiBuildValue="DefaultBuild:1"/> <ROW Property="ARPSYSTEMCOMPONENT" Value="1"/> <ROW Property="Manufacturer" Value="Twine"/> - <ROW Property="ProductCode" Value="1033:{AB12F52E-CB10-4C82-9873-D42B88AD67D9} " Type="16"/> + <ROW Property="ProductCode" Value="1033:{62479073-8D6E-4F24-91DA-F55F44FEE521} " Type="16"/> <ROW Property="ProductLanguage" Value="1033"/> <ROW Property="ProductName" Value="Tango"/> - <ROW Property="ProductVersion" Value="1.0.29.0" Type="32"/> + <ROW Property="ProductVersion" Value="1.0.30.0" Type="32"/> <ROW Property="SecureCustomProperties" Value="OLDPRODUCTS;AI_NEWERPRODUCTFOUND;AI_SETUPEXEPATH;SETUPEXEDIR"/> <ROW Property="UpgradeCode" Value="{F8EAB8B4-FD57-45B7-8307-D52DF760273D}"/> <ROW Property="WindowsType9X" MultiBuildValue="DefaultBuild:Windows 9x/ME" ValueLocId="-"/> @@ -423,7 +423,7 @@ <ROW Action="AI_DetectSoftware" Sequence="101"/> </COMPONENT> <COMPONENT cid="caphyon.advinst.msicomp.BuildComponent"> - <ROW BuildKey="DefaultBuild" BuildName="DefaultBuild" BuildOrder="1" BuildType="0" PackageFolder="..\Build\Installers\PPC" PackageFileName="PPC Installer v1.0.3" Languages="en" InstallationType="4" CabsLocation="1" PackageType="1" FilesInsideExe="true" ExtractionFolder="[AppDataFolder][|Manufacturer]\[|ProductName] [|ProductVersion]\install" ExtUI="true" UseLargeSchema="true" ExeName="PPC Installer_v1.0.29"/> + <ROW BuildKey="DefaultBuild" BuildName="DefaultBuild" BuildOrder="1" BuildType="0" PackageFolder="..\Build\Installers\PPC" PackageFileName="PPC Installer v1.0.3" Languages="en" InstallationType="4" CabsLocation="1" PackageType="1" FilesInsideExe="true" ExtractionFolder="[AppDataFolder][|Manufacturer]\[|ProductName] [|ProductVersion]\install" ExtUI="true" UseLargeSchema="true" ExeName="PPC Installer_v1.0.30"/> </COMPONENT> <COMPONENT cid="caphyon.advinst.msicomp.DictionaryComponent"> <ROW Path="<AI_DICTS>ui.ail"/> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/AvailableWiFiConnectionsControl.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/AvailableWiFiConnectionsControl.xaml index dac37ba10..a8675f843 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/AvailableWiFiConnectionsControl.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/AvailableWiFiConnectionsControl.xaml @@ -64,8 +64,8 @@ <Grid Margin="20" Visibility="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected,Converter={StaticResource BooleanToVisibilityConverter}}"> <Grid Height="80"> <touch:TouchCheckBox VerticalAlignment="Top" Margin="60 0 0 0" IsChecked="{Binding AutoConnect}" Visibility="{Binding IsConnected,Converter={StaticResource BooleanToVisibilityInverseConverter}}">Connect automatically</touch:TouchCheckBox> - <touch:TouchButton EnableDropShadow="False" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.ConnectToWiFiCommand}" CommandParameter="{Binding}" Width="150" CornerRadius="17" Height="40" HorizontalAlignment="Right" VerticalAlignment="Bottom" Visibility="{Binding IsConnected,Converter={StaticResource BooleanToVisibilityInverseConverter}}">Connect</touch:TouchButton> - <touch:TouchButton EnableDropShadow="False" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.DisconnectFromWiFiCommand}" CommandParameter="{Binding}" Width="150" CornerRadius="17" Height="40" HorizontalAlignment="Right" VerticalAlignment="Bottom" Visibility="{Binding IsConnected,Converter={StaticResource BooleanToVisibilityConverter}}">Disconnect</touch:TouchButton> + <touch:TouchButton Style="{StaticResource TangoHollowButton}" EnableDropShadow="False" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.ConnectToWiFiCommand}" CommandParameter="{Binding}" Width="150" CornerRadius="20" Height="40" HorizontalAlignment="Right" VerticalAlignment="Bottom" Visibility="{Binding IsConnected,Converter={StaticResource BooleanToVisibilityInverseConverter}}">Connect</touch:TouchButton> + <touch:TouchButton Style="{StaticResource TangoHollowButton}" EnableDropShadow="False" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.DisconnectFromWiFiCommand}" CommandParameter="{Binding}" Width="150" CornerRadius="20" Height="45" HorizontalAlignment="Right" VerticalAlignment="Bottom" Visibility="{Binding IsConnected,Converter={StaticResource BooleanToVisibilityConverter}}">Disconnect</touch:TouchButton> </Grid> <Grid Visibility="{Binding Connecting,Converter={StaticResource BooleanToVisibilityConverter}}" Background="{StaticResource TangoMidBackgroundBrush}"> 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..67b73d4f6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/IConnectivityProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connectivity/IConnectivityProvider.cs @@ -71,7 +71,7 @@ namespace Tango.PPC.Common.Connectivity /// </summary> /// <param name="network">The network.</param> /// <returns></returns> - Task<bool> Connect(WiFiNetwork network); + Task<bool> Connect(WiFiNetwork network, String password = null); /// <summary> /// Disconnects the specified network. diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index ed3f7f796..e98a03404 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -33,11 +33,16 @@ namespace Tango.PPC.Common public int MachineScanningTimeoutSeconds { get; set; } /// <summary> - /// Gets or sets the name of the name of a WiFi network to automatically connect to when the application starts. + /// Gets or sets the name of the WiFi network to automatically connect to when the application starts. /// </summary> public String AutoConnectWiFiName { get; set; } /// <summary> + /// Gets or sets the password of the WiFi network to automatically connect to when the application starts. + /// </summary> + public String AutoConnectWiFiPassword { get; set; } + + /// <summary> /// Gets or sets the embedded COM port if not specified will use auto scanning. /// </summary> public String EmbeddedComPort { get; set; } 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 e7aff7357..dabfc5893 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs @@ -27,6 +27,7 @@ namespace Tango.PPC.UI.Connectivity private Wifi _wifi; private INotificationProvider _notification; private IMachineProvider _machineProvider; + private Rfc2898Cryptographer _cryptographer; /// <summary> /// Occurs when the connectivity provider state has changed (e.g network connected/disconnected). @@ -83,6 +84,8 @@ namespace Tango.PPC.UI.Connectivity /// </summary> public DefaultConnectivityProvider(IPPCApplicationManager applicationManager, INotificationProvider notificationProvider, IMachineProvider machineProvider) { + _cryptographer = new Rfc2898Cryptographer(); + _notification = notificationProvider; _machineProvider = machineProvider; @@ -135,7 +138,8 @@ namespace Tango.PPC.UI.Connectivity if (auto_connect_network != null && !auto_connect_network.IsConnected) { - await Connect(auto_connect_network); + auto_connect_network.AutoConnect = true; + await Connect(auto_connect_network, _cryptographer.Decrypt(settings.AutoConnectWiFiPassword)); } }); } @@ -211,36 +215,45 @@ namespace Tango.PPC.UI.Connectivity /// </summary> /// <param name="network">The network.</param> /// <returns></returns> - public async Task<bool> Connect(WiFiNetwork network) + public async Task<bool> Connect(WiFiNetwork network, String password = null) { var auth = network.CreateAuthenticationRequest(); bool result = false; - if ((auth.IsPasswordRequired || auth.IsUserNameRequired) && !network.HasProfile) + if (password == null) { - var vm = await _notification.ShowDialog<WiFiAuthenticationViewVM>(new WiFiAuthenticationViewVM(auth, network)); - - if (vm.DialogResult) + if ((auth.IsPasswordRequired || auth.IsUserNameRequired) && !network.HasProfile) { - result = await network.Connect(auth, true); + var vm = await _notification.ShowDialog<WiFiAuthenticationViewVM>(new WiFiAuthenticationViewVM(auth, network)); - if (!result) + if (vm.DialogResult) { - await _notification.ShowError("Could not connect to the specified network. Please check your password."); - await network.Forget(); - } + result = await network.Connect(auth, true); - await RefreshAvailableWiFiNetworks(); + if (!result) + { + await _notification.ShowError("Could not connect to the specified network. Please check your password."); + await network.Forget(); + } + + await RefreshAvailableWiFiNetworks(); + } + else + { + return false; + } } else { - return false; + result = await network.Connect(auth, false); + await RefreshAvailableWiFiNetworks(); } } else { - result = await network.Connect(auth, false); + auth.Password = password; + result = await network.Connect(auth, true); await RefreshAvailableWiFiNetworks(); } @@ -249,6 +262,7 @@ namespace Tango.PPC.UI.Connectivity OnConnectionStateChanged(true); var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); settings.AutoConnectWiFiName = network.AutoConnect ? network.Name : null; + settings.AutoConnectWiFiPassword = _cryptographer.Encrypt(auth.Password); settings.Save(); } @@ -266,6 +280,7 @@ namespace Tango.PPC.UI.Connectivity { var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); settings.AutoConnectWiFiName = null; + settings.AutoConnectWiFiPassword = null; settings.Save(); network.AutoConnect = false; network.Disconnect().Wait(); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/WiFiAuthenticationView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/WiFiAuthenticationView.xaml index 311c3ce99..d3f6f9e49 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/WiFiAuthenticationView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/WiFiAuthenticationView.xaml @@ -36,10 +36,10 @@ </Grid> <Grid Grid.Row="2"> - <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> - <touch:TouchButton Command="{Binding CloseCommand}" CornerRadius="25" Width="170" Height="50" Style="{StaticResource TangoHollowButton}">CANCEL</touch:TouchButton> - <touch:TouchButton CornerRadius="25" Width="170" Height="50" Margin="10 0 0 0" Command="{Binding OKCommand}">CONNECT</touch:TouchButton> - </StackPanel> + <Grid> + <touch:TouchButton HorizontalAlignment="Left" Command="{Binding CloseCommand}" CornerRadius="25" Width="170" Height="50" Style="{StaticResource TangoHollowButton}">CANCEL</touch:TouchButton> + <touch:TouchButton HorizontalAlignment="Right" CornerRadius="25" Width="170" Height="50" Margin="10 0 0 0" Command="{Binding OKCommand}" Style="{StaticResource TangoHollowButton}">CONNECT</touch:TouchButton> + </Grid> </Grid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index dc9e111f3..5e3394ad6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango PPC Application")] -[assembly: AssemblyVersion("1.0.29.0")] +[assembly: AssemblyVersion("1.0.30.0")] diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index efc5f8179..d72e75011 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />--> + <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> </requestedPrivileges> </security> </trustInfo> diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/Card.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/Card.cs new file mode 100644 index 000000000..e4abca436 --- /dev/null +++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/Card.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.TCC.BL.Entities +{ + [Table("CARDS")] + public class Card : TCCEntityBase + { + [Column("CODE")] + public String Code { get; set; } + + [Column("COLUMNS")] + public int Columns { get; set; } + + [Column("ROWS")] + public int Rows { get; set; } + + [Column("TARGET_INDEX")] + public int TargetIndex { get; set; } + + [Column("VERSION")] + public double Version { get; set; } + + [Column("BATCH")] + public double Batch { get; set; } + + [Column("HOME_PRINTED")] + public bool IsHomePrinted { get; set; } + } +} diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/Result.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/Result.cs index 8e36f7f1b..e68282c84 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/Result.cs +++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/Result.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; namespace Tango.TCC.BL.Entities { [Table("RESULTS")] - public class Result + public class Result : TCCEntityBase { [Column("DATE")] public DateTime Date { get; set; } @@ -18,6 +18,7 @@ namespace Tango.TCC.BL.Entities public String DeviceGuid { get; set; } [Column("CARD_GUID")] + [ForeignKey("Card")] public String CardGuid { get; set; } [Column("RAW_COLOR")] @@ -29,12 +30,14 @@ namespace Tango.TCC.BL.Entities [Column("PROCESS_TIME")] public int ProcessTime { get; set; } - [Column("RECTIFIED_IMAGE_ADDRESS")] - public String RectifiedImageAddress { get; set; } + [Column("SAMPLE_IMAGE_BLOB_NAME")] + public String SampleImageBlobName { get; set; } - [Column("SOURCE_IMAGE_ADDRESS")] - public String SourceImageAddress { get; set; } + [Column("SOURCE_IMAGE_BLOB_NAME")] + public String SourceImageBlobName { get; set; } public virtual Device Device { get; set; } + + public virtual Card Card { get; set; } } } diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCContext.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCContext.cs index 5770bf1d0..45719f0be 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCContext.cs +++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCContext.cs @@ -38,5 +38,21 @@ namespace Tango.TCC.BL.Entities { get; set; } + + /// <summary> + /// Gets or sets the results. + /// </summary> + public DbSet<Result> Results + { + get; set; + } + + /// <summary> + /// Gets or sets the results. + /// </summary> + public DbSet<Card> Cards + { + get; set; + } } } diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCEntityBase.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCEntityBase.cs index f003bf6f0..18d441e94 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCEntityBase.cs +++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Entities/TCCEntityBase.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; @@ -10,9 +11,11 @@ namespace Tango.TCC.BL.Entities public class TCCEntityBase { [Column("ID")] + [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)] public int ID { get; set; } [Column("GUID")] + [Key] public String Guid { get; set; } public TCCEntityBase() diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/ExtensionMethods/DetectionColorExtensions.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/ExtensionMethods/DetectionColorExtensions.cs new file mode 100644 index 000000000..0ad4ed53c --- /dev/null +++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/ExtensionMethods/DetectionColorExtensions.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; +using Tango.Core.Helpers; +using Tango.PMR.TCC; + +public static class DetectionColorExtensions +{ + /// <summary> + /// Gets an int 32 representation of this color. + /// </summary> + /// <param name="detectionColor">Color of the detection.</param> + /// <returns></returns> + public static int ToInt32(this DetectionColor detectionColor) + { + return ColorHelper.ColorToInteger(Color.FromRgb((byte)detectionColor.R, (byte)detectionColor.G, (byte)detectionColor.B)); + } +} + diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Tango.TCC.BL.csproj b/Software/Visual_Studio/TCC/Tango.TCC.BL/Tango.TCC.BL.csproj index 0fe3fcf5d..04b008be6 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.BL/Tango.TCC.BL.csproj +++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Tango.TCC.BL.csproj @@ -63,10 +63,12 @@ <Compile Include="CardDetector.cs" /> <Compile Include="ColorDetector.cs" /> <Compile Include="CardDetectionHistogramMethods.cs" /> + <Compile Include="Entities\Card.cs" /> <Compile Include="Entities\Device.cs" /> <Compile Include="Entities\Result.cs" /> <Compile Include="Entities\TCCContext.cs" /> <Compile Include="Entities\TCCEntityBase.cs" /> + <Compile Include="ExtensionMethods\DetectionColorExtensions.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Web\ColorDetectionRequest.cs" /> <Compile Include="Web\ColorDetectionResponse.cs" /> diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionResponse.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionResponse.cs index afc53b26c..f7ec6322c 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionResponse.cs +++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/ColorDetectionResponse.cs @@ -12,5 +12,6 @@ namespace Tango.TCC.BL.Web { public DetectionColor RawColor { get; set; } public DetectionColor ProcessedColor { get; set; } + public String SourceImageBlobAddress { get; set; } } } diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/Components/statistics/statistics.component.html b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/Components/statistics/statistics.component.html index 989a5965b..fb2b8c6d0 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/Components/statistics/statistics.component.html +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/Components/statistics/statistics.component.html @@ -27,7 +27,7 @@ </div> </div> <div fxFlex fxLayoutGap="20px" class=" cardinforow" *ngIf="selectedPoint"> - <app-details-card [selectedResult]= "selectedPoint" ></app-details-card> + <app-details-card [selectedResult]= "selectedPoint" [view]= "'statistics'"></app-details-card> </div> </div> </div>
\ No newline at end of file diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/cards/cards.component.html b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/cards/cards.component.html index f49e8b916..456877543 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/cards/cards.component.html +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/cards/cards.component.html @@ -5,7 +5,7 @@ (click)="AddCard()"> <mat-icon>add</mat-icon> </a> - <table mat-table [dataSource]="dataSource" class="mat-elevation-z8" matSort matSortActive="cardid" + <table mat-table [dataSource]="dataSource" class="mat-elevation-z8 cardtable" matSort matSortActive="cardid" matSortDirection="asc"> <ng-container matColumnDef="template"> <th mat-header-cell *matHeaderCellDef mat-sort-header> Template </th> @@ -196,7 +196,7 @@ <mat-list> <mat-list-item fxLayout="row" fxLayoutAlign=" center" fxLayoutWrap> <span fxFlex="80"> - BenchMarks + Benchmark </span> <button fxFlex="20" mat-button mat-raised-button style="min-width: unset;">Download</button> </mat-list-item> @@ -219,39 +219,35 @@ </mat-card> </div> - <div fxFlex="30"> + <div fxFlex="32"> <mat-card class="example-card"> <mat-card-header> - BenchMarks + Benchmarks </mat-card-header> <mat-card-content> - <mat-list> - <mat-list-item fxLayout="row" fxLayoutAlign=" center" fxLayoutWrap> - <span fxFlex> - RGB - </span> - <span fxFlex> - LAB - </span> - <span fxFlex> - Color - </span> - - </mat-list-item> - <mat-divider></mat-divider> - <mat-list-item fxLayout="row" fxLayoutAlign=" center" fxLayoutWrap> - <span fxFlex> - RGB - </span> - <span fxFlex> - LAB - </span> - <span fxFlex> - Color - </span> - - </mat-list-item> - </mat-list> + <div style=" overflow-x: auto;"> + <table mat-table [dataSource]="benchmarks" class="mat-elevation-z8" matSort > + <ng-container matColumnDef="benchmarkid"> + <th mat-header-cell *matHeaderCellDef mat-sort-header class="wrapcolumn"> ID </th> + <td mat-cell *matCellDef="let element" class="wrapcolumn"> {{element.ID}} </td> + </ng-container> + <ng-container matColumnDef="rgb"> + <th mat-header-cell *matHeaderCellDef mat-sort-header> RGB </th> + <td mat-cell *matCellDef="let element"> {{element.CardGuid}} </td> + </ng-container> + <ng-container matColumnDef="lab"> + <th mat-header-cell *matHeaderCellDef mat-sort-header> Lab </th> + <td mat-cell *matCellDef="let element"> {{element.Version}} </td> + </ng-container> + <ng-container matColumnDef="color"> + <th mat-header-cell *matHeaderCellDef mat-sort-header> Color </th> + <td mat-cell *matCellDef="let element"> {{element.Batch}} </td> + </ng-container> + <tr mat-header-row *matHeaderRowDef="displayedBenchmarkColumns"></tr> + <tr mat-row *matRowDef="let row; columns: displayedBenchmarkColumns;" + [ngClass]="{'highlight':(selectedBenchmark && selectedBenchmark.ID === row.ID)}" (click)="highlight(row)"></tr> + </table> + </div> </mat-card-content> </mat-card> </div> diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/cards/cards.component.scss b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/cards/cards.component.scss index fd344bf55..8e575644b 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/cards/cards.component.scss +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/cards/cards.component.scss @@ -1,12 +1,15 @@ mat-card { padding: 0px; } -table { + table{ width: 100%; overflow-x: auto; overflow-y: hidden; + } +.cardtable { min-width: 50rem; padding: 50px; + table-layout: fixed; } td{ font-size: 16px; @@ -102,4 +105,61 @@ button { .mat-card-image { margin: 0.5em !important; width: 3em; -}
\ No newline at end of file +} +.wrapcolumn td:nth-child(1){ + display: block; + width: 50px;; +} +.mat-column-benchmarkid { + word-wrap: break-word !important; + white-space: unset !important; + flex: 0 0 20% !important; + width: 20% !important; + overflow-wrap: break-word; + word-wrap: break-word; + word-break: break-word; + -ms-hyphens: auto; + -moz-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; +} +.mat-column-rgb { + word-wrap: break-word !important; + white-space: unset !important; + flex: 0 0 20% !important; + width: 25% !important; + overflow-wrap: break-word; + word-wrap: break-word; + word-break: break-word; + -ms-hyphens: auto; + -moz-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; +} +.mat-column-lab { + word-wrap: break-word !important; + white-space: unset !important; + flex: 0 0 20% !important; + width: 25% !important; + overflow-wrap: break-word; + word-wrap: break-word; + word-break: break-word; + -ms-hyphens: auto; + -moz-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; +} +.mat-column-color { + word-wrap: break-word !important; + white-space: unset !important; + flex: 0 0 20% !important; + width: 25% !important; + overflow-wrap: break-word; + word-wrap: break-word; + word-break: break-word; + -ms-hyphens: auto; + -moz-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; +} + diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/cards/cards.component.ts b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/cards/cards.component.ts index a624badac..4d2671804 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/cards/cards.component.ts +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/cards/cards.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, ViewChild, NgModule, AfterViewInit } from '@angular/core'; -import { Card } from './../../models'; +import { Card, Benchmark } from './../../models'; import { ResultService } from './../../services'; import { MatSort, MatTableDataSource, MatPaginator, MatDialogConfig } from '@angular/material'; import { KeyToValuesPipe } from './../../helpers/object-to-array.pipe'; @@ -17,7 +17,11 @@ import { MatDialog } from '@angular/material'; export class CardsComponent implements OnInit, AfterViewInit { public dataSource = new MatTableDataSource<Card>(); - displayedCardColumns: string[] = ['template','cardid', 'version', 'batch', 'columns', 'rows', 'targetIndex', 'update']; + displayedCardColumns: string[] = ['template', 'cardid', 'version', 'batch', 'columns', 'rows', 'targetIndex', 'update']; + + public benchmarks = new MatTableDataSource<Benchmark>(); + public selectedBenchmark: Benchmark; + displayedBenchmarkColumns: string[] = ['benchmarkid', 'rgb', 'lab', 'color']; @ViewChild(MatSort) sort: MatSort; @ViewChild(MatPaginator) paginator: MatPaginator; @@ -29,6 +33,7 @@ export class CardsComponent implements OnInit, AfterViewInit { ngOnInit() { this.selectedCard = new Card(); this.dataSource.data = this.resultService.getCards(); + this.benchmarks.data = this.resultService.getAlgorithm(); } ngAfterViewInit() { this.dataSource.sort = this.sort; @@ -86,9 +91,5 @@ export class CardsComponent implements OnInit, AfterViewInit { this.dataSource.data = this.resultService.getCards(); this.selectedCard = new Card(); } - public deleteBenchMark() - { - - } - + } diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/details-card/details-card.component.html b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/details-card/details-card.component.html index e5ead4797..297834909 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/details-card/details-card.component.html +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/details-card/details-card.component.html @@ -1,4 +1,4 @@ -<mat-accordion > +<mat-accordion *ngIf="view === 'statistics'"> <mat-expansion-panel [expanded]="true"> <mat-expansion-panel-header green-100-fg color="white"> <mat-panel-title color="primary"> @@ -10,9 +10,9 @@ </mat-expansion-panel-header> <div> - <div fxLayout="column"> - <div fxLayout="row" class="topOffset" fxLayoutGap="20px"> - <div fxFlex="20"> + <div fxLayout="column" fxLayoutAlign="space-evenly stretch"> + <div fxLayout="row wrap" class="topOffset" fxLayoutGap="20px" fxLayoutAlign="space-evenly stretch"> + <div fxFlex="20" > <mat-card class="example-card"> <mat-card-header> Image @@ -101,3 +101,136 @@ </div> </mat-expansion-panel> </mat-accordion> +<div fxFlex *ngIf="view === 'result'" > + <mat-card style =" margin-right: 5px !important;" > + <mat-card-header> + <mat-card-title color="primary"> + Details + </mat-card-title> + <mat-card-subtitle color="primary"> + Date: 2 May 2019 + </mat-card-subtitle> + </mat-card-header> + <mat-card-content> + <div> + <div fxLayout="column" > + <div fxFlex="100" class="topOffset" fxLayoutAlign="center" > + <div fxLayout="row" class="topOffset" fxLayoutGap="20px"> + <mat-card > + <mat-card-header> + Template + </mat-card-header> + <mat-card-content class="cardcontexttext"> + <img mat-card-image src="./assets/card_new_small.bmp" alt="Photo of a Shiba Inu"> + </mat-card-content> + </mat-card> + <mat-card > + <mat-card-header> + Template + </mat-card-header> + <mat-card-content class="cardcontexttext"> + <img mat-card-image src="./assets/card_new_small.bmp" alt="Photo of a Shiba Inu"> + </mat-card-content> + </mat-card> + + </div> + </div> + <div fxFlex="100" class="topOffset" > + <div > + <mat-card class="example-card"> + <mat-card-header> + Card + </mat-card-header> + <mat-card-content> + <div style=" overflow-x: auto;"> + <table mat-table [dataSource]="cardTable" class="mat-elevation-z8" > + <ng-container matColumnDef="cardname"> + <th mat-header-cell *matHeaderCellDef > </th> + <td mat-cell *matCellDef="let element" > {{element.name}} </td> + </ng-container> + <ng-container matColumnDef="value"> + <th mat-header-cell *matHeaderCellDef > </th> + <td mat-cell *matCellDef="let element"> {{element.value}} </td> + </ng-container> + + <tr mat-header-row *matHeaderRowDef="displayedCardColumns"></tr> + <tr mat-row *matRowDef="let row; columns: displayedCardColumns;" + ></tr> + </table> + <!-- <mat-list > + <mat-list-item *ngFor="let card of cards" fxLayout="row wrap" fxLayoutAlign="center"> + <span fxFlex="35" class="md-list-item-text">{{card.name}}</span> + <span fxFlex="35" class="md-list-item-text" > + {{card.value}} + </span> + </mat-list-item> + + </mat-list> --> + </div> + </mat-card-content> + </mat-card> + </div> + </div> + <div fxFlex="100" class="topOffset"> + <mat-card class="example-card"> + <mat-card-header> + Device + </mat-card-header> + <mat-card-content> + Device + </mat-card-content> + </mat-card> + </div> + <div fxFlex="100"> + <div fxLayout="row" class="topOffset" fxLayoutGap="20px"> + <div fxFlex="50"> + <mat-card> + <mat-card-header> + <mat-card-title>Raw Color</mat-card-title> + </mat-card-header> + <div class="cardcontexttext"> + <div class="circle" [ngStyle]="{'background-color': selectedResult.RawColor.rgbToHex()}"></div> + </div> + <mat-card-content class="topOffset"> + <div class="cardcontexttext"> + R:{{selectedResult.RawColor.r}} G:{{selectedResult.RawColor.g}} B:{{selectedResult.RawColor.b}} + </div> + </mat-card-content> + </mat-card> + </div> + <div fxFlex="50"> + <mat-card> + <mat-card-header> + <mat-card-title> + <div>Processed Color</div> + </mat-card-title> + </mat-card-header> + <div class="cardcontexttext"> + <div class="circle" [ngStyle]="{'background-color': selectedResult.ProcessedColor.rgbToHex()}"> + </div> + </div> + <mat-card-content class="topOffset"> + <div class="cardcontexttext"> R:{{selectedResult.ProcessedColor.r}} + G:{{selectedResult.ProcessedColor.g}} + B:{{selectedResult.ProcessedColor.b}} </div> + </mat-card-content> + </mat-card> + </div> + </div> + </div> + <div fxFlex="100" class="topOffset"> + <mat-card > + <mat-card-header> + <mat-card-title>DeltaE</mat-card-title> + </mat-card-header> + + <mat-card-content class="topOffset"> + <div class="cardcontexttext"> Number</div> + </mat-card-content> + </mat-card> + </div> + </div> + </div> + </mat-card-content> + </mat-card> +</div> diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/details-card/details-card.component.scss b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/details-card/details-card.component.scss index 4d3b0b81d..359c7cd57 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/details-card/details-card.component.scss +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/details-card/details-card.component.scss @@ -21,6 +21,11 @@ md-list-item { display: inline; text-align: center; } + mat-card{ + height: 100%; + padding: 5px; + } + ::ng-deep .mat-list .mat-list-item .mat-list-item-content, .mat-nav-list .mat-list-item .mat-list-item-content { width: 99vw; } @@ -52,11 +57,46 @@ md-list-item { } :host { display: block; - padding: 10px; } .mat-card-image { - margin: 0.5em !important; + margin: 0.1em !important; max-width: 10em; - }
\ No newline at end of file + } + table{ + width: 100%; + overflow-x: auto; + overflow-y: hidden; + } + td { + font-size: 16px; + font-weight: 500; + } + mat-card-header { + font-size: 16px; + font-weight: 500; + } + .wrapcolumn td:nth-child(1){ + display: block; + width: 50px;; + } + .mat-column-cardname { + word-wrap: break-word !important; + white-space: unset !important; + flex: 0 0 40% !important; + width: 40% !important; + overflow-wrap: break-word; + word-wrap: break-word; + word-break: break-word; + -ms-hyphens: auto; + -moz-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; + } + th.mat-header-cell { + border-bottom-style:hidden; +} +tr.mat-header-row { + height: 0px; +}
\ No newline at end of file diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/details-card/details-card.component.ts b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/details-card/details-card.component.ts index 7619350fc..db3017819 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/details-card/details-card.component.ts +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/details-card/details-card.component.ts @@ -1,5 +1,6 @@ import { Component, OnInit, Input } from '@angular/core'; import { DetectionResult, RGB, RGBColor } from './../../models'; +import { MatTableDataSource } from '@angular/material'; export interface Card { name: string; @@ -13,6 +14,9 @@ export interface Card { }) export class DetailsCardComponent implements OnInit { @Input() public selectedResult: DetectionResult; + @Input() public view: string; + public cardTable = new MatTableDataSource<Card>(); + displayedCardColumns: string[] = ['cardname', 'value']; constructor() { } /// testing Card Value @@ -32,6 +36,7 @@ export class DetailsCardComponent implements OnInit { ]; ngOnInit() { + this.cardTable.data = this.cards; console.log(this.selectedResult); } diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/results/results.component.html b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/results/results.component.html index db1f00a86..08417aeb7 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/results/results.component.html +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/results/results.component.html @@ -1,6 +1,6 @@ - <div class="cardspage"> - <div fxLayoutGap="20px" class="cardinforow"> + <div fxLayout="row wrap" fxLayoutGap="2em" fxLayoutAlign="start" fxLayoutGap.xs="0"> + <div fxFlex="60" style =" margin-top: auto;" > <mat-card> <div fxLayout fxLayoutAlign="center center"> <mat-form-field fxFlex="40%"> @@ -58,15 +58,15 @@ <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr> <tr mat-row *matRowDef="let row; columns: displayedColumns;" - [ngClass]="{'highlight': (selectedResult && selectedResult.CardGuid === row.CardGuid)}" + [ngClass]="{'highlight': (selectedResult && selectedResult === row)}" (click)="resultRowClick(row)"></tr> </table> - <mat-paginator [length]="100" [pageSize]="5" [pageSizeOptions]="[5, 10, 25, 100]"> + <mat-paginator [length]="100" [pageSize]="25" [pageSizeOptions]="[5, 10, 25, 100]"> </mat-paginator> </mat-card> </div> - <div fxFlex fxLayoutGap="20px" class="container carditem" *ngIf="selectedResult"> - <app-details-card [selectedResult]= "selectedResult" ></app-details-card> + <div fxFlex *ngIf="selectedResult" > + <app-details-card [selectedResult]= "selectedResult" [view]="'result'" ></app-details-card> </div> </div> diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/results/results.component.scss b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/results/results.component.scss index 2e507c8c1..ca6a49046 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/results/results.component.scss +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/components/results/results.component.scss @@ -120,10 +120,8 @@ td{ background-color:rgb(241, 245, 250); padding: 0px; display: flex; - flex-direction: column; -} -.cardspage > *:not(:last-child) { - margin-bottom: 32px; + flex-flow: row wrap; + } .cardinforow{ margin: 0 1em 1em 1em; @@ -142,5 +140,8 @@ td{ margin-right: 0px; margin-left: 0px; } +.highlight{ + background: rgb(233, 237, 250) !important; +} diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/models/benchmark.ts b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/models/benchmark.ts new file mode 100644 index 000000000..466eee8bd --- /dev/null +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/models/benchmark.ts @@ -0,0 +1,12 @@ +export class Benchmark { + ID: string; + RGB: string; + Lab: string; + Twine: string; + Color: string; + Path: string; + + constructor() { + + } +}
\ No newline at end of file diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/models/card.ts b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/models/card.ts index b4feaf128..1fe422217 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/models/card.ts +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/models/card.ts @@ -14,6 +14,7 @@ export class Card { EnforceBarcodeDetection: boolean; PDFPath: FileInput; SCVPath: FileInput; + name: string; constructor() { this.CardGuid = '987 654 321'; diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/models/index.ts b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/models/index.ts index 5e37a2d8b..ca6e74d14 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/models/index.ts +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/models/index.ts @@ -4,3 +4,4 @@ export * from './user'; export * from './loginresponse'; export * from './card'; export * from './algorithm'; +export * from './benchmark'; diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/services/results.service.ts b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/services/results.service.ts index ce756a593..4372e71b1 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/services/results.service.ts +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/App/TCC/src/app/services/results.service.ts @@ -55,7 +55,7 @@ export class ResultService { res.RawColor = this.convertIntToRGB(xValue); const procColor = this.convertIntToRGB(yValue); res.ProcessedColor = procColor; - this.detectionResults.push(res); + return res; } // TESTING diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs b/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs index 2ad2b4fea..c8df9f5ae 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs @@ -23,6 +23,9 @@ using SendGrid; using SendGrid.Helpers.Mail; using System.Web; using System.Web.Hosting; +using Tango.Web.Storage; +using System.Threading.Tasks; +using System.Diagnostics; namespace Tango.TCC.Service.Controllers { @@ -45,11 +48,12 @@ namespace Tango.TCC.Service.Controllers device.DeviceID = request.DeviceID; device.DeviceModel = request.Device; device.Email = request.Email; - device.LastLogin = DateTime.UtcNow; device.OSVersion = request.OSVersion; db.Devices.Add(device); - db.SaveChanges(); } + + device.LastLogin = DateTime.UtcNow; + db.SaveChanges(); } response.AccessToken = WebToken<DeviceTokenObject>.CreateNew(TCCServiceConfig.JWT_TOKEN_SECRET, new DeviceTokenObject() @@ -109,6 +113,8 @@ namespace Tango.TCC.Service.Controllers [HttpPost] public ColorDetectionResponse Detect(ColorDetectionRequest request) { + Stopwatch watch = Stopwatch.StartNew(); + byte[] bitmapBytes = Convert.FromBase64String(request.BitmapString); using (MemoryStream ms = new MemoryStream(bitmapBytes)) @@ -145,10 +151,51 @@ namespace Tango.TCC.Service.Controllers var output = detector.Detect(input); + watch.Stop(); + + String sourceBlobName = "source_" + Guid.NewGuid().ToString() + ".png"; + String sampleBlobName = "sample_" + Guid.NewGuid().ToString() + ".png"; + + var manager = new BlobStorageManager(); + var source_container = manager.GetContainer(TCCServiceConfig.TCC_SOURCE_CONTAINER); + var sourceBlob = source_container.CreateEmptyBlob(sourceBlobName); + + Task.Factory.StartNew(() => + { + var sample_container = manager.GetContainer(TCCServiceConfig.TCC_SAMPLE_CONTAINER); + using (MemoryStream ms = new MemoryStream(bitmapBytes)) + { + sample_container.UploadNewBlob(ms, sampleBlobName); + } + + using (var db = TccDbContext.CreateTCC()) + { + Card card = db.Cards.SingleOrDefault(x => x.Code == request.Barcode); + if (card == null) + { + card = db.Cards.First(); + } + + Result r = new Result(); + r.Date = DateTime.UtcNow; + r.DeviceGuid = db.Devices.SingleOrDefault(x => x.DeviceID == RequestToken.Object.DeviceID).Guid; + r.CardGuid = card.Guid; + r.ProcessTime = (int)watch.ElapsedMilliseconds; + r.ProcessedColor = output.ProcessedColor.ToInt32(); + r.RawColor = output.RawColor.ToInt32(); + r.SourceImageBlobName = sourceBlobName; + r.SampleImageBlobName = sampleBlobName; + + db.Results.Add(r); + db.SaveChanges(); + } + }); + return new ColorDetectionResponse() { ProcessedColor = output.ProcessedColor, RawColor = output.RawColor, + SourceImageBlobAddress = sourceBlob.GenerateWriteSignature(TimeSpan.FromMinutes(10)), }; } } @@ -200,6 +247,25 @@ namespace Tango.TCC.Service.Controllers { ResultByEmailResponse response = new ResultByEmailResponse(); + //Opportunity to attach email to device.. + Task.Factory.StartNew(() => + { + using (var db = TccDbContext.CreateTCC()) + { + try + { + var device = db.Devices.SingleOrDefault(x => x.DeviceID == RequestToken.Object.DeviceID); + + if (device != null) + { + device.Email = request.From; + db.SaveChanges(); + } + } + catch { } + } + }); + var client = new SendGridClient(TCCServiceConfig.SEND_GRID_API_KEY); SendGridMessage msg = new SendGridMessage(); msg.SetFrom(request.From); diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/TCCServiceConfig.cs b/Software/Visual_Studio/TCC/Tango.TCC.Service/TCCServiceConfig.cs index 00a0f19f0..70c38f589 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/TCCServiceConfig.cs +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/TCCServiceConfig.cs @@ -86,5 +86,15 @@ namespace Tango.TCC.Service /// Gets the Send Grid API key. /// </summary> public static String SEND_GRID_API_KEY => ConfigurationManager.AppSettings[nameof(SEND_GRID_API_KEY)].ToString(); + + /// <summary> + /// Gets the TCC source images container. + /// </summary> + public static String TCC_SOURCE_CONTAINER => ConfigurationManager.AppSettings[nameof(TCC_SOURCE_CONTAINER)].ToString(); + + /// <summary> + /// Gets the TCC sample images container. + /// </summary> + public static String TCC_SAMPLE_CONTAINER => ConfigurationManager.AppSettings[nameof(TCC_SAMPLE_CONTAINER)].ToString(); } }
\ No newline at end of file diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/Tango.TCC.Service.csproj b/Software/Visual_Studio/TCC/Tango.TCC.Service/Tango.TCC.Service.csproj index 12fe5e8ec..5ba15e965 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/Tango.TCC.Service.csproj +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/Tango.TCC.Service.csproj @@ -59,6 +59,8 @@ <HintPath>..\..\packages\JWT.5.0.0\lib\net46\JWT.dll</HintPath> </Reference> <Reference Include="Microsoft.CSharp" /> + <Reference Include="Microsoft.SqlServer.AzureStorageEnum, Version=14.100.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL" /> + <Reference Include="Microsoft.WindowsAzure.Storage, Version=4.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> <Reference Include="SendGrid, Version=9.11.0.0, Culture=neutral, PublicKeyToken=4f047e93159395ca, processorArchitecture=MSIL"> <HintPath>..\..\packages\Sendgrid.9.11.0\lib\net452\SendGrid.dll</HintPath> </Reference> diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/Web.config b/Software/Visual_Studio/TCC/Tango.TCC.Service/Web.config index aa50e5b14..65a537625 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/Web.config +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/Web.config @@ -20,7 +20,7 @@ <add key="DB_PASSWORD" value="Aa123456" /> <add key="DB_CATALOG" value="TCC" /> <add key="TANGO_DB_CATALOG" value="Tango_TEST" /> - <add key="STORAGE_ACCOUNT" value="DefaultEndpointsProtocol=https;AccountName=tangostorage;AccountKey=S4z/D+Yg6mwMis+bs/VpcDLA9yE1iZaYq23shQlRIi2KmM9E7JY8zdZjeAPOPdG3gONHoNDEpsgH6D4cqQ/bsA==;EndpointSuffix=core.windows.net" /> + <add key="STORAGE_ACCOUNT" value="DefaultEndpointsProtocol=https;AccountName=twinetccstorage;AccountKey=Kls2bDJyqFpuCvTTLE4ZUvDcs+MhThN/0Vy/fUTqSXj9CSc2M1BaAxwASvcVb9OQUuHKjzttR9LzwhSGNCVGew==;EndpointSuffix=core.windows.net" /> <add key="TENANT_ID" value="2ebd63a5-bc2f-41dc-9066-4409ed5e5dd4" /> <add key="CLIENT_ID" value="ec612854-7abc-457b-808a-5d0c5ba80c57" /> <add key="APP_SECRET" value="54)019A7wv+#86l*PQcQWYKu%fd4Dv!@G=VhCiDI5rD+H4BTH" /> @@ -42,6 +42,8 @@ <add key="ENFORCE_BARCODE_DETECTION" value="True" /> <add key="APP_ID" value="Tdf793i4ughsiduf8749509237885ehgfdlkghlT" /> <add key="SEND_GRID_API_KEY" value="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" /> + <add key="TCC_SOURCE_CONTAINER" value="source-images" /> + <add key="TCC_SAMPLE_CONTAINER" value="sample-images" /> </appSettings> diff --git a/Software/Visual_Studio/Tango.Web/Storage/ExtensionMethods.cs b/Software/Visual_Studio/Tango.Web/Storage/ExtensionMethods.cs index 4acd10082..e9e361f21 100644 --- a/Software/Visual_Studio/Tango.Web/Storage/ExtensionMethods.cs +++ b/Software/Visual_Studio/Tango.Web/Storage/ExtensionMethods.cs @@ -21,6 +21,13 @@ namespace Tango.Web.Storage return emptyBlob; } + public static CloudBlockBlob UploadNewBlob(this CloudBlobContainer container, Stream stream, String name) + { + CloudBlockBlob emptyBlob = container.GetBlockBlobReference(name); + emptyBlob.UploadFromStream(stream); + return emptyBlob; + } + public static String GenerateReadSignature(this CloudBlockBlob blob, TimeSpan duration) { String signature = blob.GetSharedAccessSignature(new SharedAccessBlobPolicy() diff --git a/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Events.xlsx b/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Events.xlsx Binary files differindex 44d8fa99a..a89765a30 100644 --- a/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Events.xlsx +++ b/Software/Visual_Studio/Utilities/Tango.EventsTypesGenerator/Events.xlsx |
