aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2017-12-10 19:01:05 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2017-12-10 19:01:05 +0200
commit3fdcdac577d552bbdf6d7320c6ffb0753e810a08 (patch)
tree55e392cea80a3539164abb1fd16c15986c92b287 /Software/Visual_Studio
parent3eabdee9604ad67cdbab7ee35bdfa249402f8831 (diff)
downloadTango-3fdcdac577d552bbdf6d7320c6ffb0753e810a08.tar.gz
Tango-3fdcdac577d552bbdf6d7320c6ffb0753e810a08.zip
Started working on machine designer view models.
Added NAME field to MACHINE table.
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtendedObject.cs10
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtensionMethods/IEnumerableExtensions.cs22
-rw-r--r--Software/Visual_Studio/Tango.Core/Tango.Core.csproj1
-rw-r--r--Software/Visual_Studio/Tango.DAL.Observables/Entities/Machine.cs19
-rw-r--r--Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs1
-rw-r--r--Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx3
-rw-r--r--Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram58
-rw-r--r--Software/Visual_Studio/Tango.sln1
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/App.config18
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/App.xaml.cs6
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/DBAdapter.cs20
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/EntityViewModel.cs30
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/SupervisingController/IMachinesView.cs14
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/Tango.MachineDesigner.UI.csproj18
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/ViewModelLocator.cs13
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/ViewModels/MachinesViewVM.cs41
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/Views/MachinesView.xaml36
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/Views/MachinesView.xaml.cs2
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/Views/MainView.xaml2
-rw-r--r--Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/packages.config1
20 files changed, 254 insertions, 62 deletions
diff --git a/Software/Visual_Studio/Tango.Core/ExtendedObject.cs b/Software/Visual_Studio/Tango.Core/ExtendedObject.cs
index 84a73bf7c..8ac80034d 100644
--- a/Software/Visual_Studio/Tango.Core/ExtendedObject.cs
+++ b/Software/Visual_Studio/Tango.Core/ExtendedObject.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
+using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@@ -32,6 +33,15 @@ namespace Tango.Core
}
/// <summary>
+ /// Raises the property changed event.
+ /// </summary>
+ /// <param name="propName">Name of the property.</param>
+ protected virtual void RaisePropertyChangedAuto([CallerMemberName] string caller = null)
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(caller));
+ }
+
+ /// <summary>
/// Raises all relay commands CanExecute methods in the current instance.
/// </summary>
protected virtual void InvalidateRelayCommands()
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/IEnumerableExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/IEnumerableExtensions.cs
new file mode 100644
index 000000000..0e430e631
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/IEnumerableExtensions.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+
+public static class IEnumerableExtensions
+{
+ /// <summary>
+ /// Creates a new observable collection from the specified enumerable.
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="enumerable">The enumerable.</param>
+ /// <returns></returns>
+ public static ObservableCollection<T> ToObservableCollection<T>(this IEnumerable<T> enumerable)
+ {
+ return new ObservableCollection<T>(enumerable);
+ }
+}
+
diff --git a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj
index 7af35f628..fd3eeddf9 100644
--- a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj
+++ b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj
@@ -59,6 +59,7 @@
<Compile Include="ExtensionMethods\DateTimeExtensions.cs" />
<Compile Include="ExtensionMethods\DependencyObjectExtensions.cs" />
<Compile Include="ExtensionMethods\EnumExtensions.cs" />
+ <Compile Include="ExtensionMethods\IEnumerableExtensions.cs" />
<Compile Include="ExtensionMethods\IMessageExtensions.cs" />
<Compile Include="ExtensionMethods\IParameterizedExtensions.cs" />
<Compile Include="ExtensionMethods\ObjectExtensions.cs" />
diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Machine.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Machine.cs
index bdbe5d67d..3e6e08889 100644
--- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Machine.cs
+++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Machine.cs
@@ -29,6 +29,25 @@ namespace Tango.DAL.Observables
}
+ private String _name;
+ /// <summary>
+ /// Gets or sets the machine name.
+ /// </summary>
+ [EntityFieldName("NAME")]
+ public String Name
+ {
+ get
+ {
+ return _name;
+ }
+
+ set
+ {
+ _name = value; RaisePropertyChanged(nameof(Name));
+ }
+
+ }
+
private DateTime _productiondate;
/// <summary>
/// Gets or sets the machine production date.
diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs
index 97c84a140..496f3b645 100644
--- a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs
+++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE.cs
@@ -26,6 +26,7 @@ namespace Tango.DAL.Remote.DB
public System.DateTime LAST_UPDATED { get; set; }
public bool DELETED { get; set; }
public string SERIAL_NUMBER { get; set; }
+ public string NAME { get; set; }
public System.DateTime PRODUCTION_DATE { get; set; }
public string ORGANIZATION_GUID { get; set; }
public string MACHINE_VERSION_GUID { get; set; }
diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx
index 6dc1ad1ed..68b43ba94 100644
--- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx
+++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx
@@ -288,6 +288,7 @@
<Property Name="LAST_UPDATED" Type="datetime" Nullable="false" />
<Property Name="DELETED" Type="bit" Nullable="false" />
<Property Name="SERIAL_NUMBER" Type="varchar" MaxLength="50" Nullable="false" />
+ <Property Name="NAME" Type="nvarchar" MaxLength="50" />
<Property Name="PRODUCTION_DATE" Type="datetime" Nullable="false" />
<Property Name="ORGANIZATION_GUID" Type="varchar" MaxLength="36" Nullable="false" />
<Property Name="MACHINE_VERSION_GUID" Type="varchar" MaxLength="36" Nullable="false" />
@@ -1734,6 +1735,7 @@
<Property Name="LAST_UPDATED" Type="DateTime" Nullable="false" Precision="3" />
<Property Name="DELETED" Type="Boolean" Nullable="false" />
<Property Name="SERIAL_NUMBER" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="false" />
+ <Property Name="NAME" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
<Property Name="PRODUCTION_DATE" Type="DateTime" Nullable="false" Precision="3" />
<Property Name="ORGANIZATION_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" />
<Property Name="MACHINE_VERSION_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" />
@@ -2774,6 +2776,7 @@
<ScalarProperty Name="MACHINE_VERSION_GUID" ColumnName="MACHINE_VERSION_GUID" />
<ScalarProperty Name="ORGANIZATION_GUID" ColumnName="ORGANIZATION_GUID" />
<ScalarProperty Name="PRODUCTION_DATE" ColumnName="PRODUCTION_DATE" />
+ <ScalarProperty Name="NAME" ColumnName="NAME" />
<ScalarProperty Name="SERIAL_NUMBER" ColumnName="SERIAL_NUMBER" />
<ScalarProperty Name="DELETED" ColumnName="DELETED" />
<ScalarProperty Name="LAST_UPDATED" ColumnName="LAST_UPDATED" />
diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram
index 390be5547..cce34f3fb 100644
--- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram
+++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx.diagram
@@ -5,46 +5,46 @@
<!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams>
<Diagram DiagramId="f9ae01d708754bbd997add25a4bacc79" Name="Diagram1">
- <EntityTypeShape EntityType="RemoteModel.ACTION" Width="1.5" PointX="9" PointY="37.375" />
- <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="1.5" PointY="37.375" />
- <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="0.75" PointY="23.625" />
+ <EntityTypeShape EntityType="RemoteModel.ACTION" Width="1.5" PointX="9" PointY="36.625" />
+ <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="1.5" PointY="40.75" />
+ <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="0.75" PointY="6.25" />
<EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="15.375" />
- <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="0.75" PointY="18.125" />
- <EntityTypeShape EntityType="RemoteModel.APPLICATION_VERSIONS" Width="1.5" PointX="0.75" PointY="20.875" />
- <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="0.75" PointY="46.5" />
- <EntityTypeShape EntityType="RemoteModel.CARTRIDGE" Width="1.5" PointX="3" PointY="46.375" />
+ <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="0.75" PointY="12.75" />
+ <EntityTypeShape EntityType="RemoteModel.APPLICATION_VERSIONS" Width="1.5" PointX="0.75" PointY="23.625" />
+ <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="0.75" PointY="45.5" />
+ <EntityTypeShape EntityType="RemoteModel.CARTRIDGE" Width="1.5" PointX="3" PointY="45.375" />
<EntityTypeShape EntityType="RemoteModel.CONFIGURATION" Width="1.5" PointX="3" PointY="4.625" />
- <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="1.5" PointY="41.75" />
+ <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="1.5" PointY="36.625" />
<EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="0.75" PointY="2.625" />
<EntityTypeShape EntityType="RemoteModel.DISPENSER" Width="1.5" PointX="3" PointY="0.75" />
- <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="12.75" />
- <EntityTypeShape EntityType="RemoteModel.EMBEDDED_SOFTWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="10" />
- <EntityTypeShape EntityType="RemoteModel.EVENT" Width="1.5" PointX="6" PointY="41.25" />
- <EntityTypeShape EntityType="RemoteModel.EVENTS_ACTIONS" Width="1.5" PointX="11.25" PointY="41.375" />
- <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="5.75" PointY="32" />
- <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHESISES" Width="1.5" PointX="5.75" PointY="12.375" />
- <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="6.25" />
+ <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="10" />
+ <EntityTypeShape EntityType="RemoteModel.EMBEDDED_SOFTWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="18.125" />
+ <EntityTypeShape EntityType="RemoteModel.EVENT" Width="1.5" PointX="6" PointY="40.5" />
+ <EntityTypeShape EntityType="RemoteModel.EVENTS_ACTIONS" Width="1.5" PointX="11.25" PointY="40.625" />
+ <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="5.75" PointY="12.375" />
+ <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHESISES" Width="1.5" PointX="5.75" PointY="15.625" />
+ <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="20.875" />
<EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="5.25" PointY="5.625" />
- <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="5.75" PointY="15.625" />
+ <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="5.75" PointY="25" />
<EntityTypeShape EntityType="RemoteModel.LIQUID" Width="1.5" PointX="3" PointY="10.875" />
<EntityTypeShape EntityType="RemoteModel.LIQUIDS_RMLS" Width="1.5" PointX="10.25" PointY="12.25" />
- <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="0.75" PointY="27.375" />
+ <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="0.75" PointY="26.5" />
<EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS_CONFIGURATIONS" Width="1.5" PointX="8.25" PointY="6" />
- <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="3" PointY="31" />
+ <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="3" PointY="30.125" />
<EntityTypeShape EntityType="RemoteModel.MACHINES_CONFIGURATIONS" Width="1.5" PointX="5.25" PointY="2" />
- <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="8.25" PointY="31" />
- <EntityTypeShape EntityType="RemoteModel.MEDIA_COLORS" Width="1.5" PointX="5.75" PointY="18.75" />
- <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="5.75" PointY="25.75" />
- <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="5.75" PointY="22.625" />
- <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="5.75" PointY="28.875" />
- <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="0.75" PointY="32.625" />
- <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="6.75" PointY="45.625" />
+ <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="8.25" PointY="30.25" />
+ <EntityTypeShape EntityType="RemoteModel.MEDIA_COLORS" Width="1.5" PointX="5.75" PointY="28.125" />
+ <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="5.75" PointY="31" />
+ <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="5.75" PointY="18.75" />
+ <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="5.75" PointY="21.875" />
+ <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="0.75" PointY="31.875" />
+ <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="6.75" PointY="44.875" />
<EntityTypeShape EntityType="RemoteModel.RML" Width="1.5" PointX="8" PointY="10.125" />
- <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="3.75" PointY="41.5" />
- <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="9" PointY="41.625" />
+ <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="3.75" PointY="40.625" />
+ <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="9" PointY="40.75" />
<EntityTypeShape EntityType="RemoteModel.SYNC_CONFIGURATIONS" Width="1.5" PointX="7.75" PointY="1.75" />
- <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="3.75" PointY="37" />
- <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="6" PointY="37.625" />
+ <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="3.75" PointY="36.125" />
+ <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="6" PointY="36.75" />
<AssociationConnector Association="RemoteModel.FK_EVENTS_ACTIONS_ACTIONS" />
<AssociationConnector Association="RemoteModel.FK_ORGANIZATIONS_ADDRESSES" />
<AssociationConnector Association="RemoteModel.FK_USERS_ADDRESSES" />
diff --git a/Software/Visual_Studio/Tango.sln b/Software/Visual_Studio/Tango.sln
index 6551f2c0b..60c58b76b 100644
--- a/Software/Visual_Studio/Tango.sln
+++ b/Software/Visual_Studio/Tango.sln
@@ -440,7 +440,6 @@ Global
{8491D07B-C1F6-4B62-A412-41B9FD2D6538}.Release|x86.ActiveCfg = Release|Any CPU
{8491D07B-C1F6-4B62-A412-41B9FD2D6538}.Release|x86.Build.0 = Release|Any CPU
{0ECD6DA8-7AA6-48D9-8B65-279D176AD9AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {0ECD6DA8-7AA6-48D9-8B65-279D176AD9AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0ECD6DA8-7AA6-48D9-8B65-279D176AD9AF}.Debug|x64.ActiveCfg = Debug|Any CPU
{0ECD6DA8-7AA6-48D9-8B65-279D176AD9AF}.Debug|x64.Build.0 = Debug|Any CPU
{0ECD6DA8-7AA6-48D9-8B65-279D176AD9AF}.Debug|x86.ActiveCfg = Debug|Any CPU
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/App.config b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/App.config
index 8324aa6ff..92aa00bf9 100644
--- a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/App.config
+++ b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/App.config
@@ -1,6 +1,16 @@
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0" encoding="utf-8"?>
<configuration>
- <startup>
- <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
- </startup>
+ <configSections>
+ <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+ <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+ </configSections>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
+ </startup>
+ <entityFramework>
+ <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
+ <providers>
+ <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+ </providers>
+ </entityFramework>
</configuration> \ No newline at end of file
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/App.xaml.cs b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/App.xaml.cs
index 04e61e96b..7b4aa8b01 100644
--- a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/App.xaml.cs
+++ b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/App.xaml.cs
@@ -13,5 +13,11 @@ namespace Tango.MachineDesigner.UI
/// </summary>
public partial class App : Application
{
+ protected override void OnStartup(StartupEventArgs e)
+ {
+ base.OnStartup(e);
+
+ DBAdapter.Initialize();
+ }
}
}
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/DBAdapter.cs b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/DBAdapter.cs
new file mode 100644
index 000000000..e628db850
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/DBAdapter.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.DAL.Remote.DB;
+using Tango.Settings;
+
+namespace Tango.MachineDesigner.UI
+{
+ public class DBAdapter
+ {
+ public static RemoteDB DbContext { get; set; }
+
+ public static void Initialize()
+ {
+ DbContext = new RemoteDB(SettingsManager.Default.DataBase.SQLServerAddress, false);
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/EntityViewModel.cs b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/EntityViewModel.cs
new file mode 100644
index 000000000..a580098eb
--- /dev/null
+++ b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/EntityViewModel.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.SharedUI;
+
+namespace Tango.MachineDesigner.UI
+{
+ public class EntityViewModel<T> : ViewModel
+ {
+ private T _entity;
+
+ public T Entity
+ {
+ get { return _entity; }
+ set { _entity = value; RaisePropertyChanged(nameof(Entity)); }
+ }
+
+ public EntityViewModel() : base()
+ {
+
+ }
+
+ public EntityViewModel(T entity) : this()
+ {
+ Entity = entity;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/SupervisingController/IMachinesView.cs b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/SupervisingController/IMachinesView.cs
deleted file mode 100644
index ba676c925..000000000
--- a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/SupervisingController/IMachinesView.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Tango.SharedUI;
-
-namespace Tango.MachineDesigner.UI.SupervisingController
-{
- public interface IMachinesView : IView
- {
-
- }
-}
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/Tango.MachineDesigner.UI.csproj b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/Tango.MachineDesigner.UI.csproj
index 7f291de85..b0cce92a0 100644
--- a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/Tango.MachineDesigner.UI.csproj
+++ b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/Tango.MachineDesigner.UI.csproj
@@ -40,6 +40,12 @@
<Reference Include="Dragablz, Version=0.0.3.197, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Dragablz.0.0.3.197\lib\net45\Dragablz.dll</HintPath>
</Reference>
+ <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
+ </Reference>
+ <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+ <HintPath>..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+ </Reference>
<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>
@@ -65,6 +71,7 @@
<HintPath>..\..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
<Reference Include="System" />
+ <Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Data" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
@@ -87,7 +94,8 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
- <Compile Include="SupervisingController\IMachinesView.cs" />
+ <Compile Include="DBAdapter.cs" />
+ <Compile Include="EntityViewModel.cs" />
<Compile Include="SupervisingController\IMainView.cs" />
<Compile Include="ViewModels\MachinesViewVM.cs" />
<Compile Include="ViewModels\MainViewVM.cs" />
@@ -158,6 +166,10 @@
<Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project>
<Name>Tango.Core</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\Tango.DAL.Observables\Tango.DAL.Observables.csproj">
+ <Project>{0ecd6da8-7aa6-48d9-8b65-279d176ad9af}</Project>
+ <Name>Tango.DAL.Observables</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\Tango.DAL.Remote\Tango.DAL.Remote.csproj">
<Project>{38197109-8610-4d3f-92b9-16d48df94d7c}</Project>
<Name>Tango.DAL.Remote</Name>
@@ -166,6 +178,10 @@
<Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project>
<Name>Tango.Logging</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\Tango.Settings\Tango.Settings.csproj">
+ <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project>
+ <Name>Tango.Settings</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\Tango.SharedUI\Tango.SharedUI.csproj">
<Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project>
<Name>Tango.SharedUI</Name>
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/ViewModelLocator.cs b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/ViewModelLocator.cs
index 6b8bc5aea..5d26a3e21 100644
--- a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/ViewModelLocator.cs
+++ b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/ViewModelLocator.cs
@@ -33,17 +33,14 @@ namespace Tango.MachineDesigner.UI
//// SimpleIoc.Default.Register<IDataService, DataService>();
////}
- LogManager.Log("Registering MainView View Model...");
SimpleIoc.Default.Register<MainViewVM>();
+ SimpleIoc.Default.Register<MachinesViewVM>();
//Register View (Supervising Controller Pattern).
if (!ViewModelBase.IsInDesignModeStatic)
{
LogManager.Log(String.Format("Registering Supervising Controller {0}...", nameof(IMainView)));
SimpleIoc.Default.Register(() => (IMainView)MainView.Self);
-
- LogManager.Log(String.Format("Registering Supervising Controller {0}...", nameof(IMachinesView)));
- SimpleIoc.Default.Register(() => (IMachinesView)MainView.Self);
}
}
@@ -54,5 +51,13 @@ namespace Tango.MachineDesigner.UI
return ServiceLocator.Current.GetInstance<MainViewVM>();
}
}
+
+ public MachinesViewVM MachinesViewVM
+ {
+ get
+ {
+ return ServiceLocator.Current.GetInstance<MachinesViewVM>();
+ }
+ }
}
} \ No newline at end of file
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/ViewModels/MachinesViewVM.cs b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/ViewModels/MachinesViewVM.cs
index 6d2cddda6..88a62dff8 100644
--- a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/ViewModels/MachinesViewVM.cs
+++ b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/ViewModels/MachinesViewVM.cs
@@ -1,18 +1,53 @@
using System;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using Tango.MachineDesigner.UI.SupervisingController;
+using Tango.DAL.Observables;
using Tango.SharedUI;
namespace Tango.MachineDesigner.UI.ViewModels
{
- public class MachinesViewVM : ViewModel<IMachinesView>
+ public class MachinesViewVM : ViewModel
{
- public MachinesViewVM(IMachinesView view) : base(view)
+ private ObservableCollection<Machine> _machines;
+ /// <summary>
+ /// Gets or sets the machines.
+ /// </summary>
+ public ObservableCollection<Machine> Machines
{
+ get { return _machines; }
+ set { _machines = value; RaisePropertyChangedAuto(); }
+ }
+
+ private ObservableCollection<Organization> _organizations;
+ /// <summary>
+ /// Gets or sets the organizations.
+ /// </summary>
+ public ObservableCollection<Organization> Organizations
+ {
+ get { return _organizations; }
+ set { _organizations = value; RaisePropertyChangedAuto(); }
+ }
+ private Machine _selectedMachine;
+ /// <summary>
+ /// Gets or sets the selected machine.
+ /// </summary>
+ public Machine SelectedMachine
+ {
+ get { return _selectedMachine; }
+ set { _selectedMachine = value; RaisePropertyChangedAuto(); }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="MachinesViewVM"/> class.
+ /// </summary>
+ public MachinesViewVM() : base()
+ {
+ Organizations = DBAdapter.DbContext.ORGANIZATIONS.Where(x => !x.DELETED).ToList().Select(x => new Organization(x)).ToObservableCollection();
+ Machines = DBAdapter.DbContext.MACHINES.Where(x => !x.DELETED).ToList().Select(x => new Machine(x)).ToObservableCollection();
}
}
}
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/Views/MachinesView.xaml b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/Views/MachinesView.xaml
index c85f03682..0bbf3a285 100644
--- a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/Views/MachinesView.xaml
+++ b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/Views/MachinesView.xaml
@@ -1,4 +1,4 @@
-<controls:View x:Class="Tango.MachineDesigner.UI.Views.MachinesView"
+<UserControl x:Class="Tango.MachineDesigner.UI.Views.MachinesView"
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"
@@ -6,10 +6,38 @@
xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
xmlns:local="clr-namespace:Tango.MachineDesigner.UI.Views"
mc:Ignorable="d"
- d:DesignHeight="720" d:DesignWidth="1280" Background="White">
+ d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{Binding MachinesViewVM, Source={StaticResource Locator}}">
<Grid>
<Grid>
-
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="300"/>
+ <ColumnDefinition Width="1*"/>
+ </Grid.ColumnDefinitions>
+
+ <Grid Margin="10">
+ <ListBox ItemsSource="{Binding Machines}" SelectedItem="{Binding SelectedMachine}">
+ <ListBox.ItemTemplate>
+ <DataTemplate>
+ <TextBlock>
+ <Run Text="{Binding Organization.Name}"></Run>
+ <LineBreak/>
+ <Run Text="{Binding Name}"></Run>
+ <LineBreak/>
+ <Run Text="{Binding Guid}"></Run>
+ </TextBlock>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
+ </Grid>
+
+ <Grid Grid.Column="1" Margin="10">
+ <StackPanel Width="400" HorizontalAlignment="Left">
+ <TextBlock>Name</TextBlock>
+ <TextBox Text="{Binding SelectedMachine.Name}"></TextBox>
+ <TextBlock>Organization</TextBlock>
+ <ComboBox ItemsSource="{Binding Organizations}" SelectedItem="{Binding SelectedMachine.Organization}" DisplayMemberPath="Name"></ComboBox>
+ </StackPanel>
+ </Grid>
</Grid>
</Grid>
-</controls:View>
+</UserControl>
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/Views/MachinesView.xaml.cs b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/Views/MachinesView.xaml.cs
index ebab90278..3b0013051 100644
--- a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/Views/MachinesView.xaml.cs
+++ b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/Views/MachinesView.xaml.cs
@@ -19,7 +19,7 @@ namespace Tango.MachineDesigner.UI.Views
/// <summary>
/// Interaction logic for MachinesView.xaml
/// </summary>
- public partial class MachinesView : View
+ public partial class MachinesView : UserControl
{
public MachinesView() : base()
{
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/Views/MainView.xaml b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/Views/MainView.xaml
index 510ffd0c3..76048199b 100644
--- a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/Views/MainView.xaml
+++ b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/Views/MainView.xaml
@@ -63,7 +63,7 @@
<dragablz:InterTabController />
</dragablz:TabablzControl.InterTabController>
<TabItem Header="MACHINES">
- <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">Hello World</TextBlock>
+ <local:MachinesView></local:MachinesView>
</TabItem>
<TabItem Header="LIQUIDS">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">Material Design</TextBlock>
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/packages.config b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/packages.config
index 08bc64f62..05f5d8725 100644
--- a/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/packages.config
+++ b/Software/Visual_Studio/Utilities/Tango.MachineDesigner.UI/packages.config
@@ -2,6 +2,7 @@
<packages>
<package id="CommonServiceLocator" version="1.3" targetFramework="net46" />
<package id="Dragablz" version="0.0.3.197" targetFramework="net46" />
+ <package id="EntityFramework" version="6.2.0" targetFramework="net46" />
<package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net46" />
<package id="MahApps.Metro" version="1.5.0" targetFramework="net46" />
<package id="MaterialDesignColors" version="1.1.2" targetFramework="net46" />