diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-21 18:39:38 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-21 18:39:38 +0300 |
| commit | 24149160c17fabe143f143de2796f9485d64410b (patch) | |
| tree | a9c4dbcb8be70e4e88dd920697d1a9bf7300a2d5 /Software/Visual_Studio/MachineStudio/Modules | |
| parent | 9e7f301df8d5114249d74aaceddff801170d3e44 (diff) | |
| download | Tango-24149160c17fabe143f143de2796f9485d64410b.tar.gz Tango-24149160c17fabe143f143de2796f9485d64410b.zip | |
Tech Board Module seems to be working good !!
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
23 files changed, 136 insertions, 133 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/AutoComplete/MachineVersionsProvider.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/AutoComplete/MachineVersionsProvider.cs index 18cfca79d..75b4718cd 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/AutoComplete/MachineVersionsProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/AutoComplete/MachineVersionsProvider.cs @@ -21,7 +21,7 @@ namespace Tango.MachineStudio.MachineDesigner.AutoComplete public IEnumerable GetSuggestions(string filter) { Text = filter; - return ObservablesEntitiesAdapter.Instance.MachineVersions.Where(x => x.Version.ToString().StartsWith(filter, StringComparison.CurrentCultureIgnoreCase) || x.Name.StartsWith(filter, StringComparison.CurrentCultureIgnoreCase)).ToList(); + return ObservablesStaticCollections.Instance.MachineVersions.Where(x => x.Version.ToString().StartsWith(filter, StringComparison.CurrentCultureIgnoreCase) || x.Name.StartsWith(filter, StringComparison.CurrentCultureIgnoreCase)).ToList(); } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/AutoComplete/MachinesProvider.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/AutoComplete/MachinesProvider.cs deleted file mode 100644 index 01b74e8a6..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/AutoComplete/MachinesProvider.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.AutoComplete.Editors; -using Tango.BL; -using Tango.BL.Entities; - -namespace Tango.MachineStudio.MachineDesigner.AutoComplete -{ - /// <summary> - /// Represents an auto-complete <see cref="Machine">Machines</see> provider. - /// </summary> - /// <seealso cref="Tango.AutoComplete.Editors.ISuggestionProvider" /> - public class MachinesProvider : ISuggestionProvider - { - /// <summary> - /// Gets the suggestions. - /// </summary> - /// <param name="filter">The filter.</param> - /// <returns></returns> - public IEnumerable GetSuggestions(string filter) - { - return ObservablesEntitiesAdapter.Instance.Machines.Where(x => x.SerialNumber.StartsWith(filter, StringComparison.CurrentCultureIgnoreCase)).ToList(); - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj index 78f52b3fd..a578d0e54 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj @@ -75,7 +75,6 @@ <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs"> <Link>GlobalVersionInfo.cs</Link> </Compile> - <Compile Include="AutoComplete\MachinesProvider.cs" /> <Compile Include="AutoComplete\MachineVersionsProvider.cs" /> <Compile Include="ViewModelLocator.cs" /> <Compile Include="ViewModels\MachineVersionDialogVM.cs" /> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs index a819a4d1a..d2838b758 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs @@ -130,11 +130,6 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels /// </summary> public ISuggestionProvider MachinesProvider { get; set; } - /// <summary> - /// Gets or sets the versions provider. - /// </summary> - public ISuggestionProvider VersionsProvider { get; set; } - #endregion #region Commands @@ -203,11 +198,6 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { return _db.Machines.Where(x => x.SerialNumber.StartsWith(filter)).ToList(); }); - - VersionsProvider = new SuggestionProvider((filter) => - { - return _db.MachineVersions.Where(x => x.Version.ToString().StartsWith(filter) || x.Name.StartsWith(filter)).ToList(); - }); } #endregion @@ -283,7 +273,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { InitCollections().Wait(); Machine = _db.Machines.Where(x => x.Guid == SelectedMachine.Guid).Include(x => x.Organization).SingleOrDefault(x => x.Guid == SelectedMachine.Guid); - Configuration = _db.LoadConfiguration(x => x.Guid == Machine.ConfigurationGuid); + Configuration = _db.GetConfiguration(x => x.Guid == Machine.ConfigurationGuid); SetHistory(); @@ -312,7 +302,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { CanWork = false; - SelectedHistoryConfiguration = _db.LoadConfiguration(x => x.Guid == SelectedHistoryConfiguration.Guid); + SelectedHistoryConfiguration = _db.GetConfiguration(x => x.Guid == SelectedHistoryConfiguration.Guid); Configuration = SelectedHistoryConfiguration; Machine.Configuration = Configuration; @@ -700,7 +690,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels await Task.Factory.StartNew(() => { var version = _db.MachineVersions.Where(x => x.Guid == Machine.MachineVersion.Guid).Include(x => x.DefaultConfiguration).FirstOrDefault(); - var version_config = _db.LoadConfiguration(x => x.Guid == version.DefaultConfiguration.Guid); + var version_config = _db.GetConfiguration(x => x.Guid == version.DefaultConfiguration.Guid); Configuration = version_config.Clone(); Machine.Configuration = Configuration; }); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml index 4d75651f7..e2dd7c5a9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineView.xaml @@ -17,7 +17,6 @@ <UserControl.Resources> <sharedConverters:ColorToIntegerConverter x:Key="ColorToIntegerConverter" /> - <providers:MachinesProvider x:Key="MachinesProvider"></providers:MachinesProvider> <Style x:Key="draggableGrid" TargetType="Grid"> <Setter Property="RenderTransform"> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/JobRunnerTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/JobRunnerTemplate.xaml index 4de0bff14..b6bfefd8c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/JobRunnerTemplate.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/JobRunnerTemplate.xaml @@ -29,7 +29,7 @@ <GroupBox Header="JOB RUNNER"> <StackPanel> <TextBlock FontSize="10">Machine</TextBlock> - <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.MachinesViewSource}" SelectedItem="{Binding Machine,Mode=TwoWay}"> + <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.Machines}" SelectedItem="{Binding Machine,Mode=TwoWay}"> <ComboBox.ItemTemplate> <DataTemplate> <StackPanel Margin="0 5"> @@ -41,7 +41,7 @@ </ComboBox> <TextBlock FontSize="10" Margin="0 10 0 0" >RML</TextBlock> - <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.RmlsViewSource}" SelectedItem="{Binding Rml,Mode=TwoWay}" DisplayMemberPath="Name" /> + <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.Rmls}" SelectedItem="{Binding Rml,Mode=TwoWay}" DisplayMemberPath="Name" /> <TextBlock Margin="0 10 0 0" FontSize="10">Process Parameters</TextBlock> <ComboBox Margin="0 5 0 0" ItemsSource="{x:Static items:ProcessParametersItem.ProcessParametersTables}" SelectedItem="{Binding ProcessParameters,Mode=TwoWay}" DisplayMemberPath="Name" /> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ProcessParametersTemplate.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ProcessParametersTemplate.xaml index 5e5a6d46d..46a6a6340 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ProcessParametersTemplate.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/PropertiesTemplates/ProcessParametersTemplate.xaml @@ -27,7 +27,7 @@ <GroupBox Header="PROCESS PARAMETERS"> <StackPanel> <TextBlock FontSize="10">Reset to RML</TextBlock> - <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.RmlsViewSource}" SelectedItem="{Binding SelectedResetRML,Mode=TwoWay}" DisplayMemberPath="Name" /> + <ComboBox Margin="0 5 0 0" ItemsSource="{Binding Adapter.Rmls}" SelectedItem="{Binding SelectedResetRML,Mode=TwoWay}" DisplayMemberPath="Name" /> <Button Margin="0 10 0 0" Command="{Binding ResetToRMLCommand}">RESET</Button> </StackPanel> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj index d5e2f3dcd..e187db982 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj @@ -31,6 +31,12 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> + <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\EntityFramework.6.0.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.0.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> @@ -47,6 +53,7 @@ <HintPath>..\..\..\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath> </Reference> <Reference Include="System" /> + <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Data" /> <Reference Include="System.Reactive.Core, Version=3.0.3000.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL"> <HintPath>..\..\..\packages\System.Reactive.Core.3.1.1\lib\net46\System.Reactive.Core.dll</HintPath> @@ -612,7 +619,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs index 59a96f107..6b532204e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BlowerItem.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Media; using System.Xml.Serialization; +using Tango.BL; using Tango.BL.Entities; using Tango.SharedUI.Helpers; @@ -31,7 +32,7 @@ namespace Tango.MachineStudio.Technician.TechItems { BlowerConfigurations = new List<HardwareBlower>(); - foreach (var BlowerType in BL.ObservablesEntitiesAdapter.Instance.HardwareBlowerTypes) + foreach (var BlowerType in ObservablesStaticCollections.Instance.HardwareBlowerTypes) { BlowerConfigurations.Add(new HardwareBlower() { HardwareBlowerType = BlowerType }); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BreakSensorItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BreakSensorItem.cs index cf1ed682e..4a0d1c9c9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BreakSensorItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/BreakSensorItem.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Media; using System.Xml.Serialization; +using Tango.BL; using Tango.BL.Entities; using Tango.SharedUI.Helpers; @@ -31,7 +32,7 @@ namespace Tango.MachineStudio.Technician.TechItems { BreakSensorConfigurations = new List<HardwareBreakSensor>(); - foreach (var BreakSensorType in BL.ObservablesEntitiesAdapter.Instance.HardwareBreakSensorTypes) + foreach (var BreakSensorType in ObservablesStaticCollections.Instance.HardwareBreakSensorTypes) { BreakSensorConfigurations.Add(new HardwareBreakSensor() { HardwareBreakSensorType = BreakSensorType }); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DancerItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DancerItem.cs index e5651acce..1115c6dbf 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DancerItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DancerItem.cs @@ -33,7 +33,7 @@ namespace Tango.MachineStudio.Technician.TechItems { DancerConfigurations = new List<HardwareDancer>(); - foreach (var winderType in BL.ObservablesEntitiesAdapter.Instance.HardwareDancerTypes) + foreach (var winderType in BL.ObservablesStaticCollections.Instance.HardwareDancerTypes) { DancerConfigurations.Add(new HardwareDancer() { HardwareDancerType = winderType }); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs index f058036d0..7945c5b73 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/DispenserItem.cs @@ -37,7 +37,7 @@ namespace Tango.MachineStudio.Technician.TechItems { DispenserTypes = new List<DispenserType>(); - foreach (var techDispenser in BL.ObservablesEntitiesAdapter.Instance.TechDispensers) + foreach (var techDispenser in BL.ObservablesStaticCollections.Instance.TechDispensers) { DispenserTypes.Add(new DispenserType() { Code = int.Parse(techDispenser.Name.Replace("Dispenser", "")) - 1 }); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/JobRunnerItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/JobRunnerItem.cs index 8d102d6c0..3443c008e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/JobRunnerItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/JobRunnerItem.cs @@ -160,6 +160,7 @@ namespace Tango.MachineStudio.Technician.TechItems { Job.Machine = Machine; Job.Rml = Rml; + BrushStop.SetLiquidVolumes(Machine.Configuration, Rml, ProcessParameters); } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorGroupItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorGroupItem.cs index 5cdb8017e..a5288e6bc 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorGroupItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorGroupItem.cs @@ -59,7 +59,7 @@ namespace Tango.MachineStudio.Technician.TechItems { if (TechMotors != null) { - SelectedMotors = new SelectedObjectCollection<HardwareMotorType>(ObservablesEntitiesAdapter.Instance.HardwareMotorTypes.ToObservableCollection(), TechMotors); + SelectedMotors = new SelectedObjectCollection<HardwareMotorType>(ObservablesStaticCollections.Instance.HardwareMotorTypes.ToObservableCollection(), TechMotors); } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs index 779919039..c097a0b7b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MotorItem.cs @@ -38,7 +38,7 @@ namespace Tango.MachineStudio.Technician.TechItems { MotorConfigurations = new List<HardwareMotor>(); - foreach (var motorType in BL.ObservablesEntitiesAdapter.Instance.HardwareMotorTypes) + foreach (var motorType in BL.ObservablesStaticCollections.Instance.HardwareMotorTypes) { MotorConfigurations.Add(new HardwareMotor() { HardwareMotorType = motorType }); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/PidItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/PidItem.cs index a56c3b0c1..70ecc1a70 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/PidItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/PidItem.cs @@ -33,7 +33,7 @@ namespace Tango.MachineStudio.Technician.TechItems { PidConfigurations = new List<HardwarePidControl>(); - foreach (var pidType in BL.ObservablesEntitiesAdapter.Instance.HardwarePidControlTypes) + foreach (var pidType in BL.ObservablesStaticCollections.Instance.HardwarePidControlTypes) { PidConfigurations.Add(new HardwarePidControl() { HardwarePidControlType = pidType }); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ProcessParametersItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ProcessParametersItem.cs index 79aea7a0c..1bedcb1ca 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ProcessParametersItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/ProcessParametersItem.cs @@ -6,6 +6,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Media; using System.Xml.Serialization; +using Tango.BL; using Tango.BL.Entities; using Tango.Core.Commands; using Tango.SharedUI.Helpers; @@ -93,7 +94,9 @@ namespace Tango.MachineStudio.Technician.TechItems if (_counter > 1) { + String name = ProcessParameters.Name; ProcessParametersTables.Add(ProcessParameters); + ProcessParameters.Name = name; } } @@ -101,15 +104,18 @@ namespace Tango.MachineStudio.Technician.TechItems { if (SelectedResetRML != null) { - var group = SelectedResetRML.ProcessParametersTablesGroups.FirstOrDefault(x => x.Active); - - if (group != null) + using (ObservablesContext db = ObservablesContext.CreateDefault()) { - var table = group.ProcessParametersTables.OrderBy(x => x.TableIndex).FirstOrDefault(); + var group = db.GetActiveProcessParametersTablesGroup(SelectedResetRML.Guid); - if (table != null) + if (group != null) { - ProcessParameters = table.Clone(); + var table = group.ProcessParametersTables.OrderBy(x => x.TableIndex).FirstOrDefault(); + + if (table != null) + { + table.MapPrimitivesTo(ProcessParameters); + } } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SpeedSensorItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SpeedSensorItem.cs index a067ec95f..e43a518c1 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SpeedSensorItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SpeedSensorItem.cs @@ -33,7 +33,7 @@ namespace Tango.MachineStudio.Technician.TechItems { SpeedSensorConfigurations = new List<HardwareSpeedSensor>(); - foreach (var SpeedSensorType in BL.ObservablesEntitiesAdapter.Instance.HardwareSpeedSensorTypes) + foreach (var SpeedSensorType in BL.ObservablesStaticCollections.Instance.HardwareSpeedSensorTypes) { SpeedSensorConfigurations.Add(new HardwareSpeedSensor() { HardwareSpeedSensorType = SpeedSensorType }); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs index 11188c69d..b6ebf2857 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/TechItem.cs @@ -47,7 +47,7 @@ namespace Tango.MachineStudio.Technician.TechItems { ID = Guid.NewGuid().ToString(); Name = "Untitled"; - Adapter = ObservablesEntitiesAdapter.Instance; + Adapter = ObservablesStaticCollections.Instance; _color = Colors.DodgerBlue; } @@ -77,7 +77,7 @@ namespace Tango.MachineStudio.Technician.TechItems /// Gets or sets the db adapter. /// </summary> [XmlIgnore] - public ObservablesEntitiesAdapter Adapter { get; set; } + public ObservablesStaticCollections Adapter { get; set; } private String _id; /// <summary> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/WinderItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/WinderItem.cs index 425baf471..2df2d7ad7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/WinderItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/WinderItem.cs @@ -33,7 +33,7 @@ namespace Tango.MachineStudio.Technician.TechItems { WinderConfigurations = new List<HardwareWinder>(); - foreach (var winderType in BL.ObservablesEntitiesAdapter.Instance.HardwareWinderTypes) + foreach (var winderType in BL.ObservablesStaticCollections.Instance.HardwareWinderTypes) { WinderConfigurations.Add(new HardwareWinder() { HardwareWinderType = winderType }); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index 333e43187..8b331b5f5 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -94,7 +94,7 @@ namespace Tango.MachineStudio.Technician.ViewModels /// <summary> /// Gets or sets the db adapter. /// </summary> - public ObservablesEntitiesAdapter Adapter { get; set; } + public ObservablesStaticCollections Adapter { get; set; } /// <summary> /// Gets or sets the application manager. @@ -241,7 +241,7 @@ namespace Tango.MachineStudio.Technician.ViewModels ApplicationManager = applicationManager; ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; - Adapter = ObservablesEntitiesAdapter.Instance; + Adapter = ObservablesStaticCollections.Instance; Elements = new ObservableCollection<IElementEditor>(); OpenProjectCommand = new RelayCommand(OpenProject); @@ -1473,7 +1473,7 @@ namespace Tango.MachineStudio.Technician.ViewModels { if (item is MotorGroupItem) { - (item as MotorGroupItem).TechMotors = ObservablesEntitiesAdapter.Instance.HardwareMotorTypes.Where(x => (item as MotorGroupItem).ItemsGuids.Contains(x.Guid)).ToObservableCollection(); + (item as MotorGroupItem).TechMotors = ObservablesStaticCollections.Instance.HardwareMotorTypes.Where(x => (item as MotorGroupItem).ItemsGuids.Contains(x.Guid)).ToObservableCollection(); } AddTechItem(item); @@ -1666,83 +1666,93 @@ namespace Tango.MachineStudio.Technician.ViewModels { if (MachineOperator != null) { - var hw = ApplicationManager.ConnectedMachine.Machine.Configuration.HardwareVersion.Clone(); - - foreach (var motorConfig in hw.HardwareMotors) + using (_notification.PushTaskItem("Uploading hardware configuration...")) { - var itemConfig = MotorItem.MotorConfigurations.SingleOrDefault(x => x.HardwareMotorType.Code == motorConfig.HardwareMotorType.Code); - - if (itemConfig != null) + try { - itemConfig.MapPrimitivesTo(motorConfig); - } - } + HardwareVersion hw = null; + Configuration config = null; - foreach (var pidConfig in hw.HardwarePidControls) - { - var itemConfig = PidItem.PidConfigurations.SingleOrDefault(x => x.HardwarePidControlType.Code == pidConfig.HardwarePidControlType.Code); + await Task.Factory.StartNew(() => + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + config = db.GetConfiguration(x => x.Guid == ApplicationManager.ConnectedMachine.Machine.ConfigurationGuid).Clone(); + hw = db.GetHardwareVersionByMachine(ApplicationManager.ConnectedMachine.Machine.Guid).Clone(); + } + }); - if (itemConfig != null) - { - itemConfig.MapPrimitivesTo(pidConfig); - } - } + foreach (var motorConfig in hw.HardwareMotors) + { + var itemConfig = MotorItem.MotorConfigurations.SingleOrDefault(x => x.HardwareMotorType.Code == motorConfig.HardwareMotorType.Code); - foreach (var winderConfig in hw.HardwareWinders) - { - var itemConfig = WinderItem.WinderConfigurations.SingleOrDefault(x => x.HardwareWinderType.Code == winderConfig.HardwareWinderType.Code); + if (itemConfig != null) + { + itemConfig.MapPrimitivesTo(motorConfig); + } + } - if (itemConfig != null) - { - itemConfig.MapPrimitivesTo(winderConfig); - } - } + foreach (var pidConfig in hw.HardwarePidControls) + { + var itemConfig = PidItem.PidConfigurations.SingleOrDefault(x => x.HardwarePidControlType.Code == pidConfig.HardwarePidControlType.Code); - foreach (var dancerConfig in hw.HardwareDancers) - { - var itemConfig = DancerItem.DancerConfigurations.SingleOrDefault(x => x.HardwareDancerType.Code == dancerConfig.HardwareDancerType.Code); + if (itemConfig != null) + { + itemConfig.MapPrimitivesTo(pidConfig); + } + } - if (itemConfig != null) - { - itemConfig.MapPrimitivesTo(dancerConfig); - } - } + foreach (var winderConfig in hw.HardwareWinders) + { + var itemConfig = WinderItem.WinderConfigurations.SingleOrDefault(x => x.HardwareWinderType.Code == winderConfig.HardwareWinderType.Code); - foreach (var speedSensorConfig in hw.HardwareSpeedSensors) - { - var itemConfig = SpeedSensorItem.SpeedSensorConfigurations.SingleOrDefault(x => x.HardwareSpeedSensorType.Code == speedSensorConfig.HardwareSpeedSensorType.Code); + if (itemConfig != null) + { + itemConfig.MapPrimitivesTo(winderConfig); + } + } - if (itemConfig != null) - { - itemConfig.MapPrimitivesTo(speedSensorConfig); - } - } + foreach (var dancerConfig in hw.HardwareDancers) + { + var itemConfig = DancerItem.DancerConfigurations.SingleOrDefault(x => x.HardwareDancerType.Code == dancerConfig.HardwareDancerType.Code); - foreach (var blowerConfig in hw.HardwareBlowers) - { - var itemConfig = BlowerItem.BlowerConfigurations.SingleOrDefault(x => x.HardwareBlowerType.Code == blowerConfig.HardwareBlowerType.Code); + if (itemConfig != null) + { + itemConfig.MapPrimitivesTo(dancerConfig); + } + } - if (itemConfig != null) - { - itemConfig.MapPrimitivesTo(blowerConfig); - } - } + foreach (var speedSensorConfig in hw.HardwareSpeedSensors) + { + var itemConfig = SpeedSensorItem.SpeedSensorConfigurations.SingleOrDefault(x => x.HardwareSpeedSensorType.Code == speedSensorConfig.HardwareSpeedSensorType.Code); - foreach (var breakSensorConfig in hw.HardwareBreakSensors) - { - var itemConfig = BreakSensorItem.BreakSensorConfigurations.SingleOrDefault(x => x.HardwareBreakSensorType.Code == breakSensorConfig.HardwareBreakSensorType.Code); + if (itemConfig != null) + { + itemConfig.MapPrimitivesTo(speedSensorConfig); + } + } - if (itemConfig != null) - { - itemConfig.MapPrimitivesTo(breakSensorConfig); - } - } + foreach (var blowerConfig in hw.HardwareBlowers) + { + var itemConfig = BlowerItem.BlowerConfigurations.SingleOrDefault(x => x.HardwareBlowerType.Code == blowerConfig.HardwareBlowerType.Code); - using (_notification.PushTaskItem("Uploading hardware configuration...")) - { - try - { - await MachineOperator.UploadHardwareConfiguration(hw, ApplicationManager.ConnectedMachine.Machine.Configuration); + if (itemConfig != null) + { + itemConfig.MapPrimitivesTo(blowerConfig); + } + } + + foreach (var breakSensorConfig in hw.HardwareBreakSensors) + { + var itemConfig = BreakSensorItem.BreakSensorConfigurations.SingleOrDefault(x => x.HardwareBreakSensorType.Code == breakSensorConfig.HardwareBreakSensorType.Code); + + if (itemConfig != null) + { + itemConfig.MapPrimitivesTo(breakSensorConfig); + } + } + + await MachineOperator.UploadHardwareConfiguration(hw, config); } catch (Exception ex) { @@ -1753,11 +1763,18 @@ namespace Tango.MachineStudio.Technician.ViewModels } } - private void ResetHardwareConfiguration(bool showMessage = true) + private async void ResetHardwareConfiguration(bool showMessage = true) { if (MachineOperator != null) { - var hw = ApplicationManager.ConnectedMachine.Machine.Configuration.HardwareVersion; + ObservablesContext db = ObservablesContext.CreateDefault(); + + HardwareVersion hw = null; + + await Task.Factory.StartNew(() => + { + hw = db.GetHardwareVersionByMachine(ApplicationManager.ConnectedMachine.Machine.Guid); + }); foreach (var motorConfig in hw.HardwareMotors) { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/app.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/app.config index 5d794b958..77b7003e2 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/app.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/app.config @@ -1,5 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <configuration> + <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> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> @@ -48,4 +52,10 @@ </dependentAssembly> </assemblyBinding> </runtime> + <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/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config index 49b90c865..ea48e62ff 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/packages.config @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <packages> <package id="CommonServiceLocator" version="1.3" targetFramework="net46" /> + <package id="EntityFramework" version="6.0.0" targetFramework="net472" /> <package id="Expression.Blend.Sdk" version="1.0.2" targetFramework="net46" /> <package id="FontAwesome.WPF" version="4.7.0.9" targetFramework="net46" /> <package id="Google.Protobuf" version="3.4.1" targetFramework="net46" /> |
