aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-03-12 17:03:38 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-03-12 17:03:38 +0200
commite75cf513acb73558e948d6012b45f221c718dcf7 (patch)
tree386d3cd79048edbfb91860b6a063fba3c660fec5 /Software/Visual_Studio/MachineStudio
parentc923d6611ffa64605879779c490a979e03daa189 (diff)
downloadTango-e75cf513acb73558e948d6012b45f221c718dcf7.tar.gz
Tango-e75cf513acb73558e948d6012b45f221c718dcf7.zip
Added cascade delete for Machine -> Jobs.
Added addresses auto complete to users & roles. Maybe Users & Roles module is complete..
Diffstat (limited to 'Software/Visual_Studio/MachineStudio')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs1
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Providers/Place.cs31
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Providers/PlaceAddress.cs53
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Providers/PlacesProvider.cs47
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Tango.MachineStudio.UsersAndRoles.csproj14
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs132
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/AddressView.xaml8
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/OrganizationManagementView.xaml10
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/OrganizationManagementView.xaml.cs8
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml27
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml.cs8
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserView.xaml23
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserView.xaml.cs28
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/app.config11
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/packages.config1
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs1
16 files changed, 387 insertions, 16 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs
index 0c99dfe5f..044046450 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs
@@ -82,6 +82,7 @@ namespace Tango.MachineStudio.Developer.Views
}
jobBrushList.ItemsSource = segments;
+ UpdateGradientBrushDisplay();
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Providers/Place.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Providers/Place.cs
new file mode 100644
index 000000000..a2ac2a9b7
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Providers/Place.cs
@@ -0,0 +1,31 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml.Serialization;
+
+namespace Tango.MachineStudio.UsersAndRoles.Providers
+{
+ public class Place
+ {
+ [XmlElement("address")]
+ [JsonProperty("address")]
+ public PlaceAddress Address { get; set; }
+
+ [XmlAttribute("display_name")]
+ [JsonProperty("display_name")]
+ public String DisplayName { get; set; }
+
+ public Place()
+ {
+ Address = new PlaceAddress();
+ }
+
+ public override string ToString()
+ {
+ return DisplayName;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Providers/PlaceAddress.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Providers/PlaceAddress.cs
new file mode 100644
index 000000000..5b25794d1
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Providers/PlaceAddress.cs
@@ -0,0 +1,53 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml.Serialization;
+
+namespace Tango.MachineStudio.UsersAndRoles.Providers
+{
+ public class PlaceAddress
+ {
+ [XmlElement("road")]
+ [JsonProperty("road")]
+ public String Road { get; set; }
+
+ [XmlElement("village")]
+ [JsonProperty("village")]
+ public String Village
+ {
+ get { return City; }
+ set { City = value; }
+ }
+
+ [XmlElement("town")]
+ [JsonProperty("town")]
+ public String Town
+ {
+ get { return City; }
+ set { City = value; }
+ }
+
+ [XmlElement("city")]
+ [JsonProperty("city")]
+ public String City { get; set; }
+
+ [XmlElement("state")]
+ [JsonProperty("state")]
+ public String State { get; set; }
+
+ [XmlElement("postcode")]
+ [JsonProperty("postcode")]
+ public String PostalCode { get; set; }
+
+ [XmlElement("country")]
+ [JsonProperty("country")]
+ public String Country { get; set; }
+
+ [XmlElement("country_code")]
+ [JsonProperty("country_code")]
+ public String CountryCode { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Providers/PlacesProvider.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Providers/PlacesProvider.cs
new file mode 100644
index 000000000..681815d4c
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Providers/PlacesProvider.cs
@@ -0,0 +1,47 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.AutoComplete.Editors;
+using Tango.Logging;
+
+namespace Tango.MachineStudio.UsersAndRoles.Providers
+{
+ public class PlacesProvider : ISuggestionProvider
+ {
+ public IEnumerable GetSuggestions(string filter)
+ {
+ List<Place> places = new List<Place>();
+
+ using (WebClient web = new WebClient())
+ {
+ try
+ {
+ String json = null;
+
+ web.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0");
+ web.Headers.Add(HttpRequestHeader.ContentType, "application/json");
+ web.Headers.Add(HttpRequestHeader.AcceptLanguage, "en-US");
+
+ json = web.DownloadString(String.Format("https://nominatim.openstreetmap.org/search?q={0}&format=json&addressdetails=1", filter));
+
+ if (json != null)
+ {
+ List<Place> results = JsonConvert.DeserializeObject<List<Place>>(json);
+ places.AddRange(results);
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Default.Log(ex, LogCategory.Debug);
+ }
+ }
+
+ return places;
+ }
+ }
+}
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 a64c536ed..9064519c0 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
@@ -58,6 +58,9 @@
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.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>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" />
@@ -83,6 +86,9 @@
</Compile>
<Compile Include="Navigation\UsersAndRolesNavigationManager.cs" />
<Compile Include="Navigation\UsersAndRolesNavigationView.cs" />
+ <Compile Include="Providers\PlaceAddress.cs" />
+ <Compile Include="Providers\PlacesProvider.cs" />
+ <Compile Include="Providers\Place.cs" />
<Compile Include="UsersAndRolesModule.cs" />
<Compile Include="ViewModelLocator.cs" />
<Compile Include="ViewModels\MainViewVM.cs" />
@@ -104,6 +110,9 @@
<Compile Include="Views\UserManagementView.xaml.cs">
<DependentUpon>UserManagementView.xaml</DependentUpon>
</Compile>
+ <Compile Include="Views\UserView.xaml.cs">
+ <DependentUpon>UserView.xaml</DependentUpon>
+ </Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
@@ -123,6 +132,7 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
+ <None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@@ -188,6 +198,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Views\UserView.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
</ItemGroup>
<ItemGroup>
<Resource Include="Images\organization.png" />
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs
index 9478014b7..7d82cbbbc 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs
@@ -10,6 +10,7 @@ using Tango.BL.Entities;
using Tango.Core.Commands;
using Tango.MachineStudio.Common.Notifications;
using Tango.MachineStudio.UsersAndRoles.Navigation;
+using Tango.MachineStudio.UsersAndRoles.Providers;
using Tango.SharedUI;
namespace Tango.MachineStudio.UsersAndRoles.ViewModels
@@ -71,6 +72,36 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels
set { _managedUser = value; RaisePropertyChangedAuto(); }
}
+ private Place _selectedUserPlace;
+ public Place SelectedUserPlace
+ {
+ get { return _selectedUserPlace; }
+ set
+ {
+ _selectedUserPlace = value;
+
+ if (_selectedUserPlace != null && _selectedUserPlace.Address != null)
+ {
+ SetUserPlace(value);
+ }
+ }
+ }
+
+ private Place _selectedOrganizationPlace;
+ public Place SelectedOrganizationPlace
+ {
+ get { return _selectedOrganizationPlace; }
+ set
+ {
+ _selectedOrganizationPlace = value;
+
+ if (_selectedOrganizationPlace != null && _selectedOrganizationPlace.Address != null)
+ {
+ SetOrganizationPlace(value);
+ }
+ }
+ }
+
public RelayCommand ManageOrganizationCommand { get; set; }
public RelayCommand BackToOrganizationsCommand { get; set; }
@@ -89,6 +120,10 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels
public RelayCommand SaveManagedUserCommand { get; set; }
+ public RelayCommand AddUserCommand { get; set; }
+
+ public RelayCommand RemoveUserCommand { get; set; }
+
public MainViewVM(UsersAndRolesNavigationManager navigation, INotificationProvider notification)
{
_navigation = navigation;
@@ -98,13 +133,15 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels
ManageOrganizationCommand = new RelayCommand(LoadSelectedOrganization, () => SelectedOrganization != null);
BackToOrganizationsCommand = new RelayCommand(BackToOrganizations);
- ManageUserCommand = new RelayCommand(ManageUser, () => SelectedUser != null);
+ ManageUserCommand = new RelayCommand(LoadSelectedUser, () => SelectedUser != null);
SaveOrganizationCommand = new RelayCommand(SaveOrganization);
AddOrganizationCommand = new RelayCommand(AddOrganization);
RemoveOrganizationCommand = new RelayCommand(RemoveOrganization, () => SelectedOrganization != null);
BackToManagedOrganizationCommand = new RelayCommand(BackToManagedOrganization);
RemoveRoleCommand = new RelayCommand<Role>(RemoveUserRole);
SaveManagedUserCommand = new RelayCommand(SaveManagedUser);
+ AddUserCommand = new RelayCommand(AddNewUser);
+ RemoveUserCommand = new RelayCommand(RemoveSelectedUser, () => SelectedUser != null);
}
private async void AddOrganization()
@@ -144,14 +181,13 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels
{
using (_notification.PushTaskItem("Saving organization address and contact..."))
{
- ManagedOrganization.Contact.SetFullName();
await ManagedOrganization.SaveAsync(_manageContext);
LoadOrganizations();
SelectedOrganization = Organizations.SingleOrDefault(x => x.Guid == ManagedOrganization.Guid);
}
}
- private void ManageUser()
+ private void LoadSelectedUser()
{
using (_notification.PushTaskItem("Loading user details..."))
{
@@ -189,9 +225,18 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels
private async void SaveManagedUser()
{
+ try
+ {
+ ManagedUser.Validate(_userContext);
+ }
+ catch (Exception ex)
+ {
+ _notification.ShowError(ex.Message);
+ return;
+ }
+
using (_notification.PushTaskItem("Saving user details..."))
{
- ManagedUser.Contact.SetFullName();
await ManagedUser.SaveAsync(_userContext);
LoadSelectedOrganization();
}
@@ -237,6 +282,85 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels
ManagedUserRoles.Add(role);
}
+ private async void RemoveSelectedUser()
+ {
+ if (_notification.ShowQuestion("Are you sure you want to remove the selected user?"))
+ {
+ using (_notification.PushTaskItem("Removing user..."))
+ {
+ await SelectedUser.DeleteCascadeAsync(_manageContext);
+ LoadSelectedOrganization();
+ }
+ }
+ }
+
+ private async void AddNewUser()
+ {
+ String email = _notification.ShowTextInput("Enter user email", "email");
+
+ if (!String.IsNullOrWhiteSpace(email))
+ {
+ User user = new User();
+ user.Email = email;
+ user.Password = "1111";
+ user.Contact = new Contact()
+ {
+ FirstName = "Twine",
+ LastName = "User",
+ Email = email,
+ };
+
+ user.UsersRoles.Add(new UsersRole()
+ {
+ User = user,
+ Role = _manageContext.Roles.SingleOrDefault(x => x.Code == (int)BL.Enumerations.Roles.User)
+ });
+
+ try
+ {
+ user.Validate(_manageContext);
+ }
+ catch (Exception ex)
+ {
+ _notification.ShowError(ex.Message);
+ return;
+ }
+
+ user.Address = new Address();
+
+ ManagedOrganization.Users.Add(user);
+
+ using (_notification.PushTaskItem("Adding new user..."))
+ {
+ await ManagedOrganization.SaveAsync(_manageContext);
+ LoadOrganizations();
+ SelectedOrganization = Organizations.SingleOrDefault(x => x.Guid == ManagedOrganization.Guid);
+ }
+ }
+ }
+
+ private void SetUserPlace(Place place)
+ {
+ ManagedUser.Address.AddressString = place.Address.Road;
+ ManagedUser.Address.City = place.Address.City;
+ ManagedUser.Address.Country = place.Address.Country;
+ ManagedUser.Address.CountryCode = place.Address.CountryCode;
+ ManagedUser.Address.Locality = place.Address.CountryCode;
+ ManagedUser.Address.PostalCode = place.Address.PostalCode;
+ ManagedUser.Address.State = place.Address.State;
+ }
+
+ private void SetOrganizationPlace(Place place)
+ {
+ ManagedOrganization.Address.AddressString = place.Address.Road;
+ ManagedOrganization.Address.City = place.Address.City;
+ ManagedOrganization.Address.Country = place.Address.Country;
+ ManagedOrganization.Address.CountryCode = place.Address.CountryCode;
+ ManagedOrganization.Address.Locality = place.Address.CountryCode;
+ ManagedOrganization.Address.PostalCode = place.Address.PostalCode;
+ ManagedOrganization.Address.State = place.Address.State;
+ }
+
protected override void RaisePropertyChangedAuto([CallerMemberName] string caller = null)
{
base.RaisePropertyChangedAuto(caller);
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/AddressView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/AddressView.xaml
index 41f7871e2..937cf14dd 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/AddressView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/AddressView.xaml
@@ -15,17 +15,17 @@
<Grid>
<controls:TableGrid>
<TextBlock Text="COUNTRY"></TextBlock>
- <autoComplete:AutoCompleteTextBox SelectedItem="{Binding Country}" />
+ <TextBox Text="{Binding Country}" />
<TextBlock Text="COUNTRY CODE"></TextBlock>
<TextBox IsReadOnly="True" Text="{Binding CountryCode}"></TextBox>
<TextBlock Text="STATE"></TextBlock>
<TextBox Text="{Binding State}"></TextBox>
<TextBlock Text="CITY"></TextBlock>
- <autoComplete:AutoCompleteTextBox SelectedItem="{Binding City}" />
+ <TextBox Text="{Binding City}" />
<TextBlock Text="POSTAL CODE"></TextBlock>
- <mahApps:NumericUpDown Maximum="99999999999" FlowDirection="RightToLeft" Minimum="0" Background="Transparent" BorderThickness="0 0 0 1" BorderBrush="DimGray" HideUpDownButtons="True" Value="{Binding PostalCode}"></mahApps:NumericUpDown>
+ <TextBox Text="{Binding PostalCode}"></TextBox>
<TextBlock Text="LOCALITY"></TextBlock>
- <autoComplete:AutoCompleteTextBox SelectedItem="{Binding Locality}" />
+ <TextBox Text="{Binding Locality}" />
<TextBlock Text="ADDRESS"></TextBlock>
<TextBox Text="{Binding AddressString}"></TextBox>
</controls:TableGrid>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/OrganizationManagementView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/OrganizationManagementView.xaml
index 7769f65ed..64b05769a 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/OrganizationManagementView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/OrganizationManagementView.xaml
@@ -9,6 +9,7 @@
xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete"
xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
xmlns:mahApps="http://metro.mahapps.com/winfx/xaml/controls"
+ xmlns:providers="clr-namespace:Tango.MachineStudio.UsersAndRoles.Providers"
xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL"
xmlns:local="clr-namespace:Tango.MachineStudio.UsersAndRoles.Views"
xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
@@ -17,6 +18,7 @@
<UserControl.Resources>
<converters:DateTimeUTCToShortDateTimeConverter x:Key="DateTimeUTCToShortDateTimeConverter" />
+ <providers:PlacesProvider x:Key="PlacesProvider" />
</UserControl.Resources>
<Grid>
@@ -38,7 +40,13 @@
<TextBlock FontSize="14" FontWeight="SemiBold">ADDRESS</TextBlock>
<Border BorderBrush="Gray" BorderThickness="1" Width="300" HorizontalAlignment="Left" Padding="5" Margin="0 10 0 0" Background="#A9FFFFFF" Height="300">
- <local:AddressView DataContext="{Binding ManagedOrganization.Address}" />
+ <DockPanel>
+ <DockPanel DockPanel.Dock="Top">
+ <materialDesign:PackIcon Kind="Magnify" DockPanel.Dock="Left" Width="24" Height="24" />
+ <autoComplete:AutoCompleteTextBox x:Name="address_auto" Margin="5 0 0 0" Delay="500" DisplayMember="DisplayName" SelectedItem="{Binding SelectedOrganizationPlace,Mode=OneWayToSource}" Provider="{StaticResource PlacesProvider}" materialDesign:HintAssist.Hint="Find address" />
+ </DockPanel>
+ <local:AddressView DataContext="{Binding ManagedOrganization.Address}" />
+ </DockPanel>
</Border>
<TextBlock FontSize="14" FontWeight="SemiBold" Margin="0 40 0 0">CONTACT</TextBlock>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/OrganizationManagementView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/OrganizationManagementView.xaml.cs
index 76b256d62..e2c44a584 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/OrganizationManagementView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/OrganizationManagementView.xaml.cs
@@ -12,17 +12,23 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
+using static Tango.SharedUI.Controls.MultiTransitionControl;
namespace Tango.MachineStudio.UsersAndRoles.Views
{
/// <summary>
/// Interaction logic for OrganizationManagementView.xaml
/// </summary>
- public partial class OrganizationManagementView : UserControl
+ public partial class OrganizationManagementView : UserControl , ITransitionView
{
public OrganizationManagementView()
{
InitializeComponent();
}
+
+ public void OnTransitionCompleted()
+ {
+ address_auto.Text = "";
+ }
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml
index b92682b84..ccb38b198 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml
@@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:global="clr-namespace:Tango.MachineStudio.UsersAndRoles"
xmlns:vm="clr-namespace:Tango.MachineStudio.UsersAndRoles.ViewModels"
+ xmlns:providers="clr-namespace:Tango.MachineStudio.UsersAndRoles.Providers"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop"
xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete"
@@ -16,6 +17,10 @@
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
+ <UserControl.Resources>
+ <providers:PlacesProvider x:Key="PlacesProvider" />
+ </UserControl.Resources>
+
<Grid>
<Grid>
<Grid.ColumnDefinitions>
@@ -39,19 +44,31 @@
<TextBlock Text="{Binding ManagedUser.Contact.FullName,FallbackValue='Roy Ben Shabat'}" VerticalAlignment="Center" FontSize="25" Margin="10 0 0 0"></TextBlock>
</StackPanel>
- <StackPanel Orientation="Horizontal" Margin="0 20 0 0" HorizontalAlignment="Center">
+ <StackPanel Orientation="Horizontal" Margin="0 20 0 0" HorizontalAlignment="Right">
<StackPanel>
- <TextBlock FontSize="16" FontWeight="SemiBold">ADDRESS</TextBlock>
- <Border Width="300" BorderThickness="1" BorderBrush="Gray" Margin="0 5 0 0" Padding="5" Height="300" Background="#8EFFFFFF">
- <local:AddressView FontSize="10" DataContext="{Binding ManagedUser.Address}" />
+ <TextBlock FontSize="16" FontWeight="SemiBold">LOGIN</TextBlock>
+ <Border Width="300" BorderThickness="1" BorderBrush="Gray" Margin="0 5 0 0" Padding="15 5" Height="150" Background="#8EFFFFFF">
+ <local:UserView FontSize="10" DataContext="{Binding ManagedUser}" />
</Border>
</StackPanel>
<StackPanel Margin="10 0 0 0">
<TextBlock FontSize="16" FontWeight="SemiBold">CONTACT</TextBlock>
- <Border Width="300" BorderThickness="1" BorderBrush="Gray" Margin="0 5 0 0" Padding="5" Height="300" Background="#8EFFFFFF">
+ <Border Width="300" BorderThickness="1" BorderBrush="Gray" Margin="0 5 0 0" Padding="15 5" Height="250" Background="#8EFFFFFF">
<local:ContactView FontSize="10" DataContext="{Binding ManagedUser.Contact}" />
</Border>
</StackPanel>
+ <StackPanel Margin="10 0 0 0">
+ <TextBlock FontSize="16" FontWeight="SemiBold">ADDRESS</TextBlock>
+ <Border Width="300" BorderThickness="1" BorderBrush="Gray" Margin="0 5 0 0" Padding="15 5" Height="300" Background="#8EFFFFFF">
+ <DockPanel>
+ <DockPanel DockPanel.Dock="Top">
+ <materialDesign:PackIcon Kind="Magnify" DockPanel.Dock="Left" Width="24" Height="24" />
+ <autoComplete:AutoCompleteTextBox x:Name="address_auto" Margin="5 0 0 0" Delay="500" DisplayMember="DisplayName" SelectedItem="{Binding SelectedUserPlace,Mode=OneWayToSource}" Provider="{StaticResource PlacesProvider}" materialDesign:HintAssist.Hint="Find address" />
+ </DockPanel>
+ <local:AddressView FontSize="10" DataContext="{Binding ManagedUser.Address}" />
+ </DockPanel>
+ </Border>
+ </StackPanel>
</StackPanel>
</StackPanel>
</Grid>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml.cs
index b26f0ea03..f2ff25637 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserManagementView.xaml.cs
@@ -15,13 +15,14 @@ using System.Windows.Shapes;
using Tango.BL.Entities;
using Tango.DragAndDrop;
using Tango.MachineStudio.UsersAndRoles.ViewModels;
+using static Tango.SharedUI.Controls.MultiTransitionControl;
namespace Tango.MachineStudio.UsersAndRoles.Views
{
/// <summary>
/// Interaction logic for UserManagementView.xaml
/// </summary>
- public partial class UserManagementView : UserControl
+ public partial class UserManagementView : UserControl, ITransitionView
{
private MainViewVM _vm;
@@ -47,5 +48,10 @@ namespace Tango.MachineStudio.UsersAndRoles.Views
_vm.OnDropRole(e.Draggable.DataContext as Role);
}
}
+
+ public void OnTransitionCompleted()
+ {
+ address_auto.Text = "";
+ }
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserView.xaml
new file mode 100644
index 000000000..6c7596015
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserView.xaml
@@ -0,0 +1,23 @@
+<UserControl x:Class="Tango.MachineStudio.UsersAndRoles.Views.UserView"
+ 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:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL"
+ xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
+ xmlns:pass="clr-namespace:Tango.SharedUI.Helpers;assembly=Tango.SharedUI"
+ xmlns:local="clr-namespace:Tango.MachineStudio.UsersAndRoles.Views"
+ mc:Ignorable="d"
+ d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance Type=entities:User, IsDesignTimeCreatable=False}">
+
+
+
+ <Grid>
+ <controls:TableGrid>
+ <TextBlock Text="EMAIL"></TextBlock>
+ <TextBox Text="{Binding Email}"></TextBox>
+ <TextBlock Text="PASSWORD"></TextBlock>
+ <PasswordBox MaxLength="30" pass:PasswordHelper.Attach="True" pass:PasswordHelper.Password="{Binding Password,Mode=TwoWay}"></PasswordBox>
+ </controls:TableGrid>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserView.xaml.cs
new file mode 100644
index 000000000..b617bdbc4
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/Views/UserView.xaml.cs
@@ -0,0 +1,28 @@
+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;
+
+namespace Tango.MachineStudio.UsersAndRoles.Views
+{
+ /// <summary>
+ /// Interaction logic for UserView.xaml
+ /// </summary>
+ public partial class UserView : UserControl
+ {
+ public UserView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/app.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/app.config
new file mode 100644
index 000000000..cacd4cd77
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/app.config
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration> \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/packages.config
index cf0df03c8..6b8afad69 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/packages.config
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/packages.config
@@ -6,4 +6,5 @@
<package id="MaterialDesignColors" version="1.1.2" targetFramework="net46" />
<package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net46" />
<package id="MvvmLightLibs" version="5.3.0.0" 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/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs
index c40904173..e0ae60b87 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml.cs
@@ -76,6 +76,7 @@ namespace Tango.MachineStudio.UI.Views
{
Tag = module.Name,
Content = grid,
+ Visibility = Visibility.Hidden,
});
_loader.UserModules.Add(module);