diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-03-14 12:04:41 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-03-14 12:04:41 +0200 |
| commit | 1ebb6a67c93969f3d3822893d4e191d14f8fd3e3 (patch) | |
| tree | 235f1d8bc8ca127d4ae2f4ee45ec0e527e1b9844 /Software/Visual_Studio | |
| parent | 37b740c1d128d694b9dcbc3669808435b5d88fec (diff) | |
| download | Tango-1ebb6a67c93969f3d3822893d4e191d14f8fd3e3.tar.gz Tango-1ebb6a67c93969f3d3822893d4e191d14f8fd3e3.zip | |
Fixed some issues with primary keys on db.
Implemented embroidery import Fit To Scale.
Implemented assignment of user last login on machine studio login.
Diffstat (limited to 'Software/Visual_Studio')
5 files changed, 110 insertions, 66 deletions
diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryFileEditor.xaml.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryFileEditor.xaml.cs index 1ed1e5b18..6b86c68cb 100644 --- a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryFileEditor.xaml.cs +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryFileEditor.xaml.cs @@ -101,6 +101,7 @@ namespace Tango.EmbroideryUI EmbroideryFile = output.EmbroideryFile; DrawFile(); + ScaleToFit(); } protected virtual void OnPathsChanged() @@ -253,5 +254,37 @@ namespace Tango.EmbroideryUI } #endregion + + #region Public Methods + + public void ScaleToFit() + { + double minX = Paths.Select(x => x.Path.GetFlattenedPathGeometry().Bounds.Left).Min(); + double minY = Paths.Select(x => x.Path.GetFlattenedPathGeometry().Bounds.Top).Min(); + double maxX = Paths.Select(x => x.Path.GetFlattenedPathGeometry().Bounds.Right).Max(); + double maxY = Paths.Select(x => x.Path.GetFlattenedPathGeometry().Bounds.Bottom).Max(); + + Rect embRect = new Rect(minX, minY, maxX - minX, maxY - minY); + Rect editorRect = new Rect(0, 0, ActualWidth, ActualHeight); + + double embRectArea = embRect.Width * embRect.Height; + double editorRectArea = editorRect.Width * editorRect.Height; + + double factor = (editorRect.Width / embRect.Width) / 2d; + + if (embRect.Height > embRect.Width) + { + factor = (editorRect.Height / embRect.Height) / 2d; + } + + ScaleFactor = factor; + + minY = Paths.Select(x => x.Path.GetFlattenedPathGeometry().Bounds.Top).Min(); + minX = Paths.Select(x => x.Path.GetFlattenedPathGeometry().Bounds.Left).Min(); + + list.Margin = new Thickness(minX / 2, -minY / 2, 0, 0); + } + + #endregion } } diff --git a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryPath.cs b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryPath.cs index 5999845bf..33f14cd27 100644 --- a/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryPath.cs +++ b/Software/Visual_Studio/Embroidery/Tango.EmbroideryUI/EmbroideryPath.cs @@ -11,7 +11,7 @@ namespace Tango.EmbroideryUI { public class EmbroideryPath : Shape { - private PathGeometry _path; + public PathGeometry Path { get; private set; } public Brush Brush { @@ -72,14 +72,14 @@ namespace Tango.EmbroideryUI public EmbroideryPath(PathGeometry path) { - _path = path; + Path = path; } protected override Geometry DefiningGeometry { get { - return _path; + return Path; } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj index 9064519c0..9f020344a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj @@ -218,5 +218,6 @@ <ItemGroup> <Resource Include="Images\roles.png" /> </ItemGroup> + <ItemGroup /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs index bc57aee20..2fcf55d27 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs @@ -60,6 +60,16 @@ namespace Tango.MachineStudio.UI.Authentication throw new AuthenticationException("It seems like you do not have sufficient privileges to run Machine Studio. Please contact your administrator."); } + if (user != null) + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var u = db.Users.Single(x => x.Guid == user.Guid); + u.LastLogin = DateTime.UtcNow; + db.SaveChanges(); + } + } + CurrentUser = user; return user; } diff --git a/Software/Visual_Studio/Tango.BL/Entities/User.cs b/Software/Visual_Studio/Tango.BL/Entities/User.cs index 546ff4a1a..aca5cc953 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/User.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/User.cs @@ -20,16 +20,16 @@ namespace Tango.BL.Entities /// </summary> [Column("DELETED")] - public Boolean Deleted + public Boolean Deleted { - get + get { - return _deleted; + return _deleted; } - set + set { - _deleted = value; RaisePropertyChanged(nameof(Deleted)); + _deleted = value; RaisePropertyChanged(nameof(Deleted)); } } @@ -40,16 +40,16 @@ namespace Tango.BL.Entities /// </summary> [Column("EMAIL")] - public String Email + public String Email { - get + get { - return _email; + return _email; } - set + set { - _email = value; RaisePropertyChanged(nameof(Email)); + _email = value; RaisePropertyChanged(nameof(Email)); } } @@ -60,16 +60,16 @@ namespace Tango.BL.Entities /// </summary> [Column("PASSWORD")] - public String Password + public String Password { - get + get { - return _password; + return _password; } - set + set { - _password = value; RaisePropertyChanged(nameof(Password)); + _password = value; RaisePropertyChanged(nameof(Password)); } } @@ -81,16 +81,16 @@ namespace Tango.BL.Entities [Column("ORGANIZATION_GUID")] [ForeignKey("Organization")] - public String OrganizationGuid + public String OrganizationGuid { - get + get { - return _organizationguid; + return _organizationguid; } - set + set { - _organizationguid = value; RaisePropertyChanged(nameof(OrganizationGuid)); + _organizationguid = value; RaisePropertyChanged(nameof(OrganizationGuid)); } } @@ -102,16 +102,16 @@ namespace Tango.BL.Entities [Column("CONTACT_GUID")] [ForeignKey("Contact")] - public String ContactGuid + public String ContactGuid { - get + get { - return _contactguid; + return _contactguid; } - set + set { - _contactguid = value; RaisePropertyChanged(nameof(ContactGuid)); + _contactguid = value; RaisePropertyChanged(nameof(ContactGuid)); } } @@ -123,16 +123,16 @@ namespace Tango.BL.Entities [Column("ADDRESS_GUID")] [ForeignKey("Address")] - public String AddressGuid + public String AddressGuid { - get + get { - return _addressguid; + return _addressguid; } - set + set { - _addressguid = value; RaisePropertyChanged(nameof(AddressGuid)); + _addressguid = value; RaisePropertyChanged(nameof(AddressGuid)); } } @@ -143,16 +143,16 @@ namespace Tango.BL.Entities /// </summary> [Column("LAST_LOGIN")] - public Nullable<DateTime> LastLogin + public Nullable<DateTime> LastLogin { - get + get { - return _lastlogin; + return _lastlogin; } - set + set { - _lastlogin = value; RaisePropertyChanged(nameof(LastLogin)); + _lastlogin = value; RaisePropertyChanged(nameof(LastLogin)); } } @@ -166,14 +166,14 @@ namespace Tango.BL.Entities [JsonIgnore] public virtual Address Address { - get + get { - return _address; + return _address; } - set + set { - _address = value; RaisePropertyChanged(nameof(Address)); + _address = value; RaisePropertyChanged(nameof(Address)); } } @@ -187,14 +187,14 @@ namespace Tango.BL.Entities [JsonIgnore] public virtual Contact Contact { - get + get { - return _contact; + return _contact; } - set + set { - _contact = value; RaisePropertyChanged(nameof(Contact)); + _contact = value; RaisePropertyChanged(nameof(Contact)); } } @@ -206,14 +206,14 @@ namespace Tango.BL.Entities public virtual ObservableCollection<Job> Jobs { - get + get { - return _jobs; + return _jobs; } - set + set { - _jobs = value; RaisePropertyChanged(nameof(Jobs)); + _jobs = value; RaisePropertyChanged(nameof(Jobs)); } } @@ -225,14 +225,14 @@ namespace Tango.BL.Entities public virtual ObservableCollection<MachineStudioVersion> MachineStudioVersions { - get + get { - return _machinestudioversions; + return _machinestudioversions; } - set + set { - _machinestudioversions = value; RaisePropertyChanged(nameof(MachineStudioVersions)); + _machinestudioversions = value; RaisePropertyChanged(nameof(MachineStudioVersions)); } } @@ -244,14 +244,14 @@ namespace Tango.BL.Entities public virtual ObservableCollection<MachinesEvent> MachinesEvents { - get + get { - return _machinesevents; + return _machinesevents; } - set + set { - _machinesevents = value; RaisePropertyChanged(nameof(MachinesEvents)); + _machinesevents = value; RaisePropertyChanged(nameof(MachinesEvents)); } } @@ -265,14 +265,14 @@ namespace Tango.BL.Entities [JsonIgnore] public virtual Organization Organization { - get + get { - return _organization; + return _organization; } - set + set { - _organization = value; RaisePropertyChanged(nameof(Organization)); + _organization = value; RaisePropertyChanged(nameof(Organization)); } } @@ -284,14 +284,14 @@ namespace Tango.BL.Entities public virtual ObservableCollection<UsersRole> UsersRoles { - get + get { - return _usersroles; + return _usersroles; } - set + set { - _usersroles = value; RaisePropertyChanged(nameof(UsersRoles)); + _usersroles = value; RaisePropertyChanged(nameof(UsersRoles)); } } |
