diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2017-12-19 10:25:40 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2017-12-19 10:25:40 +0200 |
| commit | afc7a07d285e08d905c58dd5978441c155b2f296 (patch) | |
| tree | a2f4f51ef2747ae3a2aded2637a352ce8ef85934 /Software/Visual_Studio | |
| parent | ad35c9c2df0001157ea13312382f3cdfdad67f06 (diff) | |
| download | Tango-afc7a07d285e08d905c58dd5978441c155b2f296.tar.gz Tango-afc7a07d285e08d905c58dd5978441c155b2f296.zip | |
MERGE.
Diffstat (limited to 'Software/Visual_Studio')
259 files changed, 12756 insertions, 707 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs index b1a268a9b..0928d2a1f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs @@ -25,7 +25,7 @@ namespace Tango.MachineStudio.DB public bool IsInitialized => _isInitialized; - public PermissionsEnum Permission => PermissionsEnum.RunDataBaseModule; + public Permissions Permission => Permissions.RunDataBaseModule; public void Dispose() { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ExtensionMethods/INotificationProviderExtensions.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ExtensionMethods/INotificationProviderExtensions.cs index 2da59724c..8d95bb38e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ExtensionMethods/INotificationProviderExtensions.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ExtensionMethods/INotificationProviderExtensions.cs @@ -9,6 +9,7 @@ using Tango.DAL.Observables; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.DB.ViewModels; using Tango.MachineStudio.DB.Views.DBViews; +using Tango.MachineStudio.DB.Windows; namespace Tango.MachineStudio.DB.ExtensionMethods { @@ -17,11 +18,13 @@ namespace Tango.MachineStudio.DB.ExtensionMethods public static bool ShowDialog<T>(this INotificationProvider provider, DialogOpenMode mode, DbTableViewModel<T> context) where T : class, IObservableEntity { Type viewType = typeof(INotificationProviderExtensions).Assembly.GetType(typeof(OrganizationView).Namespace + "." + typeof(T).Name + "View"); - return provider.ShowDialog( - (mode == DialogOpenMode.Editing ? PackIconKind.TableEdit : PackIconKind.Plus), - (mode == DialogOpenMode.Editing ? "Edit " : "Add New ") + typeof(T).Name, - Activator.CreateInstance(viewType) as FrameworkElement, - context); + + DBDialogWindow window = new DBDialogWindow(Activator.CreateInstance(viewType) as FrameworkElement); + window.IconKind = (mode == DialogOpenMode.Editing ? PackIconKind.TableEdit : PackIconKind.Plus); + window.InnerTitle = (mode == DialogOpenMode.Editing ? "Edit " : "Add New ") + typeof(T).Name; + window.DataContext = context; + + return provider.ShowModalWindow(window).Value; } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Managers/ViewsManager.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Managers/ViewsManager.cs index ba68fa358..2bb5969bc 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Managers/ViewsManager.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Managers/ViewsManager.cs @@ -22,9 +22,9 @@ namespace Tango.MachineStudio.DB.Managers DisplayedViews = new ObservableCollection<RegisteredView>(); DbViews = new ObservableCollection<RegisteredView>(); - foreach (var type in typeof(ViewsManager).Assembly.GetTypes().Where(x => x.CustomAttributes.Count() > 0 && x.CustomAttributes.First().AttributeType == typeof(DBViewAttribute))) + foreach (var type in typeof(ViewsManager).Assembly.GetTypes().Where(x => x.CustomAttributes.Count() > 0 && x.CustomAttributes.First().AttributeType == typeof(DBViewAttribute)).OrderBy(x => x.Name)) { - DbViews.Add(new RegisteredView(type.Name.Replace("View", ""), Activator.CreateInstance(type) as FrameworkElement)); + DbViews.Add(new RegisteredView(type.Name.Replace("View", "").ToTitle(), Activator.CreateInstance(type) as FrameworkElement)); } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Messages/CloseEntityEditViewMessage.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Messages/CloseEntityEditViewMessage.cs new file mode 100644 index 000000000..97e5cf21c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Messages/CloseEntityEditViewMessage.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.MachineStudio.Common.Messages; + +namespace Tango.MachineStudio.DB.Messages +{ + public class CloseEntityEditViewMessage : IStudioMessage + { + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Messages/OpenEntityEditViewMessage.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Messages/OpenEntityEditViewMessage.cs new file mode 100644 index 000000000..b3bf53f93 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Messages/OpenEntityEditViewMessage.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Messages; +using Tango.MachineStudio.DB.ViewModels; +using Tango.SharedUI; + +namespace Tango.MachineStudio.DB.Messages +{ + public class OpenEntityEditViewMessage : IStudioMessage + { + public DialogOpenMode DialogOpenMode { get; set; } + + public ViewModel Context { get; set; } + + public Type EntityType { get; set; } + + public OpenEntityEditViewMessage(DialogOpenMode mode, ViewModel context, Type entityType) + { + DialogOpenMode = mode; + Context = context; + EntityType = entityType; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj index 712a99953..bb52ecb86 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj @@ -61,6 +61,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="SimpleValidator, Version=0.6.1.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\SimpleValidator.0.6.1.0\lib\net40\SimpleValidator.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Data" /> @@ -79,15 +82,35 @@ <Reference Include="WindowsBase" /> <Reference Include="PresentationCore" /> <Reference Include="PresentationFramework" /> + <Reference Include="WriteableBitmapEx.Wpf, Version=1.5.0.0, Culture=neutral, PublicKeyToken=50375ca6144f1c69, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\WriteableBitmapEx.1.5.0.0\lib\net40\WriteableBitmapEx.Wpf.dll</HintPath> + </Reference> </ItemGroup> <ItemGroup> <Compile Include="Converters\RolesPermissionsToStringConverter.cs" /> <Compile Include="DBModule.cs" /> <Compile Include="ExtensionMethods\INotificationProviderExtensions.cs" /> + <Compile Include="Messages\CloseEntityEditViewMessage.cs" /> + <Compile Include="Messages\OpenEntityEditViewMessage.cs" /> <Compile Include="ViewModels\AddressesViewVM.cs" /> + <Compile Include="ViewModels\ApplicationDisplayPanelVersionsViewVM.cs" /> + <Compile Include="ViewModels\ApplicationFirmwareVersionsViewVM.cs" /> + <Compile Include="ViewModels\ApplicationOsVersionsViewVM.cs" /> + <Compile Include="ViewModels\ApplicationVersionsViewVM.cs" /> + <Compile Include="ViewModels\CartridgesViewVM.cs" /> + <Compile Include="ViewModels\CartridgeTypesViewVM.cs" /> + <Compile Include="ViewModels\ConfigurationsViewVM.cs" /> <Compile Include="ViewModels\DbTableViewModel.cs" /> <Compile Include="ViewModels\DialogOpenMode.cs" /> + <Compile Include="ViewModels\DispenserTypesViewVM.cs" /> + <Compile Include="ViewModels\DispensersViewVM.cs" /> + <Compile Include="ViewModels\EmbeddedFirmwareVersionsViewVM.cs" /> + <Compile Include="ViewModels\EmbeddedSoftwareVersionsViewVM.cs" /> + <Compile Include="ViewModels\HardwareVersionsViewVM.cs" /> + <Compile Include="ViewModels\IdsPacksViewVM.cs" /> + <Compile Include="ViewModels\LiquidsViewVM.cs" /> <Compile Include="ViewModels\MachinesViewVM.cs" /> + <Compile Include="ViewModels\MachineVersionsViewVM.cs" /> <Compile Include="ViewModels\MultiComboVM.cs" /> <Compile Include="ViewModels\OrganizationsViewVM.cs" /> <Compile Include="ViewModels\PermissionsViewVM.cs" /> @@ -96,6 +119,96 @@ <Compile Include="ViewModels\EntityViewModel.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> <Compile Include="ViewModelLocator.cs" /> + <Compile Include="Views\DBViews\IdsPacksView.xaml.cs"> + <DependentUpon>IdsPacksView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\CartridgeTypesView.xaml.cs"> + <DependentUpon>CartridgeTypesView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\CartridgesView.xaml.cs"> + <DependentUpon>CartridgesView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\DispensersView.xaml.cs"> + <DependentUpon>DispensersView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\DispenserTypesView.xaml.cs"> + <DependentUpon>DispenserTypesView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\CartridgeTypeView.xaml.cs"> + <DependentUpon>CartridgeTypeView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\CartridgeView.xaml.cs"> + <DependentUpon>CartridgeView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\DispenserView.xaml.cs"> + <DependentUpon>DispenserView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\DispenserTypeView.xaml.cs"> + <DependentUpon>DispenserTypeView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\IdsPackView.xaml.cs"> + <DependentUpon>IdsPackView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\LiquidView.xaml.cs"> + <DependentUpon>LiquidView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\LiquidsView.xaml.cs"> + <DependentUpon>LiquidsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\HardwareVersionView.xaml.cs"> + <DependentUpon>HardwareVersionView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\EmbeddedSoftwareVersionView.xaml.cs"> + <DependentUpon>EmbeddedSoftwareVersionView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\EmbeddedFirmwareVersionView.xaml.cs"> + <DependentUpon>EmbeddedFirmwareVersionView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\ApplicationVersionView.xaml.cs"> + <DependentUpon>ApplicationVersionView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\ApplicationOsVersionView.xaml.cs"> + <DependentUpon>ApplicationOsVersionView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\ApplicationFirmwareVersionView.xaml.cs"> + <DependentUpon>ApplicationFirmwareVersionView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\HardwareVersionsView.xaml.cs"> + <DependentUpon>HardwareVersionsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\EmbeddedSoftwareVersionsView.xaml.cs"> + <DependentUpon>EmbeddedSoftwareVersionsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\EmbeddedFirmwareVersionsView.xaml.cs"> + <DependentUpon>EmbeddedFirmwareVersionsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\ApplicationVersionsView.xaml.cs"> + <DependentUpon>ApplicationVersionsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\ApplicationOsVersionsView.xaml.cs"> + <DependentUpon>ApplicationOsVersionsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\ApplicationFirmwareVersionsView.xaml.cs"> + <DependentUpon>ApplicationFirmwareVersionsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\ConfigurationsView.xaml.cs"> + <DependentUpon>ConfigurationsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\ApplicationDisplayPanelVersionsView.xaml.cs"> + <DependentUpon>ApplicationDisplayPanelVersionsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\MachineVersionsView.xaml.cs"> + <DependentUpon>MachineVersionsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\ApplicationDisplayPanelVersionView.xaml.cs"> + <DependentUpon>ApplicationDisplayPanelVersionView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\MachineVersionView.xaml.cs"> + <DependentUpon>MachineVersionView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\ConfigurationView.xaml.cs"> + <DependentUpon>ConfigurationView.xaml</DependentUpon> + </Compile> <Compile Include="Views\DBViews\PermissionView.xaml.cs"> <DependentUpon>PermissionView.xaml</DependentUpon> </Compile> @@ -135,6 +248,9 @@ <Compile Include="Views\MainDBView.xaml.cs"> <DependentUpon>MainDBView.xaml</DependentUpon> </Compile> + <Compile Include="Windows\DBDialogWindow.xaml.cs"> + <DependentUpon>DBDialogWindow.xaml</DependentUpon> + </Compile> <Page Include="Controls\DbTableView.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -150,6 +266,126 @@ <Compile Include="CustomAttributes\DBViewAttribute.cs" /> <Compile Include="Managers\RegisteredView.cs" /> <Compile Include="Managers\ViewsManager.cs" /> + <Page Include="Views\DBViews\IdsPacksView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\CartridgeTypesView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\CartridgesView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\DispensersView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\DispenserTypesView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\CartridgeTypeView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\CartridgeView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\DispenserView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\DispenserTypeView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\IdsPackView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\LiquidView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\LiquidsView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\HardwareVersionView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\EmbeddedSoftwareVersionView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\EmbeddedFirmwareVersionView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\ApplicationVersionView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\ApplicationOsVersionView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\ApplicationFirmwareVersionView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\HardwareVersionsView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\EmbeddedSoftwareVersionsView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\EmbeddedFirmwareVersionsView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\ApplicationVersionsView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\ApplicationOsVersionsView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\ApplicationFirmwareVersionsView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\ConfigurationsView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\ApplicationDisplayPanelVersionsView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\MachineVersionsView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\ApplicationDisplayPanelVersionView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\MachineVersionView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\ConfigurationView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="Views\DBViews\PermissionView.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -202,6 +438,10 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> + <Page Include="Windows\DBDialogWindow.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs"> @@ -229,6 +469,10 @@ </None> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\..\..\Tango.ColorPicker\Tango.ColorPicker.csproj"> + <Project>{a2f5af44-29ff-45d6-9d25-ecda5cce88b5}</Project> + <Name>Tango.ColorPicker</Name> + </ProjectReference> <ProjectReference Include="..\..\..\Tango.Core\Tango.Core.csproj"> <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> <Name>Tango.Core</Name> @@ -259,5 +503,6 @@ <ItemGroup> <Resource Include="Images\seamless-grid.jpg" /> </ItemGroup> + <ItemGroup /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs index c5f3f452e..48175ed17 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs @@ -24,6 +24,23 @@ namespace Tango.MachineStudio.DB SimpleIoc.Default.Register<UsersViewVM>(); SimpleIoc.Default.Register<RolesViewVM>(); SimpleIoc.Default.Register<PermissionsViewVM>(); + SimpleIoc.Default.Register<MachineVersionsViewVM>(); + SimpleIoc.Default.Register<ConfigurationsViewVM>(); + + SimpleIoc.Default.Register<ApplicationDisplayPanelVersionsViewVM>(); + SimpleIoc.Default.Register<ApplicationFirmwareVersionsViewVM>(); + SimpleIoc.Default.Register<ApplicationOsVersionsViewVM>(); + SimpleIoc.Default.Register<ApplicationVersionsViewVM>(); + SimpleIoc.Default.Register<EmbeddedFirmwareVersionsViewVM>(); + SimpleIoc.Default.Register<EmbeddedSoftwareVersionsViewVM>(); + SimpleIoc.Default.Register<HardwareVersionsViewVM>(); + + SimpleIoc.Default.Register<IdsPacksViewVM>(); + SimpleIoc.Default.Register<DispensersViewVM>(); + SimpleIoc.Default.Register<DispenserTypesViewVM>(); + SimpleIoc.Default.Register<LiquidsViewVM>(); + SimpleIoc.Default.Register<CartridgesViewVM>(); + SimpleIoc.Default.Register<CartridgeTypesViewVM>(); } public static MainViewVM MainViewVM @@ -81,5 +98,125 @@ namespace Tango.MachineStudio.DB return ServiceLocator.Current.GetInstance<PermissionsViewVM>(); } } + + public static MachineVersionsViewVM MachineVersionsViewVM + { + get + { + return ServiceLocator.Current.GetInstance<MachineVersionsViewVM>(); + } + } + + public static ConfigurationsViewVM ConfigurationsViewVM + { + get + { + return ServiceLocator.Current.GetInstance<ConfigurationsViewVM>(); + } + } + + public static ApplicationDisplayPanelVersionsViewVM ApplicationDisplayPanelVersionsViewVM + { + get + { + return ServiceLocator.Current.GetInstance<ApplicationDisplayPanelVersionsViewVM>(); + } + } + + public static ApplicationFirmwareVersionsViewVM ApplicationFirmwareVersionsViewVM + { + get + { + return ServiceLocator.Current.GetInstance<ApplicationFirmwareVersionsViewVM>(); + } + } + + public static ApplicationOsVersionsViewVM ApplicationOsVersionsViewVM + { + get + { + return ServiceLocator.Current.GetInstance<ApplicationOsVersionsViewVM>(); + } + } + + public static ApplicationVersionsViewVM ApplicationVersionsViewVM + { + get + { + return ServiceLocator.Current.GetInstance<ApplicationVersionsViewVM>(); + } + } + + public static EmbeddedFirmwareVersionsViewVM EmbeddedFirmwareVersionsViewVM + { + get + { + return ServiceLocator.Current.GetInstance<EmbeddedFirmwareVersionsViewVM>(); + } + } + + public static EmbeddedSoftwareVersionsViewVM EmbeddedSoftwareVersionsViewVM + { + get + { + return ServiceLocator.Current.GetInstance<EmbeddedSoftwareVersionsViewVM>(); + } + } + + public static HardwareVersionsViewVM HardwareVersionsViewVM + { + get + { + return ServiceLocator.Current.GetInstance<HardwareVersionsViewVM>(); + } + } + + public static IdsPacksViewVM IdsPacksViewVM + { + get + { + return ServiceLocator.Current.GetInstance<IdsPacksViewVM>(); + } + } + + public static DispensersViewVM DispensersViewVM + { + get + { + return ServiceLocator.Current.GetInstance<DispensersViewVM>(); + } + } + + public static DispenserTypesViewVM DispenserTypesViewVM + { + get + { + return ServiceLocator.Current.GetInstance<DispenserTypesViewVM>(); + } + } + + public static LiquidsViewVM LiquidsViewVM + { + get + { + return ServiceLocator.Current.GetInstance<LiquidsViewVM>(); + } + } + + public static CartridgesViewVM CartridgesViewVM + { + get + { + return ServiceLocator.Current.GetInstance<CartridgesViewVM>(); + } + } + + public static CartridgeTypesViewVM CartridgeTypesViewVM + { + get + { + return ServiceLocator.Current.GetInstance<CartridgeTypesViewVM>(); + } + } } }
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ApplicationDisplayPanelVersionsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ApplicationDisplayPanelVersionsViewVM.cs new file mode 100644 index 000000000..be458136a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ApplicationDisplayPanelVersionsViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class ApplicationDisplayPanelVersionsViewVM : DbTableViewModel<ApplicationDisplayPanelVersion> + { + public ApplicationDisplayPanelVersionsViewVM(INotificationProvider notification) : base(notification) + { + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ApplicationFirmwareVersionsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ApplicationFirmwareVersionsViewVM.cs new file mode 100644 index 000000000..0814988ba --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ApplicationFirmwareVersionsViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class ApplicationFirmwareVersionsViewVM : DbTableViewModel<ApplicationFirmwareVersion> + { + public ApplicationFirmwareVersionsViewVM(INotificationProvider notification) : base(notification) + { + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ApplicationOsVersionsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ApplicationOsVersionsViewVM.cs new file mode 100644 index 000000000..3cdd8acb7 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ApplicationOsVersionsViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class ApplicationOsVersionsViewVM : DbTableViewModel<ApplicationOsVersion> + { + public ApplicationOsVersionsViewVM(INotificationProvider notification) : base(notification) + { + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ApplicationVersionsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ApplicationVersionsViewVM.cs new file mode 100644 index 000000000..6e25fe321 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ApplicationVersionsViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class ApplicationVersionsViewVM : DbTableViewModel<ApplicationVersion> + { + public ApplicationVersionsViewVM(INotificationProvider notification) : base(notification) + { + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/CartridgeTypesViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/CartridgeTypesViewVM.cs new file mode 100644 index 000000000..c8c6ba00b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/CartridgeTypesViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class CartridgeTypesViewVM : DbTableViewModel<CartridgeType> + { + public CartridgeTypesViewVM(INotificationProvider notification) : base(notification) + { + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/CartridgesViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/CartridgesViewVM.cs new file mode 100644 index 000000000..8db217013 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/CartridgesViewVM.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class CartridgesViewVM : DbTableViewModel<Cartridge> + { + public CartridgesViewVM(INotificationProvider notification) : base(notification) + { + + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ConfigurationsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ConfigurationsViewVM.cs new file mode 100644 index 000000000..617faab31 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ConfigurationsViewVM.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class ConfigurationsViewVM : DbTableViewModel<Configuration> + { + public ConfigurationsViewVM(INotificationProvider notification) : base(notification) + { + + } + + protected override void InitializeEntity(Configuration entity) + { + base.InitializeEntity(entity); + entity.CreationDate = DateTime.Now; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs index 7f6dd8d5f..b6d77748e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs @@ -9,10 +9,17 @@ using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.DB.Managers; using Tango.SharedUI; using Tango.MachineStudio.DB.ExtensionMethods; +using System.Data.Entity.Infrastructure; +using GalaSoft.MvvmLight.Messaging; +using Tango.MachineStudio.DB.Messages; +using System.Collections.ObjectModel; +using System.Reflection; +using Tango.MachineStudio.Common.StudioApplication; +using System.ComponentModel; namespace Tango.MachineStudio.DB.ViewModels { - public abstract class DbTableViewModel<T> : ViewModel where T : class, IObservableEntity + public abstract class DbTableViewModel<T> : ViewModel, IShutdownRequestBlocker where T : class, IObservableEntity { private INotificationProvider _notification; @@ -23,9 +30,10 @@ namespace Tango.MachineStudio.DB.ViewModels { _notification = notification; Adapter = ObservablesEntitiesAdapter.Instance; + ValidationErrors = new ObservableCollection<string>(); AddCommand = new RelayCommand(OnAdd); - EditCommand = new RelayCommand(OnEdit,(x) => SelectedEntity != null); + EditCommand = new RelayCommand(OnEdit, (x) => SelectedEntity != null); DeleteCommand = new RelayCommand(OnDelete, (x) => SelectedEntity != null); DialogOKCommand = new RelayCommand(() => OnDialogOKPressed(DialogOpenMode, EditEntity)); DialogCancelCommand = new RelayCommand(() => OnDialogCancelPressed(DialogOpenMode, EditEntity)); @@ -93,6 +101,16 @@ namespace Tango.MachineStudio.DB.ViewModels set { _filter = value; RaisePropertyChangedAuto(); OnFilterChanged(value); } } + private ObservableCollection<String> _validationErrors; + /// <summary> + /// Gets or sets the validation errors. + /// </summary> + public ObservableCollection<String> ValidationErrors + { + get { return _validationErrors; } + set { _validationErrors = value; RaisePropertyChangedAuto(); } + } + /// <summary> /// Gets or sets the dialog OK command. /// </summary> @@ -118,13 +136,49 @@ namespace Tango.MachineStudio.DB.ViewModels /// </summary> public RelayCommand DeleteCommand { get; set; } + protected override void OnValidating() + { + base.OnValidating(); + ValidationErrors.Clear(); + + foreach (var prop in typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => !x.PropertyType.IsGenericType && x.PropertyType.IsClass && !x.Name.Contains("Guid"))) + { + if (prop.GetValue(EditEntity) == null) + { + ValidationErrors.Add(prop.Name + " is required"); + } + } + } + /// <summary> /// Called when delete command invoked. /// </summary> - protected virtual void OnDelete() + protected virtual async void OnDelete() { - SelectedEntity.Deleted = true; - SelectedEntity.Save(); + using (_notification.PushTaskItem("Saving changes to database...")) + { + var dependenctEntities = SelectedEntity.GetDependentEntitiesNameAndGuid(); + + if (dependenctEntities.Count > 0) + { + _notification.ShowError("The selected entity is being used by " + dependenctEntities.Count + " other entities." + Environment.NewLine + "Please delete any dependencies and try again." + Environment.NewLine + Environment.NewLine + String.Join(Environment.NewLine,dependenctEntities.Select(x => x.Key + ", ID: " + x.Value))); + return; + } + + try + { + SelectedEntity.Deleted = true; + await SelectedEntity.SaveAsync(); + } + catch (Exception ex) + { + SelectedEntity.Deleted = false; + Adapter.Invalidate(); + _notification.ShowError("Could not delete entity."); + } + + SelectedEntity = null; + } } /// <summary> @@ -132,9 +186,11 @@ namespace Tango.MachineStudio.DB.ViewModels /// </summary> protected virtual void OnEdit() { + ValidationErrors.Clear(); DialogOpenMode = DialogOpenMode.Editing; EditEntity = GetEditableEntity(DialogOpenMode); - _notification.ShowDialog(DialogOpenMode, this); + //_notification.ShowDialog(DialogOpenMode, this); + Messenger.Default.Send(new OpenEntityEditViewMessage(DialogOpenMode, this, typeof(T))); IsDialogOpen = true; } @@ -143,9 +199,11 @@ namespace Tango.MachineStudio.DB.ViewModels /// </summary> protected virtual void OnAdd() { + ValidationErrors.Clear(); DialogOpenMode = DialogOpenMode.Adding; EditEntity = GetEditableEntity(DialogOpenMode); - _notification.ShowDialog(DialogOpenMode, this); + //_notification.ShowDialog(DialogOpenMode, this); + Messenger.Default.Send(new OpenEntityEditViewMessage(DialogOpenMode, this, typeof(T))); IsDialogOpen = true; } @@ -153,8 +211,14 @@ namespace Tango.MachineStudio.DB.ViewModels /// Called when dialog closes with OK button. /// </summary> /// <param name="mode">The mode.</param> - protected virtual void OnDialogOKPressed(DialogOpenMode mode, T entity) + protected virtual async void OnDialogOKPressed(DialogOpenMode mode, T entity) { + if (!Validate()) return; + + if (ValidationErrors.Count > 0) return; + + Messenger.Default.Send(new CloseEntityEditViewMessage()); + if (mode == DialogOpenMode.Editing) { entity.ShallowCopyTo(SelectedEntity); @@ -163,10 +227,26 @@ namespace Tango.MachineStudio.DB.ViewModels OnBeforeEntitySave(mode, entity); - entity.Save(); - IsDialogOpen = false; - SelectedEntity = EditEntity; - SelectedEntity = null; + using (_notification.PushTaskItem("Saving changes to database...")) + { + try + { + await entity.SaveAsync(); + } + catch (DbUpdateException ex) + { + Adapter.Invalidate(); + _notification.ShowError("Could not save entity." + Environment.NewLine + ex.InnerException.InnerException != null ? ex.InnerException.InnerException.Message : ex.InnerException.Message); + } + catch (Exception ex) + { + Adapter.Invalidate(); + _notification.ShowError("Could not save entity." + Environment.NewLine + "Please make sure all fields are properly populated."); + } + IsDialogOpen = false; + SelectedEntity = EditEntity; + SelectedEntity = null; + } } /// <summary> @@ -174,7 +254,7 @@ namespace Tango.MachineStudio.DB.ViewModels /// </summary> /// <param name="mode">The mode.</param> /// <param name="entity">The entity.</param> - protected virtual void OnBeforeEntitySave(DialogOpenMode mode,T entity) + protected virtual void OnBeforeEntitySave(DialogOpenMode mode, T entity) { } @@ -185,6 +265,7 @@ namespace Tango.MachineStudio.DB.ViewModels /// <param name="mode">The mode.</param> protected virtual void OnDialogCancelPressed(DialogOpenMode mode, T entity) { + Messenger.Default.Send(new CloseEntityEditViewMessage()); IsDialogOpen = false; } @@ -209,12 +290,31 @@ namespace Tango.MachineStudio.DB.ViewModels protected virtual void OnFilterChanged(String filter) { + String viewSourceName = this.GetType().Name.Replace("ViewVM", "ViewSource"); + ICollectionView collectionView = Adapter.GetType().GetProperty(viewSourceName).GetValue(Adapter) as ICollectionView; + collectionView.Filter = (entity) => + { + return + entity. + GetType(). + GetProperties(BindingFlags.Public | BindingFlags.Instance). + Where(x => x.Name != "Deleted" && x.Name != "ID" && x.Name != "LastUpdated"). + Where(x => !x.PropertyType.IsGenericType && (x.PropertyType.IsClass || x.PropertyType == typeof(String))). + Select(prop => prop.GetValue(entity).ToString()). + ToList(). + Any(x => x.ToLower().Contains(filter.ToLower())); + }; } protected virtual void InitializeEntity(T entity) { } + + public Task<bool> OnShutdownRequest() + { + return Task.FromResult(true); + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DispenserTypesViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DispenserTypesViewVM.cs new file mode 100644 index 000000000..5ffe0d58c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DispenserTypesViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class DispenserTypesViewVM : DbTableViewModel<DispenserType> + { + public DispenserTypesViewVM(INotificationProvider notification) : base(notification) + { + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DispensersViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DispensersViewVM.cs new file mode 100644 index 000000000..0242c1dc7 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DispensersViewVM.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class DispensersViewVM : DbTableViewModel<Dispenser> + { + public DispensersViewVM(INotificationProvider notification) : base(notification) + { + + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/EmbeddedFirmwareVersionsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/EmbeddedFirmwareVersionsViewVM.cs new file mode 100644 index 000000000..a248d919a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/EmbeddedFirmwareVersionsViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class EmbeddedFirmwareVersionsViewVM : DbTableViewModel<EmbeddedFirmwareVersion> + { + public EmbeddedFirmwareVersionsViewVM(INotificationProvider notification) : base(notification) + { + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/EmbeddedSoftwareVersionsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/EmbeddedSoftwareVersionsViewVM.cs new file mode 100644 index 000000000..b6436203d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/EmbeddedSoftwareVersionsViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class EmbeddedSoftwareVersionsViewVM : DbTableViewModel<EmbeddedSoftwareVersion> + { + public EmbeddedSoftwareVersionsViewVM(INotificationProvider notification) : base(notification) + { + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/HardwareVersionsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/HardwareVersionsViewVM.cs new file mode 100644 index 000000000..02c90c442 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/HardwareVersionsViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class HardwareVersionsViewVM : DbTableViewModel<HardwareVersion> + { + public HardwareVersionsViewVM(INotificationProvider notification) : base(notification) + { + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/IdsPacksViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/IdsPacksViewVM.cs new file mode 100644 index 000000000..202dd959f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/IdsPacksViewVM.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class IdsPacksViewVM : DbTableViewModel<IdsPack> + { + public IdsPacksViewVM(INotificationProvider notification) : base(notification) + { + + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/LiquidsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/LiquidsViewVM.cs new file mode 100644 index 000000000..e57f6606e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/LiquidsViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class LiquidsViewVM : DbTableViewModel<Liquid> + { + public LiquidsViewVM(INotificationProvider notification) : base(notification) + { + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MachineVersionsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MachineVersionsViewVM.cs new file mode 100644 index 000000000..6a24f7d4c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MachineVersionsViewVM.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class MachineVersionsViewVM : DbTableViewModel<MachineVersion> + { + public MachineVersionsViewVM(INotificationProvider notification) : base(notification) + { + + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MainViewVM.cs index 11c0adc0e..a0ce93a5a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/MainViewVM.cs @@ -3,17 +3,16 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows; using Tango.SharedUI; namespace Tango.MachineStudio.DB.ViewModels { public class MainViewVM : ViewModel { - public String Text { get; set; } - public MainViewVM() : base() { - Text = "Hi ROy"; + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/OrganizationsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/OrganizationsViewVM.cs index a394f9faa..0327557f1 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/OrganizationsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/OrganizationsViewVM.cs @@ -13,14 +13,5 @@ namespace Tango.MachineStudio.DB.ViewModels public OrganizationsViewVM(INotificationProvider notification) : base(notification) { } - - protected override void OnFilterChanged(string filter) - { - Adapter.OrganizationsViewSource.Filter = (x) => - { - var org = x as Organization; - return org.Name.Contains(filter); - }; - } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/UsersViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/UsersViewVM.cs index 0b65d48ab..6af1184aa 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/UsersViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/UsersViewVM.cs @@ -6,6 +6,7 @@ using System.Text; using System.Threading.Tasks; using Tango.DAL.Observables; using Tango.MachineStudio.Common.Notifications; +using SimpleValidator.Extensions; namespace Tango.MachineStudio.DB.ViewModels { @@ -72,5 +73,23 @@ namespace Tango.MachineStudio.DB.ViewModels } } } + + protected override void OnValidating() + { + base.OnValidating(); + + if (EditEntity.Email != null) + { + if (Adapter.Users.ToList().Exists(x => x.Email.ToLower() == EditEntity.Email.ToLower())) + { + ValidationErrors.Add("Email already exist"); + } + } + + if (!EditEntity.Password.IsMinLength(4)) + { + ValidationErrors.Add("Password must have at least 4 characters"); + } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/AddressesView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/AddressesView.xaml index ee46a9c11..e338f3c0f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/AddressesView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/AddressesView.xaml @@ -10,7 +10,7 @@ d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.AddressesViewVM}"> <Grid> <controls:DbTableView> - <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.Addresses}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" IsReadOnly="True"> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.AddressesViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" IsReadOnly="True"> <DataGrid.Columns> <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationDisplayPanelVersionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationDisplayPanelVersionView.xaml new file mode 100644 index 000000000..a1c8d6d7e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationDisplayPanelVersionView.xaml @@ -0,0 +1,25 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.ApplicationDisplayPanelVersionView" + 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Version:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="1000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Version,Mode=TwoWay}"></mahapps:NumericUpDown> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationDisplayPanelVersionView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationDisplayPanelVersionView.xaml.cs new file mode 100644 index 000000000..6d372eaf7 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationDisplayPanelVersionView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class ApplicationDisplayPanelVersionView : UserControl + { + public ApplicationDisplayPanelVersionView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationDisplayPanelVersionsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationDisplayPanelVersionsView.xaml new file mode 100644 index 000000000..704f5f5e2 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationDisplayPanelVersionsView.xaml @@ -0,0 +1,23 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.ApplicationDisplayPanelVersionsView" + 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:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.ApplicationDisplayPanelVersionsViewVM}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.ApplicationDisplayPanelVersionsViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Version" Binding="{Binding Version}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationDisplayPanelVersionsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationDisplayPanelVersionsView.xaml.cs new file mode 100644 index 000000000..e514117dd --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationDisplayPanelVersionsView.xaml.cs @@ -0,0 +1,32 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class ApplicationDisplayPanelVersionsView : UserControl + { + public ApplicationDisplayPanelVersionsView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationFirmwareVersionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationFirmwareVersionView.xaml new file mode 100644 index 000000000..70fde065d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationFirmwareVersionView.xaml @@ -0,0 +1,25 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.ApplicationFirmwareVersionView" + 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Version:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="1000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Version,Mode=TwoWay}"></mahapps:NumericUpDown> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationFirmwareVersionView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationFirmwareVersionView.xaml.cs new file mode 100644 index 000000000..b63b05ccf --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationFirmwareVersionView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class ApplicationFirmwareVersionView : UserControl + { + public ApplicationFirmwareVersionView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationFirmwareVersionsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationFirmwareVersionsView.xaml new file mode 100644 index 000000000..a216f4a1f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationFirmwareVersionsView.xaml @@ -0,0 +1,23 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.ApplicationFirmwareVersionsView" + 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:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.ApplicationFirmwareVersionsViewVM}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.ApplicationFirmwareVersionsViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Version" Binding="{Binding Version}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationFirmwareVersionsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationFirmwareVersionsView.xaml.cs new file mode 100644 index 000000000..855e51523 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationFirmwareVersionsView.xaml.cs @@ -0,0 +1,32 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class ApplicationFirmwareVersionsView : UserControl + { + public ApplicationFirmwareVersionsView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationOsVersionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationOsVersionView.xaml new file mode 100644 index 000000000..48f96597b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationOsVersionView.xaml @@ -0,0 +1,25 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.ApplicationOsVersionView" + 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Version:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="1000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Version,Mode=TwoWay}"></mahapps:NumericUpDown> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationOsVersionView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationOsVersionView.xaml.cs new file mode 100644 index 000000000..019fd207e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationOsVersionView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class ApplicationOsVersionView : UserControl + { + public ApplicationOsVersionView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationOsVersionsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationOsVersionsView.xaml new file mode 100644 index 000000000..f53c182c3 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationOsVersionsView.xaml @@ -0,0 +1,23 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.ApplicationOsVersionsView" + 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:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.ApplicationOsVersionsViewVM}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.ApplicationOsVersionsViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Version" Binding="{Binding Version}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationOsVersionsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationOsVersionsView.xaml.cs new file mode 100644 index 000000000..ca244d95b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationOsVersionsView.xaml.cs @@ -0,0 +1,32 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class ApplicationOsVersionsView : UserControl + { + public ApplicationOsVersionsView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationVersionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationVersionView.xaml new file mode 100644 index 000000000..c5e33f3fa --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationVersionView.xaml @@ -0,0 +1,25 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.ApplicationVersionView" + 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Version:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="1000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Version,Mode=TwoWay}"></mahapps:NumericUpDown> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationVersionView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationVersionView.xaml.cs new file mode 100644 index 000000000..bde27ee0d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationVersionView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class ApplicationVersionView : UserControl + { + public ApplicationVersionView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationVersionsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationVersionsView.xaml new file mode 100644 index 000000000..09df0fee4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationVersionsView.xaml @@ -0,0 +1,23 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.ApplicationVersionsView" + 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:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.ApplicationVersionsViewVM}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.ApplicationVersionsViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Version" Binding="{Binding Version}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationVersionsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationVersionsView.xaml.cs new file mode 100644 index 000000000..23cab4296 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ApplicationVersionsView.xaml.cs @@ -0,0 +1,32 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class ApplicationVersionsView : UserControl + { + public ApplicationVersionsView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgeTypeView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgeTypeView.xaml new file mode 100644 index 000000000..a81f05646 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgeTypeView.xaml @@ -0,0 +1,29 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.CartridgeTypeView" + 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:vm="clr-namespace:Tango.MachineStudio.DB.ViewModels" + xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews" + mc:Ignorable="d" + d:DesignHeight="400" d:DesignWidth="300" d:DataContext="{d:DesignInstance Type=vm:CartridgeTypesViewVM, IsDesignTimeCreatable=False}"> + + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Code:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Code,Mode=TwoWay}"></mahapps:NumericUpDown> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgeTypeView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgeTypeView.xaml.cs new file mode 100644 index 000000000..fc23e504e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgeTypeView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class CartridgeTypeView : UserControl + { + public CartridgeTypeView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgeTypesView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgeTypesView.xaml new file mode 100644 index 000000000..d17f79c8d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgeTypesView.xaml @@ -0,0 +1,24 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.CartridgeTypesView" + 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:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.CartridgeTypesViewVM}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.CartridgeTypesViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Code" Binding="{Binding Code}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgeTypesView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgeTypesView.xaml.cs new file mode 100644 index 000000000..428ebb296 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgeTypesView.xaml.cs @@ -0,0 +1,32 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class CartridgeTypesView : UserControl + { + public CartridgeTypesView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgeView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgeView.xaml new file mode 100644 index 000000000..98adef136 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgeView.xaml @@ -0,0 +1,29 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.CartridgeView" + 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:vm="clr-namespace:Tango.MachineStudio.DB.ViewModels" + xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews" + mc:Ignorable="d" + d:DesignHeight="400" d:DesignWidth="300" d:DataContext="{d:DesignInstance Type=vm:CartridgesViewVM, IsDesignTimeCreatable=False}"> + + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Serial Number:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.SerialNumber}"></TextBox> + <TextBlock Text="Cartridge Type:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.CartridgeTypes}" SelectedItem="{Binding EditEntity.CartridgeTypes,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgeView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgeView.xaml.cs new file mode 100644 index 000000000..d2402426c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgeView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class CartridgeView : UserControl + { + public CartridgeView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgesView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgesView.xaml new file mode 100644 index 000000000..3fa7d0200 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgesView.xaml @@ -0,0 +1,24 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.CartridgesView" + 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:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.CartridgesViewVM}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.CartridgesViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Serial Number" Binding="{Binding SerialNumber}"></DataGridTextColumn> + <DataGridTextColumn Header="Cartridge Type" Binding="{Binding CartridgeTypes.Name}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgesView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgesView.xaml.cs new file mode 100644 index 000000000..27adfa44e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CartridgesView.xaml.cs @@ -0,0 +1,32 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class CartridgesView : UserControl + { + public CartridgesView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationView.xaml new file mode 100644 index 000000000..afbaf660a --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationView.xaml @@ -0,0 +1,53 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.ConfigurationView" + 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:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews" + xmlns:vm="clr-namespace:Tango.MachineStudio.DB.ViewModels" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance Type=vm:ConfigurationsViewVM, IsDesignTimeCreatable=False}"> + + <UserControl.Resources> + <DataTemplate x:Key="comTemplate"> + <TextBlock><Run Text="{Binding Name}"></Run><Run>,</Run> <Run Text="{Binding Version}"></Run></TextBlock> + </DataTemplate> + </UserControl.Resources> + + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + <TextBlock Text="Creation Date:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.CreationDate,Mode=TwoWay}" IsReadOnly="True"></TextBox> + <TextBlock Text="Application Version:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.ApplicationVersions}" SelectedItem="{Binding EditEntity.ApplicationVersions,Mode=TwoWay}" ItemTemplate="{StaticResource comTemplate}"></ComboBox> + + <TextBlock Text="Application Firmware Version:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.ApplicationFirmwareVersions}" SelectedItem="{Binding EditEntity.ApplicationFirmwareVersions,Mode=TwoWay}" ItemTemplate="{StaticResource comTemplate}"></ComboBox> + + <TextBlock Text="Application OS Version:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.ApplicationOsVersions}" SelectedItem="{Binding EditEntity.ApplicationOsVersions,Mode=TwoWay}" ItemTemplate="{StaticResource comTemplate}"></ComboBox> + + <TextBlock Text="Display Panel Version:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.ApplicationDisplayPanelVersions}" SelectedItem="{Binding EditEntity.ApplicationDisplayPanelVersions,Mode=TwoWay}" ItemTemplate="{StaticResource comTemplate}"></ComboBox> + + <TextBlock Text="Embedded Firmware Version:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.EmbeddedFirmwareVersions}" SelectedItem="{Binding EditEntity.EmbeddedFirmwareVersions,Mode=TwoWay}" ItemTemplate="{StaticResource comTemplate}"></ComboBox> + + <TextBlock Text="Embedded Software Version:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.EmbeddedSoftwareVersions}" SelectedItem="{Binding EditEntity.EmbeddedSoftwareVersions,Mode=TwoWay}" ItemTemplate="{StaticResource comTemplate}"></ComboBox> + + <TextBlock Text="Hardware Version:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.HardwareVersions}" SelectedItem="{Binding EditEntity.HardwareVersions,Mode=TwoWay}" ItemTemplate="{StaticResource comTemplate}"></ComboBox> + + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationView.xaml.cs new file mode 100644 index 000000000..8772bbae9 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class ConfigurationView : UserControl + { + public ConfigurationView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationsView.xaml new file mode 100644 index 000000000..235e49cc3 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationsView.xaml @@ -0,0 +1,30 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.ConfigurationsView" + 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:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.ConfigurationsViewVM}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.ConfigurationsViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Creation Date" Binding="{Binding CreationDate}"></DataGridTextColumn> + <DataGridTextColumn Header="Application Version" Binding="{Binding ApplicationVersions.Version}"></DataGridTextColumn> + <DataGridTextColumn Header="Application OS" Binding="{Binding ApplicationOsVersions.Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Application Firmware Version" Binding="{Binding ApplicationFirmwareVersions.Version}"></DataGridTextColumn> + <DataGridTextColumn Header="Display Panel" Binding="{Binding ApplicationDisplayPanelVersions.Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Embedded Firmware Version" Binding="{Binding EmbeddedFirmwareVersions.Version}"></DataGridTextColumn> + <DataGridTextColumn Header="Embedded Software Version" Binding="{Binding EmbeddedSoftwareVersions.Version}"></DataGridTextColumn> + <DataGridTextColumn Header="Hardware Version" Binding="{Binding HardwareVersions.Version}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationsView.xaml.cs new file mode 100644 index 000000000..de3fc9010 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ConfigurationsView.xaml.cs @@ -0,0 +1,32 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class ConfigurationsView : UserControl + { + public ConfigurationsView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispenserTypeView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispenserTypeView.xaml new file mode 100644 index 000000000..b6e3336b3 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispenserTypeView.xaml @@ -0,0 +1,29 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.DispenserTypeView" + 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:vm="clr-namespace:Tango.MachineStudio.DB.ViewModels" + xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews" + mc:Ignorable="d" + d:DesignHeight="400" d:DesignWidth="300" d:DataContext="{d:DesignInstance Type=vm:DispenserTypesViewVM, IsDesignTimeCreatable=False}"> + + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Code:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Code,Mode=TwoWay}"></mahapps:NumericUpDown> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispenserTypeView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispenserTypeView.xaml.cs new file mode 100644 index 000000000..f13875714 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispenserTypeView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class DispenserTypeView : UserControl + { + public DispenserTypeView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispenserTypesView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispenserTypesView.xaml new file mode 100644 index 000000000..874629128 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispenserTypesView.xaml @@ -0,0 +1,24 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.DispenserTypesView" + 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:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.DispenserTypesViewVM}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.DispenserTypesViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Code" Binding="{Binding Code}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispenserTypesView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispenserTypesView.xaml.cs new file mode 100644 index 000000000..89e0b05c1 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispenserTypesView.xaml.cs @@ -0,0 +1,32 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class DispenserTypesView : UserControl + { + public DispenserTypesView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispenserView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispenserView.xaml new file mode 100644 index 000000000..7dc4ec1ff --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispenserView.xaml @@ -0,0 +1,29 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.DispenserView" + 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:vm="clr-namespace:Tango.MachineStudio.DB.ViewModels" + xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews" + mc:Ignorable="d" + d:DesignHeight="400" d:DesignWidth="300" d:DataContext="{d:DesignInstance Type=vm:DispensersViewVM, IsDesignTimeCreatable=False}"> + + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Serial Number:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.SerialNumber}"></TextBox> + <TextBlock Text="Dispenser Type:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.DispenserTypes}" SelectedItem="{Binding EditEntity.DispenserTypes,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispenserView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispenserView.xaml.cs new file mode 100644 index 000000000..4ad5d74fe --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispenserView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class DispenserView : UserControl + { + public DispenserView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispensersView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispensersView.xaml new file mode 100644 index 000000000..7fdb70bbe --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispensersView.xaml @@ -0,0 +1,24 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.DispensersView" + 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:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.DispensersViewVM}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.DispensersViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Serial Number" Binding="{Binding SerialNumber}"></DataGridTextColumn> + <DataGridTextColumn Header="Dispenser Type" Binding="{Binding DispenserTypes.Name}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispensersView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispensersView.xaml.cs new file mode 100644 index 000000000..d86bd2e31 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/DispensersView.xaml.cs @@ -0,0 +1,32 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class DispensersView : UserControl + { + public DispensersView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedFirmwareVersionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedFirmwareVersionView.xaml new file mode 100644 index 000000000..56dccb7dc --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedFirmwareVersionView.xaml @@ -0,0 +1,25 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.EmbeddedFirmwareVersionView" + 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Version:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="1000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Version,Mode=TwoWay}"></mahapps:NumericUpDown> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedFirmwareVersionView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedFirmwareVersionView.xaml.cs new file mode 100644 index 000000000..82aa4f7b4 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedFirmwareVersionView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class EmbeddedFirmwareVersionView : UserControl + { + public EmbeddedFirmwareVersionView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedFirmwareVersionsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedFirmwareVersionsView.xaml new file mode 100644 index 000000000..219230d32 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedFirmwareVersionsView.xaml @@ -0,0 +1,23 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.EmbeddedFirmwareVersionsView" + 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:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.EmbeddedFirmwareVersionsViewVM}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.EmbeddedFirmwareVersionsViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Version" Binding="{Binding Version}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedFirmwareVersionsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedFirmwareVersionsView.xaml.cs new file mode 100644 index 000000000..39c50aa39 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedFirmwareVersionsView.xaml.cs @@ -0,0 +1,32 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class EmbeddedFirmwareVersionsView : UserControl + { + public EmbeddedFirmwareVersionsView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedSoftwareVersionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedSoftwareVersionView.xaml new file mode 100644 index 000000000..279c15c84 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedSoftwareVersionView.xaml @@ -0,0 +1,25 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.EmbeddedSoftwareVersionView" + 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Version:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="1000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Version,Mode=TwoWay}"></mahapps:NumericUpDown> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedSoftwareVersionView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedSoftwareVersionView.xaml.cs new file mode 100644 index 000000000..e2e626fb5 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedSoftwareVersionView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class EmbeddedSoftwareVersionView : UserControl + { + public EmbeddedSoftwareVersionView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedSoftwareVersionsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedSoftwareVersionsView.xaml new file mode 100644 index 000000000..64814a416 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedSoftwareVersionsView.xaml @@ -0,0 +1,23 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.EmbeddedSoftwareVersionsView" + 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:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.EmbeddedSoftwareVersionsViewVM}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.EmbeddedSoftwareVersionsViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Version" Binding="{Binding Version}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedSoftwareVersionsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedSoftwareVersionsView.xaml.cs new file mode 100644 index 000000000..55f7a03a6 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/EmbeddedSoftwareVersionsView.xaml.cs @@ -0,0 +1,32 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class EmbeddedSoftwareVersionsView : UserControl + { + public EmbeddedSoftwareVersionsView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/HardwareVersionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/HardwareVersionView.xaml new file mode 100644 index 000000000..45d36fb14 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/HardwareVersionView.xaml @@ -0,0 +1,25 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.HardwareVersionView" + 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Version:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="1000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Version,Mode=TwoWay}"></mahapps:NumericUpDown> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/HardwareVersionView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/HardwareVersionView.xaml.cs new file mode 100644 index 000000000..1419434bf --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/HardwareVersionView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class HardwareVersionView : UserControl + { + public HardwareVersionView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/HardwareVersionsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/HardwareVersionsView.xaml new file mode 100644 index 000000000..4a60ffcaa --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/HardwareVersionsView.xaml @@ -0,0 +1,23 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.HardwareVersionsView" + 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:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.HardwareVersionsViewVM}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.HardwareVersionsViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Version" Binding="{Binding Version}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/HardwareVersionsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/HardwareVersionsView.xaml.cs new file mode 100644 index 000000000..0e552cdb7 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/HardwareVersionsView.xaml.cs @@ -0,0 +1,32 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class HardwareVersionsView : UserControl + { + public HardwareVersionsView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackView.xaml new file mode 100644 index 000000000..308a549fa --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackView.xaml @@ -0,0 +1,64 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.IdsPackView" + 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:vm="clr-namespace:Tango.MachineStudio.DB.ViewModels" + xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews" + mc:Ignorable="d" + d:DesignHeight="400" d:DesignWidth="300" d:DataContext="{d:DesignInstance Type=vm:IdsPacksViewVM, IsDesignTimeCreatable=False}"> + + <UserControl.Resources> + <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> + </UserControl.Resources> + + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name}"></TextBox> + <TextBlock Text="Configuration:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.Configurations}" SelectedItem="{Binding EditEntity.Configuration,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + <TextBlock Text="Dispenser:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.Dispensers}" SelectedItem="{Binding EditEntity.Dispenser,Mode=TwoWay}"> + <ComboBox.ItemTemplate> + <DataTemplate> + <TextBlock><Run Text="{Binding SerialNumber}"></Run><Run>,</Run> <Run Text="{Binding DispenserTypes.Name}"></Run></TextBlock> + </DataTemplate> + </ComboBox.ItemTemplate> + </ComboBox> + <TextBlock Text="Liquid:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.Liquids}" SelectedItem="{Binding EditEntity.Liquid,Mode=TwoWay}"> + <ComboBox.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal"> + <Rectangle Width="16" Height="16" VerticalAlignment="Center"> + <Rectangle.Fill> + <SolidColorBrush Color="{Binding Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> + </Rectangle.Fill> + </Rectangle> + <TextBlock Margin="5 0 0 0" Text="{Binding Name}" VerticalAlignment="Center"></TextBlock> + </StackPanel> + </DataTemplate> + </ComboBox.ItemTemplate> + </ComboBox> + <TextBlock Text="Cartridge:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.Cartridges}" SelectedItem="{Binding EditEntity.Cartridge,Mode=TwoWay}"> + <ComboBox.ItemTemplate> + <DataTemplate> + <TextBlock><Run Text="{Binding SerialNumber}"></Run><Run>,</Run> <Run Text="{Binding CartridgeTypes.Name}"></Run></TextBlock> + </DataTemplate> + </ComboBox.ItemTemplate> + </ComboBox> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackView.xaml.cs new file mode 100644 index 000000000..766b3087e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class IdsPackView : UserControl + { + public IdsPackView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPacksView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPacksView.xaml new file mode 100644 index 000000000..df1557ec3 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPacksView.xaml @@ -0,0 +1,57 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.IdsPacksView" + 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:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.IdsPacksViewVM}"> + + <UserControl.Resources> + <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> + </UserControl.Resources> + + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.IdsPacksViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Configuration" Binding="{Binding Configuration.Name}"></DataGridTextColumn> + <DataGridTemplateColumn Header="Dispenser"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock><Run Text="{Binding Dispenser.SerialNumber}"></Run><Run>,</Run> <Run Text="{Binding Dispenser.DispenserTypes.Name}"></Run></TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="Liquid"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal"> + <Rectangle Width="16" Height="16" VerticalAlignment="Center"> + <Rectangle.Fill> + <SolidColorBrush Color="{Binding Liquid.Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> + </Rectangle.Fill> + </Rectangle> + <TextBlock Margin="5 0 0 0" Text="{Binding Liquid.Name}" VerticalAlignment="Center"></TextBlock> + </StackPanel> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="Cartridge"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock><Run Text="{Binding Cartridge.SerialNumber}"></Run><Run>,</Run> <Run Text="{Binding Dispenser.CartridgeTypes.Name}"></Run></TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPacksView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPacksView.xaml.cs new file mode 100644 index 000000000..3f1a0189b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPacksView.xaml.cs @@ -0,0 +1,32 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class IdsPacksView : UserControl + { + public IdsPacksView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidView.xaml new file mode 100644 index 000000000..19bcc2674 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidView.xaml @@ -0,0 +1,42 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.LiquidView" + 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:vm="clr-namespace:Tango.MachineStudio.DB.ViewModels" + xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews" + mc:Ignorable="d" + d:DesignHeight="400" d:DesignWidth="300" d:DataContext="{d:DesignInstance Type=vm:LiquidsViewVM, IsDesignTimeCreatable=False}"> + + <UserControl.Resources> + <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> + + <Style TargetType="{x:Type TabItem}" BasedOn="{StaticResource {x:Type TabItem}}"> + <Setter Property="mahapps:ControlsHelper.HeaderFontSize" Value="14" /> + <Setter Property="Margin" Value="2" /> + </Style> + </UserControl.Resources> + + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Code:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Code,Mode=TwoWay}"></mahapps:NumericUpDown> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + <TextBlock Text="Version:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Version,Mode=TwoWay}"></mahapps:NumericUpDown> + <TextBlock Text="Color:" FontWeight="Bold"></TextBlock> + <colorPicker:ColorPickerCombo SelectedColor="{Binding EditEntity.Color,Mode=TwoWay,Converter={StaticResource ColorToIntegerConverter},UpdateSourceTrigger=PropertyChanged}"></colorPicker:ColorPickerCombo> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidView.xaml.cs new file mode 100644 index 000000000..653def003 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class LiquidView : UserControl + { + public LiquidView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidsView.xaml new file mode 100644 index 000000000..749b0ccd7 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidsView.xaml @@ -0,0 +1,41 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.LiquidsView" + 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:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.LiquidsViewVM}"> + + <UserControl.Resources> + <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> + </UserControl.Resources> + + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.LiquidsViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Code" Binding="{Binding Code}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Version" Binding="{Binding Version}"></DataGridTextColumn> + <DataGridTemplateColumn Header="Color"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <Rectangle Width="50"> + <Rectangle.Fill> + <SolidColorBrush Color="{Binding Color,Converter={StaticResource ColorToIntegerConverter},Mode=TwoWay}"></SolidColorBrush> + </Rectangle.Fill> + </Rectangle> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidsView.xaml.cs new file mode 100644 index 000000000..2d68d5ef5 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/LiquidsView.xaml.cs @@ -0,0 +1,32 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class LiquidsView : UserControl + { + public LiquidsView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionView.xaml new file mode 100644 index 000000000..50a1c790b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionView.xaml @@ -0,0 +1,27 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.MachineVersionView" + 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Version:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="1000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Version,Mode=TwoWay}"></mahapps:NumericUpDown> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + <TextBlock Text="Default Configuration:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.Configurations}" SelectedItem="{Binding EditEntity.Configuration,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionView.xaml.cs new file mode 100644 index 000000000..5e284cd47 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionView.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.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class MachineVersionView : UserControl + { + public MachineVersionView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionsView.xaml new file mode 100644 index 000000000..08cac568f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionsView.xaml @@ -0,0 +1,24 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.MachineVersionsView" + 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:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.MachineVersionsViewVM}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.MachineVersionsViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Version" Binding="{Binding Version}"></DataGridTextColumn> + <DataGridTextColumn Header="Default Configuration" Binding="{Binding Configuration.Name}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionsView.xaml.cs new file mode 100644 index 000000000..275445917 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachineVersionsView.xaml.cs @@ -0,0 +1,32 @@ +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; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class MachineVersionsView : UserControl + { + public MachineVersionsView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachinesView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachinesView.xaml index f5913bd2c..ebd3b2c7e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachinesView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/MachinesView.xaml @@ -10,7 +10,7 @@ d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.MachinesViewVM}"> <Grid> <controls:DbTableView> - <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.Machines}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.MachinesViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> <DataGrid.Columns> <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/PermissionsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/PermissionsView.xaml index d773dc58a..9455fd519 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/PermissionsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/PermissionsView.xaml @@ -10,7 +10,7 @@ d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.PermissionsViewVM}"> <Grid> <controls:DbTableView> - <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.Permissions}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" IsReadOnly="True"> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.PermissionsViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" IsReadOnly="True"> <DataGrid.Columns> <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RolesView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RolesView.xaml index dcb61eacb..858cfd37b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RolesView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RolesView.xaml @@ -15,7 +15,7 @@ <Grid> <controls:DbTableView> - <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.Roles}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" IsReadOnly="True"> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.RolesViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" IsReadOnly="True"> <DataGrid.Columns> <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/UserView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/UserView.xaml index e63c1c131..6bfb2fbb8 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/UserView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/UserView.xaml @@ -23,7 +23,7 @@ <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True" IsEnabled="False"></TextBox> <TextBlock Text="Email:" FontWeight="Bold"></TextBlock> - <TextBox Text="{Binding EditEntity.Email,Mode=TwoWay}"></TextBox> + <TextBox Text="{Binding EditEntity.Email,Mode=TwoWay, ValidatesOnNotifyDataErrors=True}"></TextBox> <TextBlock Text="Password:" FontWeight="Bold"></TextBlock> <TextBox Text="{Binding EditEntity.Password,Mode=TwoWay}"></TextBox> <TextBlock Text="Roles:" FontWeight="Bold"></TextBlock> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/UsersView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/UsersView.xaml index 5b6c2e842..ad3814185 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/UsersView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/UsersView.xaml @@ -16,7 +16,7 @@ <Grid> <controls:DbTableView> - <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.Users}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" IsReadOnly="True"> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.UsersViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" IsReadOnly="True"> <DataGrid.Columns> <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/MainDBView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/MainDBView.xaml index c7c636d53..6c7cb2b95 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/MainDBView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/MainDBView.xaml @@ -12,12 +12,16 @@ xmlns:commonControls="clr-namespace:Tango.MachineStudio.Common.Controls;assembly=Tango.MachineStudio.Common" xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views" mc:Ignorable="d" - d:DesignHeight="720" d:DesignWidth="1270" Background="White" DataContext="{Binding MainViewVM, Source={StaticResource Locator}}"> + d:DesignHeight="720" d:DesignWidth="1270" DataContext="{Binding MainViewVM, Source={StaticResource Locator}}"> + + <UserControl.Background> + <ImageBrush ImageSource="../Images/seamless-grid.jpg" Stretch="None" TileMode="Tile" ViewportUnits="Absolute" Viewport="0,0,32,32"></ImageBrush> + </UserControl.Background> <Grid> <Grid> <Grid.ColumnDefinitions> - <ColumnDefinition Width="200"/> - <ColumnDefinition Width="486*"/> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Border Background="{StaticResource AccentColorBrush}" Margin="5" CornerRadius="5"> @@ -34,7 +38,7 @@ <materialDesign:PackIcon Kind="Table" Width="24" Height="24"></materialDesign:PackIcon> <TextBlock Margin="5 0 0 0" Style="{StaticResource MaterialDesignBody2TextBlock}" VerticalAlignment="Center" Text="{Binding Header}" Background="Transparent" HorizontalAlignment="Stretch"></TextBlock> </StackPanel> - <materialDesign:PackIcon ToolTip="View Table" VerticalAlignment="Center" DockPanel.Dock="Right" Kind="ArrowRight"></materialDesign:PackIcon> + <materialDesign:PackIcon Margin="10 0 0 0" ToolTip="View Table" VerticalAlignment="Center" DockPanel.Dock="Right" Kind="ArrowRight"></materialDesign:PackIcon> </DockPanel> </DataTemplate> </ListBox.ItemTemplate> @@ -42,12 +46,112 @@ </Border> <Grid Grid.Column="1"> - <Grid.Background> - <ImageBrush ImageSource="../Images/seamless-grid.jpg" Stretch="None" TileMode="Tile" ViewportUnits="Absolute" Viewport="0,0,32,32"></ImageBrush> - </Grid.Background> - <commonControls:MdiContainerControl ItemsSource="{x:Static managers:ViewsManager.DisplayedViews}"></commonControls:MdiContainerControl> </Grid> </Grid> + + <Grid IsHitTestVisible="False"> + <Grid.Background> + <SolidColorBrush Color="Black" Opacity="0.8"></SolidColorBrush> + </Grid.Background> + + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Opacity" Value="1"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=IsEditViewOpen}" Value="False"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="IsHitTestVisible"> + <DiscreteBooleanKeyFrame Value="False" KeyTime="00:00:00"></DiscreteBooleanKeyFrame> + </BooleanAnimationUsingKeyFrames> + <DoubleAnimation Storyboard.TargetProperty="Opacity" To="0" Duration="00:00:0.3"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="IsHitTestVisible"> + <DiscreteBooleanKeyFrame Value="True" KeyTime="00:00:00"></DiscreteBooleanKeyFrame> + </BooleanAnimationUsingKeyFrames> + <DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="00:00:0.3"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + </Grid> + + <Grid x:Name="grid" HorizontalAlignment="Right" MinWidth="300" RenderTransformOrigin="1,0" VerticalAlignment="Top" Margin="0 100 0 0"> + + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="RenderTransform"> + <Setter.Value> + <ScaleTransform ScaleY="1" ScaleX="0"></ScaleTransform> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=IsEditViewOpen}" Value="False"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="0" Duration="00:00:0.3"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="00:00:0.3"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + + <Border Padding="10" CornerRadius="10 0 0 10" Background="White"> + <Border.Effect> + <DropShadowEffect/> + </Border.Effect> + <DockPanel LastChildFill="True"> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Top" VerticalAlignment="Top"> + <materialDesign:PackIcon x:Name="icon" VerticalAlignment="Center" Width="32" Height="32" Foreground="{StaticResource AccentColorBrush}" /> + <TextBlock x:Name="txtTitle" Margin="10 0 0 0" Foreground="{StaticResource AccentColorBrush}" FontSize="16"></TextBlock> + </StackPanel> + <StackPanel DockPanel.Dock="Bottom"> + <ItemsControl ItemsSource="{Binding ValidationErrors}"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon VerticalAlignment="Center" Kind="Exclamation" Foreground="Red" Width="16" Height="16"></materialDesign:PackIcon> + <TextBlock VerticalAlignment="Center" Margin="5 0 0 0" Foreground="Red" Text="{Binding}"></TextBlock> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right"> + <Button Style="{StaticResource MaterialDesignFlatButton}" IsDefault="True" Margin="0 8 8 0" Command="{Binding DialogOKCommand}"> + ACCEPT + </Button> + <Button Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True" Margin="0 8 8 0" Command="{Binding DialogCancelCommand}"> + CANCEL + </Button> + </StackPanel> + </StackPanel> + <ScrollViewer Margin="0 10 0 0" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Padding="5"> + <ContentPresenter x:Name="presenter"></ContentPresenter> + </ScrollViewer> + </DockPanel> + </Border> + + <Thumb HorizontalAlignment="Left" Opacity="0" Width="5" VerticalAlignment="Stretch" Cursor="SizeWE" DragDelta="Thumb_DragDelta"></Thumb> + </Grid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/MainDBView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/MainDBView.xaml.cs index 9e327b575..1ffdf7eb0 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/MainDBView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/MainDBView.xaml.cs @@ -1,4 +1,6 @@ -using System; +using GalaSoft.MvvmLight.Messaging; +using MaterialDesignThemes.Wpf; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -12,6 +14,9 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.MachineStudio.DB.Messages; +using Tango.MachineStudio.DB.ViewModels; +using Tango.MachineStudio.DB.Views.DBViews; using Tango.SharedUI; using Tango.SharedUI.Controls; @@ -25,6 +30,50 @@ namespace Tango.MachineStudio.DB.Views public MainDBView() : base() { InitializeComponent(); + + Messenger.Default.Register<OpenEntityEditViewMessage>(this, HandleOpenEntityViewMessage); + Messenger.Default.Register<CloseEntityEditViewMessage>(this, HandleCloseEntityViewMessage); + } + + public bool IsEditViewOpen + { + get { return (bool)GetValue(IsEditViewOpenProperty); } + set { SetValue(IsEditViewOpenProperty, value); } + } + public static readonly DependencyProperty IsEditViewOpenProperty = + DependencyProperty.Register("IsEditViewOpen", typeof(bool), typeof(MainDBView), new PropertyMetadata(false)); + + private void HandleCloseEntityViewMessage(CloseEntityEditViewMessage message) + { + IsEditViewOpen = false; + } + + private void HandleOpenEntityViewMessage(OpenEntityEditViewMessage message) + { + Type viewType = typeof(MainDBView).Assembly.GetType(typeof(OrganizationView).Namespace + "." + message.EntityType.Name + "View"); + + presenter.DataContext = message.Context; + var view = Activator.CreateInstance(viewType) as FrameworkElement; + view.DataContext = message.Context; + grid.DataContext = message.Context; + presenter.Content = view; + icon.Kind = (message.DialogOpenMode == DialogOpenMode.Editing ? PackIconKind.TableEdit : PackIconKind.Plus); + txtTitle.Text = (message.DialogOpenMode == DialogOpenMode.Editing ? "Edit " : "Add New ") + message.EntityType.Name.ToTitle(); + + IsEditViewOpen = true; + } + + private void Thumb_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e) + { + if (double.IsNaN(grid.Width)) + { + grid.Width = grid.ActualWidth; + } + + if (grid.Width + -e.HorizontalChange > 100) + { + grid.Width += -e.HorizontalChange; + } } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Windows/DBDialogWindow.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Windows/DBDialogWindow.xaml new file mode 100644 index 000000000..83cd48926 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Windows/DBDialogWindow.xaml @@ -0,0 +1,32 @@ +<mahapps:MetroWindow x:Class="Tango.MachineStudio.DB.Windows.DBDialogWindow" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:local="clr-namespace:Tango.MachineStudio.DB.Windows" + mc:Ignorable="d" + Title="Machine Studio" Height="450" Width="650" EnableDWMDropShadow="True" ShowCloseButton="False" WindowTransitionsEnabled="False" ShowMaxRestoreButton="False" ShowMinButton="False" TitleCaps="False" BorderThickness="1" WindowStartupLocation="CenterOwner"> + <Grid> + <Border Margin="16"> + <DockPanel LastChildFill="True"> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Top" VerticalAlignment="Top"> + <materialDesign:PackIcon Kind="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=IconKind}" VerticalAlignment="Center" Width="32" Height="32" Foreground="{StaticResource AccentColorBrush}" /> + <TextBlock Margin="10 0 0 0" Foreground="{StaticResource AccentColorBrush}" FontSize="16" Text="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=InnerTitle}"></TextBlock> + </StackPanel> + <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right" DockPanel.Dock="Bottom"> + <Button Style="{StaticResource MaterialDesignFlatButton}" IsDefault="True" Margin="0 8 8 0" Command="{Binding DialogOKCommand}" Click="OnOKClicked"> + ACCEPT + </Button> + <Button Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True" Margin="0 8 8 0" Command="{Binding DialogCancelCommand}" Click="OnCancelClicked"> + CANCEL + </Button> + </StackPanel> + <ScrollViewer Margin="0 10 0 10" VerticalScrollBarVisibility="Auto" Padding="5"> + <ContentPresenter x:Name="presenter"></ContentPresenter> + </ScrollViewer> + </DockPanel> + </Border> + </Grid> +</mahapps:MetroWindow> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Windows/DBDialogWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Windows/DBDialogWindow.xaml.cs new file mode 100644 index 000000000..d9629c642 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Windows/DBDialogWindow.xaml.cs @@ -0,0 +1,68 @@ +using MahApps.Metro.Controls; +using MaterialDesignThemes.Wpf; +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.Shapes; +namespace Tango.MachineStudio.DB.Windows +{ + /// <summary> + /// Interaction logic for DBDialogWindow.xaml + /// </summary> + public partial class DBDialogWindow : MetroWindow + { + public DBDialogWindow() + { + InitializeComponent(); + } + + public String InnerTitle + { + get { return (String)GetValue(InnerTitleProperty); } + set { SetValue(InnerTitleProperty, value); } + } + public static readonly DependencyProperty InnerTitleProperty = + DependencyProperty.Register("InnerTitle", typeof(String), typeof(DBDialogWindow), new PropertyMetadata(null)); + + + + public PackIconKind IconKind + { + get { return (PackIconKind)GetValue(IconKindProperty); } + set { SetValue(IconKindProperty, value); } + } + + // Using a DependencyProperty as the backing store for IconKind. This enables animation, styling, binding, etc... + public static readonly DependencyProperty IconKindProperty = + DependencyProperty.Register("IconKind", typeof(PackIconKind), typeof(DBDialogWindow), new PropertyMetadata(PackIconKind.TableEdit)); + + + + + public DBDialogWindow(FrameworkElement content) : this() + { + presenter.Content = content; + } + + private void OnOKClicked(object sender, RoutedEventArgs e) + { + DialogResult = true; + Close(); + } + + private void OnCancelClicked(object sender, RoutedEventArgs e) + { + DialogResult = false; + Close(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/packages.config index ab8c25d56..138a48ec7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/packages.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/packages.config @@ -8,4 +8,6 @@ <package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net46" /> <package id="MvvmLight" version="5.3.0.0" targetFramework="net46" /> <package id="MvvmLightLibs" version="5.3.0.0" targetFramework="net46" /> + <package id="SimpleValidator" version="0.6.1.0" targetFramework="net46" /> + <package id="WriteableBitmapEx" version="1.5.0.0" targetFramework="net46" /> </packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MdiContainerControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MdiContainerControl.xaml index 3896347fe..b248a4aec 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MdiContainerControl.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MdiContainerControl.xaml @@ -7,7 +7,7 @@ xmlns:local="clr-namespace:Tango.MachineStudio.Common.Controls" xmlns:converters="clr-namespace:Tango.MachineStudio.Common.Converters" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300" Background="White"> + d:DesignHeight="300" d:DesignWidth="300"> <UserControl.Resources> <converters:PointToMarginConverter x:Key="PointToMarginConverter"></converters:PointToMarginConverter> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ExtensionMethods/IStudioMessageExtensions.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ExtensionMethods/IStudioMessageExtensions.cs new file mode 100644 index 000000000..83183f328 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ExtensionMethods/IStudioMessageExtensions.cs @@ -0,0 +1,15 @@ +using GalaSoft.MvvmLight.Messaging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.MachineStudio.Common.Messages; + +public static class IStudioMessageExtensions +{ + public static void Send(this IStudioMessage message) + { + Messenger.Default.Send(message); + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ExtensionMethods/UserExtensions.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ExtensionMethods/UserExtensions.cs index a11ee7e8a..a6c98319e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ExtensionMethods/UserExtensions.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ExtensionMethods/UserExtensions.cs @@ -7,7 +7,7 @@ using Tango.DAL.Observables; public static class UserExtensions { - public static bool HasPermission(this User user, PermissionsEnum permission) + public static bool HasPermission(this User user, Permissions permission) { return user.UsersRoles.Select(x => x.Role).ToList().SelectMany(x => x.RolesPermissions).ToList().Exists(x => x.Permission.Code == permission.ToInt32()); } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.cs index 36c885340..902a45a2f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/IStudioModule.cs @@ -19,7 +19,7 @@ namespace Tango.MachineStudio.Common FrameworkElement MainView { get; } - PermissionsEnum Permission { get; } + Permissions Permission { get; } bool IsInitialized { get; } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Messages/IStudioMessage.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Messages/IStudioMessage.cs new file mode 100644 index 000000000..7d1232c7b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Messages/IStudioMessage.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Common.Messages +{ + public interface IStudioMessage + { + + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs index e14df21ba..a45f9a847 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/INotificationProvider.cs @@ -1,17 +1,43 @@ using MaterialDesignThemes.Wpf; using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; +using System.Windows.Media; namespace Tango.MachineStudio.Common.Notifications { public interface INotificationProvider { - bool ShowDialog<T>(PackIconKind icon, String title, object context) where T : FrameworkElement; + ObservableCollection<TaskItem> TaskItems { get; } - bool ShowDialog(PackIconKind icon, String title, FrameworkElement content, object context); + TaskItem CurrentTaskItem { get; } + + bool HasTaskItems { get; } + + void PushTaskItem(TaskItem taskItem); + + TaskItem PushTaskItem(String message); + + void PopTaskItem(TaskItem taskItem); + + bool? ShowModalWindow(Window window); + + bool ShowModalWindow<T>(PackIconKind icon, String title, object context) where T : FrameworkElement; + + bool ShowModalWindow(PackIconKind icon, String title, FrameworkElement content, object context); + + bool? ShowDialog(PackIconKind icon, Brush iconColor, String message, bool hasCancel); + + void ShowInfo(String message); + + void ShowWarnning(String message); + + void ShowError(String message); + + bool ShowQuestion(String message); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/TaskItem.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/TaskItem.cs new file mode 100644 index 000000000..0cf5e2c8e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Notifications/TaskItem.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; + +namespace Tango.MachineStudio.Common.Notifications +{ + public class TaskItem : ExtendedObject, IDisposable + { + private INotificationProvider _notificationProvider; + + public TaskItem(INotificationProvider notificationProvider) + { + _notificationProvider = notificationProvider; + } + + private String _message; + public String Message + { + get { return _message; } + set { _message = value; RaisePropertyChangedAuto(); } + } + + public void Pop() + { + _notificationProvider.PopTaskItem(this); + } + + public void Push() + { + _notificationProvider.PushTaskItem(this); + } + + public void Dispose() + { + Pop(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IShutdownRequestBlocker.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IShutdownRequestBlocker.cs new file mode 100644 index 000000000..a157bd598 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IShutdownRequestBlocker.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Common.StudioApplication +{ + public interface IShutdownRequestBlocker + { + Task<bool> OnShutdownRequest(); + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs new file mode 100644 index 000000000..0ee27fbf6 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Common.StudioApplication +{ + public interface IStudioApplicationManager + { + void ShutDown(); + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs new file mode 100644 index 000000000..6b7984faf --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.SharedUI; + +namespace Tango.MachineStudio.Common +{ + public abstract class StudioViewModel : ViewModel + { + public abstract Task<bool> RequestShutdown(); + } + + public abstract class StudioViewModel<T> : ViewModel<T> where T : IView + { + public abstract Task<bool> OnShutdownRequest(); + + public StudioViewModel(T view) : base(view) + { + + } + } +} + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj index c94e6fbdc..1aa5216b4 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj @@ -31,14 +31,30 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> + <Reference Include="GalaSoft.MvvmLight, Version=5.3.0.19026, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL"> + <HintPath>..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.dll</HintPath> + </Reference> + <Reference Include="GalaSoft.MvvmLight.Extras, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=669f0b5e8f868abf, processorArchitecture=MSIL"> + <HintPath>..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Extras.dll</HintPath> + </Reference> + <Reference Include="GalaSoft.MvvmLight.Platform, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL"> + <HintPath>..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath> + </Reference> <Reference Include="MaterialDesignColors, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\..\packages\MaterialDesignColors.1.1.2\lib\net45\MaterialDesignColors.dll</HintPath> </Reference> <Reference Include="MaterialDesignThemes.Wpf, Version=2.3.1.953, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\..\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath> </Reference> + <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="System" /> <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> + <Private>True</Private> + </Reference> <Reference Include="System.Xml" /> <Reference Include="Microsoft.CSharp" /> <Reference Include="System.Core" /> @@ -53,6 +69,12 @@ <Reference Include="PresentationFramework" /> </ItemGroup> <ItemGroup> + <Compile Include="StudioApplication\IStudioApplicationManager.cs" /> + <Compile Include="StudioApplication\IShutdownRequestBlocker.cs" /> + <Compile Include="ExtensionMethods\IStudioMessageExtensions.cs" /> + <Compile Include="Messages\IStudioMessage.cs" /> + <Compile Include="Notifications\TaskItem.cs" /> + <Compile Include="ValidationRules\Required.cs" /> <Page Include="Controls\MdiContainerControl.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ValidationRules/Required.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ValidationRules/Required.cs new file mode 100644 index 000000000..84f274965 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/ValidationRules/Required.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Controls; + +namespace Tango.MachineStudio.Common.ValidationRules +{ + public class Required : ValidationRule + { + public override ValidationResult Validate(object value, CultureInfo cultureInfo) + { + return new ValidationResult(!String.IsNullOrWhiteSpace(value.ToStringSafe()), "Required"); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/packages.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/packages.config index 0c779127b..f67c854e3 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/packages.config +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/packages.config @@ -1,5 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <packages> + <package id="CommonServiceLocator" version="1.3" targetFramework="net46" /> <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" /> </packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs index b3b92b6ab..ca553de1e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs @@ -14,13 +14,9 @@ namespace Tango.MachineStudio.UI /// </summary> public partial class App : Application { - public static ObservablesEntitiesAdapter DbAdapter { get; set; } - protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); - - DbAdapter = ObservablesEntitiesAdapter.Instance; } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/account.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/account.png Binary files differnew file mode 100644 index 000000000..46f0d38fc --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/account.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs index 3f7d4cad8..9193cfd3e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs @@ -1,4 +1,5 @@ using MahApps.Metro.Controls; +using Microsoft.Practices.ServiceLocation; using System; using System.Collections.Generic; using System.Linq; @@ -13,6 +14,7 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.MachineStudio.Common.StudioApplication; namespace Tango.MachineStudio.UI { @@ -26,8 +28,15 @@ namespace Tango.MachineStudio.UI public MainWindow() { InitializeComponent(); - Instance = this; + + this.Closing += MainWindow_Closing; + } + + private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) + { + e.Cancel = true; + ServiceLocator.Current.GetInstance<IStudioApplicationManager>().ShutDown(); } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs index 8e0fd2220..b1ba03109 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs @@ -7,17 +7,49 @@ using System.Windows; using MaterialDesignThemes.Wpf; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.UI.Windows; +using System.Windows.Media; +using Tango.Core; +using System.Collections.ObjectModel; namespace Tango.MachineStudio.UI.Notifications { - public class DefaultNotificationProvider : INotificationProvider + public class DefaultNotificationProvider : ExtendedObject, INotificationProvider { - public bool ShowDialog<T>(PackIconKind icon, string title, object context) where T : FrameworkElement + public ObservableCollection<TaskItem> TaskItems { get; private set; } + + public bool HasTaskItems { - return ShowDialog(icon, title, Activator.CreateInstance<T>(), context); + get { return TaskItems.Count > 0; } } - public bool ShowDialog(PackIconKind icon, string title, FrameworkElement content, object context) + private TaskItem _currentTaskItem; + + public TaskItem CurrentTaskItem + { + get { return _currentTaskItem; } + set { _currentTaskItem = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(HasTaskItems)); } + } + + public DefaultNotificationProvider() + { + TaskItems = new ObservableCollection<TaskItem>(); + } + + public bool ShowModalWindow<T>(PackIconKind icon, string title, object context) where T : FrameworkElement + { + return ShowModalWindow(icon, title, Activator.CreateInstance<T>(), context); + } + + public bool? ShowModalWindow(Window window) + { + window.Owner = Application.Current.MainWindow; + MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; + bool result = window.ShowDialog().Value; + MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + return result; + } + + public bool ShowModalWindow(PackIconKind icon, string title, FrameworkElement content, object context) { DialogWindow dialog = new DialogWindow(content); dialog.DataContext = context; @@ -28,5 +60,69 @@ namespace Tango.MachineStudio.UI.Notifications MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; return result; } + + public bool? ShowDialog(PackIconKind icon, Brush iconColor, string message, bool hasCancel) + { + MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; + + var result = new MessageBoxWindow() + { + Owner = Application.Current.MainWindow, + Message = message, + IconKind = icon, + IconColor = iconColor, + HasCancel = hasCancel + + }.ShowDialog(); + + MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + return result; + } + + public void ShowError(string message) + { + ShowDialog(PackIconKind.Exclamation, Brushes.Red, message, false); + } + + public void ShowInfo(string message) + { + ShowDialog(PackIconKind.Information, Brushes.Black, message, false); + } + + public bool ShowQuestion(string message) + { + return ShowDialog(PackIconKind.CommentQuestionOutline, Brushes.Black, message, true).Value; + } + + public void ShowWarnning(string message) + { + ShowDialog(PackIconKind.Exclamation, Brushes.DarkOrange, message, false); + } + + public void PushTaskItem(TaskItem taskItem) + { + TaskItems.Add(taskItem); + CurrentTaskItem = taskItem; + } + + public TaskItem PushTaskItem(string message) + { + TaskItem item = new TaskItem(this); + item.Message = message; + PushTaskItem(item); + return item; + } + + public void PopTaskItem(TaskItem taskItem) + { + TaskItems.Remove(taskItem); + + if (TaskItems.Count > 0) + { + CurrentTaskItem = TaskItems.Last(); + } + + RaisePropertyChanged(nameof(HasTaskItems)); + } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml index f23776ec2..2a8dd9f28 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml @@ -12,17 +12,9 @@ <Border Margin="16"> <DockPanel LastChildFill="True"> <StackPanel Orientation="Horizontal" DockPanel.Dock="Top" VerticalAlignment="Top"> - <materialDesign:PackIcon Kind="TableEdit" VerticalAlignment="Center" Width="32" Height="32" Foreground="{StaticResource AccentColorBrush}" /> + <materialDesign:PackIcon Kind="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=IconKind}" VerticalAlignment="Center" Width="32" Height="32" Foreground="{StaticResource AccentColorBrush}" /> <TextBlock Margin="10 0 0 0" Foreground="{StaticResource AccentColorBrush}" FontSize="16" Text="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=InnerTitle}"></TextBlock> </StackPanel> - <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right" DockPanel.Dock="Bottom"> - <Button Style="{StaticResource MaterialDesignFlatButton}" IsDefault="True" Margin="0 8 8 0" Command="{Binding DialogOKCommand}" Click="OnOKClicked"> - ACCEPT - </Button> - <Button Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True" Margin="0 8 8 0" Command="{Binding DialogCancelCommand}" Click="OnCancelClicked"> - CANCEL - </Button> - </StackPanel> <ScrollViewer Margin="0 10 0 10" VerticalScrollBarVisibility="Auto" Padding="5"> <ContentPresenter x:Name="presenter"></ContentPresenter> </ScrollViewer> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs index c946d2b88..31dd3d644 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DialogWindow.xaml.cs @@ -1,4 +1,5 @@ using MahApps.Metro.Controls; +using MaterialDesignThemes.Wpf; using System; using System.Collections.Generic; using System.Linq; @@ -38,6 +39,17 @@ namespace Tango.MachineStudio.UI.Windows + public PackIconKind IconKind + { + get { return (PackIconKind)GetValue(IconKindProperty); } + set { SetValue(IconKindProperty, value); } + } + public static readonly DependencyProperty IconKindProperty = + DependencyProperty.Register("IconKind", typeof(PackIconKind), typeof(DialogWindow), new PropertyMetadata(PackIconKind.Information)); + + + + public DialogWindow(FrameworkElement content) : this() { presenter.Content = content; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml new file mode 100644 index 000000000..4f3b826fe --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml @@ -0,0 +1,40 @@ +<Window x:Class="Tango.MachineStudio.UI.Notifications.MessageBoxWindow" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:local="clr-namespace:Tango.MachineStudio.UI.Notifications" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + mc:Ignorable="d" + Title="Machine Studio" MinHeight="220" MaxHeight="600" SizeToContent="Height" Width="570" Opacity="0" AllowsTransparency="True" WindowStyle="None" WindowStartupLocation="CenterOwner" Background="Transparent"> + + <Window.Resources> + <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"></BooleanToVisibilityConverter> + </Window.Resources> + + <Grid> + <Border Background="White" CornerRadius="10" Padding="10" Margin="20"> + <Border.Effect> + <DropShadowEffect ShadowDepth="0" BlurRadius="10"></DropShadowEffect> + </Border.Effect> + <DockPanel LastChildFill="True"> + <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right" DockPanel.Dock="Bottom"> + <Button Style="{StaticResource MaterialDesignFlatButton}" IsDefault="True" Margin="0 8 8 0" Click="OnOKClicked"> + ACCEPT + </Button> + <Button Visibility="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=HasCancel,Converter={StaticResource BooleanToVisibilityConverter}}" Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True" Margin="0 8 8 0" Click="OnCancelClicked"> + CANCEL + </Button> + </StackPanel> + <Grid> + <StackPanel Orientation="Horizontal" VerticalAlignment="Top" Margin="0 30 0 0"> + <materialDesign:PackIcon Kind="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=IconKind}" VerticalAlignment="Top" Width="50" Height="50" Foreground="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=IconColor}" /> + <TextBlock Padding="0 10 0 0" TextWrapping="Wrap" Margin="10 0 0 0" VerticalAlignment="Top" FontSize="14" Text="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=Message}" Width="400"></TextBlock> + </StackPanel> + </Grid> + </DockPanel> + </Border> + </Grid> +</Window> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml.cs new file mode 100644 index 000000000..7ce4965ef --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/MessageBoxWindow.xaml.cs @@ -0,0 +1,83 @@ +using MahApps.Metro.Controls; +using MaterialDesignThemes.Wpf; +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.Animation; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.UI.Notifications +{ + /// <summary> + /// Interaction logic for MessageBoxWindow.xaml + /// </summary> + public partial class MessageBoxWindow : Window + { + public MessageBoxWindow() + { + InitializeComponent(); + this.Loaded += MessageBoxWindow_Loaded; + } + + private void MessageBoxWindow_Loaded(object sender, RoutedEventArgs e) + { + DoubleAnimation ani = new DoubleAnimation(); + ani.To = 1; + ani.Duration = TimeSpan.FromSeconds(0.5); + this.BeginAnimation(Window.OpacityProperty, ani); + } + + public String Message + { + get { return (String)GetValue(MessageProperty); } + set { SetValue(MessageProperty, value); } + } + public static readonly DependencyProperty MessageProperty = + DependencyProperty.Register("Message", typeof(String), typeof(MessageBoxWindow), new PropertyMetadata(null)); + + public Brush IconColor + { + get { return (Brush)GetValue(IconColorProperty); } + set { SetValue(IconColorProperty, value); } + } + public static readonly DependencyProperty IconColorProperty = + DependencyProperty.Register("IconColor", typeof(Brush), typeof(MessageBoxWindow), new PropertyMetadata(Brushes.Black)); + + public PackIconKind IconKind + { + get { return (PackIconKind)GetValue(IconKindProperty); } + set { SetValue(IconKindProperty, value); } + } + public static readonly DependencyProperty IconKindProperty = + DependencyProperty.Register("IconKind", typeof(PackIconKind), typeof(MessageBoxWindow), new PropertyMetadata(PackIconKind.Information)); + + public bool HasCancel + { + get { return (bool)GetValue(HasCancelProperty); } + set { SetValue(HasCancelProperty, value); } + } + public static readonly DependencyProperty HasCancelProperty = + DependencyProperty.Register("HasCancel", typeof(bool), typeof(MessageBoxWindow), new PropertyMetadata(false)); + + private void OnOKClicked(object sender, RoutedEventArgs e) + { + DialogResult = true; + Close(); + } + + private void OnCancelClicked(object sender, RoutedEventArgs e) + { + DialogResult = false; + Close(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs new file mode 100644 index 000000000..b95a74a3e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -0,0 +1,53 @@ +using Microsoft.Practices.ServiceLocation; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Tango.Core.Helpers; +using Tango.MachineStudio.Common.StudioApplication; +using Tango.MachineStudio.Common.Navigation; +using GalaSoft.MvvmLight.Ioc; +using System.Reflection; +using System.Collections; + +namespace Tango.MachineStudio.UI.StudioApplication +{ + public class DefaultStudioApplicationManager : IStudioApplicationManager + { + private INavigationManager _navigationManager; + + public DefaultStudioApplicationManager(INavigationManager navigationManager) + { + _navigationManager = navigationManager; + } + + public async void ShutDown() + { + _navigationManager.NavigateTo(NavigationView.ShutdownView); + + await Task.Factory.StartNew(async () => + { + + //Do Shutdown Procedures... + foreach (var vm in ServiceLocator.Current.GetAllInstancesByBase<IShutdownRequestBlocker>()) + { + var result = await vm.OnShutdownRequest(); + if (!result) + { + ThreadsHelper.InvokeUI(() => + { + _navigationManager.NavigateTo(NavigationView.MainView); + }); + return; + } + } + + Thread.Sleep(3000); + Environment.Exit(0); + + }); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj index 9d2860241..be0c1a829 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -70,6 +70,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="SimpleValidator, Version=0.6.1.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\packages\SimpleValidator.0.6.1.0\lib\net40\SimpleValidator.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.Data" /> @@ -96,10 +99,14 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </ApplicationDefinition> + <Compile Include="StudioApplication\DefaultStudioApplicationManager.cs" /> <Compile Include="Authentication\DefaultAuthenticationProvider.cs" /> <Compile Include="Modules\DefaultStudioModuleLoader.cs" /> <Compile Include="Navigation\DefaultNavigationManager.cs" /> <Compile Include="Notifications\DefaultNotificationProvider.cs" /> + <Compile Include="Notifications\MessageBoxWindow.xaml.cs"> + <DependentUpon>MessageBoxWindow.xaml</DependentUpon> + </Compile> <Compile Include="SupervisingController\IMainView.cs" /> <Compile Include="ViewModels\LoadingViewVM.cs" /> <Compile Include="ViewModels\LoginViewVM.cs" /> @@ -136,6 +143,10 @@ <DependentUpon>MainWindow.xaml</DependentUpon> <SubType>Code</SubType> </Compile> + <Page Include="Notifications\MessageBoxWindow.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Themes\Generic.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -232,7 +243,12 @@ <ItemGroup> <Resource Include="Images\machine-trans.png" /> </ItemGroup> - <ItemGroup /> + <ItemGroup> + <Resource Include="Images\account.png" /> + </ItemGroup> + <ItemGroup> + <Folder Include="Controls\" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <PropertyGroup> <PostBuildEvent>$(TargetDir)linkgen.exe -s "$(TargetPath)" -d "$(TargetDir)Utilities\Machine Studio.lnk"</PostBuildEvent> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs index 5095dfc93..f4a7a7502 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModelLocator.cs @@ -7,10 +7,12 @@ using Tango.MachineStudio.Common.Authentication; using Tango.MachineStudio.Common.Modules; using Tango.MachineStudio.Common.Navigation; using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.Common.StudioApplication; using Tango.MachineStudio.UI.Authentication; using Tango.MachineStudio.UI.Modules; using Tango.MachineStudio.UI.Navigation; using Tango.MachineStudio.UI.Notifications; +using Tango.MachineStudio.UI.StudioApplication; using Tango.MachineStudio.UI.SupervisingController; using Tango.MachineStudio.UI.ViewModels; using Tango.MachineStudio.UI.Views; @@ -45,11 +47,13 @@ namespace Tango.MachineStudio.UI SimpleIoc.Default.Unregister<IAuthenticationProvider>(); SimpleIoc.Default.Unregister<INavigationManager>(); SimpleIoc.Default.Unregister<IStudioModuleLoader>(); + SimpleIoc.Default.Unregister<IStudioApplicationManager>(); SimpleIoc.Default.Register<INotificationProvider, DefaultNotificationProvider>(); SimpleIoc.Default.Register<IAuthenticationProvider, DefaultAuthenticationProvider>(); SimpleIoc.Default.Register<INavigationManager, DefaultNavigationManager>(); SimpleIoc.Default.Register<IStudioModuleLoader, DefaultStudioModuleLoader>(); + SimpleIoc.Default.Register<IStudioApplicationManager, DefaultStudioApplicationManager>(); SimpleIoc.Default.Register<MainViewVM>(); SimpleIoc.Default.Register<LoadingViewVM>(); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs index 72ab5aca9..f50b734f4 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs @@ -4,26 +4,58 @@ using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; +using Tango.Core.Threading; +using Tango.DAL.Observables; using Tango.MachineStudio.Common.Modules; using Tango.MachineStudio.Common.Navigation; +using Tango.MachineStudio.Common.Notifications; using Tango.SharedUI; namespace Tango.MachineStudio.UI.ViewModels { public class LoadingViewVM : ViewModel { - public LoadingViewVM(INavigationManager navigationManager, IStudioModuleLoader studioModuleLoader) + private INotificationProvider _notificationProvider; + private INavigationManager _navigationManager; + private IStudioModuleLoader _studioModuleLoader; + + public LoadingViewVM(INavigationManager navigationManager, IStudioModuleLoader studioModuleLoader, INotificationProvider notificationProvider) + { + _navigationManager = navigationManager; + _studioModuleLoader = studioModuleLoader; + _notificationProvider = notificationProvider; + Load(); + } + + private void Load() { - Task.Factory.StartNew(() => + StaThreadHelper.StartStaThread(() => { Thread.Sleep(3000); - }).ContinueWith((x) => - { - - studioModuleLoader.LoadModules(); - navigationManager.NavigateTo(NavigationView.LoginView); - - }, TaskScheduler.FromCurrentSynchronizationContext()); + try + { + ObservablesEntitiesAdapter.Instance.Initialize(); + InvokeUI(() => + { + _studioModuleLoader.LoadModules(); + _navigationManager.NavigateTo(NavigationView.LoginView); + }); + } + catch (Exception ex) + { + InvokeUINow(() => + { + if (_notificationProvider.ShowQuestion("An error occurred while trying to connect to Twine database." + Environment.NewLine + "Would you like to try again?")) + { + Load(); + } + else + { + Environment.Exit(0); + } + }); + } + }); } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs index 67c116790..6fe90fa99 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoginViewVM.cs @@ -1,13 +1,17 @@ using System; +using System.Collections; using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; using Tango.Core.Commands; +using Tango.Core.Cryptography; using Tango.MachineStudio.Common.Authentication; using Tango.MachineStudio.Common.Navigation; +using Tango.MachineStudio.Common.Notifications; +using Tango.Settings; using Tango.SharedUI; namespace Tango.MachineStudio.UI.ViewModels @@ -16,34 +20,59 @@ namespace Tango.MachineStudio.UI.ViewModels { private IAuthenticationProvider _authenticationProvider; private INavigationManager _navigationManager; + private INotificationProvider _notificationProvider; + private Rfc2898Cryptographer cryptographer; private String _email; + [Required(ErrorMessage = "Email is required")] + [EmailAddress(ErrorMessage = "Please enter a valid email")] public String Email { get { return _email; } set { _email = value; RaisePropertyChangedAuto(); } } - public RelayCommand<PasswordBox> LoginCommand { get; set; } + private bool _rememberMe; - public LoginViewVM(IAuthenticationProvider authenticationProvider, INavigationManager navigationManager) + public bool RememberMe { + get { return _rememberMe; } + set { _rememberMe = value; RaisePropertyChangedAuto(); } + } + + + public RelayCommand<String> LoginCommand { get; set; } + + public LoginViewVM(IAuthenticationProvider authenticationProvider, INavigationManager navigationManager, INotificationProvider notificationProvider) + { + _notificationProvider = notificationProvider; _navigationManager = navigationManager; _authenticationProvider = authenticationProvider; - LoginCommand = new RelayCommand<PasswordBox>(Login); + LoginCommand = new RelayCommand<String>(Login); + + cryptographer = new Rfc2898Cryptographer(); + Email = SettingsManager.Default.MachineStudio.LastLoginEmail; + RememberMe = SettingsManager.Default.MachineStudio.RememberMe; } - private void Login(PasswordBox passwordBox) + private void Login(String password) { - String password = passwordBox.Password; - try - { - _authenticationProvider.Login(Email, password); - _navigationManager.NavigateTo(NavigationView.MainView); - } - catch (Exception ex) + if (Validate()) { - MessageBox.Show("Failed"); + try + { + _authenticationProvider.Login(Email, password); + _navigationManager.NavigateTo(NavigationView.MainView); + SettingsManager.Default.MachineStudio.LastLoginEmail = Email; + SettingsManager.Default.MachineStudio.RememberMe = RememberMe; + + SettingsManager.Default.MachineStudio.LastLoginPassword = RememberMe ? cryptographer.Encrypt(password) : null; + SettingsManager.SaveDefaultSettings(); + } + catch + { + _notificationProvider.ShowError("Invalid credentials. Please try again."); + } } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index 213d1a83d..7ef47fabd 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -10,6 +10,7 @@ using Tango.Core.Commands; using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Authentication; using Tango.MachineStudio.Common.Modules; +using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.UI.SupervisingController; using Tango.SharedUI; @@ -52,10 +53,24 @@ namespace Tango.MachineStudio.UI.ViewModels set { _studioModuleLoader = value; RaisePropertyChangedAuto(); } } - public MainViewVM(IMainView view, IAuthenticationProvider authenticationProvider, IStudioModuleLoader studioModuleLoader) : base(view) + private INotificationProvider _notificationProvider; + + public INotificationProvider NotificationProvider + { + get { return _notificationProvider; } + set { _notificationProvider = value; RaisePropertyChangedAuto(); } + } + + + public MainViewVM( + IMainView view, + IAuthenticationProvider authenticationProvider, + IStudioModuleLoader studioModuleLoader, + INotificationProvider notificationProvider) : base(view) { AuthenticationProvider = authenticationProvider; StudioModuleLoader = studioModuleLoader; + NotificationProvider = notificationProvider; StartModuleCommand = new RelayCommand<IStudioModule>(StartModule); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml index ab0875023..459c8fde8 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml @@ -6,7 +6,7 @@ xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" - d:DesignHeight="720" d:DesignWidth="1280" DataContext="{Binding LoadingViewVM, Source={StaticResource Locator}}" Background="White"> + d:DesignHeight="720" d:DesignWidth="1280" Cursor="Wait" DataContext="{Binding LoadingViewVM, Source={StaticResource Locator}}" Background="White"> <Grid> <Grid HorizontalAlignment="Center" VerticalAlignment="Center"> <StackPanel> @@ -15,7 +15,7 @@ <TextBlock FontSize="70" Foreground="{StaticResource AccentColorBrush}">Machine Studio</TextBlock> </StackPanel> <TextBlock HorizontalAlignment="Right" FontSize="18" Margin="0 0 -50 0" Foreground="{StaticResource AccentColorBrush}">Twine Solutions</TextBlock> - <mahapps:ProgressRing Margin="20 60 20 20" Width="80" Height="80"></mahapps:ProgressRing> + <mahapps:ProgressRing Margin="20 60 20 40" Width="80" Height="80"></mahapps:ProgressRing> <TextBlock HorizontalAlignment="Center" FontSize="18" FontStyle="Italic">Loading, please wait...</TextBlock> </StackPanel> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml index 60590a16b..1531370af 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml @@ -2,17 +2,41 @@ 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:rules="clr-namespace:Tango.MachineStudio.Common.ValidationRules;assembly=Tango.MachineStudio.Common" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" d:DesignHeight="720" d:DesignWidth="1280" DataContext="{Binding LoginViewVM, Source={StaticResource Locator}}" Background="White"> + + <UserControl.Resources> + <rules:Required x:Key="Required"></rules:Required> + </UserControl.Resources> + + + <UserControl.InputBindings> + <KeyBinding Key="Return" Command="{Binding LoginCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Password}"></KeyBinding> + </UserControl.InputBindings> <Grid> - <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="300"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="40"> <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant" Width="100"></Image> - <TextBox Margin="0 40 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Email" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="24" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Text="{Binding Email,UpdateSourceTrigger=PropertyChanged}" /> - <PasswordBox x:Name="txtPass" Margin="0 20 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Password" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="24" Style="{StaticResource MaterialDesignFloatingHintPasswordBox}" /> - <Button Margin="0 40 0 0" Height="50" Command="{Binding LoginCommand}" CommandParameter="{Binding ElementName=txtPass}">LOGIN</Button> + <TextBlock Margin="20 0 0 0" VerticalAlignment="Center" FontSize="70" Foreground="{StaticResource AccentColorBrush}">Machine Studio</TextBlock> + </StackPanel> + <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="320" Margin="0 120 0 0"> + <TextBlock HorizontalAlignment="Center" FontSize="24">Login to your account</TextBlock> + <Image Source="/Images/account.png" RenderOptions.BitmapScalingMode="Fant" Width="100" Margin="0 20 0 0"></Image> + <DockPanel Margin="0 20 0 0"> + <materialDesign:PackIcon Margin="0 0 0 0" Width="20" Height="20" VerticalAlignment="Top" Foreground="{Binding ElementName=txtEmail, Path=BorderBrush}" Kind="EmailOutline" /> + <TextBox x:Name="txtEmail" IsTabStop="True" Margin="5 0 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Email" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="20" Style="{StaticResource MaterialDesignFloatingHintTextBox}" Text="{Binding Email,UpdateSourceTrigger=PropertyChanged,ValidatesOnNotifyDataErrors=True}" AutomationProperties.IsRequiredForForm="True" /> + </DockPanel> + <DockPanel Margin="0 20 0 0"> + <materialDesign:PackIcon Margin="0 0 0 0" Width="20" Height="20" VerticalAlignment="Top" Foreground="{Binding ElementName=txtPass, Path=BorderBrush}" Kind="Key" /> + <PasswordBox x:Name="txtPass" PasswordChanged="txtPass_PasswordChanged" Margin="5 0 0 0" materialDesign:HintAssist.FloatingScale="0.50" materialDesign:HintAssist.Hint="Password" materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0" FontSize="20" Style="{StaticResource MaterialDesignFloatingHintPasswordBox}" AutomationProperties.IsRequiredForForm="True" /> + </DockPanel> + <CheckBox Margin="25 20 0 0" IsChecked="{Binding RememberMe}">Remember me</CheckBox> + <Button Margin="25 20 0 0" Height="50" Command="{Binding LoginCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Password}" Content="LOGIN"> + + </Button> </StackPanel> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml.cs index 0b3a9ae4f..027e37682 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoginView.xaml.cs @@ -12,17 +12,50 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using static Tango.SharedUI.Controls.MultiTransitionControl; +using SimpleValidator.Extensions; +using Tango.Settings; +using Tango.Core.Cryptography; namespace Tango.MachineStudio.UI.Views { /// <summary> /// Interaction logic for LoginView.xaml /// </summary> - public partial class LoginView : UserControl + public partial class LoginView : UserControl, ITransitionView { + private Rfc2898Cryptographer cryptographer; + public LoginView() { InitializeComponent(); + + cryptographer = new Rfc2898Cryptographer(); + } + + public String Password + { + get { return (String)GetValue(PasswordProperty); } + set { SetValue(PasswordProperty, value); } + } + public static readonly DependencyProperty PasswordProperty = + DependencyProperty.Register("Password", typeof(String), typeof(LoginView), new PropertyMetadata(null)); + + public void OnTransitionCompleted() + { + txtEmail.Focus(); + + if (txtEmail.Text.IsNotNullOrWhiteSpace()) + { + txtPass.Focus(); + } + + txtPass.Password = cryptographer.Decrypt(SettingsManager.Default.MachineStudio.LastLoginPassword); + } + + private void txtPass_PasswordChanged(object sender, RoutedEventArgs e) + { + Password = txtPass.Password; } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml index 98b6ecb73..cb7378666 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -3,36 +3,78 @@ 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:dockablz="clr-namespace:Dragablz.Dockablz;assembly=Dragablz" xmlns:dragablz="clr-namespace:Dragablz;assembly=Dragablz" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:db="clr-namespace:Tango.MachineStudio.DB.Views;assembly=Tango.MachineStudio.DB" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" d:DesignHeight="720" d:DesignWidth="1270" Background="White" DataContext="{Binding MainViewVM, Source={StaticResource Locator}}"> <Grid> + <Grid.Style> + <Style TargetType="Grid"> + <Style.Triggers> + <DataTrigger Binding="{Binding NotificationProvider.HasTaskItems}" Value="True"> + <Setter Property="Cursor" Value="AppStarting"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding NotificationProvider.HasTaskItems}" Value="False"> + <Setter Property="Cursor" Value="Arrow"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + <materialDesign:DrawerHost IsLeftDrawerOpen="{Binding ElementName=MenuToggleButton, Path=IsChecked}"> <materialDesign:DrawerHost.LeftDrawerContent> - <DockPanel MinWidth="212"> - <Grid DockPanel.Dock="Top"> + <StackPanel MinWidth="300"> + <Grid> <ToggleButton Style="{StaticResource MaterialDesignHamburgerToggleButton}" HorizontalAlignment="Right" Margin="16" IsChecked="{Binding ElementName=MenuToggleButton, Path=IsChecked, Mode=TwoWay}" /> <StackPanel Margin="5 0 0 0" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center"> - <materialDesign:PackIcon VerticalAlignment="Center" Kind="Account" Foreground="{StaticResource AccentColorBrush}" Width="32" Height="32"></materialDesign:PackIcon> - <TextBlock Margin="10 0 0 0" VerticalAlignment="Center">User Name</TextBlock> + <Image Source="/Images/account.png" RenderOptions.BitmapScalingMode="Fant" VerticalAlignment="Center" Width="50" Height="50"></Image> + <TextBlock FontSize="16" TextTrimming="CharacterEllipsis" MaxWidth="170" FontWeight="Bold" Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding AuthenticationProvider.CurrentUser.Contact.FullName}"></TextBlock> </StackPanel> </Grid> - <ListBox x:Name="DemoItemsListBox" Margin="0 16 0 16" SelectedIndex="0"> - <Button Command="{Binding HomeCommand}" Style="{DynamicResource MaterialDesignFlatButton}">Home</Button> - <ListBoxItem>Item 2</ListBoxItem> - <ListBoxItem>Item 3</ListBoxItem> - <ListBoxItem>Item 4</ListBoxItem> - <ListBoxItem>Item 5</ListBoxItem> + <StackPanel Margin="0 16 0 0"> + <ListBoxItem> + <i:Interaction.Triggers> + <i:EventTrigger EventName="PreviewMouseUp"> + <i:InvokeCommandAction Command="{Binding HomeCommand}"></i:InvokeCommandAction> + </i:EventTrigger> + </i:Interaction.Triggers> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon VerticalAlignment="Center" Kind="Home" Width="32" Height="32"></materialDesign:PackIcon> + <TextBlock FontSize="16" VerticalAlignment="Center" Margin="10 0 0 0">Home</TextBlock> + </StackPanel> + </ListBoxItem> + </StackPanel> + <ListBox ItemsSource="{Binding StudioModuleLoader.UserModules}" HorizontalContentAlignment="Stretch"> + <ListBox.ItemContainerStyle> + <Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}"> + <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter> + <Setter Property="VerticalContentAlignment" Value="Stretch"></Setter> + </Style> + </ListBox.ItemContainerStyle> + <ListBox.ItemTemplate> + <DataTemplate> + <Grid Background="Transparent"> + <i:Interaction.Triggers> + <i:EventTrigger EventName="PreviewMouseUp"> + <i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.StartModuleCommand}" CommandParameter="{Binding}"></i:InvokeCommandAction> + </i:EventTrigger> + </i:Interaction.Triggers> + + <TextBlock Text="{Binding Name}" ToolTip="{Binding Description}"></TextBlock> + </Grid> + </DataTemplate> + </ListBox.ItemTemplate> </ListBox> - </DockPanel> + </StackPanel> </materialDesign:DrawerHost.LeftDrawerContent> <DockPanel> <materialDesign:ColorZone Padding="16" materialDesign:ShadowAssist.ShadowDepth="Depth2" @@ -150,6 +192,47 @@ <ContentPresenter Content="{Binding CurrentModule.MainView}"></ContentPresenter> </Grid> </Grid> + + <Border HorizontalAlignment="Right" Margin="0 -1 10 0" VerticalAlignment="Top" Width="300" Height="40" Padding="5" CornerRadius="0 0 30 30" BorderThickness="1 0 1 1" BorderBrush="DimGray"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="RenderTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="0"></ScaleTransform> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding NotificationProvider.HasTaskItems}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="00:00:0.2"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation BeginTime="00:00:01" Storyboard.TargetProperty="RenderTransform.ScaleY" To="0" From="1" Duration="00:00:0.5"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + <Border.Background> + <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> + <GradientStop Color="#03A9F4"/> + <GradientStop Color="#0081BB" Offset="1"/> + </LinearGradientBrush> + </Border.Background> + + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="20 0 0 0"> + <mahapps:ProgressRing Width="24" Height="24" Foreground="White"></mahapps:ProgressRing> + <TextBlock Text="{Binding NotificationProvider.CurrentTaskItem.Message}" Foreground="White" VerticalAlignment="Center" Margin="10 0 0 0"></TextBlock> + </StackPanel> + </Border> </Grid> </DockPanel> </materialDesign:DrawerHost> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ShutdownView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ShutdownView.xaml index 20329ef25..487dfe1f8 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ShutdownView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ShutdownView.xaml @@ -3,10 +3,21 @@ 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300" DataContext="{Binding ShutdownViewVM, Source={StaticResource Locator}}"> + d:DesignHeight="720" d:DesignWidth="1280" Cursor="Wait" Background="White" DataContext="{Binding ShutdownViewVM, Source={StaticResource Locator}}"> <Grid> - + <Grid HorizontalAlignment="Center" VerticalAlignment="Center"> + <StackPanel> + <Image Source="/Images/machine-trans.png" RenderOptions.BitmapScalingMode="Fant" Width="100"></Image> + <StackPanel Orientation="Horizontal"> + <TextBlock FontSize="70" Foreground="Gray">Machine Studio</TextBlock> + </StackPanel> + <TextBlock HorizontalAlignment="Right" FontSize="18" Margin="0 0 -50 0" Foreground="Gray">Twine Solutions</TextBlock> + <mahapps:ProgressRing Margin="20 60 20 40" Width="80" Height="80" Foreground="Gray"></mahapps:ProgressRing> + <TextBlock HorizontalAlignment="Center" FontSize="18" FontStyle="Italic" Foreground="Gray">Shutting Down, please wait...</TextBlock> + </StackPanel> + </Grid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config index 2da000205..3a7265a72 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/packages.config @@ -9,4 +9,5 @@ <package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net46" /> <package id="MvvmLight" version="5.3.0.0" targetFramework="net46" /> <package id="MvvmLightLibs" version="5.3.0.0" targetFramework="net46" /> + <package id="SimpleValidator" version="0.6.1.0" targetFramework="net46" /> </packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Class.cs b/Software/Visual_Studio/Tango.CodeGeneration/Class.cs index 087f07916..45a32ae3e 100644 --- a/Software/Visual_Studio/Tango.CodeGeneration/Class.cs +++ b/Software/Visual_Studio/Tango.CodeGeneration/Class.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace Tango.CodeGeneration { - public class Class : CodeObject + public class Class : CodeObject { /// <summary> /// Gets or sets the class name. diff --git a/Software/Visual_Studio/Tango.CodeGeneration/EntityCodeFileJava.cs b/Software/Visual_Studio/Tango.CodeGeneration/EntityCodeFileJava.cs new file mode 100644 index 000000000..d2bfd80fc --- /dev/null +++ b/Software/Visual_Studio/Tango.CodeGeneration/EntityCodeFileJava.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.CodeGeneration +{ + public class EntityCodeFileJava : Class + { + public String EntityName { get; set; } + + public String TableName { get; set; } + + public List<EntityCodeFileField> Fields { get; set; } + + public EntityCodeFileJava(String name) : base(name) + { + Fields = new List<EntityCodeFileField>(); + } + } +} diff --git a/Software/Visual_Studio/Tango.CodeGeneration/EnumerationFileJava.cs b/Software/Visual_Studio/Tango.CodeGeneration/EnumerationFileJava.cs new file mode 100644 index 000000000..6a42326f7 --- /dev/null +++ b/Software/Visual_Studio/Tango.CodeGeneration/EnumerationFileJava.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.CodeGeneration +{ + public class EnumerationFileJava : CodeFile + { + public String Name { get; set; } + + public List<EnumerationField> Fields { get; set; } + + public EnumerationFileJava() + { + Fields = new List<EnumerationField>(); + } + } +} diff --git a/Software/Visual_Studio/Tango.CodeGeneration/ObservablesAdapterFile.cs b/Software/Visual_Studio/Tango.CodeGeneration/ObservablesAdapterFile.cs new file mode 100644 index 000000000..7b1e3d8fe --- /dev/null +++ b/Software/Visual_Studio/Tango.CodeGeneration/ObservablesAdapterFile.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.CodeGeneration +{ + public class ObservablesAdapterFile : Class + { + + } +} diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj b/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj index e2cc941e7..1c491813a 100644 --- a/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj +++ b/Software/Visual_Studio/Tango.CodeGeneration/Tango.CodeGeneration.csproj @@ -64,8 +64,11 @@ <Compile Include="CodeFile.cs" /> <Compile Include="CodeObject.cs" /> <Compile Include="DpProperty.cs" /> + <Compile Include="EntityCodeFileJava.cs" /> <Compile Include="EntityCodeFile.cs" /> <Compile Include="EnumerationField.cs" /> + <Compile Include="TangoDAOJavaFile.cs" /> + <Compile Include="EnumerationFileJava.cs" /> <Compile Include="EnumerationFile.cs" /> <Compile Include="Helper.cs" /> <Compile Include="ICodeObject.cs" /> @@ -73,6 +76,7 @@ <Compile Include="CodeObjectModifier.cs" /> <Compile Include="MethodModifier.cs" /> <Compile Include="Namespace.cs" /> + <Compile Include="ObservablesAdapterFile.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Property.cs" /> </ItemGroup> @@ -96,6 +100,10 @@ <EmbeddedResource Include="Templates\Namespace.cshtml" /> <EmbeddedResource Include="Templates\EntityCodeFile.cshtml" /> <EmbeddedResource Include="Templates\EnumerationFile.cshtml" /> + <EmbeddedResource Include="Templates\ObservablesAdapterFile.cshtml" /> + <EmbeddedResource Include="Templates\EntityCodeFileJava.cshtml" /> + <EmbeddedResource Include="Templates\EnumerationFileJava.cshtml" /> + <EmbeddedResource Include="Templates\TangoDAOJavaFile.cshtml" /> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. diff --git a/Software/Visual_Studio/Tango.CodeGeneration/TangoDAOJavaFile.cs b/Software/Visual_Studio/Tango.CodeGeneration/TangoDAOJavaFile.cs new file mode 100644 index 000000000..5221365e4 --- /dev/null +++ b/Software/Visual_Studio/Tango.CodeGeneration/TangoDAOJavaFile.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.CodeGeneration +{ + public class TangoDAOJavaFile : CodeFile + { + public String Name { get; set; } + + public List<TangoDAOEntity> Entities { get; set; } + + public TangoDAOJavaFile() + { + Entities = new List<TangoDAOEntity>(); + } + + public class TangoDAOEntity + { + public String Name { get; set; } + public String TableName { get; set; } + } + } +} diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFileJava.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFileJava.cshtml new file mode 100644 index 000000000..aeba15b12 --- /dev/null +++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/EntityCodeFileJava.cshtml @@ -0,0 +1,59 @@ +package com.twine.tango.dal.entities; + +import com.raizlabs.android.dbflow.annotation.Column; +import com.raizlabs.android.dbflow.annotation.ForeignKey; +import com.raizlabs.android.dbflow.annotation.ForeignKeyReference; +import com.raizlabs.android.dbflow.annotation.Table; +import org.joda.time.DateTime; +import com.twine.tango.dal.Entity; +import com.twine.tango.dal.TangoDB; + + + @@Table(name = "@(Model.TableName)", database = TangoDB.class) + public class @(Model.Name) extends Entity + { + @foreach (var prop in Model.Fields) + { + if (!prop.Construct) + { + <div> + @@Column(name = "@(prop.FieldName)") + private @(prop.Type) @(prop.Description); + + </div> + } + else + { + <div> + @@ForeignKey(references = { @@ForeignKeyReference(columnName = "@(prop.FieldName)_GUID", foreignKeyColumnName = "GUID")}) + private @(prop.Type) @(prop.Description); + + </div> + } + } + + @foreach (var prop in Model.Fields) + { + <div> + /** + * Gets the @(prop.Name). + * + * return the @(prop.Name) + */ + public @(prop.Type) @(prop.Type == "Boolean" ? "is" + prop.Name : "get" + prop.Name)() + { + return @(prop.Description); + } + + /** + * Sets the @(prop.Name). + * + * @@param @(prop.Description) the @(prop.Name) + */ + public void set@(prop.Name)(@(prop.Type) @(prop.Description)) + { + this.@(prop.Description) = @(prop.Description); + } + </div> + } + } diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Templates/EnumerationFileJava.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/EnumerationFileJava.cshtml new file mode 100644 index 000000000..435608204 --- /dev/null +++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/EnumerationFileJava.cshtml @@ -0,0 +1,23 @@ +package com.twine.tango.dal.enumerations; + +import com.twine.tango.core.DescriptionAnnotation; + +public enum @(Model.Name) +{ + @foreach (var prop in Model.Fields) + { + <div> + @@DescriptionAnnotation(description = "@(prop.Description)") + @(prop.Name)(@(prop.Value)), + + </div> + } + ; + + private int value; + + @(Model.Name)(int value) + { + this.value = value; + } +} diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Templates/ObservablesAdapterFile.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/ObservablesAdapterFile.cshtml new file mode 100644 index 000000000..856b8ac42 --- /dev/null +++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/ObservablesAdapterFile.cshtml @@ -0,0 +1,46 @@ +using System.Collections.ObjectModel; +using System.ComponentModel; + +namespace Tango.DAL.Observables +{ + public partial class @(Model.Name) + { + @foreach (var prop in Model.Properties) + { + <div> + private @(prop.Type) _@(prop.Name.ToLower()); + /// <summary> + /// Gets or sets the @(prop.Name). + /// </summary> + public @(prop.Type) @(prop.Name) + { + get { return _@(prop.Name.ToLower()); } + set { _@(prop.Name.ToLower()) = value; RaisePropertyChanged(nameof(@(prop.Name))); } + } + + private ICollectionView _@(prop.Name.ToLower())ViewSource; + /// <summary> + /// Gets or sets the @(prop.Name) View Source. + ///</summary> + public ICollectionView @(prop.Name)ViewSource + { + get { return _@(prop.Name.ToLower())ViewSource; } + set { _@(prop.Name.ToLower())ViewSource = value; RaisePropertyChanged(nameof(@(prop.Name)ViewSource)); } + } + </div> + } + + /// <summary> + /// Initialize collection sources. + /// </summary> + private void InitCollectionSources() + { + @foreach (var prop in Model.Properties) + { + <div> + @(prop.Name)ViewSource = CreateCollectionView(@(prop.Name)); + </div> + } + } + } +} diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Templates/TangoDAOJavaFile.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/TangoDAOJavaFile.cshtml new file mode 100644 index 000000000..46bd6532c --- /dev/null +++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/TangoDAOJavaFile.cshtml @@ -0,0 +1,27 @@ +package com.twine.tango.dal.dao; + +import com.raizlabs.android.dbflow.sql.language.SQLite; +@foreach (var entity in Model.Entities) +{ + <div>import com.twine.tango.dal.entities.@(entity.Name);</div> +} +import java.util.List; + +public class TangoDAO +{ +@foreach (var entity in Model.Entities) +{ +<div> + /** + * Gets all the @(entity.TableName) from database. + * + * @@return all @(entity.TableName) + */ + public static List<@(entity.Name)> getAll@(entity.TableName)() + { + return SQLite.select().from(@(entity.Name).class).queryList(); + } + +</div> +} +} diff --git a/Software/Visual_Studio/Tango.ColorPicker/Chromes/Implementation/ButtonChrome.cs b/Software/Visual_Studio/Tango.ColorPicker/Chromes/Implementation/ButtonChrome.cs new file mode 100644 index 000000000..871ef2dc0 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/Chromes/Implementation/ButtonChrome.cs @@ -0,0 +1,272 @@ +/************************************************************************************* + + Extended WPF Toolkit + + Copyright (C) 2007-2013 Xceed Software Inc. + + This program is provided to you under the terms of the Microsoft Public + License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + ***********************************************************************************/ + +using System; +using System.Windows; +using System.Windows.Controls; + +namespace Tango.ColorPicker +{ + internal class ButtonChrome : ContentControl + { + #region CornerRadius + + public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.Register( "CornerRadius", typeof( CornerRadius ), typeof( ButtonChrome ), new UIPropertyMetadata( default( CornerRadius ), new PropertyChangedCallback( OnCornerRadiusChanged ) ) ); + public CornerRadius CornerRadius + { + get + { + return ( CornerRadius )GetValue( CornerRadiusProperty ); + } + set + { + SetValue( CornerRadiusProperty, value ); + } + } + + private static void OnCornerRadiusChanged( DependencyObject o, DependencyPropertyChangedEventArgs e ) + { + ButtonChrome buttonChrome = o as ButtonChrome; + if( buttonChrome != null ) + buttonChrome.OnCornerRadiusChanged( ( CornerRadius )e.OldValue, ( CornerRadius )e.NewValue ); + } + + protected virtual void OnCornerRadiusChanged( CornerRadius oldValue, CornerRadius newValue ) + { + //we always want the InnerBorderRadius to be one less than the CornerRadius + CornerRadius newInnerCornerRadius = new CornerRadius( Math.Max( 0, newValue.TopLeft - 1 ), + Math.Max( 0, newValue.TopRight - 1 ), + Math.Max( 0, newValue.BottomRight - 1 ), + Math.Max( 0, newValue.BottomLeft - 1 ) ); + + InnerCornerRadius = newInnerCornerRadius; + } + + #endregion //CornerRadius + + #region InnerCornerRadius + + public static readonly DependencyProperty InnerCornerRadiusProperty = DependencyProperty.Register( "InnerCornerRadius", typeof( CornerRadius ), typeof( ButtonChrome ), new UIPropertyMetadata( default( CornerRadius ), new PropertyChangedCallback( OnInnerCornerRadiusChanged ) ) ); + public CornerRadius InnerCornerRadius + { + get + { + return ( CornerRadius )GetValue( InnerCornerRadiusProperty ); + } + set + { + SetValue( InnerCornerRadiusProperty, value ); + } + } + + private static void OnInnerCornerRadiusChanged( DependencyObject o, DependencyPropertyChangedEventArgs e ) + { + ButtonChrome buttonChrome = o as ButtonChrome; + if( buttonChrome != null ) + buttonChrome.OnInnerCornerRadiusChanged( ( CornerRadius )e.OldValue, ( CornerRadius )e.NewValue ); + } + + protected virtual void OnInnerCornerRadiusChanged( CornerRadius oldValue, CornerRadius newValue ) + { + // TODO: Add your property changed side-effects. Descendants can override as well. + } + + #endregion //InnerCornerRadius + + #region RenderChecked + + public static readonly DependencyProperty RenderCheckedProperty = DependencyProperty.Register( "RenderChecked", typeof( bool ), typeof( ButtonChrome ), new UIPropertyMetadata( false, OnRenderCheckedChanged ) ); + public bool RenderChecked + { + get + { + return ( bool )GetValue( RenderCheckedProperty ); + } + set + { + SetValue( RenderCheckedProperty, value ); + } + } + + private static void OnRenderCheckedChanged( DependencyObject o, DependencyPropertyChangedEventArgs e ) + { + ButtonChrome buttonChrome = o as ButtonChrome; + if( buttonChrome != null ) + buttonChrome.OnRenderCheckedChanged( ( bool )e.OldValue, ( bool )e.NewValue ); + } + + protected virtual void OnRenderCheckedChanged( bool oldValue, bool newValue ) + { + // TODO: Add your property changed side-effects. Descendants can override as well. + } + + #endregion //RenderChecked + + #region RenderEnabled + + public static readonly DependencyProperty RenderEnabledProperty = DependencyProperty.Register( "RenderEnabled", typeof( bool ), typeof( ButtonChrome ), new UIPropertyMetadata( true, OnRenderEnabledChanged ) ); + public bool RenderEnabled + { + get + { + return ( bool )GetValue( RenderEnabledProperty ); + } + set + { + SetValue( RenderEnabledProperty, value ); + } + } + + private static void OnRenderEnabledChanged( DependencyObject o, DependencyPropertyChangedEventArgs e ) + { + ButtonChrome buttonChrome = o as ButtonChrome; + if( buttonChrome != null ) + buttonChrome.OnRenderEnabledChanged( ( bool )e.OldValue, ( bool )e.NewValue ); + } + + protected virtual void OnRenderEnabledChanged( bool oldValue, bool newValue ) + { + // TODO: Add your property changed side-effects. Descendants can override as well. + } + + #endregion //RenderEnabled + + #region RenderFocused + + public static readonly DependencyProperty RenderFocusedProperty = DependencyProperty.Register( "RenderFocused", typeof( bool ), typeof( ButtonChrome ), new UIPropertyMetadata( false, OnRenderFocusedChanged ) ); + public bool RenderFocused + { + get + { + return ( bool )GetValue( RenderFocusedProperty ); + } + set + { + SetValue( RenderFocusedProperty, value ); + } + } + + private static void OnRenderFocusedChanged( DependencyObject o, DependencyPropertyChangedEventArgs e ) + { + ButtonChrome buttonChrome = o as ButtonChrome; + if( buttonChrome != null ) + buttonChrome.OnRenderFocusedChanged( ( bool )e.OldValue, ( bool )e.NewValue ); + } + + protected virtual void OnRenderFocusedChanged( bool oldValue, bool newValue ) + { + // TODO: Add your property changed side-effects. Descendants can override as well. + } + + #endregion //RenderFocused + + #region RenderMouseOver + + public static readonly DependencyProperty RenderMouseOverProperty = DependencyProperty.Register( "RenderMouseOver", typeof( bool ), typeof( ButtonChrome ), new UIPropertyMetadata( false, OnRenderMouseOverChanged ) ); + public bool RenderMouseOver + { + get + { + return ( bool )GetValue( RenderMouseOverProperty ); + } + set + { + SetValue( RenderMouseOverProperty, value ); + } + } + + private static void OnRenderMouseOverChanged( DependencyObject o, DependencyPropertyChangedEventArgs e ) + { + ButtonChrome buttonChrome = o as ButtonChrome; + if( buttonChrome != null ) + buttonChrome.OnRenderMouseOverChanged( ( bool )e.OldValue, ( bool )e.NewValue ); + } + + protected virtual void OnRenderMouseOverChanged( bool oldValue, bool newValue ) + { + // TODO: Add your property changed side-effects. Descendants can override as well. + } + + #endregion //RenderMouseOver + + #region RenderNormal + + public static readonly DependencyProperty RenderNormalProperty = DependencyProperty.Register( "RenderNormal", typeof( bool ), typeof( ButtonChrome ), new UIPropertyMetadata( true, OnRenderNormalChanged ) ); + public bool RenderNormal + { + get + { + return ( bool )GetValue( RenderNormalProperty ); + } + set + { + SetValue( RenderNormalProperty, value ); + } + } + + private static void OnRenderNormalChanged( DependencyObject o, DependencyPropertyChangedEventArgs e ) + { + ButtonChrome buttonChrome = o as ButtonChrome; + if( buttonChrome != null ) + buttonChrome.OnRenderNormalChanged( ( bool )e.OldValue, ( bool )e.NewValue ); + } + + protected virtual void OnRenderNormalChanged( bool oldValue, bool newValue ) + { + // TODO: Add your property changed side-effects. Descendants can override as well. + } + + #endregion //RenderNormal + + #region RenderPressed + + public static readonly DependencyProperty RenderPressedProperty = DependencyProperty.Register( "RenderPressed", typeof( bool ), typeof( ButtonChrome ), new UIPropertyMetadata( false, OnRenderPressedChanged ) ); + public bool RenderPressed + { + get + { + return ( bool )GetValue( RenderPressedProperty ); + } + set + { + SetValue( RenderPressedProperty, value ); + } + } + + private static void OnRenderPressedChanged( DependencyObject o, DependencyPropertyChangedEventArgs e ) + { + ButtonChrome buttonChrome = o as ButtonChrome; + if( buttonChrome != null ) + buttonChrome.OnRenderPressedChanged( ( bool )e.OldValue, ( bool )e.NewValue ); + } + + protected virtual void OnRenderPressedChanged( bool oldValue, bool newValue ) + { + // TODO: Add your property changed side-effects. Descendants can override as well. + } + + #endregion //RenderPressed + + #region Contsructors + + static ButtonChrome() + { + DefaultStyleKeyProperty.OverrideMetadata( typeof( ButtonChrome ), new FrameworkPropertyMetadata( typeof( ButtonChrome ) ) ); + } + + #endregion //Contsructors + } +} diff --git a/Software/Visual_Studio/Tango.ColorPicker/Chromes/Themes/Generic.xaml b/Software/Visual_Studio/Tango.ColorPicker/Chromes/Themes/Generic.xaml new file mode 100644 index 000000000..a6e259ca3 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/Chromes/Themes/Generic.xaml @@ -0,0 +1,228 @@ +<!--*********************************************************************************** + + Extended WPF Toolkit + + Copyright (C) 2007-2013 Xceed Software Inc. + + This program is provided to you under the terms of the Microsoft Public + License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + **********************************************************************************--> + +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:chrome="clr-namespace:Tango.ColorPicker" + xmlns:themes="clr-namespace:Tango.ColorPicker.Themes"> + + <!-- =============================================================================== --> + <!-- ButtonChrome --> + <!-- =============================================================================== --> + + <Style TargetType="{x:Type chrome:ButtonChrome}"> + <Setter Property="IsTabStop" Value="False" /> + <Setter Property="SnapsToDevicePixels" Value="True" /> + <Setter Property="FocusVisualStyle" Value="{x:Null}" /> + <Setter Property="Background" Value="{DynamicResource {x:Static themes:ResourceKeys.ButtonNormalBackgroundKey}}" /> + <Setter Property="BorderBrush" Value="{DynamicResource {x:Static themes:ResourceKeys.ButtonNormalOuterBorderKey}}" /> + <Setter Property="BorderThickness" Value="1" /> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type chrome:ButtonChrome}"> + <Grid> + + <Border x:Name="OuterBorder" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}"> + <Border x:Name="InnerBorder" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding InnerCornerRadius}" BorderBrush="{DynamicResource {x:Static themes:ResourceKeys.ButtonNormalInnerBorderKey}}" /> + </Border> + + <Border x:Name="MouseOverVisual" Opacity="0" Visibility="Collapsed" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}" BorderBrush="{DynamicResource {x:Static themes:ResourceKeys.ButtonMouseOverOuterBorderKey}}" Background="{DynamicResource {x:Static themes:ResourceKeys.ButtonMouseOverBackgroundKey}}"> + <Border x:Name="MouseOverInnerVisual" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding InnerCornerRadius}" BorderBrush="{DynamicResource {x:Static themes:ResourceKeys.ButtonMouseOverInnerBorderKey}}" /> + </Border> + <Border x:Name="PressedVisual" Opacity="0" Visibility="Collapsed" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}" BorderBrush="{DynamicResource {x:Static themes:ResourceKeys.ButtonPressedOuterBorderKey}}" Background="{DynamicResource {x:Static themes:ResourceKeys.ButtonPressedBackgroundKey}}"> + <Border x:Name="PressedInnerVisual" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding InnerCornerRadius}" BorderBrush="{DynamicResource {x:Static themes:ResourceKeys.ButtonPressedInnerBorderKey}}" /> + </Border> + + <Border x:Name="FocusVisual" Opacity="0" Visibility="Collapsed" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}" BorderBrush="{DynamicResource {x:Static themes:ResourceKeys.ButtonFocusedOuterBorderKey}}" Background="{DynamicResource {x:Static themes:ResourceKeys.ButtonFocusedBackgroundKey}}"> + <Border x:Name="FocusInnerVisual" BorderThickness="1" CornerRadius="{TemplateBinding InnerCornerRadius}" BorderBrush="{DynamicResource {x:Static themes:ResourceKeys.ButtonFocusedInnerBorderKey}}" /> + </Border> + + <ContentPresenter Margin="{TemplateBinding Padding}" + IsEnabled="{TemplateBinding IsEnabled}" + Content="{TemplateBinding Content}" + ContentStringFormat="{TemplateBinding ContentStringFormat}" + ContentTemplate="{TemplateBinding ContentTemplate}" + ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" /> + + </Grid> + <ControlTemplate.Triggers> + + <!-- If button is disabled, not checked, and is rendered normal --> + <MultiTrigger> + <MultiTrigger.Conditions> + <Condition Property="RenderEnabled" Value="False" /> + <Condition Property="RenderChecked" Value="False" /> + </MultiTrigger.Conditions> + <Setter TargetName="OuterBorder" Property="BorderBrush" Value="{DynamicResource {x:Static themes:ResourceKeys.ButtonDisabledOuterBorderKey}}" /> + <Setter TargetName="InnerBorder" Property="BorderBrush" Value="{DynamicResource {x:Static themes:ResourceKeys.ButtonInnerBorderDisabledKey}}" /> + <Setter TargetName="OuterBorder" Property="Background" Value="{DynamicResource {x:Static themes:ResourceKeys.ControlDisabledBackgroundKey}}" /> + </MultiTrigger> + + <!-- if button is enabled and pressed --> + <MultiTrigger> + <MultiTrigger.Conditions> + <Condition Property="RenderEnabled" Value="True" /> + <Condition Property="RenderPressed" Value="True" /> + </MultiTrigger.Conditions> + <MultiTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PressedVisual" Storyboard.TargetProperty="Visibility"> + <DiscreteObjectKeyFrame KeyTime="00:00:00"> + <DiscreteObjectKeyFrame.Value> + <Visibility>Visible</Visibility> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PressedVisual" Storyboard.TargetProperty="Opacity"> + <LinearDoubleKeyFrame KeyTime="00:00:00.050" Value="1" /> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </MultiTrigger.EnterActions> + <MultiTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PressedVisual" Storyboard.TargetProperty="Visibility"> + <DiscreteObjectKeyFrame KeyTime="00:00:00.115"> + <DiscreteObjectKeyFrame.Value> + <Visibility>Collapsed</Visibility> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PressedVisual" Storyboard.TargetProperty="Opacity"> + <LinearDoubleKeyFrame KeyTime="00:00:00.115" Value="0" /> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </MultiTrigger.ExitActions> + </MultiTrigger> + + <!-- if button is enabled, is not checked, the mouse is over, and not pressed --> + <MultiTrigger> + <MultiTrigger.Conditions> + <Condition Property="RenderEnabled" Value="True" /> + <Condition Property="RenderChecked" Value="False" /> + <Condition Property="RenderMouseOver" Value="True" /> + <Condition Property="RenderPressed" Value="False" /> + </MultiTrigger.Conditions> + <MultiTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Visibility"> + <DiscreteObjectKeyFrame KeyTime="00:00:00"> + <DiscreteObjectKeyFrame.Value> + <Visibility>Visible</Visibility> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Opacity"> + <LinearDoubleKeyFrame KeyTime="00:00:00.115" Value="1" /> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </MultiTrigger.EnterActions> + <MultiTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Visibility"> + <DiscreteObjectKeyFrame KeyTime="00:00:00.150"> + <DiscreteObjectKeyFrame.Value> + <Visibility>Collapsed</Visibility> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetName="MouseOverVisual" Storyboard.TargetProperty="Opacity"> + <LinearDoubleKeyFrame KeyTime="00:00:00.150" Value="0" /> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </MultiTrigger.ExitActions> + </MultiTrigger> + + <!-- if button is enabled, checked, he mouse is not over, and it is not pressed --> + <MultiTrigger> + <MultiTrigger.Conditions> + <Condition Property="RenderEnabled" Value="True" /> + <Condition Property="RenderChecked" Value="True" /> + <Condition Property="RenderMouseOver" Value="False" /> + <Condition Property="RenderPressed" Value="False" /> + </MultiTrigger.Conditions> + <Setter TargetName="OuterBorder" Property="BorderBrush" Value="{DynamicResource {x:Static themes:ResourceKeys.ButtonPressedOuterBorderKey}}" /> + <Setter TargetName="InnerBorder" Property="BorderBrush" Value="{DynamicResource {x:Static themes:ResourceKeys.ButtonPressedInnerBorderKey}}" /> + <Setter TargetName="OuterBorder" Property="Background" Value="{DynamicResource {x:Static themes:ResourceKeys.ButtonPressedBackgroundKey}}" /> + </MultiTrigger> + + <!-- if button is focused, is enabled, not pressed, and the mouse is not over --> + <MultiTrigger> + <MultiTrigger.Conditions> + <Condition Property="RenderFocused" Value="True" /> + <Condition Property="RenderEnabled" Value="True" /> + <Condition Property="RenderPressed" Value="False" /> + <Condition Property="RenderMouseOver" Value="False" /> + </MultiTrigger.Conditions> + <MultiTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisual" Storyboard.TargetProperty="Visibility"> + <DiscreteObjectKeyFrame KeyTime="00:00:00"> + <DiscreteObjectKeyFrame.Value> + <Visibility>Visible</Visibility> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisual" Storyboard.TargetProperty="Opacity"> + <LinearDoubleKeyFrame KeyTime="00:00:00.25" Value="1" /> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </MultiTrigger.EnterActions> + <MultiTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusVisual" Storyboard.TargetProperty="Visibility"> + <DiscreteObjectKeyFrame KeyTime="00:00:00.115"> + <DiscreteObjectKeyFrame.Value> + <Visibility>Collapsed</Visibility> + </DiscreteObjectKeyFrame.Value> + </DiscreteObjectKeyFrame> + </ObjectAnimationUsingKeyFrames> + <DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisual" Storyboard.TargetProperty="Opacity"> + <LinearDoubleKeyFrame KeyTime="00:00:00.115" Value="0" /> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </MultiTrigger.ExitActions> + </MultiTrigger> + + <!-- if not rendered normally --> + <MultiTrigger> + <MultiTrigger.Conditions> + <Condition Property="RenderNormal" Value="False" /> + <Condition Property="RenderChecked" Value="False" /> + </MultiTrigger.Conditions> + <Setter TargetName="OuterBorder" Property="BorderBrush" Value="Transparent" /> + <Setter TargetName="InnerBorder" Property="BorderBrush" Value="{x:Null}" /> + <Setter TargetName="OuterBorder" Property="Background" Value="Transparent" /> + </MultiTrigger> + + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + +</ResourceDictionary> diff --git a/Software/Visual_Studio/Tango.ColorPicker/ColorBlendConverter.cs b/Software/Visual_Studio/Tango.ColorPicker/ColorBlendConverter.cs new file mode 100644 index 000000000..3e61fea36 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/ColorBlendConverter.cs @@ -0,0 +1,82 @@ +/************************************************************************************* + + Extended WPF Toolkit + + Copyright (C) 2007-2013 Xceed Software Inc. + + This program is provided to you under the terms of the Microsoft Public + License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + ***********************************************************************************/ + +using System; +using System.Windows.Data; +using System.Windows.Media; + +namespace Tango.ColorPicker.Core.Converters +{ + /// <summary> + /// This converter allow to blend two colors into one based on a specified ratio + /// </summary> + internal class ColorBlendConverter : IValueConverter + { + private double _blendedColorRatio = 0; + + /// <summary> + /// The ratio of the blended color. Must be between 0 and 1. + /// </summary> + public double BlendedColorRatio + { + get { return _blendedColorRatio; } + + set + { + if (value < 0d || value > 1d) + throw new ArgumentException("BlendedColorRatio must greater than or equal to 0 and lower than or equal to 1 "); + + _blendedColorRatio = value; + } + } + + /// <summary> + /// The color to blend with the source color + /// </summary> + public Color BlendedColor { get; set; } + + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + if (value == null || value.GetType() != typeof(Color)) + return null; + + Color color = (Color)value; + return new Color() + { + A = this.BlendValue(color.A, this.BlendedColor.A), + R = this.BlendValue(color.R, this.BlendedColor.R), + G = this.BlendValue(color.G, this.BlendedColor.G), + B = this.BlendValue(color.B, this.BlendedColor.B) + }; + } + + private byte BlendValue(byte original, byte blend) + { + double blendRatio = this.BlendedColorRatio; + double sourceRatio = 1 - blendRatio; + + double result = (((double)original) * sourceRatio) + (((double)blend) * blendRatio); + result = Math.Round(result); + result = Math.Min(255d, Math.Max(0d, result)); + return System.Convert.ToByte(result); + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/Tango.ColorPicker/ColorCanvas/Implementation/ColorCanvas.cs b/Software/Visual_Studio/Tango.ColorPicker/ColorCanvas/Implementation/ColorCanvas.cs new file mode 100644 index 000000000..da7176f61 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/ColorCanvas/Implementation/ColorCanvas.cs @@ -0,0 +1,602 @@ +/************************************************************************************* + + Extended WPF Toolkit + + Copyright (C) 2007-2013 Xceed Software Inc. + + This program is provided to you under the terms of the Microsoft Public + License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + ***********************************************************************************/ + +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Input; +using System.Windows.Media; +using Tango.ColorPicker.Core.Utilities; +using Tango.ColorPicker.Primitives; +using System.IO; +using System; + +namespace Tango +{ + [TemplatePart( Name = PART_ColorShadingCanvas, Type = typeof( Canvas ) )] + [TemplatePart( Name = PART_ColorShadeSelector, Type = typeof( Canvas ) )] + [TemplatePart( Name = PART_SpectrumSlider, Type = typeof( ColorSpectrumSlider ) )] + [TemplatePart( Name = PART_HexadecimalTextBox, Type = typeof( TextBox ) )] + internal class ColorCanvas : Control + { + private const string PART_ColorShadingCanvas = "PART_ColorShadingCanvas"; + private const string PART_ColorShadeSelector = "PART_ColorShadeSelector"; + private const string PART_SpectrumSlider = "PART_SpectrumSlider"; + private const string PART_HexadecimalTextBox = "PART_HexadecimalTextBox"; + + #region Private Members + + private TranslateTransform _colorShadeSelectorTransform = new TranslateTransform(); + private Canvas _colorShadingCanvas; + private Canvas _colorShadeSelector; + private ColorSpectrumSlider _spectrumSlider; + private TextBox _hexadecimalTextBox; + private Point? _currentColorPosition; + private bool _surpressPropertyChanged; + private bool _updateSpectrumSliderValue = true; + + #endregion //Private Members + + #region Properties + + #region SelectedColor + + public static readonly DependencyProperty SelectedColorProperty = DependencyProperty.Register( "SelectedColor", typeof( Color? ), typeof( ColorCanvas ), new FrameworkPropertyMetadata( null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnSelectedColorChanged ) ); + public Color? SelectedColor + { + get + { + return ( Color? )GetValue( SelectedColorProperty ); + } + set + { + SetValue( SelectedColorProperty, value ); + } + } + + private static void OnSelectedColorChanged( DependencyObject o, DependencyPropertyChangedEventArgs e ) + { + ColorCanvas colorCanvas = o as ColorCanvas; + if( colorCanvas != null ) + colorCanvas.OnSelectedColorChanged( ( Color? )e.OldValue, ( Color? )e.NewValue ); + } + + protected virtual void OnSelectedColorChanged( Color? oldValue, Color? newValue ) + { + SetHexadecimalStringProperty( GetFormatedColorString( newValue ), false ); + UpdateRGBValues( newValue ); + UpdateColorShadeSelectorPosition( newValue ); + + RoutedPropertyChangedEventArgs<Color?> args = new RoutedPropertyChangedEventArgs<Color?>( oldValue, newValue ); + args.RoutedEvent = SelectedColorChangedEvent; + RaiseEvent( args ); + } + + #endregion //SelectedColor + + #region RGB + + #region A + + public static readonly DependencyProperty AProperty = DependencyProperty.Register( "A", typeof( byte ), typeof( ColorCanvas ), new UIPropertyMetadata( ( byte )255, OnAChanged ) ); + public byte A + { + get + { + return ( byte )GetValue( AProperty ); + } + set + { + SetValue( AProperty, value ); + } + } + + private static void OnAChanged( DependencyObject o, DependencyPropertyChangedEventArgs e ) + { + ColorCanvas colorCanvas = o as ColorCanvas; + if( colorCanvas != null ) + colorCanvas.OnAChanged( ( byte )e.OldValue, ( byte )e.NewValue ); + } + + protected virtual void OnAChanged( byte oldValue, byte newValue ) + { + if( !_surpressPropertyChanged ) + UpdateSelectedColor(); + } + + #endregion //A + + #region R + + public static readonly DependencyProperty RProperty = DependencyProperty.Register( "R", typeof( byte ), typeof( ColorCanvas ), new UIPropertyMetadata( ( byte )0, OnRChanged ) ); + public byte R + { + get + { + return ( byte )GetValue( RProperty ); + } + set + { + SetValue( RProperty, value ); + } + } + + private static void OnRChanged( DependencyObject o, DependencyPropertyChangedEventArgs e ) + { + ColorCanvas colorCanvas = o as ColorCanvas; + if( colorCanvas != null ) + colorCanvas.OnRChanged( ( byte )e.OldValue, ( byte )e.NewValue ); + } + + protected virtual void OnRChanged( byte oldValue, byte newValue ) + { + if( !_surpressPropertyChanged ) + UpdateSelectedColor(); + } + + #endregion //R + + #region G + + public static readonly DependencyProperty GProperty = DependencyProperty.Register( "G", typeof( byte ), typeof( ColorCanvas ), new UIPropertyMetadata( ( byte )0, OnGChanged ) ); + public byte G + { + get + { + return ( byte )GetValue( GProperty ); + } + set + { + SetValue( GProperty, value ); + } + } + + private static void OnGChanged( DependencyObject o, DependencyPropertyChangedEventArgs e ) + { + ColorCanvas colorCanvas = o as ColorCanvas; + if( colorCanvas != null ) + colorCanvas.OnGChanged( ( byte )e.OldValue, ( byte )e.NewValue ); + } + + protected virtual void OnGChanged( byte oldValue, byte newValue ) + { + if( !_surpressPropertyChanged ) + UpdateSelectedColor(); + } + + #endregion //G + + #region B + + public static readonly DependencyProperty BProperty = DependencyProperty.Register( "B", typeof( byte ), typeof( ColorCanvas ), new UIPropertyMetadata( ( byte )0, OnBChanged ) ); + public byte B + { + get + { + return ( byte )GetValue( BProperty ); + } + set + { + SetValue( BProperty, value ); + } + } + + private static void OnBChanged( DependencyObject o, DependencyPropertyChangedEventArgs e ) + { + ColorCanvas colorCanvas = o as ColorCanvas; + if( colorCanvas != null ) + colorCanvas.OnBChanged( ( byte )e.OldValue, ( byte )e.NewValue ); + } + + protected virtual void OnBChanged( byte oldValue, byte newValue ) + { + if( !_surpressPropertyChanged ) + UpdateSelectedColor(); + } + + #endregion //B + + #endregion //RGB + + #region HexadecimalString + + public static readonly DependencyProperty HexadecimalStringProperty = DependencyProperty.Register( "HexadecimalString", typeof( string ), typeof( ColorCanvas ), new UIPropertyMetadata( "", OnHexadecimalStringChanged, OnCoerceHexadecimalString ) ); + public string HexadecimalString + { + get + { + return ( string )GetValue( HexadecimalStringProperty ); + } + set + { + SetValue( HexadecimalStringProperty, value ); + } + } + + private static void OnHexadecimalStringChanged( DependencyObject o, DependencyPropertyChangedEventArgs e ) + { + ColorCanvas colorCanvas = o as ColorCanvas; + if( colorCanvas != null ) + colorCanvas.OnHexadecimalStringChanged( ( string )e.OldValue, ( string )e.NewValue ); + } + + protected virtual void OnHexadecimalStringChanged( string oldValue, string newValue ) + { + string newColorString = GetFormatedColorString( newValue ); + string currentColorString = GetFormatedColorString( SelectedColor ); + if( !currentColorString.Equals( newColorString ) ) + { + Color? col = null; + if( !string.IsNullOrEmpty( newColorString ) ) + { + col = ( Color )ColorConverter.ConvertFromString( newColorString ); + } + UpdateSelectedColor( col ); + } + + SetHexadecimalTextBoxTextProperty( newValue ); + } + + private static object OnCoerceHexadecimalString( DependencyObject d, object basevalue ) + { + var colorCanvas = ( ColorCanvas )d; + if( colorCanvas == null ) + return basevalue; + + return colorCanvas.OnCoerceHexadecimalString( basevalue ); + } + + private object OnCoerceHexadecimalString( object newValue ) + { + var value = newValue as string; + string retValue = value; + + try + { + if( !string.IsNullOrEmpty( retValue ) ) + { + ColorConverter.ConvertFromString( value ); + } + } + catch + { + //When HexadecimalString is changed via Code-Behind and hexadecimal format is bad, throw. + throw new InvalidDataException( "Color provided is not in the correct format." ); + } + + return retValue; + } + + #endregion //HexadecimalString + + #region UsingAlphaChannel + + public static readonly DependencyProperty UsingAlphaChannelProperty = DependencyProperty.Register( "UsingAlphaChannel", typeof( bool ), typeof( ColorCanvas ), new FrameworkPropertyMetadata( true, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, new PropertyChangedCallback( OnUsingAlphaChannelPropertyChanged ) ) ); + public bool UsingAlphaChannel + { + get + { + return ( bool )GetValue( UsingAlphaChannelProperty ); + } + set + { + SetValue( UsingAlphaChannelProperty, value ); + } + } + + private static void OnUsingAlphaChannelPropertyChanged( DependencyObject o, DependencyPropertyChangedEventArgs e ) + { + ColorCanvas colorCanvas = o as ColorCanvas; + if( colorCanvas != null ) + colorCanvas.OnUsingAlphaChannelChanged(); + } + + protected virtual void OnUsingAlphaChannelChanged() + { + SetHexadecimalStringProperty( GetFormatedColorString( SelectedColor ), false ); + } + + #endregion //UsingAlphaChannel + + #endregion //Properties + + #region Constructors + + static ColorCanvas() + { + DefaultStyleKeyProperty.OverrideMetadata( typeof( ColorCanvas ), new FrameworkPropertyMetadata( typeof( ColorCanvas ) ) ); + } + + #endregion //Constructors + + #region Base Class Overrides + + public override void OnApplyTemplate() + { + base.OnApplyTemplate(); + + if( _colorShadingCanvas != null ) + { + _colorShadingCanvas.MouseLeftButtonDown -= ColorShadingCanvas_MouseLeftButtonDown; + _colorShadingCanvas.MouseLeftButtonUp -= ColorShadingCanvas_MouseLeftButtonUp; + _colorShadingCanvas.MouseMove -= ColorShadingCanvas_MouseMove; + _colorShadingCanvas.SizeChanged -= ColorShadingCanvas_SizeChanged; + } + + _colorShadingCanvas = GetTemplateChild( PART_ColorShadingCanvas ) as Canvas; + + if( _colorShadingCanvas != null ) + { + _colorShadingCanvas.MouseLeftButtonDown += ColorShadingCanvas_MouseLeftButtonDown; + _colorShadingCanvas.MouseLeftButtonUp += ColorShadingCanvas_MouseLeftButtonUp; + _colorShadingCanvas.MouseMove += ColorShadingCanvas_MouseMove; + _colorShadingCanvas.SizeChanged += ColorShadingCanvas_SizeChanged; + } + + _colorShadeSelector = GetTemplateChild( PART_ColorShadeSelector ) as Canvas; + + if( _colorShadeSelector != null ) + _colorShadeSelector.RenderTransform = _colorShadeSelectorTransform; + + if( _spectrumSlider != null ) + _spectrumSlider.ValueChanged -= SpectrumSlider_ValueChanged; + + _spectrumSlider = GetTemplateChild( PART_SpectrumSlider ) as ColorSpectrumSlider; + + if( _spectrumSlider != null ) + _spectrumSlider.ValueChanged += SpectrumSlider_ValueChanged; + + if( _hexadecimalTextBox != null ) + _hexadecimalTextBox.LostFocus -= new RoutedEventHandler( HexadecimalTextBox_LostFocus ); + + _hexadecimalTextBox = GetTemplateChild( PART_HexadecimalTextBox ) as TextBox; + + if( _hexadecimalTextBox != null ) + _hexadecimalTextBox.LostFocus += new RoutedEventHandler( HexadecimalTextBox_LostFocus ); + + UpdateRGBValues( SelectedColor ); + UpdateColorShadeSelectorPosition( SelectedColor ); + + // When changing theme, HexadecimalString needs to be set since it is not binded. + SetHexadecimalTextBoxTextProperty( GetFormatedColorString( SelectedColor ) ); + } + + protected override void OnKeyDown( KeyEventArgs e ) + { + base.OnKeyDown( e ); + + //hitting enter on textbox will update Hexadecimal string + if( e.Key == Key.Enter && e.OriginalSource is TextBox ) + { + TextBox textBox = ( TextBox )e.OriginalSource; + if( textBox.Name == PART_HexadecimalTextBox ) + SetHexadecimalStringProperty( textBox.Text, true ); + } + } + + #endregion //Base Class Overrides + + #region Event Handlers + + void ColorShadingCanvas_MouseLeftButtonDown( object sender, MouseButtonEventArgs e ) + { + Point p = e.GetPosition( _colorShadingCanvas ); + UpdateColorShadeSelectorPositionAndCalculateColor( p, true ); + _colorShadingCanvas.CaptureMouse(); + //Prevent from closing ColorCanvas after mouseDown in ListView + e.Handled = true; + } + + void ColorShadingCanvas_MouseLeftButtonUp( object sender, MouseButtonEventArgs e ) + { + _colorShadingCanvas.ReleaseMouseCapture(); + } + + void ColorShadingCanvas_MouseMove( object sender, MouseEventArgs e ) + { + if( e.LeftButton == MouseButtonState.Pressed ) + { + Point p = e.GetPosition( _colorShadingCanvas ); + UpdateColorShadeSelectorPositionAndCalculateColor( p, true ); + Mouse.Synchronize(); + } + } + + void ColorShadingCanvas_SizeChanged( object sender, SizeChangedEventArgs e ) + { + if( _currentColorPosition != null ) + { + Point _newPoint = new Point + { + X = ( ( Point )_currentColorPosition ).X * e.NewSize.Width, + Y = ( ( Point )_currentColorPosition ).Y * e.NewSize.Height + }; + + UpdateColorShadeSelectorPositionAndCalculateColor( _newPoint, false ); + } + } + + void SpectrumSlider_ValueChanged( object sender, RoutedPropertyChangedEventArgs<double> e ) + { + if( (_currentColorPosition != null) && (this.SelectedColor != null) ) + { + CalculateColor( ( Point )_currentColorPosition ); + } + } + + void HexadecimalTextBox_LostFocus( object sender, RoutedEventArgs e ) + { + TextBox textbox = sender as TextBox; + SetHexadecimalStringProperty( textbox.Text, true ); + } + + #endregion //Event Handlers + + #region Events + + public static readonly RoutedEvent SelectedColorChangedEvent = EventManager.RegisterRoutedEvent( "SelectedColorChanged", RoutingStrategy.Bubble, typeof( RoutedPropertyChangedEventHandler<Color?> ), typeof( ColorCanvas ) ); + public event RoutedPropertyChangedEventHandler<Color?> SelectedColorChanged + { + add + { + AddHandler( SelectedColorChangedEvent, value ); + } + remove + { + RemoveHandler( SelectedColorChangedEvent, value ); + } + } + + #endregion //Events + + #region Methods + + private void UpdateSelectedColor() + { + SelectedColor = Color.FromArgb( A, R, G, B ); + } + + private void UpdateSelectedColor( Color? color ) + { + SelectedColor = ( ( color != null ) && color.HasValue ) + ? (Color?)Color.FromArgb( color.Value.A, color.Value.R, color.Value.G, color.Value.B ) + : null; + } + + private void UpdateRGBValues( Color? color ) + { + if( ( color == null ) || !color.HasValue ) + return; + + _surpressPropertyChanged = true; + + A = color.Value.A; + R = color.Value.R; + G = color.Value.G; + B = color.Value.B; + + _surpressPropertyChanged = false; + } + + private void UpdateColorShadeSelectorPositionAndCalculateColor( Point p, bool calculateColor ) + { + if( p.Y < 0 ) + p.Y = 0; + + if( p.X < 0 ) + p.X = 0; + + if( p.X > _colorShadingCanvas.ActualWidth ) + p.X = _colorShadingCanvas.ActualWidth; + + if( p.Y > _colorShadingCanvas.ActualHeight ) + p.Y = _colorShadingCanvas.ActualHeight; + + _colorShadeSelectorTransform.X = p.X - ( _colorShadeSelector.Width / 2 ); + _colorShadeSelectorTransform.Y = p.Y - ( _colorShadeSelector.Height / 2 ); + + p.X = p.X / _colorShadingCanvas.ActualWidth; + p.Y = p.Y / _colorShadingCanvas.ActualHeight; + + _currentColorPosition = p; + + if( calculateColor ) + CalculateColor( p ); + } + + private void UpdateColorShadeSelectorPosition( Color? color ) + { + if( (_spectrumSlider == null) || (_colorShadingCanvas == null) || (color == null) || !color.HasValue) + return; + + _currentColorPosition = null; + + HsvColor hsv = ColorUtilities.ConvertRgbToHsv( color.Value.R, color.Value.G, color.Value.B ); + + if( _updateSpectrumSliderValue ) + { + _spectrumSlider.Value = hsv.H; + } + + Point p = new Point( hsv.S, 1 - hsv.V ); + + _currentColorPosition = p; + + _colorShadeSelectorTransform.X = ( p.X * _colorShadingCanvas.Width ) - 5; + _colorShadeSelectorTransform.Y = ( p.Y * _colorShadingCanvas.Height ) - 5; + } + + private void CalculateColor( Point p ) + { + HsvColor hsv = new HsvColor( 360 - _spectrumSlider.Value, 1, 1 ) + { + S = p.X, + V = 1 - p.Y + }; + var currentColor = ColorUtilities.ConvertHsvToRgb( hsv.H, hsv.S, hsv.V ); + currentColor.A = A; + _updateSpectrumSliderValue = false; + SelectedColor = currentColor; + _updateSpectrumSliderValue = true; + SetHexadecimalStringProperty( GetFormatedColorString( SelectedColor ), false ); + } + + private string GetFormatedColorString( Color? colorToFormat ) + { + if( ( colorToFormat == null ) || !colorToFormat.HasValue ) + return string.Empty; + return ColorUtilities.FormatColorString( colorToFormat.ToString(), UsingAlphaChannel ); + } + + private string GetFormatedColorString( string stringToFormat ) + { + return ColorUtilities.FormatColorString( stringToFormat, UsingAlphaChannel ); + } + + private void SetHexadecimalStringProperty( string newValue, bool modifyFromUI ) + { + if( modifyFromUI ) + { + try + { + if( !string.IsNullOrEmpty( newValue ) ) + { + ColorConverter.ConvertFromString( newValue ); + } + HexadecimalString = newValue; + } + catch + { + //When HexadecimalString is changed via UI and hexadecimal format is bad, keep the previous HexadecimalString. + SetHexadecimalTextBoxTextProperty( HexadecimalString ); + } + } + else + { + //When HexadecimalString is changed via Code-Behind, hexadecimal format will be evaluated in OnCoerceHexadecimalString() + HexadecimalString = newValue; + } + } + + private void SetHexadecimalTextBoxTextProperty( string newValue ) + { + if( _hexadecimalTextBox != null ) + _hexadecimalTextBox.Text = newValue; + } + + #endregion //Methods + } +} diff --git a/Software/Visual_Studio/Tango.ColorPicker/ColorCanvas/Implementation/ColorSpectrumSlider.cs b/Software/Visual_Studio/Tango.ColorPicker/ColorCanvas/Implementation/ColorSpectrumSlider.cs new file mode 100644 index 000000000..06233ba35 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/ColorCanvas/Implementation/ColorSpectrumSlider.cs @@ -0,0 +1,111 @@ +/************************************************************************************* + + Extended WPF Toolkit + + Copyright (C) 2007-2013 Xceed Software Inc. + + This program is provided to you under the terms of the Microsoft Public + License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + ***********************************************************************************/ + +using System; +using System.Collections.Generic; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; +using System.Windows.Shapes; +using Tango.ColorPicker.Core.Utilities; + +namespace Tango +{ + [TemplatePart( Name = PART_SpectrumDisplay, Type = typeof( Rectangle ) )] + internal class ColorSpectrumSlider : Slider + { + private const string PART_SpectrumDisplay = "PART_SpectrumDisplay"; + + #region Private Members + + private Rectangle _spectrumDisplay; + private LinearGradientBrush _pickerBrush; + + #endregion //Private Members + + #region Constructors + + static ColorSpectrumSlider() + { + DefaultStyleKeyProperty.OverrideMetadata( typeof( ColorSpectrumSlider ), new FrameworkPropertyMetadata( typeof( ColorSpectrumSlider ) ) ); + } + + #endregion //Constructors + + #region Dependency Properties + + public static readonly DependencyProperty SelectedColorProperty = DependencyProperty.Register( "SelectedColor", typeof( Color ), typeof( ColorSpectrumSlider ), new PropertyMetadata( System.Windows.Media.Colors.Transparent ) ); + public Color SelectedColor + { + get + { + return ( Color )GetValue( SelectedColorProperty ); + } + set + { + SetValue( SelectedColorProperty, value ); + } + } + + #endregion //Dependency Properties + + #region Base Class Overrides + + public override void OnApplyTemplate() + { + base.OnApplyTemplate(); + + _spectrumDisplay = ( Rectangle )GetTemplateChild( PART_SpectrumDisplay ); + CreateSpectrum(); + OnValueChanged( Double.NaN, Value ); + } + + protected override void OnValueChanged( double oldValue, double newValue ) + { + base.OnValueChanged( oldValue, newValue ); + + Color color = ColorUtilities.ConvertHsvToRgb( 360 - newValue, 1, 1 ); + SelectedColor = color; + } + + #endregion //Base Class Overrides + + #region Methods + + private void CreateSpectrum() + { + _pickerBrush = new LinearGradientBrush(); + _pickerBrush.StartPoint = new Point( 0.5, 0 ); + _pickerBrush.EndPoint = new Point( 0.5, 1 ); + _pickerBrush.ColorInterpolationMode = ColorInterpolationMode.SRgbLinearInterpolation; + + List<Color> colorsList = ColorUtilities.GenerateHsvSpectrum(); + + double stopIncrement = ( double )1 / colorsList.Count; + + int i; + for( i = 0; i < colorsList.Count; i++ ) + { + _pickerBrush.GradientStops.Add( new GradientStop( colorsList[ i ], i * stopIncrement ) ); + } + + _pickerBrush.GradientStops[ i - 1 ].Offset = 1.0; + _spectrumDisplay.Fill = _pickerBrush; + } + + #endregion //Methods + } +} diff --git a/Software/Visual_Studio/Tango.ColorPicker/ColorCanvas/Themes/Generic.xaml b/Software/Visual_Studio/Tango.ColorPicker/ColorCanvas/Themes/Generic.xaml new file mode 100644 index 000000000..a54e2f6a5 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/ColorCanvas/Themes/Generic.xaml @@ -0,0 +1,602 @@ +<!--*********************************************************************************** + + Extended WPF Toolkit + + Copyright (C) 2007-2013 Xceed Software Inc. + + This program is provided to you under the terms of the Microsoft Public + License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + **********************************************************************************--> + +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="clr-namespace:Tango" + xmlns:conv="clr-namespace:Tango.ColorPicker.Core.Converters"> + + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="/Tango.ColorPicker;component/Themes/Brushes.xaml"></ResourceDictionary> + <ResourceDictionary Source="/Tango.ColorPicker;component/Themes/Glyphs.xaml"></ResourceDictionary> + <ResourceDictionary Source="/Tango.ColorPicker;component/Themes/Buttons.xaml"></ResourceDictionary> + <ResourceDictionary Source="/Tango.ColorPicker;component/Themes/Common.xaml"></ResourceDictionary> + </ResourceDictionary.MergedDictionaries> + + <conv:ColorToSolidColorBrushConverter x:Key="ColorToSolidColorBrushConverter" /> + <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> + + <LinearGradientBrush x:Key="ColorPickerDarkBorderBrush" + EndPoint="0.5,1" + StartPoint="0.5,0"> + <GradientStop Color="#FFA3AEB9" + Offset="0" /> + <GradientStop Color="#FF8399A9" + Offset="0.375" /> + <GradientStop Color="#FF718597" + Offset="0.375" /> + <GradientStop Color="#FF617584" + Offset="1" /> + </LinearGradientBrush> + + <LinearGradientBrush x:Key="ColorCanvasBackgroundBrush" + StartPoint="0,0" + EndPoint="0,1"> + <LinearGradientBrush.GradientStops> + <GradientStopCollection> + <GradientStop Offset="0" + Color="#FFffffff" /> + <GradientStop Offset="1" + Color="#FFE8EBED" /> + </GradientStopCollection> + </LinearGradientBrush.GradientStops> + </LinearGradientBrush> + + <SolidColorBrush x:Key="HorizontalSliderTrackNormalBackground" + Color="#FFE7EAEA" /> + + <LinearGradientBrush x:Key="HorizontalSliderTrackNormalBorder" + EndPoint="0,1" + StartPoint="0,0"> + <GradientStop Color="#FFAEB1AF" + Offset="0.1" /> + <GradientStop Color="White" + Offset=".9" /> + </LinearGradientBrush> + + <LinearGradientBrush x:Key="ThumbStroke" + EndPoint="0.5,1" + StartPoint="0.5,0"> + <GradientStop Color="#FFA3AEB9" + Offset="0" /> + <GradientStop Color="#FF8399A9" + Offset="0.375" /> + <GradientStop Color="#FF718597" + Offset="0.375" /> + <GradientStop Color="#FF617584" + Offset="1" /> + </LinearGradientBrush> + + <LinearGradientBrush x:Key="ThumbFill" + StartPoint="0,0" + EndPoint="0,1"> + <LinearGradientBrush.GradientStops> + <GradientStopCollection> + <GradientStop Offset="0" + Color="#FFfefefe" /> + <GradientStop Offset="0.5" + Color="#FFeff1f2" /> + <GradientStop Offset="1" + Color="#FFd0d6db" /> + </GradientStopCollection> + </LinearGradientBrush.GradientStops> + </LinearGradientBrush> + + <SolidColorBrush x:Key="ThumbMouseOver" + Color="#FFE5F2F6" /> + + <Style x:Key="ColorCanvasTextBoxStyle" + TargetType="TextBox" + BasedOn="{StaticResource {x:Type TextBox}}"> + <Setter Property="Background" + Value="Transparent" /> + <Style.Triggers> + <Trigger Property="IsFocused" + Value="False"> + <Setter Property="BorderBrush" + Value="Transparent" /> + </Trigger> + </Style.Triggers> + </Style> + + <Style x:Key="SliderRepeatButtonStyle" + TargetType="{x:Type RepeatButton}"> + <Setter Property="OverridesDefaultStyle" + Value="true" /> + <Setter Property="IsTabStop" + Value="false" /> + <Setter Property="Focusable" + Value="false" /> + <Setter Property="Background" + Value="Transparent" /> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type RepeatButton}"> + <Border Background="{TemplateBinding Background}" /> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <Style x:Key="CustomThumbForSlider" + TargetType="{x:Type Thumb}"> + <Setter Property="OverridesDefaultStyle" + Value="True" /> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type Thumb}"> + <Rectangle x:Name="_thumb" + Fill="{StaticResource ThumbFill}" + Stroke="{StaticResource ThumbStroke}" + Height="14" + Width="8" + RadiusX="1" + RadiusY="1" /> + <ControlTemplate.Triggers> + <Trigger Property="IsMouseOver" + Value="True"> + <Setter TargetName="_thumb" + Property="Rectangle.Fill" + Value="{StaticResource ThumbMouseOver}" /> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <Style x:Key="VerticalSlideThumbStyle" + TargetType="{x:Type Thumb}"> + <Setter Property="Focusable" + Value="false" /> + <Setter Property="OverridesDefaultStyle" + Value="true" /> + <Setter Property="Height" + Value="12" /> + <Setter Property="Width" + Value="11" /> + <Setter Property="Foreground" + Value="Gray" /> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type Thumb}"> + <Canvas SnapsToDevicePixels="true"> + <Path x:Name="LeftArrow" + Stretch="Fill" + StrokeLineJoin="Round" + Stroke="#FF000000" + Fill="#FF000000" + Data="F1 M 276.761,316L 262.619,307.835L 262.619,324.165L 276.761,316 Z " + RenderTransformOrigin="0.5,0.5" + Width="6" + Height="8"> + <Path.RenderTransform> + <TransformGroup> + <ScaleTransform /> + <SkewTransform /> + <RotateTransform /> + <TranslateTransform Y="6" + X="-3" /> + </TransformGroup> + </Path.RenderTransform> + </Path> + <Path x:Name="RightArrow" + Stretch="Fill" + StrokeLineJoin="Round" + Stroke="#FF000000" + Fill="#FF000000" + Data="F1 M 276.761,316L 262.619,307.835L 262.619,324.165L 276.761,316 Z " + RenderTransformOrigin="0.5,0.5" + Width="6" + Height="8"> + <Path.RenderTransform> + <TransformGroup> + <ScaleTransform /> + <SkewTransform /> + <RotateTransform Angle="-180" /> + <TranslateTransform Y="6" + X="8" /> + </TransformGroup> + </Path.RenderTransform> + </Path> + </Canvas> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <Style x:Key="ColorCanvasSliderStyle" + TargetType="{x:Type Slider}"> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type Slider}"> + <Border BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}" + Background="{TemplateBinding Background}" + SnapsToDevicePixels="true"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" + MinHeight="{TemplateBinding MinHeight}" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + <TickBar x:Name="TopTick" + Fill="{TemplateBinding Foreground}" + Height="4" + Placement="Top" + Grid.Row="0" + Visibility="Collapsed" /> + <TickBar x:Name="BottomTick" + Fill="{TemplateBinding Foreground}" + Height="4" + Placement="Bottom" + Grid.Row="2" + Visibility="Collapsed" /> + <Border x:Name="TrackBackground" + BorderBrush="{StaticResource HorizontalSliderTrackNormalBorder}" + BorderThickness="1" + Background="{StaticResource HorizontalSliderTrackNormalBackground}" + CornerRadius="1" + Height="4.0" + Margin="5,0" + Grid.Row="1" + VerticalAlignment="center"> + <Canvas Margin="-6,-1"> + <Rectangle x:Name="PART_SelectionRange" + Fill="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" + Height="4.0" + Stroke="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" + StrokeThickness="1.0" + Visibility="Hidden" /> + </Canvas> + </Border> + <Track x:Name="PART_Track" + Grid.Row="1"> + <Track.DecreaseRepeatButton> + <RepeatButton Command="{x:Static Slider.DecreaseLarge}" + Style="{StaticResource SliderRepeatButtonStyle}" /> + </Track.DecreaseRepeatButton> + <Track.IncreaseRepeatButton> + <RepeatButton Command="{x:Static Slider.IncreaseLarge}" + Style="{StaticResource SliderRepeatButtonStyle}" /> + </Track.IncreaseRepeatButton> + <Track.Thumb> + <Thumb x:Name="Thumb" + Style="{StaticResource CustomThumbForSlider}" /> + </Track.Thumb> + </Track> + </Grid> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <Style TargetType="{x:Type local:ColorCanvas}"> + <Setter Property="Background" + Value="{StaticResource ColorCanvasBackgroundBrush}" /> + <Setter Property="BorderBrush" + Value="{StaticResource ColorPickerDarkBorderBrush}" /> + <Setter Property="BorderThickness" + Value="1" /> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type local:ColorCanvas}"> + <Border Background="{TemplateBinding Background}" + BorderThickness="{TemplateBinding BorderThickness}" + BorderBrush="{TemplateBinding BorderBrush}" + Padding="3"> + <Grid Margin="2"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="200" /> + <ColumnDefinition Width="Auto" /> + </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + <Border BorderThickness="1" + BorderBrush="DarkGray" + ClipToBounds="True" + Background="{StaticResource CheckerBrush}"> + <Canvas x:Name="PART_ColorShadingCanvas" + Width="200" + Height="100" + HorizontalAlignment="Left" + VerticalAlignment="Top"> + <Rectangle x:Name="ColorShadingRectangle" + Height="{Binding ElementName=PART_ColorShadingCanvas, Path=Height}" + Width="{Binding ElementName=PART_ColorShadingCanvas, Path=Width}" + Fill="{Binding SelectedColor, ElementName=PART_SpectrumSlider, Converter={StaticResource ColorToSolidColorBrushConverter}}" /> + <Rectangle x:Name="WhiteGradient" + Width="{Binding ElementName=PART_ColorShadingCanvas,Path=Width}" + Height="{Binding ElementName=PART_ColorShadingCanvas,Path=Height}"> + <Rectangle.Fill> + <LinearGradientBrush StartPoint="0,0" + EndPoint="1,0"> + <GradientStop Offset="0" + Color="#ffffffff" /> + <GradientStop Offset="1" + Color="Transparent" /> + </LinearGradientBrush> + </Rectangle.Fill> + </Rectangle> + <Rectangle x:Name="BlackGradient" + Width="{Binding ElementName=PART_ColorShadingCanvas,Path=Width}" + Height="{Binding ElementName=PART_ColorShadingCanvas,Path=Height}"> + <Rectangle.Fill> + <LinearGradientBrush StartPoint="0,1" + EndPoint="0, 0"> + <GradientStop Offset="0" + Color="#ff000000" /> + <GradientStop Offset="1" + Color="#00000000" /> + </LinearGradientBrush> + </Rectangle.Fill> + </Rectangle> + <Canvas x:Name="PART_ColorShadeSelector" + Width="10" + Height="10" + IsHitTestVisible="False"> + <Ellipse Width="10" + Height="10" + StrokeThickness="3" + Stroke="#FFFFFFFF" + IsHitTestVisible="False" /> + <Ellipse Width="10" + Height="10" + StrokeThickness="1" + Stroke="#FF000000" + IsHitTestVisible="False" /> + </Canvas> + </Canvas> + </Border> + + <Border Grid.Row="1" + Margin="0,5,0,0"> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*" /> + <ColumnDefinition Width="*" /> + </Grid.ColumnDefinitions> + <Border x:Name="SelectedColorBorder" + Background="{StaticResource CheckerBrush}" + Height="22" + Margin="2,0,2,0" + BorderThickness="1" + BorderBrush="#FFC9CACA"> + <Rectangle x:Name="SelectedColor" + Fill="{Binding SelectedColor, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ColorToSolidColorBrushConverter}}" /> + </Border> + <TextBox x:Name="PART_HexadecimalTextBox" + Grid.Column="1" + Margin="2,0,2,0" + VerticalAlignment="Center" + Style="{StaticResource ColorCanvasTextBoxStyle}" /> + </Grid> + </Border> + + <Border Grid.Column="1" + Grid.RowSpan="2" + Margin="4,-8,0,0" + ClipToBounds="False"> + <local:ColorSpectrumSlider x:Name="PART_SpectrumSlider" + VerticalAlignment="Stretch" /> + </Border> + </Grid> + + <Border x:Name="RGBBorder" + MinWidth="180" + Grid.Row="1" + BorderThickness="1" + ClipToBounds="True" + Margin="0,10,0,0"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="*" /> + <ColumnDefinition Width="Auto" /> + </Grid.ColumnDefinitions> + + <TextBlock Grid.Row="0" + Grid.Column="0" + Text="R" + VerticalAlignment="Center" /> + <Slider x:Name="PART_RSlider" + Maximum="255" + SmallChange="1" + LargeChange="10" + TickFrequency="1" + Grid.Row="0" + Grid.Column="1" + Margin="4,6,4,6" + Style="{StaticResource ColorCanvasSliderStyle}" + Value="{Binding R, RelativeSource={RelativeSource TemplatedParent}}" + VerticalAlignment="Center" /> + <TextBox Grid.Row="0" + Grid.Column="2" + Text="{Binding Value, ElementName=PART_RSlider}" + VerticalAlignment="Center" + Style="{StaticResource ColorCanvasTextBoxStyle}" /> + + <TextBlock Grid.Row="1" + Grid.Column="0" + Text="G" + VerticalAlignment="Center" /> + <Slider x:Name="PART_GSlider" + Maximum="255" + SmallChange="1" + LargeChange="10" + TickFrequency="1" + Grid.Row="1" + Grid.Column="1" + Margin="4,6,4,6" + Style="{StaticResource ColorCanvasSliderStyle}" + Value="{Binding G, RelativeSource={RelativeSource TemplatedParent}}" + VerticalAlignment="Center" /> + <TextBox Grid.Row="1" + Grid.Column="2" + Text="{Binding Value, ElementName=PART_GSlider}" + VerticalAlignment="Center" + Style="{StaticResource ColorCanvasTextBoxStyle}" /> + + <TextBlock Grid.Row="2" + Grid.Column="0" + Text="B" + VerticalAlignment="Center" /> + <Slider x:Name="PART_BSlider" + Maximum="255" + SmallChange="1" + LargeChange="10" + TickFrequency="1" + Grid.Row="2" + Grid.Column="1" + Margin="4,6,4,6" + Style="{StaticResource ColorCanvasSliderStyle}" + Value="{Binding B, RelativeSource={RelativeSource TemplatedParent}}" + VerticalAlignment="Center" /> + <TextBox Grid.Row="2" + Grid.Column="3" + Text="{Binding Value, ElementName=PART_BSlider}" + VerticalAlignment="Center" + Style="{StaticResource ColorCanvasTextBoxStyle}" /> + + <TextBlock Grid.Row="3" + Grid.Column="0" + Text="A" + VerticalAlignment="Center" + Visibility="{Binding Path=UsingAlphaChannel, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}" /> + <Slider x:Name="PART_OpacitySlider" + Grid.Row="3" + Grid.Column="1" + Maximum="255" + SmallChange="1" + LargeChange="10" + Margin="4,6,4,6" + Style="{StaticResource ColorCanvasSliderStyle}" + Value="{Binding Path=A, RelativeSource={RelativeSource TemplatedParent}}" + VerticalAlignment="Center" + Visibility="{Binding Path=UsingAlphaChannel, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}" /> + <TextBox Grid.Row="3" + Grid.Column="3" + Text="{Binding Value, ElementName=PART_OpacitySlider}" + VerticalAlignment="Center" + Style="{StaticResource ColorCanvasTextBoxStyle}" + Visibility="{Binding Path=UsingAlphaChannel, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource BooleanToVisibilityConverter}}" /> + </Grid> + </Border> + </Grid> + </Border> + <ControlTemplate.Triggers> + <Trigger Property="IsEnabled" + Value="False"> + <Setter Property="Foreground" + Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" /> + </Trigger> + <Trigger Property="SelectedColor" + Value="{x:Null}"> + <Setter Property="Visibility" + Value="Collapsed" + TargetName="PART_ColorShadeSelector" /> + <Setter Property="Background" + Value="Transparent" + TargetName="SelectedColorBorder" /> + <Setter Property="IsEnabled" + Value="False" + TargetName="RGBBorder" /> + <Setter Property="TextElement.Foreground" + Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" + TargetName="RGBBorder" /> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <Style TargetType="{x:Type local:ColorSpectrumSlider}"> + <Setter Property="BorderBrush" + Value="DarkGray" /> + <Setter Property="BorderThickness" + Value="1" /> + <Setter Property="Orientation" + Value="Vertical" /> + <Setter Property="Background" + Value="Transparent" /> + <Setter Property="Foreground" + Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" /> + <Setter Property="Minimum" + Value="0" /> + <Setter Property="Maximum" + Value="360" /> + <Setter Property="TickFrequency" + Value="0.001" /> + <Setter Property="IsSnapToTickEnabled" + Value="True" /> + <Setter Property="IsDirectionReversed" + Value="False" /> + <Setter Property="IsMoveToPointEnabled" + Value="True" /> + <Setter Property="Value" + Value="0" /> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type local:ColorSpectrumSlider}"> + <Grid> + <Border BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}" + Margin="0,8,0,0"> + <Border x:Name="PART_TrackBackground" + Width="15"> + <Rectangle x:Name="PART_SpectrumDisplay" + Stretch="Fill" + VerticalAlignment="Stretch" /> + </Border> + </Border> + + <Track Name="PART_Track"> + <Track.DecreaseRepeatButton> + <RepeatButton Style="{StaticResource SliderRepeatButtonStyle}" + Command="Slider.DecreaseLarge" /> + </Track.DecreaseRepeatButton> + <Track.IncreaseRepeatButton> + <RepeatButton Style="{StaticResource SliderRepeatButtonStyle}" + Command="Slider.IncreaseLarge" /> + </Track.IncreaseRepeatButton> + <Track.Thumb> + <Thumb Style="{StaticResource VerticalSlideThumbStyle}" /> + </Track.Thumb> + </Track> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + +</ResourceDictionary> diff --git a/Software/Visual_Studio/Tango.ColorPicker/ColorPicker/Implementation/ColorItem.cs b/Software/Visual_Studio/Tango.ColorPicker/ColorPicker/Implementation/ColorItem.cs new file mode 100644 index 000000000..dbf1860f7 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/ColorPicker/Implementation/ColorItem.cs @@ -0,0 +1,53 @@ +/************************************************************************************* + + Extended WPF Toolkit + + Copyright (C) 2007-2013 Xceed Software Inc. + + This program is provided to you under the terms of the Microsoft Public + License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + ***********************************************************************************/ + +using System.Windows.Media; + +namespace Tango +{ + internal class ColorItem + { + public Color? Color + { + get; + set; + } + public string Name + { + get; + set; + } + + public ColorItem(Color? color, string name) + { + Color = color; + Name = name; + } + + public override bool Equals(object obj) + { + var ci = obj as ColorItem; + if (ci == null) + return false; + return (ci.Color.Equals(Color) && ci.Name.Equals(Name)); + } + + public override int GetHashCode() + { + return this.Color.GetHashCode() ^ this.Name.GetHashCode(); + } + } +} diff --git a/Software/Visual_Studio/Tango.ColorPicker/ColorPicker/Implementation/ColorPicker.cs b/Software/Visual_Studio/Tango.ColorPicker/ColorPicker/Implementation/ColorPicker.cs new file mode 100644 index 000000000..aff0ae661 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/ColorPicker/Implementation/ColorPicker.cs @@ -0,0 +1,770 @@ +/************************************************************************************* + + Extended WPF Toolkit + + Copyright (C) 2007-2013 Xceed Software Inc. + + This program is provided to you under the terms of the Microsoft Public + License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + ***********************************************************************************/ + +using System; +using System.Collections.ObjectModel; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Media; +using Tango.ColorPicker.Core.Utilities; +using System.Windows.Controls.Primitives; +using System.Linq; +using System.Collections.Generic; +using System.Windows.Data; +using Tango.ColorPicker; + +namespace Tango +{ + internal enum ColorMode + { + ColorPalette, + ColorCanvas + } + + internal enum ColorSortingMode + { + Alphabetical, + HueSaturationBrightness + } + + [TemplatePart(Name = PART_AvailableColors, Type = typeof(ListBox))] + [TemplatePart(Name = PART_StandardColors, Type = typeof(ListBox))] + [TemplatePart(Name = PART_RecentColors, Type = typeof(ListBox))] + [TemplatePart(Name = PART_ColorPickerToggleButton, Type = typeof(ToggleButton))] + [TemplatePart(Name = PART_ColorPickerPalettePopup, Type = typeof(Popup))] + [TemplatePart(Name = PART_ColorModeButton, Type = typeof(Button))] + public class ColorPickerCombo : Control + { + private const string PART_AvailableColors = "PART_AvailableColors"; + private const string PART_StandardColors = "PART_StandardColors"; + private const string PART_RecentColors = "PART_RecentColors"; + private const string PART_ColorPickerToggleButton = "PART_ColorPickerToggleButton"; + private const string PART_ColorPickerPalettePopup = "PART_ColorPickerPalettePopup"; + private const string PART_ColorModeButton = "PART_ColorModeButton"; + + #region Members + + private ListBox _availableColors; + private ListBox _standardColors; + private ListBox _recentColors; + private ToggleButton _toggleButton; + private Popup _popup; + private Button _colorModeButton; + private Color? _initialColor; + private bool _selectionChanged; + + #endregion //Members + + #region Properties + + #region AdvancedButtonHeader + + public static readonly DependencyProperty AdvancedButtonHeaderProperty = DependencyProperty.Register("AdvancedButtonHeader", typeof(string), typeof(ColorPickerCombo), new UIPropertyMetadata("Advanced")); + public string AdvancedButtonHeader + { + get + { + return (string)GetValue(AdvancedButtonHeaderProperty); + } + set + { + SetValue(AdvancedButtonHeaderProperty, value); + } + } + + #endregion //AdvancedButtonHeader + + #region AvailableColors + + internal static readonly DependencyProperty AvailableColorsProperty = DependencyProperty.Register("AvailableColors", typeof(ObservableCollection<ColorItem>), typeof(ColorPickerCombo), new UIPropertyMetadata(CreateAvailableColors())); + internal ObservableCollection<ColorItem> AvailableColors + { + get + { + return (ObservableCollection<ColorItem>)GetValue(AvailableColorsProperty); + } + set + { + SetValue(AvailableColorsProperty, value); + } + } + + #endregion //AvailableColors + + #region AvailableColorsSortingMode + + internal static readonly DependencyProperty AvailableColorsSortingModeProperty = DependencyProperty.Register("AvailableColorsSortingMode", typeof(ColorSortingMode), typeof(ColorPickerCombo), new UIPropertyMetadata(ColorSortingMode.Alphabetical, OnAvailableColorsSortingModeChanged)); + internal ColorSortingMode AvailableColorsSortingMode + { + get + { + return (ColorSortingMode)GetValue(AvailableColorsSortingModeProperty); + } + set + { + SetValue(AvailableColorsSortingModeProperty, value); + } + } + + private static void OnAvailableColorsSortingModeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ColorPickerCombo colorPicker = (ColorPickerCombo)d; + if (colorPicker != null) + colorPicker.OnAvailableColorsSortingModeChanged((ColorSortingMode)e.OldValue, (ColorSortingMode)e.NewValue); + } + + private void OnAvailableColorsSortingModeChanged(ColorSortingMode oldValue, ColorSortingMode newValue) + { + ListCollectionView lcv = (ListCollectionView)(CollectionViewSource.GetDefaultView(this.AvailableColors)); + if (lcv != null) + { + lcv.CustomSort = (AvailableColorsSortingMode == ColorSortingMode.HueSaturationBrightness) + ? new ColorSorter() + : null; + } + } + + #endregion //AvailableColorsSortingMode + + #region AvailableColorsHeader + + public static readonly DependencyProperty AvailableColorsHeaderProperty = DependencyProperty.Register("AvailableColorsHeader", typeof(string), typeof(ColorPickerCombo), new UIPropertyMetadata("Available Colors")); + public string AvailableColorsHeader + { + get + { + return (string)GetValue(AvailableColorsHeaderProperty); + } + set + { + SetValue(AvailableColorsHeaderProperty, value); + } + } + + #endregion //AvailableColorsHeader + + #region ButtonStyle + + public static readonly DependencyProperty ButtonStyleProperty = DependencyProperty.Register("ButtonStyle", typeof(Style), typeof(ColorPickerCombo)); + public Style ButtonStyle + { + get + { + return (Style)GetValue(ButtonStyleProperty); + } + set + { + SetValue(ButtonStyleProperty, value); + } + } + + #endregion //ButtonStyle + + #region DisplayColorAndName + + public static readonly DependencyProperty DisplayColorAndNameProperty = DependencyProperty.Register("DisplayColorAndName", typeof(bool), typeof(ColorPickerCombo), new UIPropertyMetadata(false)); + public bool DisplayColorAndName + { + get + { + return (bool)GetValue(DisplayColorAndNameProperty); + } + set + { + SetValue(DisplayColorAndNameProperty, value); + } + } + + #endregion //DisplayColorAndName + + #region ColorMode + + internal static readonly DependencyProperty ColorModeProperty = DependencyProperty.Register("ColorMode", typeof(ColorMode), typeof(ColorPickerCombo), new UIPropertyMetadata(ColorMode.ColorPalette)); + internal ColorMode ColorMode + { + get + { + return (ColorMode)GetValue(ColorModeProperty); + } + set + { + SetValue(ColorModeProperty, value); + } + } + + #endregion //ColorMode + + #region IsOpen + + public static readonly DependencyProperty IsOpenProperty = DependencyProperty.Register("IsOpen", typeof(bool), typeof(ColorPickerCombo), new UIPropertyMetadata(false, OnIsOpenChanged)); + public bool IsOpen + { + get + { + return (bool)GetValue(IsOpenProperty); + } + set + { + SetValue(IsOpenProperty, value); + } + } + + private static void OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ColorPickerCombo colorPicker = (ColorPickerCombo)d; + if (colorPicker != null) + colorPicker.OnIsOpenChanged((bool)e.OldValue, (bool)e.NewValue); + } + + private void OnIsOpenChanged(bool oldValue, bool newValue) + { + if (newValue) + { + _initialColor = this.SelectedColor; + } + RoutedEventArgs args = new RoutedEventArgs(newValue ? OpenedEvent : ClosedEvent, this); + this.RaiseEvent(args); + } + + #endregion //IsOpen + + #region RecentColors + + internal static readonly DependencyProperty RecentColorsProperty = DependencyProperty.Register("RecentColors", typeof(ObservableCollection<ColorItem>), typeof(ColorPickerCombo), new UIPropertyMetadata(null)); + internal ObservableCollection<ColorItem> RecentColors + { + get + { + return (ObservableCollection<ColorItem>)GetValue(RecentColorsProperty); + } + set + { + SetValue(RecentColorsProperty, value); + } + } + + #endregion //RecentColors + + #region RecentColorsHeader + + public static readonly DependencyProperty RecentColorsHeaderProperty = DependencyProperty.Register("RecentColorsHeader", typeof(string), typeof(ColorPickerCombo), new UIPropertyMetadata("Recent Colors")); + public string RecentColorsHeader + { + get + { + return (string)GetValue(RecentColorsHeaderProperty); + } + set + { + SetValue(RecentColorsHeaderProperty, value); + } + } + + #endregion //RecentColorsHeader + + #region SelectedColor + + public static readonly DependencyProperty SelectedColorProperty = DependencyProperty.Register("SelectedColor", typeof(Color?), typeof(ColorPickerCombo), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, new PropertyChangedCallback(OnSelectedColorPropertyChanged))); + public Color? SelectedColor + { + get + { + return (Color?)GetValue(SelectedColorProperty); + } + set + { + SetValue(SelectedColorProperty, value); + } + } + + private static void OnSelectedColorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ColorPickerCombo colorPicker = (ColorPickerCombo)d; + if (colorPicker != null) + colorPicker.OnSelectedColorChanged((Color?)e.OldValue, (Color?)e.NewValue); + } + + private void OnSelectedColorChanged(Color? oldValue, Color? newValue) + { + SelectedColorText = GetFormatedColorString(newValue); + + RoutedPropertyChangedEventArgs<Color?> args = new RoutedPropertyChangedEventArgs<Color?>(oldValue, newValue); + args.RoutedEvent = ColorPickerCombo.SelectedColorChangedEvent; + RaiseEvent(args); + } + + #endregion //SelectedColor + + #region SelectedColorText + + public static readonly DependencyProperty SelectedColorTextProperty = DependencyProperty.Register("SelectedColorText", typeof(string), typeof(ColorPickerCombo), new UIPropertyMetadata("")); + public string SelectedColorText + { + get + { + return (string)GetValue(SelectedColorTextProperty); + } + protected set + { + SetValue(SelectedColorTextProperty, value); + } + } + + #endregion //SelectedColorText + + #region ShowAdvancedButton + + public static readonly DependencyProperty ShowAdvancedButtonProperty = DependencyProperty.Register("ShowAdvancedButton", typeof(bool), typeof(ColorPickerCombo), new UIPropertyMetadata(true)); + public bool ShowAdvancedButton + { + get + { + return (bool)GetValue(ShowAdvancedButtonProperty); + } + set + { + SetValue(ShowAdvancedButtonProperty, value); + } + } + + #endregion //ShowAdvancedButton + + #region ShowAvailableColors + + public static readonly DependencyProperty ShowAvailableColorsProperty = DependencyProperty.Register("ShowAvailableColors", typeof(bool), typeof(ColorPickerCombo), new UIPropertyMetadata(true)); + public bool ShowAvailableColors + { + get + { + return (bool)GetValue(ShowAvailableColorsProperty); + } + set + { + SetValue(ShowAvailableColorsProperty, value); + } + } + + #endregion //ShowAvailableColors + + #region ShowRecentColors + + public static readonly DependencyProperty ShowRecentColorsProperty = DependencyProperty.Register("ShowRecentColors", typeof(bool), typeof(ColorPickerCombo), new UIPropertyMetadata(false)); + public bool ShowRecentColors + { + get + { + return (bool)GetValue(ShowRecentColorsProperty); + } + set + { + SetValue(ShowRecentColorsProperty, value); + } + } + + #endregion //DisplayRecentColors + + #region ShowStandardColors + + public static readonly DependencyProperty ShowStandardColorsProperty = DependencyProperty.Register("ShowStandardColors", typeof(bool), typeof(ColorPickerCombo), new UIPropertyMetadata(true)); + public bool ShowStandardColors + { + get + { + return (bool)GetValue(ShowStandardColorsProperty); + } + set + { + SetValue(ShowStandardColorsProperty, value); + } + } + + #endregion //DisplayStandardColors + + #region ShowDropDownButton + + public static readonly DependencyProperty ShowDropDownButtonProperty = DependencyProperty.Register("ShowDropDownButton", typeof(bool), typeof(ColorPickerCombo), new UIPropertyMetadata(true)); + public bool ShowDropDownButton + { + get + { + return (bool)GetValue(ShowDropDownButtonProperty); + } + set + { + SetValue(ShowDropDownButtonProperty, value); + } + } + + #endregion //ShowDropDownButton + + #region StandardButtonHeader + + public static readonly DependencyProperty StandardButtonHeaderProperty = DependencyProperty.Register("StandardButtonHeader", typeof(string), typeof(ColorPickerCombo), new UIPropertyMetadata("Standard")); + public string StandardButtonHeader + { + get + { + return (string)GetValue(StandardButtonHeaderProperty); + } + set + { + SetValue(StandardButtonHeaderProperty, value); + } + } + + #endregion //StandardButtonHeader + + #region StandardColors + + internal static readonly DependencyProperty StandardColorsProperty = DependencyProperty.Register("StandardColors", typeof(ObservableCollection<ColorItem>), typeof(ColorPickerCombo), new UIPropertyMetadata(CreateStandardColors())); + internal ObservableCollection<ColorItem> StandardColors + { + get + { + return (ObservableCollection<ColorItem>)GetValue(StandardColorsProperty); + } + set + { + SetValue(StandardColorsProperty, value); + } + } + + #endregion //StandardColors + + #region StandardColorsHeader + + public static readonly DependencyProperty StandardColorsHeaderProperty = DependencyProperty.Register("StandardColorsHeader", typeof(string), typeof(ColorPickerCombo), new UIPropertyMetadata("Standard Colors")); + public string StandardColorsHeader + { + get + { + return (string)GetValue(StandardColorsHeaderProperty); + } + set + { + SetValue(StandardColorsHeaderProperty, value); + } + } + + #endregion //StandardColorsHeader + + #region UsingAlphaChannel + + public static readonly DependencyProperty UsingAlphaChannelProperty = DependencyProperty.Register("UsingAlphaChannel", typeof(bool), typeof(ColorPickerCombo), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, new PropertyChangedCallback(OnUsingAlphaChannelPropertyChanged))); + public bool UsingAlphaChannel + { + get + { + return (bool)GetValue(UsingAlphaChannelProperty); + } + set + { + SetValue(UsingAlphaChannelProperty, value); + } + } + + private static void OnUsingAlphaChannelPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + ColorPickerCombo colorPicker = (ColorPickerCombo)d; + if (colorPicker != null) + colorPicker.OnUsingAlphaChannelChanged(); + } + + private void OnUsingAlphaChannelChanged() + { + SelectedColorText = GetFormatedColorString(SelectedColor); + } + + #endregion //UsingAlphaChannel + + #endregion //Properties + + #region Constructors + + static ColorPickerCombo() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(ColorPickerCombo), new FrameworkPropertyMetadata(typeof(ColorPickerCombo))); + } + + public ColorPickerCombo() + { +#if VS2008 + this.RecentColors = new ObservableCollection<ColorItem>(); +#else + this.SetCurrentValue(ColorPickerCombo.RecentColorsProperty, new ObservableCollection<ColorItem>()); +#endif + + Keyboard.AddKeyDownHandler(this, OnKeyDown); + Mouse.AddPreviewMouseDownOutsideCapturedElementHandler(this, OnMouseDownOutsideCapturedElement); + } + + #endregion //Constructors + + #region Base Class Overrides + + public override void OnApplyTemplate() + { + base.OnApplyTemplate(); + + if (_availableColors != null) + _availableColors.SelectionChanged -= Color_SelectionChanged; + + _availableColors = GetTemplateChild(PART_AvailableColors) as ListBox; + if (_availableColors != null) + _availableColors.SelectionChanged += Color_SelectionChanged; + + if (_standardColors != null) + _standardColors.SelectionChanged -= Color_SelectionChanged; + + _standardColors = GetTemplateChild(PART_StandardColors) as ListBox; + if (_standardColors != null) + _standardColors.SelectionChanged += Color_SelectionChanged; + + if (_recentColors != null) + _recentColors.SelectionChanged -= Color_SelectionChanged; + + _recentColors = GetTemplateChild(PART_RecentColors) as ListBox; + if (_recentColors != null) + _recentColors.SelectionChanged += Color_SelectionChanged; + + if (_popup != null) + _popup.Opened -= Popup_Opened; + + _popup = GetTemplateChild(PART_ColorPickerPalettePopup) as Popup; + if (_popup != null) + _popup.Opened += Popup_Opened; + + _toggleButton = this.Template.FindName(PART_ColorPickerToggleButton, this) as ToggleButton; + + if (_colorModeButton != null) + _colorModeButton.Click -= new RoutedEventHandler(this.ColorModeButton_Clicked); + + _colorModeButton = this.Template.FindName(PART_ColorModeButton, this) as Button; + + if (_colorModeButton != null) + _colorModeButton.Click += new RoutedEventHandler(this.ColorModeButton_Clicked); + } + + protected override void OnMouseUp(MouseButtonEventArgs e) + { + base.OnMouseUp(e); + + // Close ColorPicker on MouseUp to prevent action of mouseUp on controls behind the ColorPicker. + if (_selectionChanged) + { + CloseColorPicker(true); + _selectionChanged = false; + } + } + + #endregion //Base Class Overrides + + #region Event Handlers + + private void OnKeyDown(object sender, KeyEventArgs e) + { + if (!IsOpen) + { + if (KeyboardUtilities.IsKeyModifyingPopupState(e)) + { + IsOpen = true; + // Focus will be on ListBoxItem in Popup_Opened(). + e.Handled = true; + } + } + else + { + if (KeyboardUtilities.IsKeyModifyingPopupState(e)) + { + CloseColorPicker(true); + e.Handled = true; + } + else if (e.Key == Key.Escape) + { + this.SelectedColor = _initialColor; + CloseColorPicker(true); + e.Handled = true; + } + } + } + + private void OnMouseDownOutsideCapturedElement(object sender, MouseButtonEventArgs e) + { + CloseColorPicker(true); + } + + private void Color_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + ListBox lb = (ListBox)sender; + + if (e.AddedItems.Count > 0) + { + var colorItem = (ColorItem)e.AddedItems[0]; + SelectedColor = colorItem.Color; + UpdateRecentColors(colorItem); + _selectionChanged = true; + lb.SelectedIndex = -1; //for now I don't care about keeping track of the selected color + } + } + + private void Popup_Opened(object sender, EventArgs e) + { + if ((_availableColors != null) && ShowAvailableColors) + FocusOnListBoxItem(_availableColors); + else if ((_standardColors != null) && ShowStandardColors) + FocusOnListBoxItem(_standardColors); + else if ((_recentColors != null) && ShowRecentColors) + FocusOnListBoxItem(_recentColors); + } + + private void FocusOnListBoxItem(ListBox listBox) + { + ListBoxItem listBoxItem = (ListBoxItem)listBox.ItemContainerGenerator.ContainerFromItem(listBox.SelectedItem); + if ((listBoxItem == null) && (listBox.Items.Count > 0)) + listBoxItem = (ListBoxItem)listBox.ItemContainerGenerator.ContainerFromItem(listBox.Items[0]); + if (listBoxItem != null) + listBoxItem.Focus(); + } + + private void ColorModeButton_Clicked(object sender, RoutedEventArgs e) + { + this.ColorMode = (this.ColorMode == ColorMode.ColorPalette) ? ColorMode.ColorCanvas : ColorMode.ColorPalette; + } + + #endregion //Event Handlers + + #region Events + + #region SelectedColorChangedEvent + + public static readonly RoutedEvent SelectedColorChangedEvent = EventManager.RegisterRoutedEvent("SelectedColorChanged", RoutingStrategy.Bubble, typeof(RoutedPropertyChangedEventHandler<Color?>), typeof(ColorPickerCombo)); + public event RoutedPropertyChangedEventHandler<Color?> SelectedColorChanged + { + add + { + AddHandler(SelectedColorChangedEvent, value); + } + remove + { + RemoveHandler(SelectedColorChangedEvent, value); + } + } + + #endregion + + #region OpenedEvent + + public static readonly RoutedEvent OpenedEvent = EventManager.RegisterRoutedEvent("OpenedEvent", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(ColorPickerCombo)); + public event RoutedEventHandler Opened + { + add + { + AddHandler(OpenedEvent, value); + } + remove + { + RemoveHandler(OpenedEvent, value); + } + } + + #endregion //OpenedEvent + + #region ClosedEvent + + public static readonly RoutedEvent ClosedEvent = EventManager.RegisterRoutedEvent("ClosedEvent", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(ColorPickerCombo)); + public event RoutedEventHandler Closed + { + add + { + AddHandler(ClosedEvent, value); + } + remove + { + RemoveHandler(ClosedEvent, value); + } + } + + #endregion //ClosedEvent + + #endregion //Events + + #region Methods + + private void CloseColorPicker(bool isFocusOnColorPicker) + { + if (IsOpen) + IsOpen = false; + ReleaseMouseCapture(); + + if (isFocusOnColorPicker && (_toggleButton != null)) + _toggleButton.Focus(); + this.UpdateRecentColors(new ColorItem(SelectedColor, SelectedColorText)); + } + + private void UpdateRecentColors(ColorItem colorItem) + { + if (!RecentColors.Contains(colorItem)) + RecentColors.Add(colorItem); + + if (RecentColors.Count > 10) //don't allow more than ten, maybe make a property that can be set by the user. + RecentColors.RemoveAt(0); + } + + private string GetFormatedColorString(Color? colorToFormat) + { + if ((colorToFormat == null) || !colorToFormat.HasValue) + return string.Empty; + + return ColorUtilities.FormatColorString(colorToFormat.Value.GetColorName(), UsingAlphaChannel); + } + + private static ObservableCollection<ColorItem> CreateStandardColors() + { + ObservableCollection<ColorItem> _standardColors = new ObservableCollection<ColorItem>(); + _standardColors.Add(new ColorItem(Colors.Transparent, "Transparent")); + _standardColors.Add(new ColorItem(Colors.White, "White")); + _standardColors.Add(new ColorItem(Colors.Gray, "Gray")); + _standardColors.Add(new ColorItem(Colors.Black, "Black")); + _standardColors.Add(new ColorItem(Colors.Red, "Red")); + _standardColors.Add(new ColorItem(Colors.Green, "Green")); + _standardColors.Add(new ColorItem(Colors.Blue, "Blue")); + _standardColors.Add(new ColorItem(Colors.Yellow, "Yellow")); + _standardColors.Add(new ColorItem(Colors.Orange, "Orange")); + _standardColors.Add(new ColorItem(Colors.Purple, "Purple")); + return _standardColors; + } + + private static ObservableCollection<ColorItem> CreateAvailableColors() + { + ObservableCollection<ColorItem> _standardColors = new ObservableCollection<ColorItem>(); + + foreach (var item in ColorUtilities.KnownColors) + { + if (!String.Equals(item.Key, "Transparent")) + { + var colorItem = new ColorItem(item.Value, item.Key); + if (!_standardColors.Contains(colorItem)) + _standardColors.Add(colorItem); + } + } + + return _standardColors; + } + + #endregion //Methods + } +} diff --git a/Software/Visual_Studio/Tango.ColorPicker/ColorPicker/Implementation/ColorSorter.cs b/Software/Visual_Studio/Tango.ColorPicker/ColorPicker/Implementation/ColorSorter.cs new file mode 100644 index 000000000..fa33faa55 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/ColorPicker/Implementation/ColorSorter.cs @@ -0,0 +1,77 @@ +/************************************************************************************* + + Extended WPF Toolkit + + Copyright (C) 2007-2013 Xceed Software Inc. + + This program is provided to you under the terms of the Microsoft Public + License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + ***********************************************************************************/ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Media; + +namespace Tango.ColorPicker +{ + internal class ColorSorter : IComparer + { + public int Compare( object firstItem, object secondItem ) + { + if( firstItem == null || secondItem == null ) + return -1; + + ColorItem colorItem1 = ( ColorItem )firstItem; + ColorItem colorItem2 = ( ColorItem )secondItem; + + if( (colorItem1.Color == null) || !colorItem1.Color.HasValue || + (colorItem2.Color == null) || !colorItem2.Color.HasValue ) + return -1; + + System.Drawing.Color drawingColor1 = System.Drawing.Color.FromArgb( colorItem1.Color.Value.A, colorItem1.Color.Value.R, colorItem1.Color.Value.G, colorItem1.Color.Value.B ); + System.Drawing.Color drawingColor2 = System.Drawing.Color.FromArgb( colorItem2.Color.Value.A, colorItem2.Color.Value.R, colorItem2.Color.Value.G, colorItem2.Color.Value.B ); + + // Compare Hue + double hueColor1 = Math.Round( ( double )drawingColor1.GetHue(), 3 ); + double hueColor2 = Math.Round( ( double )drawingColor2.GetHue(), 3 ); + + if( hueColor1 > hueColor2 ) + return 1; + else if( hueColor1 < hueColor2 ) + return -1; + else + { + // Hue is equal, compare Saturation + double satColor1 = Math.Round( ( double )drawingColor1.GetSaturation(), 3 ); + double satColor2 = Math.Round( ( double )drawingColor2.GetSaturation(), 3 ); + + if( satColor1 > satColor2 ) + return 1; + else if( satColor1 < satColor2 ) + return -1; + else + { + // Saturation is equal, compare Brightness + double brightColor1 = Math.Round( ( double )drawingColor1.GetBrightness(), 3 ); + double brightColor2 = Math.Round( ( double )drawingColor2.GetBrightness(), 3 ); + + if( brightColor1 > brightColor2 ) + return 1; + else if( brightColor1 < brightColor2 ) + return -1; + } + } + + return 0; + } + } +} diff --git a/Software/Visual_Studio/Tango.ColorPicker/ColorPicker/Themes/Generic.xaml b/Software/Visual_Studio/Tango.ColorPicker/ColorPicker/Themes/Generic.xaml new file mode 100644 index 000000000..996da3308 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/ColorPicker/Themes/Generic.xaml @@ -0,0 +1,356 @@ +<!--*********************************************************************************** + + Extended WPF Toolkit + + Copyright (C) 2007-2013 Xceed Software Inc. + + This program is provided to you under the terms of the Microsoft Public + License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + **********************************************************************************--> + +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="clr-namespace:Tango" + xmlns:conv="clr-namespace:Tango.ColorPicker.Core.Converters" + xmlns:sys="clr-namespace:System;assembly=mscorlib" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:chrome="clr-namespace:Tango.ColorPicker"> + + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="/Tango.ColorPicker;component/Themes/Brushes.xaml"></ResourceDictionary> + <ResourceDictionary Source="/Tango.ColorPicker;component/Themes/Glyphs.xaml"></ResourceDictionary> + <ResourceDictionary Source="/Tango.ColorPicker;component/Themes/Buttons.xaml"></ResourceDictionary> + <ResourceDictionary Source="/Tango.ColorPicker;component/Themes/Common.xaml"></ResourceDictionary> + <ResourceDictionary Source="/Tango.ColorPicker;component/ColorCanvas/Themes/Generic.xaml"></ResourceDictionary> + <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" /> + </ResourceDictionary.MergedDictionaries> + + <SolidColorBrush x:Key="ButtonHover" Color="#C2E0FF" /> + <SolidColorBrush x:Key="ButtonHoverBorder" Color="#3399FF" /> + <SolidColorBrush x:Key="ButtonChecked" Color="#E6F0FA" /> + <SolidColorBrush x:Key="ButtonPressed" Color="#99CCFF" /> + <SolidColorBrush x:Key="ButtonPressedBorder" Color="#3399FF" /> + + + <!-- =============================================================================== --> + <!-- ColorPicker --> + <!-- =============================================================================== --> + + <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> + <conv:InverseBoolConverter x:Key="InverseBoolConverter" /> + <conv:ColorToSolidColorBrushConverter x:Key="ColorToSolidColorBrushConverter" /> + + <LinearGradientBrush x:Key="ColorPickerDarkBorderBrush" EndPoint="0.5,1" StartPoint="0.5,0"> + <GradientStop Color="#FFA3AEB9" Offset="0" /> + <GradientStop Color="#FF8399A9" Offset="0.375" /> + <GradientStop Color="#FF718597" Offset="0.375" /> + <GradientStop Color="#FF617584" Offset="1" /> + </LinearGradientBrush> + + <LinearGradientBrush x:Key="PopupBackgroundBrush" StartPoint="0,0" EndPoint="0,1"> + <LinearGradientBrush.GradientStops> + <GradientStopCollection> + <GradientStop Offset="0" Color="#FFffffff" /> + <GradientStop Offset="1" Color="#FFE8EBED" /> + </GradientStopCollection> + </LinearGradientBrush.GradientStops> + </LinearGradientBrush> + + <Style x:Key="ColorItemContainerStyle" TargetType="{x:Type ListBoxItem}"> + <Setter Property="ToolTip" Value="{Binding Name}" /> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type ListBoxItem}"> + <Grid x:Name="mainGrid" + ToolTip="{Binding Name}"> + <Grid.Resources> + <Style TargetType="ToolTip"> + <Style.Triggers> + <Trigger Property="Content" + Value="{x:Static sys:String.Empty}"> + <Setter Property="Visibility" + Value="Collapsed" /> + </Trigger> + </Style.Triggers> + </Style> + </Grid.Resources> + <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" /> + <Border BorderThickness="1" Background="Transparent" BorderBrush="Transparent" x:Name="_outerBorder" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> + <Border Background="Transparent" BorderThickness="1" BorderBrush="Transparent" x:Name="_innerBorder" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" /> + </Border> + </Grid> + <ControlTemplate.Triggers> + <Trigger Property="IsMouseOver" Value="True"> + <Setter TargetName="_outerBorder" Property="BorderBrush" Value="#FFFF0000" /> + <Setter TargetName="_innerBorder" Property="BorderBrush" Value="#FFFFFF00" /> + </Trigger> + <Trigger Property="IsSelected" Value="True"> + <Setter TargetName="_outerBorder" Property="BorderBrush" Value="#FFFF0000" /> + <Setter TargetName="_innerBorder" Property="BorderBrush" Value="#FFFFFF00" /> + </Trigger> + <DataTrigger Binding="{Binding DisplayColorAndName, RelativeSource={RelativeSource AncestorType={x:Type local:ColorPickerCombo}}}" + Value="False"> + <Setter Property="ToolTip" + Value="{x:Static sys:String.Empty}" + TargetName="mainGrid" /> + </DataTrigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <DataTemplate x:Key="ColorItemTemplate"> + <Grid> + <Border Background="{StaticResource CheckerBrush}" BorderBrush="Black" BorderThickness="1" Margin="2,2,2,2" > + <Rectangle Width="14" Height="14"> + <Rectangle.Style> + <Style TargetType="Rectangle"> + <Setter Property="Fill" Value="{Binding Color, Converter={StaticResource ColorToSolidColorBrushConverter}}" /> + </Style> + </Rectangle.Style> + </Rectangle> + </Border> + </Grid> + </DataTemplate> + + <Style x:Key="ColorPickerToggleButtonStyle" TargetType="ToggleButton"> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="ToggleButton"> + <Grid SnapsToDevicePixels="True"> + + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*"/> + <ColumnDefinition Width="Auto"/> + </Grid.ColumnDefinitions> + + <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True"> + <ContentPresenter Content="{TemplateBinding Content}" + ContentTemplate="{TemplateBinding ContentTemplate}" + ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" + VerticalAlignment="{TemplateBinding VerticalContentAlignment}" + HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" /> + </Border> + + <chrome:ButtonChrome x:Name="ToggleButtonChrome" + Grid.Column="1" + CornerRadius="0,2.75,2.75,0" + Visibility="{Binding ShowDropDownButton, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ColorPickerCombo}, Converter={StaticResource BooleanToVisibilityConverter}}" + RenderChecked="{Binding IsOpen, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ColorPickerCombo}}" + RenderEnabled="{Binding IsEnabled, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ColorPickerCombo}}" + RenderMouseOver="{TemplateBinding IsMouseOver}" + RenderPressed="{TemplateBinding IsPressed}"> + + <Grid x:Name="arrowGlyph" IsHitTestVisible="False" Grid.Column="1" Margin="5"> + <Path x:Name="Arrow" + Width="9" + Height="5" + Data="{StaticResource DownArrowGeometry}" + Fill="#FF000000" + Margin="0,1,0,0"/> + </Grid> + </chrome:ButtonChrome> + </Grid> + + </Grid> + <ControlTemplate.Triggers> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Fill" TargetName="Arrow" Value="#AFAFAF" /> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <Style x:Key="ColorDisplayStyle" TargetType="ContentControl"> + <Setter Property="Focusable" + Value="False" /> + <Setter Property="ContentTemplate"> + <Setter.Value> + <DataTemplate> + <Border Background="{StaticResource CheckerBrush}"> + <Rectangle Fill="{Binding SelectedColor, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ColorPickerCombo}, Converter={StaticResource ColorToSolidColorBrushConverter}}" /> + </Border> + </DataTemplate> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding SelectedColor, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ColorPickerCombo}}" + Value="{x:Null}"> + <Setter Property="Visibility" + Value="Collapsed" /> + </DataTrigger> + </Style.Triggers> + </Style> + + <Style x:Key="ColorListStyle" TargetType="ListBox"> + <Setter Property="Background" Value="Transparent" /> + <Setter Property="BorderThickness" Value="0" /> + <Setter Property="ItemsPanel"> + <Setter.Value> + <ItemsPanelTemplate> + <WrapPanel Width="200" /> + </ItemsPanelTemplate> + </Setter.Value> + </Setter> + <Setter Property="ItemContainerStyle" Value="{StaticResource ColorItemContainerStyle}" /> + <Setter Property="ItemTemplate" Value="{StaticResource ColorItemTemplate}" /> + <Setter Property="SelectionMode" Value="Single" /> + </Style> + + <Style TargetType="{x:Type local:ColorPickerCombo}"> + <Setter Property="Background" Value="White" /> + <Setter Property="BorderBrush" Value="{StaticResource ColorPickerDarkBorderBrush}" /> + <Setter Property="BorderThickness" Value="1,1,0,1" /> + <Setter Property="ButtonStyle" Value="{StaticResource ColorPickerToggleButtonStyle}" /> + <Setter Property="Focusable" Value="False" /> + <Setter Property="HorizontalContentAlignment" Value="Stretch" /> + <Setter Property="VerticalContentAlignment" Value="Stretch" /> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type local:ColorPickerCombo}"> + <Grid> + <ToggleButton x:Name="PART_ColorPickerToggleButton" Style="{x:Null}" Background="#E9E9E9" + IsTabStop="True" + MinHeight="22" + VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" + HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" + Padding="{TemplateBinding Padding}" + IsChecked="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" + IsHitTestVisible="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolConverter}}" + > + <Grid Margin="2"> + <ContentControl x:Name="ColorOnly" Style="{StaticResource ColorDisplayStyle}" Visibility="Hidden" /> + + <Border x:Name="ColorAndName" Background="Transparent" BorderThickness="0"> + <StackPanel Orientation="Horizontal"> + <ContentControl HorizontalAlignment="Left" Margin="0 0 10 0" Width="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}" Style="{StaticResource ColorDisplayStyle}" BorderThickness="0" BorderBrush="#FFC9CACA" /> + <TextBlock Text="{Binding SelectedColorText, RelativeSource={RelativeSource TemplatedParent}}" VerticalAlignment="Center" /> + </StackPanel> + </Border> + </Grid> + </ToggleButton> + + <Popup x:Name="PART_ColorPickerPalettePopup" + VerticalAlignment="Bottom" + IsOpen="{Binding ElementName=PART_ColorPickerToggleButton, Path=IsChecked}" + StaysOpen="False" + AllowsTransparency="True" + Focusable="False" + HorizontalOffset="1" + VerticalOffset="1" + PopupAnimation="Slide" + ToolTip="{x:Static sys:String.Empty}"> + <Popup.Resources> + <Style TargetType="ToolTip"> + <Style.Triggers> + <Trigger Property="Content" + Value="{x:Static sys:String.Empty}"> + <Setter Property="Visibility" + Value="Collapsed" /> + </Trigger> + </Style.Triggers> + </Style> + </Popup.Resources> + <Border BorderThickness="1" Opacity="1" Background="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=Background}" BorderBrush="{StaticResource ColorPickerDarkBorderBrush}" Padding="3"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + <Grid x:Name="_colorPaletteHost" Visibility="Collapsed" Margin="4"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + + <TabControl> + <TabItem Header="Standard Colors"> + + <!-- Available Colors --> + <Grid Grid.Row="1" Visibility="{TemplateBinding ShowAvailableColors, Converter={StaticResource BooleanToVisibilityConverter}}"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition /> + </Grid.RowDefinitions> + <ListBox x:Name="PART_AvailableColors" + Grid.Row="1" + ItemsSource="{Binding AvailableColors, RelativeSource={RelativeSource TemplatedParent}}" + Style="{StaticResource ColorListStyle}" /> + </Grid> + </Grid> + + </TabItem> + + <TabItem Header="Canvas"> + <!-- ColorCanvas --> + <Grid> + <Grid Visibility="Visible"> + <local:ColorCanvas Background="Transparent" + BorderThickness="0" + UsingAlphaChannel="False" + SelectedColor="{Binding SelectedColor, RelativeSource={RelativeSource TemplatedParent}}" /> + </Grid> + <Grid x:Name="_colorCanvasHost" Visibility="Visible"> + <local:ColorCanvas Background="Transparent" + BorderThickness="0" + UsingAlphaChannel="{Binding UsingAlphaChannel, RelativeSource={RelativeSource TemplatedParent}}" + SelectedColor="{Binding SelectedColor, RelativeSource={RelativeSource TemplatedParent}}" /> + </Grid> + </Grid> + </TabItem> + </TabControl> + </Grid> + <!-- More Colors Button --> + <Button x:Name="PART_ColorModeButton" Grid.Row="2" Margin="5" Visibility="Collapsed" /> + </Grid> + </Border> + </Popup> + </Grid> + <ControlTemplate.Triggers> + <Trigger Property="DisplayColorAndName" Value="True"> + <Setter TargetName="ColorOnly" Property="Visibility" Value="Collapsed" /> + <Setter TargetName="ColorAndName" Property="Visibility" Value="Visible" /> + </Trigger> + + <Trigger Property="ColorMode" Value="ColorPalette"> + <Setter TargetName="_colorPaletteHost" Property="Visibility" Value="Visible" /> + <Setter TargetName="_colorCanvasHost" Property="Visibility" Value="Collapsed" /> + <Setter TargetName="PART_ColorModeButton" + Property="Content" + Value="{Binding AdvancedButtonHeader, RelativeSource={RelativeSource TemplatedParent}}" /> + </Trigger> + + <Trigger Property="ColorMode" Value="ColorCanvas"> + <Setter TargetName="_colorPaletteHost" Property="Visibility" Value="Collapsed" /> + <Setter TargetName="_colorCanvasHost" Property="Visibility" Value="Visible" /> + <Setter TargetName="PART_ColorModeButton" + Property="Content" + Value="{Binding StandardButtonHeader, RelativeSource={RelativeSource TemplatedParent}}" /> + </Trigger> + + <Trigger Property="ShowDropDownButton" Value="False"> + <Setter Property="BorderThickness" Value="1" /> + </Trigger> + + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + +</ResourceDictionary> diff --git a/Software/Visual_Studio/Tango.ColorPicker/ColorToSolidColorBrushConverter.cs b/Software/Visual_Studio/Tango.ColorPicker/ColorToSolidColorBrushConverter.cs new file mode 100644 index 000000000..730bc29d6 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/ColorToSolidColorBrushConverter.cs @@ -0,0 +1,67 @@ +/************************************************************************************* + + Extended WPF Toolkit + + Copyright (C) 2007-2013 Xceed Software Inc. + + This program is provided to you under the terms of the Microsoft Public + License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + ***********************************************************************************/ + +using System; +using System.Windows.Data; +using System.Windows.Media; + +namespace Tango.ColorPicker.Core.Converters +{ + internal class ColorToSolidColorBrushConverter : IValueConverter + { + #region IValueConverter Members + + /// <summary> + /// Converts a Color to a SolidColorBrush. + /// </summary> + /// <param name="value">The Color produced by the binding source.</param> + /// <param name="targetType">The type of the binding target property.</param> + /// <param name="parameter">The converter parameter to use.</param> + /// <param name="culture">The culture to use in the converter.</param> + /// <returns> + /// A converted SolidColorBrush. If the method returns null, the valid null value is used. + /// </returns> + public object Convert( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture ) + { + if( value != null ) + return new SolidColorBrush( ( Color )value ); + + return value; + } + + + /// <summary> + /// Converts a SolidColorBrush to a Color. + /// </summary> + /// <remarks>Currently not used in toolkit, but provided for developer use in their own projects</remarks> + /// <param name="value">The SolidColorBrush that is produced by the binding target.</param> + /// <param name="targetType">The type to convert to.</param> + /// <param name="parameter">The converter parameter to use.</param> + /// <param name="culture">The culture to use in the converter.</param> + /// <returns> + /// A converted value. If the method returns null, the valid null value is used. + /// </returns> + public object ConvertBack( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture ) + { + if( value != null ) + return ( ( SolidColorBrush )value ).Color; + + return value; + } + + #endregion + } +} diff --git a/Software/Visual_Studio/Tango.ColorPicker/ColorUtilities.cs b/Software/Visual_Studio/Tango.ColorPicker/ColorUtilities.cs new file mode 100644 index 000000000..1be254437 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/ColorUtilities.cs @@ -0,0 +1,205 @@ +/************************************************************************************* + + Extended WPF Toolkit + + Copyright (C) 2007-2013 Xceed Software Inc. + + This program is provided to you under the terms of the Microsoft Public + License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + ***********************************************************************************/ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Windows.Media; +using Tango.ColorPicker.Primitives; + +namespace Tango.ColorPicker.Core.Utilities +{ + internal static class ColorUtilities + { + public static readonly Dictionary<string, Color> KnownColors = GetKnownColors(); + + public static string GetColorName( this Color color ) + { + string colorName = KnownColors.Where( kvp => kvp.Value.Equals( color ) ).Select( kvp => kvp.Key ).FirstOrDefault(); + + if( String.IsNullOrEmpty( colorName ) ) + colorName = color.ToString(); + + return colorName; + } + + public static string FormatColorString( string stringToFormat, bool isUsingAlphaChannel ) + { + if( !isUsingAlphaChannel && ( stringToFormat.Length == 9 ) ) + return stringToFormat.Remove( 1, 2 ); + return stringToFormat; + } + + private static Dictionary<string, Color> GetKnownColors() + { + var colorProperties = typeof( Colors ).GetProperties( BindingFlags.Static | BindingFlags.Public ); + return colorProperties.ToDictionary( p => p.Name, p => ( Color )p.GetValue( null, null ) ); + } + + /// <summary> + /// Converts an RGB color to an HSV color. + /// </summary> + /// <param name="r"></param> + /// <param name="b"></param> + /// <param name="g"></param> + /// <returns></returns> + public static HsvColor ConvertRgbToHsv( int r, int b, int g ) + { + double delta, min; + double h = 0, s, v; + + min = Math.Min( Math.Min( r, g ), b ); + v = Math.Max( Math.Max( r, g ), b ); + delta = v - min; + + if( v == 0.0 ) + { + s = 0; + } + else + s = delta / v; + + if( s == 0 ) + h = 0.0; + + else + { + if( r == v ) + h = ( g - b ) / delta; + else if( g == v ) + h = 2 + ( b - r ) / delta; + else if( b == v ) + h = 4 + ( r - g ) / delta; + + h *= 60; + if( h < 0.0 ) + h = h + 360; + + } + + return new HsvColor + { + H = h, + S = s, + V = v / 255 + }; + } + + /// <summary> + /// Converts an HSV color to an RGB color. + /// </summary> + /// <param name="h"></param> + /// <param name="s"></param> + /// <param name="v"></param> + /// <returns></returns> + public static Color ConvertHsvToRgb( double h, double s, double v ) + { + double r = 0, g = 0, b = 0; + + if( s == 0 ) + { + r = v; + g = v; + b = v; + } + else + { + int i; + double f, p, q, t; + + if( h == 360 ) + h = 0; + else + h = h / 60; + + i = ( int )Math.Truncate( h ); + f = h - i; + + p = v * ( 1.0 - s ); + q = v * ( 1.0 - ( s * f ) ); + t = v * ( 1.0 - ( s * ( 1.0 - f ) ) ); + + switch( i ) + { + case 0: + { + r = v; + g = t; + b = p; + break; + } + case 1: + { + r = q; + g = v; + b = p; + break; + } + case 2: + { + r = p; + g = v; + b = t; + break; + } + case 3: + { + r = p; + g = q; + b = v; + break; + } + case 4: + { + r = t; + g = p; + b = v; + break; + } + default: + { + r = v; + g = p; + b = q; + break; + } + } + + } + + return Color.FromArgb( 255, ( byte )( Math.Round(r * 255) ), ( byte )( Math.Round(g * 255) ), ( byte )( Math.Round(b * 255) ) ); + } + + /// <summary> + /// Generates a list of colors with hues ranging from 0 360 and a saturation and value of 1. + /// </summary> + /// <returns></returns> + public static List<Color> GenerateHsvSpectrum() + { + List<Color> colorsList = new List<Color>( 8 ); + + for( int i = 0; i < 29; i++ ) + { + colorsList.Add( ColorUtilities.ConvertHsvToRgb( i * 12, 1, 1 ) ); + } + + colorsList.Add( ColorUtilities.ConvertHsvToRgb( 0, 1, 1 ) ); + + return colorsList; + } + } +} diff --git a/Software/Visual_Studio/Tango.ColorPicker/HsvColor.cs b/Software/Visual_Studio/Tango.ColorPicker/HsvColor.cs new file mode 100644 index 000000000..fa4beb8f5 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/HsvColor.cs @@ -0,0 +1,32 @@ +/************************************************************************************* + + Extended WPF Toolkit + + Copyright (C) 2007-2013 Xceed Software Inc. + + This program is provided to you under the terms of the Microsoft Public + License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + ***********************************************************************************/ + +namespace Tango.ColorPicker.Primitives +{ + internal struct HsvColor + { + public double H; + public double S; + public double V; + + public HsvColor( double h, double s, double v ) + { + H = h; + S = s; + V = v; + } + } +} diff --git a/Software/Visual_Studio/Tango.ColorPicker/InverseBoolConverter.cs b/Software/Visual_Studio/Tango.ColorPicker/InverseBoolConverter.cs new file mode 100644 index 000000000..11598a1ed --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/InverseBoolConverter.cs @@ -0,0 +1,38 @@ +/************************************************************************************* + + Extended WPF Toolkit + + Copyright (C) 2007-2013 Xceed Software Inc. + + This program is provided to you under the terms of the Microsoft Public + License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + ***********************************************************************************/ + +using System; +using System.Windows.Data; + +namespace Tango.ColorPicker.Core.Converters +{ + internal class InverseBoolConverter : IValueConverter + { + #region IValueConverter Members + + public object Convert( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture ) + { + return !( bool )value; + } + + public object ConvertBack( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture ) + { + throw new NotImplementedException(); + } + + #endregion + } +} diff --git a/Software/Visual_Studio/Tango.ColorPicker/KeyboardUtilities.cs b/Software/Visual_Studio/Tango.ColorPicker/KeyboardUtilities.cs new file mode 100644 index 000000000..a7a2a0870 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/KeyboardUtilities.cs @@ -0,0 +1,33 @@ +/************************************************************************************* + + Extended WPF Toolkit + + Copyright (C) 2007-2013 Xceed Software Inc. + + This program is provided to you under the terms of the Microsoft Public + License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + ***********************************************************************************/ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Input; + +namespace Tango.ColorPicker.Core.Utilities +{ + internal class KeyboardUtilities + { + internal static bool IsKeyModifyingPopupState( KeyEventArgs e ) + { + return ( ( ( ( Keyboard.Modifiers & ModifierKeys.Alt ) == ModifierKeys.Alt ) && ( ( e.SystemKey == Key.Down ) || ( e.SystemKey == Key.Up ) ) ) + || ( e.Key == Key.F4 ) ); + } + } +} diff --git a/Software/Visual_Studio/Tango.ColorPicker/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.ColorPicker/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..ac8cb5adb --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/Properties/AssemblyInfo.cs @@ -0,0 +1,18 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +[assembly: AssemblyTitle("Tango - Color Picker Control")] +[assembly: ComVisible(false)] + + +[assembly:ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Software/Visual_Studio/Tango.ColorPicker/Properties/Resources.Designer.cs b/Software/Visual_Studio/Tango.ColorPicker/Properties/Resources.Designer.cs new file mode 100644 index 000000000..09502e5a8 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.ColorPicker.Properties { + using System; + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.ColorPicker.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Software/Visual_Studio/Tango.ColorPicker/Properties/Resources.resx b/Software/Visual_Studio/Tango.ColorPicker/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/Properties/Resources.resx @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.ColorPicker/Properties/Settings.Designer.cs b/Software/Visual_Studio/Tango.ColorPicker/Properties/Settings.Designer.cs new file mode 100644 index 000000000..3f2514fb6 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.ColorPicker.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.1.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/Tango.ColorPicker/Properties/Settings.settings b/Software/Visual_Studio/Tango.ColorPicker/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/Properties/Settings.settings @@ -0,0 +1,7 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.ColorPicker/ResourceKeys.cs b/Software/Visual_Studio/Tango.ColorPicker/ResourceKeys.cs new file mode 100644 index 000000000..466a49840 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/ResourceKeys.cs @@ -0,0 +1,61 @@ +/************************************************************************************* + + Extended WPF Toolkit + + Copyright (C) 2007-2013 Xceed Software Inc. + + This program is provided to you under the terms of the Microsoft Public + License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + ***********************************************************************************/ + +using System.Windows; + +namespace Tango.ColorPicker.Themes +{ + internal static class ResourceKeys + { + #region Brush Keys + + public static readonly ComponentResourceKey ControlNormalBackgroundKey = new ComponentResourceKey( typeof( ResourceKeys ), "ControlNormalBackgroundKey" ); + public static readonly ComponentResourceKey ControlDisabledBackgroundKey = new ComponentResourceKey( typeof( ResourceKeys ), "ControlDisabledBackgroundKey" ); + public static readonly ComponentResourceKey ControlNormalBorderKey = new ComponentResourceKey( typeof( ResourceKeys ), "ControlNormalBorderKey" ); + public static readonly ComponentResourceKey ControlMouseOverBorderKey = new ComponentResourceKey( typeof( ResourceKeys ), "ControlMouseOverBorderKey" ); + public static readonly ComponentResourceKey ControlSelectedBorderKey = new ComponentResourceKey(typeof(ResourceKeys), "ControlSelectedBorderKey"); + public static readonly ComponentResourceKey ControlFocusedBorderKey = new ComponentResourceKey( typeof( ResourceKeys ), "ControlFocusedBorderKey" ); + + public static readonly ComponentResourceKey ButtonNormalOuterBorderKey = new ComponentResourceKey( typeof( ResourceKeys ), "ButtonNormalOuterBorderKey" ); + public static readonly ComponentResourceKey ButtonNormalInnerBorderKey = new ComponentResourceKey( typeof( ResourceKeys ), "ButtonNormalInnerBorderKey" ); + public static readonly ComponentResourceKey ButtonNormalBackgroundKey = new ComponentResourceKey( typeof( ResourceKeys ), "ButtonNormalBackgroundKey" ); + + public static readonly ComponentResourceKey ButtonMouseOverBackgroundKey = new ComponentResourceKey( typeof( ResourceKeys ), "ButtonMouseOverBackgroundKey" ); + public static readonly ComponentResourceKey ButtonMouseOverOuterBorderKey = new ComponentResourceKey( typeof( ResourceKeys ), "ButtonMouseOverOuterBorderKey" ); + public static readonly ComponentResourceKey ButtonMouseOverInnerBorderKey = new ComponentResourceKey( typeof( ResourceKeys ), "ButtonMouseOverInnerBorderKey" ); + + public static readonly ComponentResourceKey ButtonPressedOuterBorderKey = new ComponentResourceKey( typeof( ResourceKeys ), "ButtonPressedOuterBorderKey" ); + public static readonly ComponentResourceKey ButtonPressedInnerBorderKey = new ComponentResourceKey( typeof( ResourceKeys ), "ButtonPressedInnerBorderKey" ); + public static readonly ComponentResourceKey ButtonPressedBackgroundKey = new ComponentResourceKey( typeof( ResourceKeys ), "ButtonPressedBackgroundKey" ); + + public static readonly ComponentResourceKey ButtonFocusedOuterBorderKey = new ComponentResourceKey( typeof( ResourceKeys ), "ButtonFocusedOuterBorderKey" ); + public static readonly ComponentResourceKey ButtonFocusedInnerBorderKey = new ComponentResourceKey( typeof( ResourceKeys ), "ButtonFocusedInnerBorderKey" ); + public static readonly ComponentResourceKey ButtonFocusedBackgroundKey = new ComponentResourceKey( typeof( ResourceKeys ), "ButtonFocusedBackgroundKey" ); + + public static readonly ComponentResourceKey ButtonDisabledOuterBorderKey = new ComponentResourceKey( typeof( ResourceKeys ), "ButtonDisabledOuterBorderKey" ); + public static readonly ComponentResourceKey ButtonInnerBorderDisabledKey = new ComponentResourceKey( typeof( ResourceKeys ), "ButtonInnerBorderDisabledKey" ); + + #endregion //Brush Keys + + public static readonly ComponentResourceKey GlyphNormalForegroundKey = new ComponentResourceKey( typeof( ResourceKeys ), "GlyphNormalForegroundKey" ); + public static readonly ComponentResourceKey GlyphDisabledForegroundKey = new ComponentResourceKey( typeof( ResourceKeys ), "GlyphDisabledForegroundKey" ); + + public static readonly ComponentResourceKey SpinButtonCornerRadiusKey = new ComponentResourceKey( typeof( ResourceKeys ), "SpinButtonCornerRadiusKey" ); + + public static readonly ComponentResourceKey SpinnerButtonStyleKey = new ComponentResourceKey( typeof( ResourceKeys ), "SpinnerButtonStyleKey" ); + + } +} diff --git a/Software/Visual_Studio/Tango.ColorPicker/Tango.ColorPicker.csproj b/Software/Visual_Studio/Tango.ColorPicker/Tango.ColorPicker.csproj new file mode 100644 index 000000000..c104df2e3 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/Tango.ColorPicker.csproj @@ -0,0 +1,159 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{A2F5AF44-29FF-45D6-9D25-ECDA5CCE88B5}</ProjectGuid> + <OutputType>library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Tango.ColorPicker</RootNamespace> + <AssemblyName>Tango.ColorPicker</AssemblyName> + <TargetFrameworkVersion>v4.6</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + <SccProjectName>SAK</SccProjectName> + <SccLocalPath>SAK</SccLocalPath> + <SccAuxPath>SAK</SccAuxPath> + <SccProvider>SAK</SccProvider> + <TargetFrameworkProfile /> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\Build\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup> + <SignAssembly>false</SignAssembly> + </PropertyGroup> + <PropertyGroup> + <AssemblyOriginatorKeyFile> + </AssemblyOriginatorKeyFile> + </PropertyGroup> + <ItemGroup> + <Reference Include="ControlzEx, Version=3.0.2.4, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\ControlzEx.3.0.2.4\lib\net45\ControlzEx.dll</HintPath> + </Reference> + <Reference Include="MahApps.Metro, Version=1.5.0.23, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL"> + <HintPath>..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> + <HintPath>..\packages\MahApps.Metro.1.5.0\lib\net45\System.Windows.Interactivity.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="System.Xml" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xaml"> + <RequiredTargetFramework>4.0</RequiredTargetFramework> + </Reference> + <Reference Include="WindowsBase" /> + <Reference Include="PresentationCore" /> + <Reference Include="PresentationFramework" /> + </ItemGroup> + <ItemGroup> + <Page Include="Chromes\Themes\Generic.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="ColorCanvas\Themes\Generic.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="ColorPicker\Themes\Generic.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Themes\Brushes.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Themes\Buttons.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Themes\Generic.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Themes\Common.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Themes\Glyphs.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + </ItemGroup> + <ItemGroup> + <Compile Include="..\Versioning\GlobalVersionInfo.cs"> + <Link>GlobalVersionInfo.cs</Link> + </Compile> + <Compile Include="Chromes\Implementation\ButtonChrome.cs" /> + <Compile Include="ColorBlendConverter.cs" /> + <Compile Include="ColorCanvas\Implementation\ColorCanvas.cs" /> + <Compile Include="ColorCanvas\Implementation\ColorSpectrumSlider.cs" /> + <Compile Include="ColorPicker\Implementation\ColorItem.cs" /> + <Compile Include="ColorPicker\Implementation\ColorPicker.cs" /> + <Compile Include="ColorPicker\Implementation\ColorSorter.cs" /> + <Compile Include="ColorToSolidColorBrushConverter.cs" /> + <Compile Include="ColorUtilities.cs" /> + <Compile Include="HsvColor.cs" /> + <Compile Include="InverseBoolConverter.cs" /> + <Compile Include="KeyboardUtilities.cs" /> + <Compile Include="Properties\AssemblyInfo.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <Compile Include="ResourceKeys.cs" /> + <Compile Include="WindowColors.cs" /> + <Compile Include="WindowControl.cs" /> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <None Include="packages.config" /> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + <AppDesigner Include="Properties\" /> + </ItemGroup> + <ItemGroup /> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.ColorPicker/Themes/Brushes.xaml b/Software/Visual_Studio/Tango.ColorPicker/Themes/Brushes.xaml new file mode 100644 index 000000000..c1fa670cd --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/Themes/Brushes.xaml @@ -0,0 +1,216 @@ +<!--*********************************************************************************** + + Extended WPF Toolkit + + Copyright (C) 2007-2013 Xceed Software Inc. + + This program is provided to you under the terms of the Microsoft Public + License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + **********************************************************************************--> + +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:options="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options" + xmlns:themes="clr-namespace:Tango.ColorPicker.Themes"> + + <SolidColorBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=ControlNormalBackgroundKey}" + Color="#FFFFFFFF" + options:Freeze="true" /> + <SolidColorBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=ControlDisabledBackgroundKey}" + Color="#F4F4F4" + options:Freeze="true" /> + + + <LinearGradientBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=ControlNormalBorderKey}" + EndPoint="0,20" + MappingMode="Absolute" + StartPoint="0,0" + options:Freeze="true"> + <GradientStop Color="#ABADB3" + Offset="0.05" /> + <GradientStop Color="#E2E3EA" + Offset="0.07" /> + <GradientStop Color="#E3E9EF" + Offset="1" /> + </LinearGradientBrush> + <LinearGradientBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=ControlMouseOverBorderKey}" + StartPoint="0,0" + EndPoint="0,1" + options:Freeze="true"> + <LinearGradientBrush.GradientStops> + <GradientStopCollection> + <GradientStop Color="#5794BF" + Offset="0.05" /> + <GradientStop Color="#B7D5EA" + Offset="0.07" /> + <GradientStop Color="#C7E2F1" + Offset="1" /> + </GradientStopCollection> + </LinearGradientBrush.GradientStops> + </LinearGradientBrush> + <LinearGradientBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=ControlFocusedBorderKey}" + StartPoint="0,0" + EndPoint="0,1" + options:Freeze="true"> + <LinearGradientBrush.GradientStops> + <GradientStopCollection> + <GradientStop Color="#3D7BAD" + Offset="0.05" /> + <GradientStop Color="#A4C9E3" + Offset="0.07" /> + <GradientStop Color="#B7D9ED" + Offset="1" /> + </GradientStopCollection> + </LinearGradientBrush.GradientStops> + </LinearGradientBrush> + + <SolidColorBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=ButtonNormalOuterBorderKey}" + Color="#FF707070" + options:Freeze="true" /> + <LinearGradientBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=ButtonNormalInnerBorderKey}" + EndPoint="0,1" + StartPoint="0,0" + options:Freeze="true"> + <GradientStop Color="#FAFFFFFF" + Offset="0" /> + <GradientStop Color="#85FFFFFF" + Offset="1" /> + </LinearGradientBrush> + <LinearGradientBrush options:Freeze="true" + x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=ButtonNormalBackgroundKey}" + StartPoint="0,0" + EndPoint="0,1"> + <LinearGradientBrush.GradientStops> + <GradientStopCollection> + <GradientStop Color="#F3F3F3" + Offset="0" /> + <GradientStop Color="#EBEBEB" + Offset="0.5" /> + <GradientStop Color="#DDDDDD" + Offset="0.5" /> + <GradientStop Color="#CDCDCD" + Offset="1" /> + </GradientStopCollection> + </LinearGradientBrush.GradientStops> + </LinearGradientBrush> + + <SolidColorBrush options:Freeze="true" + x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=ButtonMouseOverOuterBorderKey}" + Color="#3C7FB1" /> + <LinearGradientBrush options:Freeze="true" + x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=ButtonMouseOverInnerBorderKey}" + StartPoint="0,0" + EndPoint="0,1"> + <LinearGradientBrush.GradientStops> + <GradientStopCollection> + <GradientStop Color="#FAFFFFFF" + Offset="0" /> + <GradientStop Color="#85FFFFFF" + Offset="1" /> + </GradientStopCollection> + </LinearGradientBrush.GradientStops> + </LinearGradientBrush> + <LinearGradientBrush options:Freeze="true" + x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=ButtonMouseOverBackgroundKey}" + StartPoint="0,0" + EndPoint="0,1"> + <LinearGradientBrush.GradientStops> + <GradientStopCollection> + <GradientStop Color="#FFEAF6FD" + Offset="0" /> + <GradientStop Color="#FFD9F0FC" + Offset="0.50" /> + <GradientStop Color="#FFBEE6FD" + Offset="0.50" /> + <GradientStop Color="#FFA7D9F5" + Offset="1" /> + </GradientStopCollection> + </LinearGradientBrush.GradientStops> + </LinearGradientBrush> + + <SolidColorBrush options:Freeze="true" + x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=ButtonPressedOuterBorderKey}" + Color="#2C628B" /> + <LinearGradientBrush options:Freeze="true" + x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=ButtonPressedInnerBorderKey}" + StartPoint="0,0" + EndPoint="0,1"> + <LinearGradientBrush.GradientStops> + <GradientStopCollection> + <GradientStop Color="#FAFFFFFF" + Offset="0" /> + <GradientStop Color="#85FFFFFF" + Offset="1" /> + </GradientStopCollection> + </LinearGradientBrush.GradientStops> + </LinearGradientBrush> + <LinearGradientBrush options:Freeze="true" + x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=ButtonPressedBackgroundKey}" + StartPoint="0.5,0" + EndPoint="0.5,1"> + <LinearGradientBrush.GradientStops> + <GradientStopCollection> + <GradientStop Color="#C2E4F6" + Offset="0.5" /> + <GradientStop Color="#ABDAF3" + Offset="0.5" /> + <GradientStop Color="#90CBEB" + Offset="1" /> + </GradientStopCollection> + </LinearGradientBrush.GradientStops> + </LinearGradientBrush> + + <SolidColorBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=ButtonFocusedOuterBorderKey}" + Color="#FF707070" + options:Freeze="true" /> + <SolidColorBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=ButtonFocusedInnerBorderKey}" + Color="#F900CCFF" + options:Freeze="true" /> + <LinearGradientBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=ButtonFocusedBackgroundKey}" + EndPoint="0,1" + StartPoint="0,0" + options:Freeze="true"> + <GradientStop Color="#FFEAF6FD" + Offset="0" /> + <GradientStop Color="#FFD9F0FC" + Offset="0.50" /> + <GradientStop Color="#FFBEE6FD" + Offset="0.50" /> + <GradientStop Color="#FFA7D9F5" + Offset="1" /> + </LinearGradientBrush> + + <SolidColorBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=ButtonDisabledOuterBorderKey}" + Color="#ADB2B5" + options:Freeze="true" /> + <LinearGradientBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=ButtonInnerBorderDisabledKey}" + EndPoint="0,1" + StartPoint="0,0" + options:Freeze="true"> + <GradientStop Color="#FAFFFFFF" + Offset="0" /> + <GradientStop Color="#85FFFFFF" + Offset="1" /> + </LinearGradientBrush> + + <SolidColorBrush options:Freeze="true" + x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=GlyphNormalForegroundKey}" + Color="#FF000000" /> + <SolidColorBrush options:Freeze="true" + x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=GlyphDisabledForegroundKey}" + Color="#A9A9A9" /> + + <CornerRadius x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=SpinButtonCornerRadiusKey}" + TopLeft="0" + TopRight="0" + BottomRight="0" + BottomLeft="0" + options:Freeze="true" /> + +</ResourceDictionary> diff --git a/Software/Visual_Studio/Tango.ColorPicker/Themes/Buttons.xaml b/Software/Visual_Studio/Tango.ColorPicker/Themes/Buttons.xaml new file mode 100644 index 000000000..50eff3078 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/Themes/Buttons.xaml @@ -0,0 +1,49 @@ +<!--*********************************************************************************** + + Extended WPF Toolkit + + Copyright (C) 2007-2013 Xceed Software Inc. + + This program is provided to you under the terms of the Microsoft Public + License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + **********************************************************************************--> + +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:themes="clr-namespace:Tango.ColorPicker.Themes" + xmlns:chrome="clr-namespace:Tango.ColorPicker"> + + <Style x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type themes:ResourceKeys}, ResourceId=SpinnerButtonStyleKey}" + TargetType="RepeatButton"> + <Setter Property="BorderThickness" Value="1" /> + <Setter Property="Padding" Value="2,2" /> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="RepeatButton"> + <Grid> + <chrome:ButtonChrome x:Name="Chrome" + BorderBrush="{TemplateBinding BorderBrush}" + Background="{TemplateBinding Background}" + CornerRadius="{DynamicResource {x:Static themes:ResourceKeys.SpinButtonCornerRadiusKey}}" + RenderEnabled="{TemplateBinding IsEnabled}" + RenderMouseOver="{TemplateBinding IsMouseOver}" + RenderNormal="True" + RenderPressed="{TemplateBinding IsPressed}" + SnapsToDevicePixels="true" /> + + <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" + VerticalAlignment="{TemplateBinding VerticalContentAlignment}" + Margin="{TemplateBinding Padding}" /> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + +</ResourceDictionary> diff --git a/Software/Visual_Studio/Tango.ColorPicker/Themes/Common.xaml b/Software/Visual_Studio/Tango.ColorPicker/Themes/Common.xaml new file mode 100644 index 000000000..58b985cba --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/Themes/Common.xaml @@ -0,0 +1,234 @@ +<!--*********************************************************************************** + + Extended WPF Toolkit + + Copyright (C) 2007-2013 Xceed Software Inc. + + This program is provided to you under the terms of the Microsoft Public + License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + **********************************************************************************--> + +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:media="clr-namespace:Tango.ColorPicker.Core.Media" + xmlns:conv="clr-namespace:Tango.ColorPicker.Core.Converters" + xmlns:primitives="clr-namespace:Tango.ColorPicker.Primitives" + xmlns:s="clr-namespace:System;assembly=mscorlib"> + + + <!-- =============================================================================== --> + <!-- Images for the buttons and their various states --> + <!-- =============================================================================== --> + + <!-- ResizeGrip --> + <ImageBrush x:Key="resize_grip" + ImageSource="Images/resize_grip.png" /> + + <Style x:Key="buttonImageStyle" TargetType="Image"> + <Setter Property="Stretch" Value="None" /> + <Setter Property="UseLayoutRounding" Value="True" /> + <Setter Property="RenderOptions.EdgeMode" Value="Aliased" /> + <Setter Property="RenderOptions.BitmapScalingMode" Value="NearestNeighbor" /> + </Style> + + <!-- Minimize --> + <BitmapImage x:Key="minimize_normal" + UriSource="Images/minimize_normal.png" /> + <BitmapImage x:Key="minimize_hover" + UriSource="Images/minimize_hover.png" /> + <BitmapImage x:Key="minimize_pressed" + UriSource="Images/minimize_pressed.png" /> + <BitmapImage x:Key="minimize_inactive" + UriSource="Images/minimize_inactive.png" /> + + <!-- Maximize --> + <BitmapImage x:Key="maximize_normal" + UriSource="Images/maximize_normal.png" /> + <BitmapImage x:Key="maximize_hover" + UriSource="Images/maximize_hover.png" /> + <BitmapImage x:Key="maximize_pressed" + UriSource="Images/maximize_pressed.png" /> + <BitmapImage x:Key="maximize_inactive" + UriSource="Images/maximize_inactive.png" /> + <BitmapImage x:Key="maximize_disabled" + UriSource="Images/maximize_disabled.png" /> + + <!-- Restore --> + <BitmapImage x:Key="restore_normal" + UriSource="Images/restore_normal.png" /> + <BitmapImage x:Key="restore_hover" + UriSource="Images/restore_hover.png" /> + <BitmapImage x:Key="restore_pressed" + UriSource="Images/restore_pressed.png" /> + <BitmapImage x:Key="restore_inactive" + UriSource="Images/restore_inactive.png" /> + <BitmapImage x:Key="restore_disabled" + UriSource="Images/restore_disabled.png" /> + + <!-- Close --> + <BitmapImage x:Key="close_normal" + UriSource="Images/close_normal.png" /> + <BitmapImage x:Key="close_hover" + UriSource="Images/close_hover.png" /> + <BitmapImage x:Key="close_pressed" + UriSource="Images/close_pressed.png" /> + <BitmapImage x:Key="close_inactive" + UriSource="Images/close_inactive.png" /> + + <!-- Close (with 2 rounded corners) --> + <BitmapImage x:Key="close_rounded_normal" + UriSource="Images/close_rounded_normal.png" /> + <BitmapImage x:Key="close_rounded_hover" + UriSource="Images/close_rounded_hover.png" /> + <BitmapImage x:Key="close_rounded_pressed" + UriSource="Images/close_rounded_pressed.png" /> + <BitmapImage x:Key="close_rounded_inactive" + UriSource="Images/close_rounded_inactive.png" /> + + <!-- Close (for ToolWindow) --> + <BitmapImage x:Key="close_toolwindow_normal" + UriSource="Images/close_toolwindow_normal.png" /> + <BitmapImage x:Key="close_toolwindow_hover" + UriSource="Images/close_toolwindow_hover.png" /> + <BitmapImage x:Key="close_toolwindow_pressed" + UriSource="Images/close_toolwindow_pressed.png" /> + <BitmapImage x:Key="close_toolwindow_inactive" + UriSource="Images/close_toolwindow_inactive.png" /> + + + <!-- =============================================================================== --> + <!-- Common Styles --> + <!-- Need to find a way to share these for WindowControl and StyleableWindow --> + <!-- =============================================================================== --> + + <!-- Button template --> + <ControlTemplate x:Key="buttonTemplate" TargetType="Button"> + <Border Name="outerBorder" + Background="{TemplateBinding Background}" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}"> + <Image Source="{TemplateBinding Content}" Style="{StaticResource buttonImageStyle}"/> + </Border> + </ControlTemplate> + + <Style x:Key="windowButtonBaseStyle" TargetType="Button"> + <Setter Property="IsTabStop" Value="False" /> + <Setter Property="Margin" Value="0,-1,0,0" /> + <Setter Property="OverridesDefaultStyle" Value="True" /> + <Setter Property="Template" Value="{StaticResource buttonTemplate}" /> + </Style> + + <!--Default Close button style--> + <Style x:Key="{ComponentResourceKey + TypeInTargetAssembly={x:Type primitives:WindowControl}, + ResourceId=DefaultCloseButtonStyle}" + TargetType="Button" + BasedOn="{StaticResource windowButtonBaseStyle}"> + <Setter Property="ToolTip" Value="Close" /> + <Setter Property="Content" Value="{StaticResource close_normal}" /> + <Style.Triggers> + <!-- Regular Window --> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource TemplatedParent},Path=IsActive}" Value="False"> + <Setter Property="Content" Value="{StaticResource close_inactive}" /> + </DataTrigger> + <Trigger Property="IsMouseOver" Value="True"> + <Setter Property="Content" Value="{StaticResource close_hover}" /> + </Trigger> + <Trigger Property="IsPressed" Value="True"> + <Setter Property="Content" Value="{StaticResource close_pressed}" /> + </Trigger> + + <!-- NoResize (Close button with 2 rounded corners) --> + + <!-- Tool Window --> + <Trigger Property="Name" Value="PART_ToolWindowCloseButton"> + <Setter Property="Content" Value="{StaticResource close_toolwindow_normal}" /> + </Trigger> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding RelativeSource={RelativeSource self},Path=Name}" Value="PART_ToolWindowCloseButton" /> + <Condition Binding="{Binding RelativeSource={RelativeSource TemplatedParent},Path=IsActive}" Value="False" /> + </MultiDataTrigger.Conditions> + <Setter Property="Content" Value="{StaticResource close_toolwindow_inactive}" /> + </MultiDataTrigger> + <MultiTrigger> + <MultiTrigger.Conditions> + <Condition Property="Name" Value="PART_ToolWindowCloseButton" /> + <Condition Property="IsMouseOver" Value="True" /> + </MultiTrigger.Conditions> + <Setter Property="Content" Value="{StaticResource close_toolwindow_hover}" /> + </MultiTrigger> + <MultiTrigger> + <MultiTrigger.Conditions> + <Condition Property="Name" Value="PART_ToolWindowCloseButton" /> + <Condition Property="IsPressed" Value="True" /> + </MultiTrigger.Conditions> + <Setter Property="Content" Value="{StaticResource close_toolwindow_pressed}" /> + </MultiTrigger> + + </Style.Triggers> + </Style> + + + + + + + <SolidColorBrush x:Key="Window_WindowBorderBrush" Color="#FF252C33" /> + + <conv:ColorBlendConverter x:Key="Window_WindowBackground_converter" BlendedColor="#FFA0A0A0" BlendedColorRatio="0.35" /> + <SolidColorBrush x:Key="Window_WindowBackground" + Color="{Binding + Source={x:Static media:WindowColors.ColorizationColor}, + Converter={StaticResource Window_WindowBackground_converter}}" + Opacity="0.85"/> + + <SolidColorBrush x:Key="Window_Background" Color="White"/> + + <SolidColorBrush x:Key="Window_BorderBrush" Color="#5D6C7A" /> + + <s:Double x:Key="Window_CaptionFontSize">15</s:Double> + + <Thickness x:Key="Window_BorderThickness" Left="1" Right="1" Bottom="1" Top="1" /> + + <conv:ColorBlendConverter x:Key="Window_WindowInactiveBackground_converter" BlendedColor="#FFF0F0F0" BlendedColorRatio="0.67" /> + <SolidColorBrush x:Key="Window_WindowInactiveBackground" + Color="{Binding + Source={x:Static media:WindowColors.ColorizationColor}, + Converter={StaticResource Window_WindowInactiveBackground_converter}}" + Opacity="0.85"/> + + <SolidColorBrush x:Key="Window_CaptionForeground" Color="Black"/> + + <Thickness x:Key="Window_WindowBorderThickness">1</Thickness> + + <!-- ========================================================================= --> + <!-- Used by ColorPicker and ColorCanvas --> + <!-- ========================================================================= --> + <DrawingBrush x:Key="CheckerBrush" Viewport="0,0,10,10" ViewportUnits="Absolute" TileMode="Tile"> + <DrawingBrush.Drawing> + <DrawingGroup> + <GeometryDrawing Brush="White"> + <GeometryDrawing.Geometry> + <RectangleGeometry Rect="0,0 100,100" /> + </GeometryDrawing.Geometry> + </GeometryDrawing> + <GeometryDrawing Brush="LightGray"> + <GeometryDrawing.Geometry> + <GeometryGroup> + <RectangleGeometry Rect="0,0 50,50" /> + <RectangleGeometry Rect="50,50 50,50" /> + </GeometryGroup> + </GeometryDrawing.Geometry> + </GeometryDrawing> + </DrawingGroup> + </DrawingBrush.Drawing> + </DrawingBrush> + +</ResourceDictionary> diff --git a/Software/Visual_Studio/Tango.ColorPicker/Themes/Generic.xaml b/Software/Visual_Studio/Tango.ColorPicker/Themes/Generic.xaml new file mode 100644 index 000000000..79e634e15 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/Themes/Generic.xaml @@ -0,0 +1,12 @@ +<ResourceDictionary + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="Tango.ColorPicker;component/Themes/Brushes.xaml"></ResourceDictionary> + <ResourceDictionary Source="Tango.ColorPicker;component/Themes/Glyphs.xaml"></ResourceDictionary> + <ResourceDictionary Source="Tango.ColorPicker;component/Themes/Common.xaml"></ResourceDictionary> + <ResourceDictionary Source="Tango.ColorPicker;component/Themes/Buttons.xaml"></ResourceDictionary> + <ResourceDictionary Source="Tango.ColorPicker;component/ColorCanvas/Themes/Generic.xaml"></ResourceDictionary> + <ResourceDictionary Source="Tango.ColorPicker;component/ColorPicker/Themes/Generic.xaml"></ResourceDictionary> + </ResourceDictionary.MergedDictionaries> +</ResourceDictionary> diff --git a/Software/Visual_Studio/Tango.ColorPicker/Themes/Glyphs.xaml b/Software/Visual_Studio/Tango.ColorPicker/Themes/Glyphs.xaml new file mode 100644 index 000000000..833bca95f --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/Themes/Glyphs.xaml @@ -0,0 +1,67 @@ +<!--*********************************************************************************** + + Extended WPF Toolkit + + Copyright (C) 2007-2013 Xceed Software Inc. + + This program is provided to you under the terms of the Microsoft Public + License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + **********************************************************************************--> + +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:themes="clr-namespace:Tango.ColorPicker.Themes"> + + <Geometry x:Key="UpArrowGeometry">M0,5 L4.5,.5 9,5 6,5 4.5,3.5 3,5 z</Geometry> + <Geometry x:Key="DownArrowGeometry">M0,0 L3,0 4.5,1.5 6,0 9,0 4.5,4.5 z</Geometry> + + <DataTemplate x:Key="IncreaseGlyphNormalKey"> + <Path Width="9" + Height="5" + Data="{StaticResource UpArrowGeometry}" + Fill="{DynamicResource {x:Static themes:ResourceKeys.GlyphNormalForegroundKey}}" + SnapsToDevicePixels="True" + HorizontalAlignment="Center" + VerticalAlignment="Center" + Focusable="False" /> + </DataTemplate> + <DataTemplate x:Key="IncreaseGlyphDisabledKey"> + <Path Width="9" + Height="5" + Data="{StaticResource UpArrowGeometry}" + Fill="{DynamicResource {x:Static themes:ResourceKeys.GlyphDisabledForegroundKey}}" + SnapsToDevicePixels="True" + HorizontalAlignment="Center" + VerticalAlignment="Center" + Focusable="False" /> + </DataTemplate> + + <DataTemplate x:Key="DecreaseGlyphNormalKey"> + <Path Width="9" + Height="5" + Data="{StaticResource DownArrowGeometry}" + Fill="{DynamicResource {x:Static themes:ResourceKeys.GlyphNormalForegroundKey}}" + SnapsToDevicePixels="True" + HorizontalAlignment="Center" + VerticalAlignment="Center" + Focusable="False" /> + </DataTemplate> + + <DataTemplate x:Key="DecreaseGlyphDisabledKey"> + <Path Width="9" + Height="5" + Data="{StaticResource DownArrowGeometry}" + Fill="{DynamicResource {x:Static themes:ResourceKeys.GlyphDisabledForegroundKey}}" + SnapsToDevicePixels="True" + HorizontalAlignment="Center" + VerticalAlignment="Center" + Focusable="False" /> + </DataTemplate> + +</ResourceDictionary> diff --git a/Software/Visual_Studio/Tango.ColorPicker/WindowColors.cs b/Software/Visual_Studio/Tango.ColorPicker/WindowColors.cs new file mode 100644 index 000000000..b5e505915 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/WindowColors.cs @@ -0,0 +1,126 @@ +/************************************************************************************* + + Extended WPF Toolkit + + Copyright (C) 2007-2013 Xceed Software Inc. + + This program is provided to you under the terms of the Microsoft Public + License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + ***********************************************************************************/ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Media; + +namespace Tango.ColorPicker.Core.Media +{ + /// <summary> + /// Contains system colors and configurations that can be used by the control themes. + /// + /// Mainly extracted from the registry because theses values are not exposed by the standard .NET API. + /// </summary> + internal static class WindowColors + { + private static Color? _colorizationMode; + private static bool? _colorizationOpaqueBlend; + + /// <summary> + /// Relative to the \HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\ColorizationColor Registry key. + /// + /// Gets the window chrome color. + /// </summary> + public static Color ColorizationColor + { + get + { + if( _colorizationMode.HasValue ) + return _colorizationMode.Value; + + try + { + _colorizationMode = WindowColors.GetDWMColorValue( "ColorizationColor" ); + } + catch + { + // If for any reason (for example, a SecurityException for XBAP apps) + // we cannot read the value in the registry, fall back on some color. + _colorizationMode = Color.FromArgb(255, 175, 175, 175); + } + + return _colorizationMode.Value; + } + } + + /// <summary> + /// Relative to the \HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\ColorizationOpaqueBlend Registry key: + /// + /// Gets whether transparency is disabled. + /// + /// Returns true if transparency is disabled; false otherwise. + /// </summary> + public static bool ColorizationOpaqueBlend + { + get + { + if( _colorizationOpaqueBlend.HasValue ) + return _colorizationOpaqueBlend.Value; + + try + { + _colorizationOpaqueBlend = WindowColors.GetDWMBoolValue( "ColorizationOpaqueBlend" ); + } + catch + { + // If for any reason (for example, a SecurityException for XBAP apps) + // we cannot read the value in the registry, fall back on some color. + _colorizationOpaqueBlend = false; + } + + return _colorizationOpaqueBlend.Value; + } + } + + private static int GetDWMIntValue( string keyName ) + { + // This value is not accessible throught the standard WPF API. + // We must dig into the registry to get the value. + var curUser = Microsoft.Win32.Registry.CurrentUser; + var subKey = curUser.CreateSubKey( + @"Software\Microsoft\Windows\DWM", + Microsoft.Win32.RegistryKeyPermissionCheck.ReadSubTree +#if VS2008 + ); +#else + ,Microsoft.Win32.RegistryOptions.None ); +#endif + return ( int )subKey.GetValue( keyName ); + } + + private static Color GetDWMColorValue( string keyName ) + { + int value = WindowColors.GetDWMIntValue( keyName ); + byte[] bytes = BitConverter.GetBytes( value ); + return new Color() + { + B = bytes[ 0 ], + G = bytes[ 1 ], + R = bytes[ 2 ], + A = 255 + }; + } + + private static bool GetDWMBoolValue( string keyName ) + { + int value = WindowColors.GetDWMIntValue( keyName ); + return ( value != 0 ); + } + } +} diff --git a/Software/Visual_Studio/Tango.ColorPicker/WindowControl.cs b/Software/Visual_Studio/Tango.ColorPicker/WindowControl.cs new file mode 100644 index 000000000..371e02ed3 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/WindowControl.cs @@ -0,0 +1,834 @@ +/************************************************************************************* + + Extended WPF Toolkit + + Copyright (C) 2007-2013 Xceed Software Inc. + + This program is provided to you under the terms of the Microsoft Public + License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license + + For more features, controls, and fast professional support, + pick up the Plus Edition at http://xceed.com/wpf_toolkit + + Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids + + ***********************************************************************************/ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Controls; +using System.Windows; +using System.Windows.Media; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.IO; +using Tango.ColorPicker.Core; +using System.ComponentModel; + +namespace Tango.ColorPicker.Primitives +{ + [TemplatePart(Name = PART_HeaderThumb, Type = typeof(Thumb))] + [TemplatePart(Name = PART_Icon, Type = typeof(Image))] + [TemplatePart(Name = PART_CloseButton, Type = typeof(Button))] + [TemplatePart(Name = PART_ToolWindowCloseButton, Type = typeof(Button))] + [TemplatePart(Name = PART_BlockMouseInputsBorder, Type = typeof(Border))] + [TemplatePart(Name = PART_HeaderGrid, Type = typeof(Grid))] + internal class WindowControl : ContentControl + { + public static readonly ComponentResourceKey DefaultCloseButtonStyleKey = new ComponentResourceKey(typeof(WindowControl), "DefaultCloseButtonStyle"); + + private const string PART_HeaderThumb = "PART_HeaderThumb"; + private const string PART_Icon = "PART_Icon"; + private const string PART_CloseButton = "PART_CloseButton"; + private const string PART_ToolWindowCloseButton = "PART_ToolWindowCloseButton"; + private const string PART_BlockMouseInputsBorder = "PART_BlockMouseInputsBorder"; + private const string PART_HeaderGrid = "PART_HeaderGrid"; + + #region Members + + private Thumb _headerThumb; + private Image _icon; + private Button _closeButton; + private Button _windowToolboxCloseButton; + private bool _setIsActiveInternal; + internal Border _windowBlockMouseInputsPanel; + + #endregion + + #region Constructors + + static WindowControl() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(WindowControl), new FrameworkPropertyMetadata(typeof(WindowControl))); + } + + public WindowControl() + { + } + + #endregion //Constructors + + #region Dependency Properties + + #region Public DP + + #region Caption + + public static readonly DependencyProperty CaptionProperty = DependencyProperty.Register("Caption", typeof(string), typeof(WindowControl), new UIPropertyMetadata(String.Empty)); + public string Caption + { + get + { + return (string)GetValue(CaptionProperty); + } + set + { + SetValue(CaptionProperty, value); + } + } + + #endregion //Caption + + #region CaptionFontSize + + public static readonly DependencyProperty CaptionFontSizeProperty = DependencyProperty.Register("CaptionFontSize", typeof(double), typeof(WindowControl), new UIPropertyMetadata(15d)); + public double CaptionFontSize + { + get + { + return (double)GetValue(CaptionFontSizeProperty); + } + set + { + SetValue(CaptionFontSizeProperty, value); + } + } + + #endregion //CaptionFontSize + + #region CaptionForeground + + public static readonly DependencyProperty CaptionForegroundProperty = DependencyProperty.Register("CaptionForeground", typeof(Brush), typeof(WindowControl), new UIPropertyMetadata(null)); + public Brush CaptionForeground + { + get + { + return (Brush)GetValue(CaptionForegroundProperty); + } + set + { + SetValue(CaptionForegroundProperty, value); + } + } + + #endregion //CaptionForeground + + #region CaptionShadowBrush + + public static readonly DependencyProperty CaptionShadowBrushProperty = DependencyProperty.Register("CaptionShadowBrush", typeof(Brush), typeof(WindowControl), new UIPropertyMetadata(new SolidColorBrush(Color.FromArgb(179, 255, 255, 255)))); + public Brush CaptionShadowBrush + { + get + { + return (Brush)GetValue(CaptionShadowBrushProperty); + } + set + { + SetValue(CaptionShadowBrushProperty, value); + } + } + + #endregion //CaptionShadowBrush + + #region CaptionIcon + + public static readonly DependencyProperty CaptionIconProperty = DependencyProperty.Register("CaptionIcon", typeof(ImageSource), typeof(WindowControl), new UIPropertyMetadata(null)); + public ImageSource CaptionIcon + { + get + { + return (ImageSource)GetValue(CaptionIconProperty); + } + set + { + SetValue(CaptionIconProperty, value); + } + } + + #endregion //CaptionIcon + + #region CloseButtonStyle + + public static readonly DependencyProperty CloseButtonStyleProperty = DependencyProperty.Register("CloseButtonStyle", typeof(Style), typeof(WindowControl), new UIPropertyMetadata(null)); + public Style CloseButtonStyle + { + get + { + return (Style)GetValue(CloseButtonStyleProperty); + } + set + { + SetValue(CloseButtonStyleProperty, value); + } + } + + #endregion //CloseButtonStyle + + #region CloseButtonVisibility + + public static readonly DependencyProperty CloseButtonVisibilityProperty = DependencyProperty.Register("CloseButtonVisibility", typeof(Visibility), typeof(WindowControl), new PropertyMetadata(Visibility.Visible, null, OnCoerceCloseButtonVisibility)); + public Visibility CloseButtonVisibility + { + get + { + return (Visibility)GetValue(CloseButtonVisibilityProperty); + } + set + { + SetValue(CloseButtonVisibilityProperty, value); + } + } + + private static object OnCoerceCloseButtonVisibility(DependencyObject d, object basevalue) + { + if (basevalue == DependencyProperty.UnsetValue) + return basevalue; + + WindowControl windowControl = d as WindowControl; + if (windowControl == null) + return basevalue; + return windowControl.OnCoerceCloseButtonVisibility((Visibility)basevalue); + } + + protected virtual object OnCoerceCloseButtonVisibility(Visibility newValue) + { + return newValue; + } + + #endregion //CloseButtonVisibility + + #region IsActive + + public static readonly DependencyProperty IsActiveProperty = DependencyProperty.Register("IsActive", typeof(bool), typeof(WindowControl), new UIPropertyMetadata(true, null, OnCoerceIsActive)); + public bool IsActive + { + get + { + return (bool)GetValue(IsActiveProperty); + } + set + { + SetValue(IsActiveProperty, value); + } + } + + private static object OnCoerceIsActive(DependencyObject d, object basevalue) + { + WindowControl w = d as WindowControl; + if (w != null && !w._setIsActiveInternal && !w.AllowPublicIsActiveChange) + throw new InvalidOperationException("Cannot set IsActive directly. This is handled by the underlying system"); + + return basevalue; + } + + internal void SetIsActiveInternal(bool isActive) + { + _setIsActiveInternal = true; + this.IsActive = isActive; + _setIsActiveInternal = false; + } + + #endregion //IsActive + + + + + + + + + + #region Left + + public static readonly DependencyProperty LeftProperty = DependencyProperty.Register("Left", typeof(double), typeof(WindowControl), new PropertyMetadata(0.0, new PropertyChangedCallback(OnLeftPropertyChanged), OnCoerceLeft)); + public double Left + { + get + { + return (double)GetValue(LeftProperty); + } + set + { + SetValue(LeftProperty, value); + } + } + + private static object OnCoerceLeft(DependencyObject d, object basevalue) + { + if (basevalue == DependencyProperty.UnsetValue) + return basevalue; + + var windowControl = (WindowControl)d; + if (windowControl == null) + return basevalue; + + return windowControl.OnCoerceLeft(basevalue); + } + + private object OnCoerceLeft(object newValue) + { + var value = (double)newValue; + if (object.Equals(value, double.NaN)) + return 0.0; + + return newValue; + } + + private static void OnLeftPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) + { + WindowControl windowControl = obj as WindowControl; + if (windowControl != null) + windowControl.OnLeftPropertyChanged((double)e.OldValue, (double)e.NewValue); + } + + internal event EventHandler<EventArgs> LeftChanged; + + protected virtual void OnLeftPropertyChanged(double oldValue, double newValue) + { + EventHandler<EventArgs> handler = LeftChanged; + if (handler != null) + { + handler(this, EventArgs.Empty); + } + } + + #endregion //Left + + #region Top + + public static readonly DependencyProperty TopProperty = DependencyProperty.Register("Top", typeof(double), typeof(WindowControl), new PropertyMetadata(0.0, new PropertyChangedCallback(OnTopPropertyChanged), OnCoerceTop)); + public double Top + { + get + { + return (double)GetValue(TopProperty); + } + set + { + SetValue(TopProperty, value); + } + } + + private static object OnCoerceTop(DependencyObject d, object basevalue) + { + if (basevalue == DependencyProperty.UnsetValue) + return basevalue; + + var windowControl = (WindowControl)d; + if (windowControl == null) + return basevalue; + + return windowControl.OnCoerceTop(basevalue); + } + + private object OnCoerceTop(object newValue) + { + var value = (double)newValue; + if (object.Equals(value, double.NaN)) + return 0.0; + + return newValue; + } + + private static void OnTopPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) + { + WindowControl windowControl = obj as WindowControl; + if (windowControl != null) + windowControl.OnTopPropertyChanged((double)e.OldValue, (double)e.NewValue); + } + + internal event EventHandler<EventArgs> TopChanged; + + protected virtual void OnTopPropertyChanged(double oldValue, double newValue) + { + EventHandler<EventArgs> handler = TopChanged; + if (handler != null) + { + handler(this, EventArgs.Empty); + } + } + + #endregion //TopProperty + + + + + + + + + + + + + + + + + + #region WindowBackground + + public static readonly DependencyProperty WindowBackgroundProperty = DependencyProperty.Register("WindowBackground", typeof(Brush), typeof(WindowControl), new PropertyMetadata(null)); + public Brush WindowBackground + { + get + { + return (Brush)GetValue(WindowBackgroundProperty); + } + set + { + SetValue(WindowBackgroundProperty, value); + } + } + + #endregion // WindowBackground + + #region WindowBorderBrush + + public static readonly DependencyProperty WindowBorderBrushProperty = DependencyProperty.Register("WindowBorderBrush", typeof(Brush), typeof(WindowControl), new PropertyMetadata(null)); + public Brush WindowBorderBrush + { + get + { + return (Brush)GetValue(WindowBorderBrushProperty); + } + set + { + SetValue(WindowBorderBrushProperty, value); + } + } + + #endregion //WindowBorderBrush + + #region WindowBorderThickness + + public static readonly DependencyProperty WindowBorderThicknessProperty = DependencyProperty.Register("WindowBorderThickness", typeof(Thickness), typeof(WindowControl), new PropertyMetadata(new Thickness(0))); + public Thickness WindowBorderThickness + { + get + { + return (Thickness)GetValue(WindowBorderThicknessProperty); + } + set + { + SetValue(WindowBorderThicknessProperty, value); + } + } + + #endregion //WindowBorderThickness + + #region WindowInactiveBackground + + public static readonly DependencyProperty WindowInactiveBackgroundProperty = DependencyProperty.Register("WindowInactiveBackground", typeof(Brush), typeof(WindowControl), new PropertyMetadata(null)); + public Brush WindowInactiveBackground + { + get + { + return (Brush)GetValue(WindowInactiveBackgroundProperty); + } + set + { + SetValue(WindowInactiveBackgroundProperty, value); + } + } + + #endregion // WindowInactiveBackground + + #region WindowOpacity + + public static readonly DependencyProperty WindowOpacityProperty = DependencyProperty.Register("WindowOpacity", typeof(double), typeof(WindowControl), new PropertyMetadata(1d)); + public double WindowOpacity + { + get + { + return (double)GetValue(WindowOpacityProperty); + } + set + { + SetValue(WindowOpacityProperty, value); + } + } + + #endregion //WindowOpacity + + #region WindowStyle + + public static readonly DependencyProperty WindowStyleProperty = DependencyProperty.Register("WindowStyle", typeof(WindowStyle), typeof(WindowControl), new PropertyMetadata(WindowStyle.SingleBorderWindow, null, OnCoerceWindowStyle)); + public WindowStyle WindowStyle + { + get + { + return (WindowStyle)GetValue(WindowStyleProperty); + } + set + { + SetValue(WindowStyleProperty, value); + } + } + + private static object OnCoerceWindowStyle(DependencyObject d, object basevalue) + { + if (basevalue == DependencyProperty.UnsetValue) + return basevalue; + + WindowControl windowControl = d as WindowControl; + if (windowControl == null) + return basevalue; + return windowControl.OnCoerceWindowStyle((WindowStyle)basevalue); + } + + protected virtual object OnCoerceWindowStyle(WindowStyle newValue) + { + return newValue; + } + + private static void OnWindowStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + WindowControl window = (WindowControl)d; + if (window != null) + window.OnWindowStyleChanged((WindowStyle)e.OldValue, (WindowStyle)e.NewValue); + } + + protected virtual void OnWindowStyleChanged(WindowStyle oldValue, WindowStyle newValue) + { + } + + #endregion //WindowStyle + + #region WindowThickness + + public static readonly DependencyProperty WindowThicknessProperty = DependencyProperty.Register("WindowThickness", typeof(Thickness), typeof(WindowControl), + new PropertyMetadata(new Thickness(SystemParameters.ResizeFrameVerticalBorderWidth - 3, + SystemParameters.ResizeFrameHorizontalBorderHeight - 3, + SystemParameters.ResizeFrameVerticalBorderWidth - 3, + SystemParameters.ResizeFrameHorizontalBorderHeight - 3))); + public Thickness WindowThickness + { + get + { + return (Thickness)GetValue(WindowThicknessProperty); + } + set + { + SetValue(WindowThicknessProperty, value); + } + } + + #endregion //WindowThickness + + #endregion //Public DP + + #endregion //Dependency Properties + + #region Internal Properties + + internal bool IsStartupPositionInitialized + { + get; + set; + } + + #region IsBlockMouseInputsPanelActive (Internal) + + internal bool IsBlockMouseInputsPanelActive + { + get + { + return _IsBlockMouseInputsPanelActive; + } + set + { + if (value != _IsBlockMouseInputsPanelActive) + { + _IsBlockMouseInputsPanelActive = value; + this.UpdateBlockMouseInputsPanel(); + } + } + } + + private bool _IsBlockMouseInputsPanelActive; + + #endregion + + internal virtual bool AllowPublicIsActiveChange + { + get { return true; } + } + + + #endregion //Internal Properties + + #region Base Class Overrides + + public override void OnApplyTemplate() + { + base.OnApplyTemplate(); + + if (_headerThumb != null) + { + _headerThumb.PreviewMouseLeftButtonDown -= new MouseButtonEventHandler(this.HeaderPreviewMouseLeftButtonDown); + _headerThumb.PreviewMouseRightButtonDown -= new MouseButtonEventHandler(this.HeaderPreviewMouseRightButtonDown); + _headerThumb.DragDelta -= new DragDeltaEventHandler(this.HeaderThumbDragDelta); + } + _headerThumb = this.Template.FindName(PART_HeaderThumb, this) as Thumb; + if (_headerThumb != null) + { + _headerThumb.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(this.HeaderPreviewMouseLeftButtonDown); + _headerThumb.PreviewMouseRightButtonDown += new MouseButtonEventHandler(this.HeaderPreviewMouseRightButtonDown); + _headerThumb.DragDelta += new DragDeltaEventHandler(this.HeaderThumbDragDelta); + } + + if (_icon != null) + { + _icon.MouseLeftButtonDown -= new MouseButtonEventHandler(this.IconMouseLeftButtonDown); + } + _icon = this.Template.FindName(PART_Icon, this) as Image; + if (_icon != null) + { + _icon.MouseLeftButtonDown += new MouseButtonEventHandler(this.IconMouseLeftButtonDown); + } + + if (_closeButton != null) + { + _closeButton.Click -= new RoutedEventHandler(this.Close); + } + _closeButton = this.Template.FindName(PART_CloseButton, this) as Button; + if (_closeButton != null) + { + _closeButton.Click += new RoutedEventHandler(this.Close); + } + + if (_windowToolboxCloseButton != null) + { + _windowToolboxCloseButton.Click -= new RoutedEventHandler(this.Close); + } + _windowToolboxCloseButton = this.Template.FindName(PART_ToolWindowCloseButton, this) as Button; + if (_windowToolboxCloseButton != null) + { + _windowToolboxCloseButton.Click += new RoutedEventHandler(this.Close); + } + + _windowBlockMouseInputsPanel = this.Template.FindName(PART_BlockMouseInputsBorder, this) as Border; + this.UpdateBlockMouseInputsPanel(); + + + + } + + #endregion //Base Class Overrides + + #region Events + + #region HeaderMouseLeftButtonClickedEvent + + public static readonly RoutedEvent HeaderMouseLeftButtonClickedEvent = EventManager.RegisterRoutedEvent("HeaderMouseLeftButtonClicked", RoutingStrategy.Bubble, typeof(MouseButtonEventHandler), typeof(WindowControl)); + public event MouseButtonEventHandler HeaderMouseLeftButtonClicked + { + add + { + AddHandler(HeaderMouseLeftButtonClickedEvent, value); + } + remove + { + RemoveHandler(HeaderMouseLeftButtonClickedEvent, value); + } + } + + #endregion //HeaderMouseLeftButtonClickedEvent + + #region HeaderMouseRightButtonClickedEvent + + public static readonly RoutedEvent HeaderMouseRightButtonClickedEvent = EventManager.RegisterRoutedEvent("HeaderMouseRightButtonClicked", RoutingStrategy.Bubble, typeof(MouseButtonEventHandler), typeof(WindowControl)); + public event MouseButtonEventHandler HeaderMouseRightButtonClicked + { + add + { + AddHandler(HeaderMouseRightButtonClickedEvent, value); + } + remove + { + RemoveHandler(HeaderMouseRightButtonClickedEvent, value); + } + } + + #endregion //HeaderMouseRightButtonClickedEvent + + #region HeaderMouseLeftButtonDoubleClickedEvent + + public static readonly RoutedEvent HeaderMouseLeftButtonDoubleClickedEvent = EventManager.RegisterRoutedEvent("HeaderMouseLeftButtonDoubleClicked", RoutingStrategy.Bubble, typeof(MouseButtonEventHandler), typeof(WindowControl)); + public event MouseButtonEventHandler HeaderMouseLeftButtonDoubleClicked + { + add + { + AddHandler(HeaderMouseLeftButtonDoubleClickedEvent, value); + } + remove + { + RemoveHandler(HeaderMouseLeftButtonDoubleClickedEvent, value); + } + } + + #endregion //HeaderMouseLeftButtonDoubleClickedEvent + + #region HeaderDragDeltaEvent + + public static readonly RoutedEvent HeaderDragDeltaEvent = EventManager.RegisterRoutedEvent("HeaderDragDelta", RoutingStrategy.Bubble, typeof(DragDeltaEventHandler), typeof(WindowControl)); + public event DragDeltaEventHandler HeaderDragDelta + { + add + { + AddHandler(HeaderDragDeltaEvent, value); + } + remove + { + RemoveHandler(HeaderDragDeltaEvent, value); + } + } + + #endregion //HeaderDragDeltaEvent + + #region HeaderIconClickedEvent + + public static readonly RoutedEvent HeaderIconClickedEvent = EventManager.RegisterRoutedEvent("HeaderIconClicked", RoutingStrategy.Bubble, typeof(MouseButtonEventHandler), typeof(WindowControl)); + public event MouseButtonEventHandler HeaderIconClicked + { + add + { + AddHandler(HeaderIconClickedEvent, value); + } + remove + { + RemoveHandler(HeaderIconClickedEvent, value); + } + } + + #endregion //HeaderIconClickedEvent + + #region HeaderIconDoubleClickedEvent + + public static readonly RoutedEvent HeaderIconDoubleClickedEvent = EventManager.RegisterRoutedEvent("HeaderIconDoubleClicked", RoutingStrategy.Bubble, typeof(MouseButtonEventHandler), typeof(WindowControl)); + public event MouseButtonEventHandler HeaderIconDoubleClicked + { + add + { + AddHandler(HeaderIconDoubleClickedEvent, value); + } + remove + { + RemoveHandler(HeaderIconDoubleClickedEvent, value); + } + } + + #endregion //HeaderIconDoubleClickedEvent + + #region CloseButtonClickedEvent + + public static readonly RoutedEvent CloseButtonClickedEvent = EventManager.RegisterRoutedEvent("CloseButtonClicked", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(WindowControl)); + public event RoutedEventHandler CloseButtonClicked + { + add + { + AddHandler(CloseButtonClickedEvent, value); + } + remove + { + RemoveHandler(CloseButtonClickedEvent, value); + } + } + + #endregion //CloseButtonClickedEvent + + + + + + + + + + + #endregion //Events + + #region Event Handler + + private void HeaderPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + + MouseButtonEventArgs args = new MouseButtonEventArgs(Mouse.PrimaryDevice, 0, MouseButton.Left); + args.RoutedEvent = (e.ClickCount == 2) ? HeaderMouseLeftButtonDoubleClickedEvent : HeaderMouseLeftButtonClickedEvent; + args.Source = this; + this.RaiseEvent(args); + } + + private void HeaderPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) + { + MouseButtonEventArgs args = new MouseButtonEventArgs(Mouse.PrimaryDevice, 0, MouseButton.Right); + args.RoutedEvent = HeaderMouseRightButtonClickedEvent; + args.Source = this; + this.RaiseEvent(args); + } + + private void HeaderThumbDragDelta(object sender, DragDeltaEventArgs e) + { + DragDeltaEventArgs args = new DragDeltaEventArgs(e.HorizontalChange, e.VerticalChange); + args.RoutedEvent = HeaderDragDeltaEvent; + args.Source = this; + this.RaiseEvent(args); + } + + private void IconMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + MouseButtonEventArgs args = new MouseButtonEventArgs(Mouse.PrimaryDevice, 0, MouseButton.Left); + args.RoutedEvent = (e.ClickCount == 2) ? HeaderIconDoubleClickedEvent : HeaderIconClickedEvent; + args.Source = this; + this.RaiseEvent(args); + } + + private void Close(object sender, RoutedEventArgs e) + { + this.RaiseEvent(new RoutedEventArgs(CloseButtonClickedEvent, this)); + } + + + + + #endregion // Event Handler + + #region Internal Methods + + internal virtual void UpdateBlockMouseInputsPanel() + { + if (_windowBlockMouseInputsPanel != null) + { + _windowBlockMouseInputsPanel.Visibility = this.IsBlockMouseInputsPanelActive ? Visibility.Visible : Visibility.Collapsed; + } + } + + internal double GetHeaderHeight() + { + Grid headerGrid = this.Template.FindName(PART_HeaderGrid, this) as Grid; + if (headerGrid != null) + return headerGrid.ActualHeight; + return 0; + } + + #endregion + + #region Private Methods + + + #endregion //Private Methods + } +} diff --git a/Software/Visual_Studio/Tango.ColorPicker/packages.config b/Software/Visual_Studio/Tango.ColorPicker/packages.config new file mode 100644 index 000000000..c42222162 --- /dev/null +++ b/Software/Visual_Studio/Tango.ColorPicker/packages.config @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="ControlzEx" version="3.0.2.4" targetFramework="net46" /> + <package id="MahApps.Metro" version="1.5.0" targetFramework="net46" /> +</packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Core/Cryptography/ICryptographer.cs b/Software/Visual_Studio/Tango.Core/Cryptography/ICryptographer.cs new file mode 100644 index 000000000..a5c9ea923 --- /dev/null +++ b/Software/Visual_Studio/Tango.Core/Cryptography/ICryptographer.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Core.Cryptography +{ + public interface ICryptographer + { + String Encrypt(String text); + String Decrypt(String text); + String Encrypt(String text, String key); + String Decrypt(String text, String key); + } +} diff --git a/Software/Visual_Studio/Tango.Core/Cryptography/Rfc2898Cryptographer.cs b/Software/Visual_Studio/Tango.Core/Cryptography/Rfc2898Cryptographer.cs new file mode 100644 index 000000000..9d369d323 --- /dev/null +++ b/Software/Visual_Studio/Tango.Core/Cryptography/Rfc2898Cryptographer.cs @@ -0,0 +1,70 @@ +using System.IO; +using System.Text; +using System.Security.Cryptography; +using System; +using SimpleValidator.Extensions; + +namespace Tango.Core.Cryptography +{ + public class Rfc2898Cryptographer : ICryptographer + { + public string Decrypt(string text) + { + return Decrypt(text, Properties.Resources.EncryptionPassword); + } + + public string Decrypt(string text, string key) + { + if (text.IsNullOrWhiteSpace()) return text; + + string EncryptionKey = Properties.Resources.EncryptionPassword; + text = text.Replace(" ", "+"); + byte[] cipherBytes = Convert.FromBase64String(text); + using (Aes encryptor = Aes.Create()) + { + Rfc2898DeriveBytes pdb = new Rfc2898DeriveBytes(EncryptionKey, new byte[] { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 }); + encryptor.Key = pdb.GetBytes(32); + encryptor.IV = pdb.GetBytes(16); + using (MemoryStream ms = new MemoryStream()) + { + using (CryptoStream cs = new CryptoStream(ms, encryptor.CreateDecryptor(), CryptoStreamMode.Write)) + { + cs.Write(cipherBytes, 0, cipherBytes.Length); + cs.Close(); + } + text = Encoding.Unicode.GetString(ms.ToArray()); + } + } + return text; + } + + public string Encrypt(string text) + { + return Encrypt(text, Properties.Resources.EncryptionPassword); + } + + public string Encrypt(string text, string key) + { + if (text.IsNullOrWhiteSpace()) return text; + + string EncryptionKey = key; + byte[] clearBytes = Encoding.Unicode.GetBytes(text); + using (Aes encryptor = Aes.Create()) + { + Rfc2898DeriveBytes pdb = new Rfc2898DeriveBytes(EncryptionKey, new byte[] { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 }); + encryptor.Key = pdb.GetBytes(32); + encryptor.IV = pdb.GetBytes(16); + using (MemoryStream ms = new MemoryStream()) + { + using (CryptoStream cs = new CryptoStream(ms, encryptor.CreateEncryptor(), CryptoStreamMode.Write)) + { + cs.Write(clearBytes, 0, clearBytes.Length); + cs.Close(); + } + text = Convert.ToBase64String(ms.ToArray()); + } + } + return text; + } + } +} diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/IServiceLocatorExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/IServiceLocatorExtensions.cs new file mode 100644 index 000000000..d39cf478f --- /dev/null +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/IServiceLocatorExtensions.cs @@ -0,0 +1,22 @@ +using Microsoft.Practices.ServiceLocation; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +public static class IServiceLocatorExtensions +{ + public static List<Object> GetAllInstances(this IServiceLocator locator) + { + var dictionaries = locator.GetType().GetField("_instancesRegistry", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(locator) as Dictionary<Type, Dictionary<string, object>>; + var instances = dictionaries.SelectMany(x => x.Value).Select(x => x.Value).ToList(); + return instances; + } + + public static List<T> GetAllInstancesByBase<T>(this IServiceLocator locator) + { + return locator.GetAllInstances().Where(x => typeof(T).IsAssignableFrom(x.GetType())).Select(x => (T)x).ToList(); + } +} diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs index 3b46ab7cc..544b4a1da 100644 --- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/StringExtensions.cs @@ -56,7 +56,7 @@ public static class StringExtensions /// </summary> /// <param name="text">The text.</param> /// <returns></returns> - public static String Singularize(this String text) + public static String SingularizeMVC(this String text) { var serv = PluralizationService.CreateService(new System.Globalization.CultureInfo("en-us")); return serv.Singularize(text); @@ -67,7 +67,7 @@ public static class StringExtensions /// </summary> /// <param name="text">The text.</param> /// <returns></returns> - public static String Pluralize(this String text) + public static String PluralizeMVC(this String text) { var serv = PluralizationService.CreateService(new System.Globalization.CultureInfo("en-us")); return serv.Pluralize(text); diff --git a/Software/Visual_Studio/Tango.Core/Helpers/ColorHelper.cs b/Software/Visual_Studio/Tango.Core/Helpers/ColorHelper.cs new file mode 100644 index 000000000..c88d5aead --- /dev/null +++ b/Software/Visual_Studio/Tango.Core/Helpers/ColorHelper.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; + +namespace Tango.Core.Helpers +{ + /// <summary> + /// Contains several color helper methods. + /// </summary> + public static class ColorHelper + { + /// <summary> + /// Converts a color to integer. + /// </summary> + /// <param name="color">The color.</param> + /// <returns></returns> + public static int ColorToInteger(Color color) + { + return (int)((color.A << 24) | (color.R << 16) | + (color.G << 8) | (color.B << 0)); + } + + /// <summary> + /// Converts an integer to color. + /// </summary> + /// <param name="integer">The integer.</param> + /// <returns></returns> + public static Color IntegerToColor(int integer) + { + byte a = (byte)(integer >> 24); + byte r = (byte)(integer >> 16); + byte g = (byte)(integer >> 8); + byte b = (byte)(integer >> 0); + return Color.FromArgb(a, r, g, b); + } + } +} diff --git a/Software/Visual_Studio/Tango.Core/Helpers/ThreadsHelper.cs b/Software/Visual_Studio/Tango.Core/Helpers/ThreadsHelper.cs new file mode 100644 index 000000000..5f140d344 --- /dev/null +++ b/Software/Visual_Studio/Tango.Core/Helpers/ThreadsHelper.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Threading; + +namespace Tango.Core.Helpers +{ + public static class ThreadsHelper + { + public static void InvokeUI(Action action) + { + Dispatcher.CurrentDispatcher.BeginInvoke(action); + } + + public static void InvokeUINow(Action action) + { + Dispatcher.CurrentDispatcher.Invoke(action); + } + } +} diff --git a/Software/Visual_Studio/Tango.Core/Properties/Resources.Designer.cs b/Software/Visual_Studio/Tango.Core/Properties/Resources.Designer.cs new file mode 100644 index 000000000..4f47c533a --- /dev/null +++ b/Software/Visual_Studio/Tango.Core/Properties/Resources.Designer.cs @@ -0,0 +1,72 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.Core.Properties { + using System; + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.Core.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// <summary> + /// Looks up a localized string similar to twineAa123456. + /// </summary> + internal static string EncryptionPassword { + get { + return ResourceManager.GetString("EncryptionPassword", resourceCulture); + } + } + } +} diff --git a/Software/Visual_Studio/Tango.Core/Properties/Resources.resx b/Software/Visual_Studio/Tango.Core/Properties/Resources.resx new file mode 100644 index 000000000..dedc8ed88 --- /dev/null +++ b/Software/Visual_Studio/Tango.Core/Properties/Resources.resx @@ -0,0 +1,124 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <data name="EncryptionPassword" xml:space="preserve"> + <value>twineAa123456</value> + <comment>Standard password for cryptography</comment> + </data> +</root>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Core/Software - Shortcut.lnk b/Software/Visual_Studio/Tango.Core/Software - Shortcut.lnk Binary files differnew file mode 100644 index 000000000..70db0cc38 --- /dev/null +++ b/Software/Visual_Studio/Tango.Core/Software - Shortcut.lnk diff --git a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj index fd3eeddf9..59afc2931 100644 --- a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj +++ b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj @@ -31,15 +31,34 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> + <Reference Include="GalaSoft.MvvmLight, Version=5.3.0.19026, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL"> + <HintPath>..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.dll</HintPath> + </Reference> + <Reference Include="GalaSoft.MvvmLight.Extras, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=669f0b5e8f868abf, processorArchitecture=MSIL"> + <HintPath>..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Extras.dll</HintPath> + </Reference> + <Reference Include="GalaSoft.MvvmLight.Platform, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL"> + <HintPath>..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath> + </Reference> <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> <HintPath>..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath> </Reference> + <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="PresentationCore" /> <Reference Include="PresentationFramework" /> + <Reference Include="SimpleValidator, Version=0.6.1.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\SimpleValidator.0.6.1.0\lib\net40\SimpleValidator.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.Core" /> <Reference Include="System.Data.Entity.Design" /> <Reference Include="System.Windows" /> + <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> + <Private>True</Private> + </Reference> <Reference Include="System.Xaml" /> <Reference Include="System.Xml.Linq" /> <Reference Include="System.Data.DataSetExtensions" /> @@ -55,6 +74,8 @@ </Compile> <Compile Include="Commands\RelayCommand.cs" /> <Compile Include="ConcurrentList.cs" /> + <Compile Include="Cryptography\ICryptographer.cs" /> + <Compile Include="Cryptography\Rfc2898Cryptographer.cs" /> <Compile Include="ExtendedObject.cs" /> <Compile Include="ExtensionMethods\DateTimeExtensions.cs" /> <Compile Include="ExtensionMethods\DependencyObjectExtensions.cs" /> @@ -64,15 +85,24 @@ <Compile Include="ExtensionMethods\IParameterizedExtensions.cs" /> <Compile Include="ExtensionMethods\ObjectExtensions.cs" /> <Compile Include="ExtensionMethods\ReflectionExtensions.cs" /> + <Compile Include="ExtensionMethods\IServiceLocatorExtensions.cs" /> <Compile Include="ExtensionMethods\StringExtensions.cs" /> <Compile Include="Helpers\AssemblyHelper.cs" /> + <Compile Include="Helpers\ColorHelper.cs" /> <Compile Include="Helpers\PathHelper.cs" /> + <Compile Include="Helpers\ThreadsHelper.cs" /> <Compile Include="IParameterized.cs" /> <Compile Include="ParameterIgnoreAttribute.cs" /> <Compile Include="ParameterItem.cs" /> <Compile Include="ParameterItemAttribute.cs" /> <Compile Include="ParameterItemMode.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Threading\StaThreadHelper.cs" /> </ItemGroup> <ItemGroup> <None Include="packages.config" /> @@ -83,5 +113,11 @@ <Name>Tango.Serialization</Name> </ProjectReference> </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Core/Threading/StaThreadHelper.cs b/Software/Visual_Studio/Tango.Core/Threading/StaThreadHelper.cs new file mode 100644 index 000000000..5c1f5b93c --- /dev/null +++ b/Software/Visual_Studio/Tango.Core/Threading/StaThreadHelper.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace Tango.Core.Threading +{ + public static class StaThreadHelper + { + public static void StartStaThread(Action action) + { + Thread thread = new Thread(() => + { + action(); + }); + thread.SetApartmentState(ApartmentState.STA); + thread.IsBackground = true; + thread.Start(); + } + } +} diff --git a/Software/Visual_Studio/Tango.Core/packages.config b/Software/Visual_Studio/Tango.Core/packages.config index e7e6cbade..114eefdba 100644 --- a/Software/Visual_Studio/Tango.Core/packages.config +++ b/Software/Visual_Studio/Tango.Core/packages.config @@ -1,4 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <packages> + <package id="CommonServiceLocator" version="1.3" targetFramework="net46" /> <package id="Google.Protobuf" version="3.4.1" targetFramework="net45" /> + <package id="MvvmLightLibs" version="5.3.0.0" targetFramework="net46" /> + <package id="SimpleValidator" version="0.6.1.0" targetFramework="net46" /> </packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.Context.cs b/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.Context.cs index 1c639e33d..38ae0a849 100644 --- a/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.Context.cs +++ b/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.Context.cs @@ -49,7 +49,6 @@ namespace Tango.DAL.Local.DB public virtual DbSet<LIQUID> LIQUIDS { get; set; } public virtual DbSet<LIQUIDS_RMLS> LIQUIDS_RMLS { get; set; } public virtual DbSet<MACHINE_VERSIONS> MACHINE_VERSIONS { get; set; } - public virtual DbSet<MACHINE_VERSIONS_CONFIGURATIONS> MACHINE_VERSIONS_CONFIGURATIONS { get; set; } public virtual DbSet<MACHINE> MACHINES { get; set; } public virtual DbSet<MACHINES_CONFIGURATIONS> MACHINES_CONFIGURATIONS { get; set; } public virtual DbSet<MACHINES_EVENTS> MACHINES_EVENTS { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx b/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx index 83482b978..bd71d7457 100644 --- a/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx @@ -262,18 +262,6 @@ <Property Name="DELETED" Type="bit" Nullable="false" /> <Property Name="VERSION" Type="real" Nullable="false" /> </EntityType> - <EntityType Name="MACHINE_VERSIONS_CONFIGURATIONS"> - <Key> - <PropertyRef Name="ID" /> - </Key> - <Property Name="ID" Type="integer" Nullable="false" /> - <Property Name="GUID" Type="nvarchar" MaxLength="2147483647" Nullable="false" /> - <Property Name="LAST_UPDATED" Type="datetime" Nullable="false" /> - <Property Name="DELETED" Type="bit" Nullable="false" /> - <Property Name="VERSION" Type="real" Nullable="false" /> - <Property Name="MACHINE_VERSION_GUID" Type="nvarchar" MaxLength="2147483647" Nullable="false" /> - <Property Name="CONFIGURATION_GUID" Type="nvarchar" MaxLength="2147483647" Nullable="false" /> - </EntityType> <EntityType Name="MACHINES"> <Key> <PropertyRef Name="ID" /> @@ -482,7 +470,6 @@ <EntitySet Name="LIQUIDS" EntityType="Self.LIQUIDS" store:Type="Tables" /> <EntitySet Name="LIQUIDS_RMLS" EntityType="Self.LIQUIDS_RMLS" store:Type="Tables" /> <EntitySet Name="MACHINE_VERSIONS" EntityType="Self.MACHINE_VERSIONS" store:Type="Tables" /> - <EntitySet Name="MACHINE_VERSIONS_CONFIGURATIONS" EntityType="Self.MACHINE_VERSIONS_CONFIGURATIONS" store:Type="Tables" /> <EntitySet Name="MACHINES" EntityType="Self.MACHINES" store:Type="Tables" /> <EntitySet Name="MACHINES_CONFIGURATIONS" EntityType="Self.MACHINES_CONFIGURATIONS" store:Type="Tables" /> <EntitySet Name="MACHINES_EVENTS" EntityType="Self.MACHINES_EVENTS" store:Type="Tables" /> @@ -528,7 +515,6 @@ <EntitySet Name="LIQUIDS" EntityType="LocalModel.LIQUID" /> <EntitySet Name="LIQUIDS_RMLS" EntityType="LocalModel.LIQUIDS_RMLS" /> <EntitySet Name="MACHINE_VERSIONS" EntityType="LocalModel.MACHINE_VERSIONS" /> - <EntitySet Name="MACHINE_VERSIONS_CONFIGURATIONS" EntityType="LocalModel.MACHINE_VERSIONS_CONFIGURATIONS" /> <EntitySet Name="MACHINES" EntityType="LocalModel.MACHINE" /> <EntitySet Name="MACHINES_CONFIGURATIONS" EntityType="LocalModel.MACHINES_CONFIGURATIONS" /> <EntitySet Name="MACHINES_EVENTS" EntityType="LocalModel.MACHINES_EVENTS" /> @@ -802,18 +788,6 @@ <Property Name="DELETED" Type="Boolean" Nullable="false" /> <Property Name="VERSION" Type="Double" Nullable="false" /> </EntityType> - <EntityType Name="MACHINE_VERSIONS_CONFIGURATIONS"> - <Key> - <PropertyRef Name="ID" /> - </Key> - <Property Name="ID" Type="Int64" Nullable="false" /> - <Property Name="GUID" Type="String" Nullable="false" MaxLength="2147483647" FixedLength="false" Unicode="true" /> - <Property Name="LAST_UPDATED" Type="DateTime" Nullable="false" /> - <Property Name="DELETED" Type="Boolean" Nullable="false" /> - <Property Name="VERSION" Type="Double" Nullable="false" /> - <Property Name="MACHINE_VERSION_GUID" Type="String" Nullable="false" MaxLength="2147483647" FixedLength="false" Unicode="true" /> - <Property Name="CONFIGURATION_GUID" Type="String" Nullable="false" MaxLength="2147483647" FixedLength="false" Unicode="true" /> - </EntityType> <EntityType Name="MACHINE"> <Key> <PropertyRef Name="ID" /> @@ -1284,19 +1258,6 @@ </MappingFragment> </EntityTypeMapping> </EntitySetMapping> - <EntitySetMapping Name="MACHINE_VERSIONS_CONFIGURATIONS"> - <EntityTypeMapping TypeName="LocalModel.MACHINE_VERSIONS_CONFIGURATIONS"> - <MappingFragment StoreEntitySet="MACHINE_VERSIONS_CONFIGURATIONS"> - <ScalarProperty Name="CONFIGURATION_GUID" ColumnName="CONFIGURATION_GUID" /> - <ScalarProperty Name="MACHINE_VERSION_GUID" ColumnName="MACHINE_VERSION_GUID" /> - <ScalarProperty Name="VERSION" ColumnName="VERSION" /> - <ScalarProperty Name="DELETED" ColumnName="DELETED" /> - <ScalarProperty Name="LAST_UPDATED" ColumnName="LAST_UPDATED" /> - <ScalarProperty Name="GUID" ColumnName="GUID" /> - <ScalarProperty Name="ID" ColumnName="ID" /> - </MappingFragment> - </EntityTypeMapping> - </EntitySetMapping> <EntitySetMapping Name="MACHINES"> <EntityTypeMapping TypeName="LocalModel.MACHINE"> <MappingFragment StoreEntitySet="MACHINES"> diff --git a/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx.diagram b/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx.diagram index e96c0836c..350983c76 100644 --- a/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx.diagram +++ b/Software/Visual_Studio/Tango.DAL.Local/DB/LocalADO.edmx.diagram @@ -29,22 +29,21 @@ <EntityTypeShape EntityType="LocalModel.LIQUID" Width="1.5" PointX="4.75" PointY="11.75" /> <EntityTypeShape EntityType="LocalModel.LIQUIDS_RMLS" Width="1.5" PointX="12.75" PointY="0.75" /> <EntityTypeShape EntityType="LocalModel.MACHINE_VERSIONS" Width="1.5" PointX="12.75" PointY="3.75" /> - <EntityTypeShape EntityType="LocalModel.MACHINE_VERSIONS_CONFIGURATIONS" Width="1.5" PointX="12.75" PointY="6.75" /> - <EntityTypeShape EntityType="LocalModel.MACHINE" Width="1.5" PointX="6.75" PointY="12.75" /> - <EntityTypeShape EntityType="LocalModel.MACHINES_CONFIGURATIONS" Width="1.5" PointX="12.75" PointY="10.75" /> - <EntityTypeShape EntityType="LocalModel.MACHINES_EVENTS" Width="1.5" PointX="8.75" PointY="13.75" /> - <EntityTypeShape EntityType="LocalModel.MEDIA_COLORS" Width="1.5" PointX="10.75" PointY="13.75" /> - <EntityTypeShape EntityType="LocalModel.MEDIA_CONDITIONS" Width="1.5" PointX="12.75" PointY="13.75" /> - <EntityTypeShape EntityType="LocalModel.MEDIA_MATERIALS" Width="1.5" PointX="14.75" PointY="0.75" /> - <EntityTypeShape EntityType="LocalModel.MEDIA_PURPOSES" Width="1.5" PointX="0.75" PointY="14.75" /> - <EntityTypeShape EntityType="LocalModel.ORGANIZATION" Width="1.5" PointX="14.75" PointY="3.75" /> - <EntityTypeShape EntityType="LocalModel.PERMISSION" Width="1.5" PointX="14.75" PointY="7.75" /> - <EntityTypeShape EntityType="LocalModel.RML" Width="1.5" PointX="14.75" PointY="11.75" /> - <EntityTypeShape EntityType="LocalModel.ROLE" Width="1.5" PointX="2.75" PointY="15.75" /> - <EntityTypeShape EntityType="LocalModel.ROLES_PERMISSIONS" Width="1.5" PointX="16.75" PointY="0.75" /> - <EntityTypeShape EntityType="LocalModel.SYNC_CONFIGURATIONS" Width="1.5" PointX="16.75" PointY="3.75" /> - <EntityTypeShape EntityType="LocalModel.USER" Width="1.5" PointX="4.75" PointY="16.75" /> - <EntityTypeShape EntityType="LocalModel.USERS_ROLES" Width="1.5" PointX="16.75" PointY="6.75" /> + <EntityTypeShape EntityType="LocalModel.MACHINE" Width="1.5" PointX="12.75" PointY="6.75" /> + <EntityTypeShape EntityType="LocalModel.MACHINES_CONFIGURATIONS" Width="1.5" PointX="6.75" PointY="12.75" /> + <EntityTypeShape EntityType="LocalModel.MACHINES_EVENTS" Width="1.5" PointX="12.75" PointY="10.75" /> + <EntityTypeShape EntityType="LocalModel.MEDIA_COLORS" Width="1.5" PointX="8.75" PointY="13.75" /> + <EntityTypeShape EntityType="LocalModel.MEDIA_CONDITIONS" Width="1.5" PointX="14.75" PointY="0.75" /> + <EntityTypeShape EntityType="LocalModel.MEDIA_MATERIALS" Width="1.5" PointX="0.75" PointY="14.75" /> + <EntityTypeShape EntityType="LocalModel.MEDIA_PURPOSES" Width="1.5" PointX="14.75" PointY="3.75" /> + <EntityTypeShape EntityType="LocalModel.ORGANIZATION" Width="1.5" PointX="14.75" PointY="6.75" /> + <EntityTypeShape EntityType="LocalModel.PERMISSION" Width="1.5" PointX="14.75" PointY="10.75" /> + <EntityTypeShape EntityType="LocalModel.RML" Width="1.5" PointX="10.75" PointY="14.75" /> + <EntityTypeShape EntityType="LocalModel.ROLE" Width="1.5" PointX="12.75" PointY="14.75" /> + <EntityTypeShape EntityType="LocalModel.ROLES_PERMISSIONS" Width="1.5" PointX="14.75" PointY="14.75" /> + <EntityTypeShape EntityType="LocalModel.SYNC_CONFIGURATIONS" Width="1.5" PointX="2.75" PointY="15.75" /> + <EntityTypeShape EntityType="LocalModel.USER" Width="1.5" PointX="4.75" PointY="15.75" /> + <EntityTypeShape EntityType="LocalModel.USERS_ROLES" Width="1.5" PointX="16.75" PointY="0.75" /> </Diagram> </edmx:Diagrams> </edmx:Designer> diff --git a/Software/Visual_Studio/Tango.DAL.Local/DB/MACHINE_VERSIONS_CONFIGURATIONS.cs b/Software/Visual_Studio/Tango.DAL.Local/DB/MACHINE_VERSIONS_CONFIGURATIONS.cs deleted file mode 100644 index 79adafd58..000000000 --- a/Software/Visual_Studio/Tango.DAL.Local/DB/MACHINE_VERSIONS_CONFIGURATIONS.cs +++ /dev/null @@ -1,25 +0,0 @@ -//------------------------------------------------------------------------------ -// <auto-generated> -// This code was generated from a template. -// -// Manual changes to this file may cause unexpected behavior in your application. -// Manual changes to this file will be overwritten if the code is regenerated. -// </auto-generated> -//------------------------------------------------------------------------------ - -namespace Tango.DAL.Local.DB -{ - using System; - using System.Collections.Generic; - - public partial class MACHINE_VERSIONS_CONFIGURATIONS - { - public long ID { get; set; } - public string GUID { get; set; } - public System.DateTime LAST_UPDATED { get; set; } - public bool DELETED { get; set; } - public double VERSION { get; set; } - public string MACHINE_VERSION_GUID { get; set; } - public string CONFIGURATION_GUID { get; set; } - } -} diff --git a/Software/Visual_Studio/Tango.DAL.Local/Tango.DAL.Local.csproj b/Software/Visual_Studio/Tango.DAL.Local/Tango.DAL.Local.csproj index 2296ce942..db5f258a2 100644 --- a/Software/Visual_Studio/Tango.DAL.Local/Tango.DAL.Local.csproj +++ b/Software/Visual_Studio/Tango.DAL.Local/Tango.DAL.Local.csproj @@ -161,9 +161,6 @@ <Compile Include="DB\MACHINE_VERSIONS.cs"> <DependentUpon>LocalADO.tt</DependentUpon> </Compile> - <Compile Include="DB\MACHINE_VERSIONS_CONFIGURATIONS.cs"> - <DependentUpon>LocalADO.tt</DependentUpon> - </Compile> <Compile Include="DB\MEDIA_COLORS.cs"> <DependentUpon>LocalADO.tt</DependentUpon> </Compile> diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationDisplayPanelVersion.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationDisplayPanelVersion.cs index 4a06b47f1..4f1c6f071 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationDisplayPanelVersion.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationDisplayPanelVersion.cs @@ -10,6 +10,44 @@ namespace Tango.DAL.Observables public class ApplicationDisplayPanelVersion : ObservableEntity<APPLICATION_DISPLAY_PANEL_VERSIONS> { + private Double _version; + /// <summary> + /// Gets or sets the applicationdisplaypanelversion version. + /// </summary> + [EntityFieldName("VERSION")] + public Double Version + { + get + { + return _version; + } + + set + { + _version = value; RaisePropertyChanged(nameof(Version)); + } + + } + + private String _name; + /// <summary> + /// Gets or sets the applicationdisplaypanelversion name. + /// </summary> + [EntityFieldName("NAME")] + public String Name + { + get + { + return _name; + } + + set + { + _name = value; RaisePropertyChanged(nameof(Name)); + } + + } + private ObservableCollection<Configuration> _configurations; /// <summary> /// Gets or sets the applicationdisplaypanelversion configurations. diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationFirmwareVersion.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationFirmwareVersion.cs index 509b7afe6..5428e4974 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationFirmwareVersion.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationFirmwareVersion.cs @@ -10,6 +10,44 @@ namespace Tango.DAL.Observables public class ApplicationFirmwareVersion : ObservableEntity<APPLICATION_FIRMWARE_VERSIONS> { + private Double _version; + /// <summary> + /// Gets or sets the applicationfirmwareversion version. + /// </summary> + [EntityFieldName("VERSION")] + public Double Version + { + get + { + return _version; + } + + set + { + _version = value; RaisePropertyChanged(nameof(Version)); + } + + } + + private String _name; + /// <summary> + /// Gets or sets the applicationfirmwareversion name. + /// </summary> + [EntityFieldName("NAME")] + public String Name + { + get + { + return _name; + } + + set + { + _name = value; RaisePropertyChanged(nameof(Name)); + } + + } + private ObservableCollection<Configuration> _configurations; /// <summary> /// Gets or sets the applicationfirmwareversion configurations. diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationOsVersion.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationOsVersion.cs index 7d2c937e2..ee3522978 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationOsVersion.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationOsVersion.cs @@ -10,6 +10,44 @@ namespace Tango.DAL.Observables public class ApplicationOsVersion : ObservableEntity<APPLICATION_OS_VERSIONS> { + private Double _version; + /// <summary> + /// Gets or sets the applicationosversion version. + /// </summary> + [EntityFieldName("VERSION")] + public Double Version + { + get + { + return _version; + } + + set + { + _version = value; RaisePropertyChanged(nameof(Version)); + } + + } + + private String _name; + /// <summary> + /// Gets or sets the applicationosversion name. + /// </summary> + [EntityFieldName("NAME")] + public String Name + { + get + { + return _name; + } + + set + { + _name = value; RaisePropertyChanged(nameof(Name)); + } + + } + private ObservableCollection<Configuration> _configurations; /// <summary> /// Gets or sets the applicationosversion configurations. diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationVersion.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationVersion.cs index 63400b251..7dd3648f6 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationVersion.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/ApplicationVersion.cs @@ -10,6 +10,44 @@ namespace Tango.DAL.Observables public class ApplicationVersion : ObservableEntity<APPLICATION_VERSIONS> { + private Double _version; + /// <summary> + /// Gets or sets the applicationversion version. + /// </summary> + [EntityFieldName("VERSION")] + public Double Version + { + get + { + return _version; + } + + set + { + _version = value; RaisePropertyChanged(nameof(Version)); + } + + } + + private String _name; + /// <summary> + /// Gets or sets the applicationversion name. + /// </summary> + [EntityFieldName("NAME")] + public String Name + { + get + { + return _name; + } + + set + { + _name = value; RaisePropertyChanged(nameof(Name)); + } + + } + private ObservableCollection<Configuration> _configurations; /// <summary> /// Gets or sets the applicationversion configurations. diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Cartridge.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Cartridge.cs index f758d3893..3505ad6ba 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Cartridge.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Cartridge.cs @@ -10,6 +10,25 @@ namespace Tango.DAL.Observables public class Cartridge : ObservableEntity<CARTRIDGE> { + private String _serialnumber; + /// <summary> + /// Gets or sets the cartridge serial number. + /// </summary> + [EntityFieldName("SERIAL_NUMBER")] + public String SerialNumber + { + get + { + return _serialnumber; + } + + set + { + _serialnumber = value; RaisePropertyChanged(nameof(SerialNumber)); + } + + } + private String _cartridgetypeguid; /// <summary> /// Gets or sets the cartridge cartridge type guid. diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/CartridgeType.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/CartridgeType.cs index d84e02f9e..3c658a544 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/CartridgeType.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/CartridgeType.cs @@ -10,6 +10,44 @@ namespace Tango.DAL.Observables public class CartridgeType : ObservableEntity<CARTRIDGE_TYPES> { + private Int32 _code; + /// <summary> + /// Gets or sets the cartridgetype code. + /// </summary> + [EntityFieldName("CODE")] + public Int32 Code + { + get + { + return _code; + } + + set + { + _code = value; RaisePropertyChanged(nameof(Code)); + } + + } + + private String _name; + /// <summary> + /// Gets or sets the cartridgetype name. + /// </summary> + [EntityFieldName("NAME")] + public String Name + { + get + { + return _name; + } + + set + { + _name = value; RaisePropertyChanged(nameof(Name)); + } + + } + private ObservableCollection<Cartridge> _cartridges; /// <summary> /// Gets or sets the cartridgetype cartridges. diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Configuration.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Configuration.cs index 2c8c89233..1db20779d 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Configuration.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Configuration.cs @@ -257,25 +257,6 @@ namespace Tango.DAL.Observables } - private ObservableCollection<IdsPack> _idspacks; - /// <summary> - /// Gets or sets the configuration ids packs. - /// </summary> - [EntityFieldName("IDS_PACKS")] - public ObservableCollection<IdsPack> IdsPacks - { - get - { - return _idspacks; - } - - set - { - _idspacks = value; RaisePropertyChanged(nameof(IdsPacks)); - } - - } - private EmbeddedFirmwareVersion _embeddedfirmwareversions; /// <summary> /// Gets or sets the configuration embedded firmware versions. @@ -333,21 +314,40 @@ namespace Tango.DAL.Observables } - private ObservableCollection<MachineVersionsConfiguration> _machineversionsconfigurations; + private ObservableCollection<IdsPack> _idspacks; + /// <summary> + /// Gets or sets the configuration ids packs. + /// </summary> + [EntityFieldName("IDS_PACKS")] + public ObservableCollection<IdsPack> IdsPacks + { + get + { + return _idspacks; + } + + set + { + _idspacks = value; RaisePropertyChanged(nameof(IdsPacks)); + } + + } + + private ObservableCollection<MachineVersion> _machineversions; /// <summary> - /// Gets or sets the configuration machine versions configurations. + /// Gets or sets the configuration machine versions. /// </summary> - [EntityFieldName("MACHINE_VERSIONS_CONFIGURATIONS")] - public ObservableCollection<MachineVersionsConfiguration> MachineVersionsConfigurations + [EntityFieldName("MACHINE_VERSIONS")] + public ObservableCollection<MachineVersion> MachineVersions { get { - return _machineversionsconfigurations; + return _machineversions; } set { - _machineversionsconfigurations = value; RaisePropertyChanged(nameof(MachineVersionsConfigurations)); + _machineversions = value; RaisePropertyChanged(nameof(MachineVersions)); } } @@ -397,7 +397,7 @@ namespace Tango.DAL.Observables IdsPacks = new ObservableCollection<IdsPack>(); - MachineVersionsConfigurations = new ObservableCollection<MachineVersionsConfiguration>(); + MachineVersions = new ObservableCollection<MachineVersion>(); MachinesConfigurations = new ObservableCollection<MachinesConfiguration>(); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Dispenser.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Dispenser.cs index 1a79e554d..7ec1520ba 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Dispenser.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Dispenser.cs @@ -10,6 +10,25 @@ namespace Tango.DAL.Observables public class Dispenser : ObservableEntity<DISPENSER> { + private String _serialnumber; + /// <summary> + /// Gets or sets the dispenser serial number. + /// </summary> + [EntityFieldName("SERIAL_NUMBER")] + public String SerialNumber + { + get + { + return _serialnumber; + } + + set + { + _serialnumber = value; RaisePropertyChanged(nameof(SerialNumber)); + } + + } + private String _dispensertypeguid; /// <summary> /// Gets or sets the dispenser dispenser type guid. diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/DispenserType.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/DispenserType.cs index 3c04564f0..13cd25159 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/DispenserType.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/DispenserType.cs @@ -10,6 +10,44 @@ namespace Tango.DAL.Observables public class DispenserType : ObservableEntity<DISPENSER_TYPES> { + private Int32 _code; + /// <summary> + /// Gets or sets the dispensertype code. + /// </summary> + [EntityFieldName("CODE")] + public Int32 Code + { + get + { + return _code; + } + + set + { + _code = value; RaisePropertyChanged(nameof(Code)); + } + + } + + private String _name; + /// <summary> + /// Gets or sets the dispensertype name. + /// </summary> + [EntityFieldName("NAME")] + public String Name + { + get + { + return _name; + } + + set + { + _name = value; RaisePropertyChanged(nameof(Name)); + } + + } + private ObservableCollection<Dispenser> _dispensers; /// <summary> /// Gets or sets the dispensertype dispensers. diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/EmbeddedFirmwareVersion.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/EmbeddedFirmwareVersion.cs index 885955242..b9e4593aa 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/EmbeddedFirmwareVersion.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/EmbeddedFirmwareVersion.cs @@ -10,6 +10,44 @@ namespace Tango.DAL.Observables public class EmbeddedFirmwareVersion : ObservableEntity<EMBEDDED_FIRMWARE_VERSIONS> { + private Double _version; + /// <summary> + /// Gets or sets the embeddedfirmwareversion version. + /// </summary> + [EntityFieldName("VERSION")] + public Double Version + { + get + { + return _version; + } + + set + { + _version = value; RaisePropertyChanged(nameof(Version)); + } + + } + + private String _name; + /// <summary> + /// Gets or sets the embeddedfirmwareversion name. + /// </summary> + [EntityFieldName("NAME")] + public String Name + { + get + { + return _name; + } + + set + { + _name = value; RaisePropertyChanged(nameof(Name)); + } + + } + private ObservableCollection<Configuration> _configurations; /// <summary> /// Gets or sets the embeddedfirmwareversion configurations. diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/EmbeddedSoftwareVersion.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/EmbeddedSoftwareVersion.cs index 25d8255cf..ee66f11a1 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/EmbeddedSoftwareVersion.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/EmbeddedSoftwareVersion.cs @@ -10,6 +10,44 @@ namespace Tango.DAL.Observables public class EmbeddedSoftwareVersion : ObservableEntity<EMBEDDED_SOFTWARE_VERSIONS> { + private Double _version; + /// <summary> + /// Gets or sets the embeddedsoftwareversion version. + /// </summary> + [EntityFieldName("VERSION")] + public Double Version + { + get + { + return _version; + } + + set + { + _version = value; RaisePropertyChanged(nameof(Version)); + } + + } + + private String _name; + /// <summary> + /// Gets or sets the embeddedsoftwareversion name. + /// </summary> + [EntityFieldName("NAME")] + public String Name + { + get + { + return _name; + } + + set + { + _name = value; RaisePropertyChanged(nameof(Name)); + } + + } + private ObservableCollection<Configuration> _configurations; /// <summary> /// Gets or sets the embeddedsoftwareversion configurations. diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/FiberSynthesis.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/FiberSynth.cs index 3e2acc54f..7a0caefc4 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/FiberSynthesis.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/FiberSynth.cs @@ -6,13 +6,13 @@ using Tango.DAL.Remote.DB; namespace Tango.DAL.Observables { - [EntityFieldName("FIBER_SYNTHESISES")] - public class FiberSynthesis : ObservableEntity<FIBER_SYNTHESISES> + [EntityFieldName("FIBER_SYNTHS")] + public class FiberSynth : ObservableEntity<FIBER_SYNTHS> { private String _name; /// <summary> - /// Gets or sets the fibersynthesis name. + /// Gets or sets the fibersynth name. /// </summary> [EntityFieldName("NAME")] public String Name @@ -31,7 +31,7 @@ namespace Tango.DAL.Observables private Int32 _code; /// <summary> - /// Gets or sets the fibersynthesis code. + /// Gets or sets the fibersynth code. /// </summary> [EntityFieldName("CODE")] public Int32 Code @@ -50,7 +50,7 @@ namespace Tango.DAL.Observables private ObservableCollection<Rml> _rmls; /// <summary> - /// Gets or sets the fibersynthesis rmls. + /// Gets or sets the fibersynth rmls. /// </summary> [EntityFieldName("RMLS")] public ObservableCollection<Rml> Rmls @@ -68,18 +68,18 @@ namespace Tango.DAL.Observables } /// <summary> - /// Initializes a new instance of the <see cref="FiberSynthesis" /> class. + /// Initializes a new instance of the <see cref="FiberSynth" /> class. /// </summary> - public FiberSynthesis() : base() + public FiberSynth() : base() { Init(); } /// <summary> - /// Initializes a new instance of the <see cref="FiberSynthesis" /> class. + /// Initializes a new instance of the <see cref="FiberSynth" /> class. /// </summary> /// <param name="entity">The entity.</param> - public FiberSynthesis(FIBER_SYNTHESISES entity) : base(entity) + public FiberSynth(FIBER_SYNTHS entity) : base(entity) { Init(); MapEntityToObservable(entity, this); diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/HardwareVersion.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/HardwareVersion.cs index 054f9f20d..e0748bc48 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/HardwareVersion.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/HardwareVersion.cs @@ -10,6 +10,44 @@ namespace Tango.DAL.Observables public class HardwareVersion : ObservableEntity<HARDWARE_VERSIONS> { + private Double _version; + /// <summary> + /// Gets or sets the hardwareversion version. + /// </summary> + [EntityFieldName("VERSION")] + public Double Version + { + get + { + return _version; + } + + set + { + _version = value; RaisePropertyChanged(nameof(Version)); + } + + } + + private String _name; + /// <summary> + /// Gets or sets the hardwareversion name. + /// </summary> + [EntityFieldName("NAME")] + public String Name + { + get + { + return _name; + } + + set + { + _name = value; RaisePropertyChanged(nameof(Name)); + } + + } + private ObservableCollection<Configuration> _configurations; /// <summary> /// Gets or sets the hardwareversion configurations. diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/IdsPack.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/IdsPack.cs index 303167b80..20de3c46d 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/IdsPack.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/IdsPack.cs @@ -86,6 +86,25 @@ namespace Tango.DAL.Observables } + private String _name; + /// <summary> + /// Gets or sets the idspack name. + /// </summary> + [EntityFieldName("NAME")] + public String Name + { + get + { + return _name; + } + + set + { + _name = value; RaisePropertyChanged(nameof(Name)); + } + + } + private Cartridge _cartridge; /// <summary> /// Gets or sets the idspack cartridge. diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Liquid.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Liquid.cs index 4c021757a..13e8eb15a 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Liquid.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Liquid.cs @@ -67,6 +67,25 @@ namespace Tango.DAL.Observables } + private Int32 _color; + /// <summary> + /// Gets or sets the liquid color. + /// </summary> + [EntityFieldName("COLOR")] + public Int32 Color + { + get + { + return _color; + } + + set + { + _color = value; RaisePropertyChanged(nameof(Color)); + } + + } + private ObservableCollection<IdsPack> _idspacks; /// <summary> /// Gets or sets the liquid ids packs. diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/MachineVersion.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/MachineVersion.cs index 20ae58a1d..9205d8b9a 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/MachineVersion.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/MachineVersion.cs @@ -29,21 +29,59 @@ namespace Tango.DAL.Observables } - private ObservableCollection<MachineVersionsConfiguration> _machineversionsconfigurations; + private String _name; /// <summary> - /// Gets or sets the machineversion machine versions configurations. + /// Gets or sets the machineversion name. /// </summary> - [EntityFieldName("MACHINE_VERSIONS_CONFIGURATIONS")] - public ObservableCollection<MachineVersionsConfiguration> MachineVersionsConfigurations + [EntityFieldName("NAME")] + public String Name { get { - return _machineversionsconfigurations; + return _name; } set { - _machineversionsconfigurations = value; RaisePropertyChanged(nameof(MachineVersionsConfigurations)); + _name = value; RaisePropertyChanged(nameof(Name)); + } + + } + + private String _defaultconfigurationguid; + /// <summary> + /// Gets or sets the machineversion default configuration guid. + /// </summary> + [EntityFieldName("DEFAULT_CONFIGURATION_GUID")] + public String DefaultConfigurationGuid + { + get + { + return _defaultconfigurationguid; + } + + set + { + _defaultconfigurationguid = value; RaisePropertyChanged(nameof(DefaultConfigurationGuid)); + } + + } + + private Configuration _configuration; + /// <summary> + /// Gets or sets the machineversion configuration. + /// </summary> + [EntityFieldName("CONFIGURATION")] + public Configuration Configuration + { + get + { + return _configuration; + } + + set + { + _configuration = value; RaisePropertyChanged(nameof(Configuration)); } } @@ -91,8 +129,6 @@ namespace Tango.DAL.Observables private void Init() { - MachineVersionsConfigurations = new ObservableCollection<MachineVersionsConfiguration>(); - Machines = new ObservableCollection<Machine>(); } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/MachineVersionsConfiguration.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/MachineVersionsConfiguration.cs deleted file mode 100644 index 1206ebbd3..000000000 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/MachineVersionsConfiguration.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using Tango.DAL.Remote.DB; - -namespace Tango.DAL.Observables -{ - [EntityFieldName("MACHINE_VERSIONS_CONFIGURATIONS")] - public class MachineVersionsConfiguration : ObservableEntity<MACHINE_VERSIONS_CONFIGURATIONS> - { - - private String _machineversionguid; - /// <summary> - /// Gets or sets the machineversionsconfiguration machine version guid. - /// </summary> - [EntityFieldName("MACHINE_VERSION_GUID")] - public String MachineVersionGuid - { - get - { - return _machineversionguid; - } - - set - { - _machineversionguid = value; RaisePropertyChanged(nameof(MachineVersionGuid)); - } - - } - - private String _configurationguid; - /// <summary> - /// Gets or sets the machineversionsconfiguration configuration guid. - /// </summary> - [EntityFieldName("CONFIGURATION_GUID")] - public String ConfigurationGuid - { - get - { - return _configurationguid; - } - - set - { - _configurationguid = value; RaisePropertyChanged(nameof(ConfigurationGuid)); - } - - } - - private Configuration _configuration; - /// <summary> - /// Gets or sets the machineversionsconfiguration configuration. - /// </summary> - [EntityFieldName("CONFIGURATION")] - public Configuration Configuration - { - get - { - return _configuration; - } - - set - { - _configuration = value; RaisePropertyChanged(nameof(Configuration)); - } - - } - - private MachineVersion _machineversions; - /// <summary> - /// Gets or sets the machineversionsconfiguration machine versions. - /// </summary> - [EntityFieldName("MACHINE_VERSIONS")] - public MachineVersion MachineVersions - { - get - { - return _machineversions; - } - - set - { - _machineversions = value; RaisePropertyChanged(nameof(MachineVersions)); - } - - } - - /// <summary> - /// Initializes a new instance of the <see cref="MachineVersionsConfiguration" /> class. - /// </summary> - public MachineVersionsConfiguration() : base() - { - Init(); - } - - /// <summary> - /// Initializes a new instance of the <see cref="MachineVersionsConfiguration" /> class. - /// </summary> - /// <param name="entity">The entity.</param> - public MachineVersionsConfiguration(MACHINE_VERSIONS_CONFIGURATIONS entity) : base(entity) - { - Init(); - MapEntityToObservable(entity, this); - } - - /// <summary> - /// Initialize complex types. - /// </summary> - private void Init() - { - } - } -} diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Rml.cs b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Rml.cs index f0a78e074..1a2d31fe1 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/Rml.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Entities/Rml.cs @@ -143,21 +143,21 @@ namespace Tango.DAL.Observables } - private String _fibersynthesisguid; + private String _fibersynthguid; /// <summary> - /// Gets or sets the rml fiber synthesis guid. + /// Gets or sets the rml fiber synth guid. /// </summary> - [EntityFieldName("FIBER_SYNTHESIS_GUID")] - public String FiberSynthesisGuid + [EntityFieldName("FIBER_SYNTH_GUID")] + public String FiberSynthGuid { get { - return _fibersynthesisguid; + return _fibersynthguid; } set { - _fibersynthesisguid = value; RaisePropertyChanged(nameof(FiberSynthesisGuid)); + _fibersynthguid = value; RaisePropertyChanged(nameof(FiberSynthGuid)); } } @@ -371,21 +371,21 @@ namespace Tango.DAL.Observables } - private FiberSynthesis _fibersynthesises; + private FiberSynth _fibersynths; /// <summary> - /// Gets or sets the rml fiber synthesises. + /// Gets or sets the rml fiber synths. /// </summary> - [EntityFieldName("FIBER_SYNTHESISES")] - public FiberSynthesis FiberSynthesises + [EntityFieldName("FIBER_SYNTHS")] + public FiberSynth FiberSynths { get { - return _fibersynthesises; + return _fibersynths; } set { - _fibersynthesises = value; RaisePropertyChanged(nameof(FiberSynthesises)); + _fibersynths = value; RaisePropertyChanged(nameof(FiberSynths)); } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/Actions.cs b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/Actions.cs new file mode 100644 index 000000000..5723920b5 --- /dev/null +++ b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/Actions.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.ComponentModel; + +namespace Tango.DAL.Observables +{ + public enum Actions + { + } +} diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/CartridgeTypes.cs b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/CartridgeTypes.cs new file mode 100644 index 000000000..35cc310c6 --- /dev/null +++ b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/CartridgeTypes.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.ComponentModel; + +namespace Tango.DAL.Observables +{ + public enum CartridgeTypes + { + + /// <summary> + /// (Cartridge 1) + /// </summary> + [Description("Cartridge 1")] + Cartridge1 = 1, + + } +} diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/DispenserTypes.cs b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/DispenserTypes.cs new file mode 100644 index 000000000..bcd085dc4 --- /dev/null +++ b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/DispenserTypes.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.ComponentModel; + +namespace Tango.DAL.Observables +{ + public enum DispenserTypes + { + + /// <summary> + /// (Dispenser 1) + /// </summary> + [Description("Dispenser 1")] + Dispenser1 = 1, + + } +} diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/Events.cs b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/Events.cs new file mode 100644 index 000000000..63becf698 --- /dev/null +++ b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/Events.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.ComponentModel; + +namespace Tango.DAL.Observables +{ + public enum Events + { + } +} diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/FiberShapes.cs b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/FiberShapes.cs new file mode 100644 index 000000000..53a56c61f --- /dev/null +++ b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/FiberShapes.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.ComponentModel; + +namespace Tango.DAL.Observables +{ + public enum FiberShapes + { + } +} diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/FiberSynthes.cs b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/FiberSynthes.cs new file mode 100644 index 000000000..4bc13b83a --- /dev/null +++ b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/FiberSynthes.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.ComponentModel; + +namespace Tango.DAL.Observables +{ + public enum FiberSynthes + { + } +} diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/FiberSynthesises.cs b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/FiberSynthesises.cs new file mode 100644 index 000000000..e66e5f3df --- /dev/null +++ b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/FiberSynthesises.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.ComponentModel; + +namespace Tango.DAL.Observables +{ + public enum FiberSynthesises + { + } +} diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/FiberSynths.cs b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/FiberSynths.cs new file mode 100644 index 000000000..aa2dfec11 --- /dev/null +++ b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/FiberSynths.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.ComponentModel; + +namespace Tango.DAL.Observables +{ + public enum FiberSynths + { + } +} diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/LinearMassDensityUnits.cs b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/LinearMassDensityUnits.cs new file mode 100644 index 000000000..e5fc1e320 --- /dev/null +++ b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/LinearMassDensityUnits.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.ComponentModel; + +namespace Tango.DAL.Observables +{ + public enum LinearMassDensityUnits + { + } +} diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/Liquids.cs b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/Liquids.cs new file mode 100644 index 000000000..95cf098b1 --- /dev/null +++ b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/Liquids.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.ComponentModel; + +namespace Tango.DAL.Observables +{ + public enum Liquids + { + + /// <summary> + /// (Cyan) + /// </summary> + [Description("Cyan")] + Cyan = 1, + + /// <summary> + /// (Magenta) + /// </summary> + [Description("Magenta")] + Magenta = 2, + + } +} diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/MediaConditions.cs b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/MediaConditions.cs new file mode 100644 index 000000000..8f7016c5d --- /dev/null +++ b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/MediaConditions.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.ComponentModel; + +namespace Tango.DAL.Observables +{ + public enum MediaConditions + { + } +} diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/MediaMaterials.cs b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/MediaMaterials.cs new file mode 100644 index 000000000..252b2772a --- /dev/null +++ b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/MediaMaterials.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.ComponentModel; + +namespace Tango.DAL.Observables +{ + public enum MediaMaterials + { + } +} diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/MediaPurposes.cs b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/MediaPurposes.cs new file mode 100644 index 000000000..c47a96064 --- /dev/null +++ b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/MediaPurposes.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.ComponentModel; + +namespace Tango.DAL.Observables +{ + public enum MediaPurposes + { + } +} diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/PermissionsEnum.cs b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/Permissions.cs index 7390d4ac9..542555b51 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/PermissionsEnum.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/Permissions.cs @@ -6,7 +6,7 @@ using System.ComponentModel; namespace Tango.DAL.Observables { - public enum PermissionsEnum + public enum Permissions { /// <summary> diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Entities/RolesEnum.cs b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/Roles.cs index f2a144a57..6563e0826 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Entities/RolesEnum.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/Enumerations/Roles.cs @@ -6,7 +6,7 @@ using System.ComponentModel; namespace Tango.DAL.Observables { - public enum RolesEnum + public enum Roles { /// <summary> diff --git a/Software/Visual_Studio/Tango.DAL.Observables/IObservableEntity.cs b/Software/Visual_Studio/Tango.DAL.Observables/IObservableEntity.cs index 9bef6e6f0..397d7b820 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/IObservableEntity.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/IObservableEntity.cs @@ -23,6 +23,10 @@ namespace Tango.DAL.Observables void Save(); + Task SaveAsync(); + void Delete(); + + List<KeyValuePair<String, String>> GetDependentEntitiesNameAndGuid(); } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/ObservableEntity.cs b/Software/Visual_Studio/Tango.DAL.Observables/ObservableEntity.cs index b021d092a..e5e49ac38 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/ObservableEntity.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/ObservableEntity.cs @@ -119,7 +119,25 @@ namespace Tango.DAL.Observables } } + public List<KeyValuePair<String, String>> GetDependentEntitiesNameAndGuid() + { + List<KeyValuePair<String, String>> namesAndIds = new List<KeyValuePair<string, string>>(); + + foreach (var prop in this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsGenericType)) + { + IList list = prop.GetValue(this) as IList; + + foreach (var item in list) + { + namesAndIds.Add(new KeyValuePair<string, string>(item.GetType().Name, item.GetType().GetProperty("ID").GetValue(item).ToString())); + } + } + + return namesAndIds; + } + public abstract void Delete(); + public abstract Task SaveAsync(); } public abstract class ObservableEntity<T> : ObservableEntity where T : class @@ -185,6 +203,14 @@ namespace Tango.DAL.Observables ObservablesEntitiesAdapter.Instance.SaveChanges(); } + public override Task SaveAsync() + { + return Task.Factory.StartNew(() => + { + Save(); + }); + } + public override void Delete() { String tabelName = this.GetType().GetDALName(); @@ -202,17 +228,23 @@ namespace Tango.DAL.Observables foreach (var prop in this.GetType().GetProperties().Where(x => !x.PropertyType.IsGenericType && x.PropertyType.IsClass && x.PropertyType != typeof(String) && x.PropertyType != typeof(DateTime))) { IObservableEntity propObservable = prop.GetValue(this) as IObservableEntity; - try - { - this.GetType().GetProperty(prop.Name + "Guid").SetValue(this, propObservable.Guid); - } - catch (NullReferenceException) - { - this.GetType().GetProperty(prop.Name.Singularize() + "Guid").SetValue(this, propObservable.Guid); - } - catch + + if (propObservable != null) { - throw; + var guidProp = this.GetType().GetProperty(prop.Name + "Guid"); + + if (guidProp != null) + { + guidProp.SetValue(this, propObservable.Guid); + } + else + { + guidProp = this.GetType().GetProperty(prop.Name.SingularizeMVC() + "Guid"); + if (guidProp != null) + { + guidProp.SetValue(this, propObservable.Guid); + } + } } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/ObservablesEntitiesAdapter.cs b/Software/Visual_Studio/Tango.DAL.Observables/ObservablesEntitiesAdapter.cs index 09a380de1..0be7419e1 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/ObservablesEntitiesAdapter.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/ObservablesEntitiesAdapter.cs @@ -13,7 +13,7 @@ using Tango.Settings; namespace Tango.DAL.Observables { - public class ObservablesEntitiesAdapter : ExtendedObject + public partial class ObservablesEntitiesAdapter : ExtendedObject { private static ObservablesEntitiesAdapter _instance; @@ -39,6 +39,10 @@ namespace Tango.DAL.Observables private ObservablesEntitiesAdapter() { Context = new RemoteDB(SettingsManager.Default.DataBase.SQLServerAddress, false); + } + + public void Initialize() + { Invalidate(); } @@ -82,72 +86,41 @@ namespace Tango.DAL.Observables { role.RolesPermissions = role.RolesPermissions.Where(x => !x.Deleted).ToObservableCollection(); } - } - private ObservableCollection<Organization> _organizations; - public ObservableCollection<Organization> Organizations - { - get { return _organizations; } - set { _organizations = value; RaisePropertyChangedAuto(); } - } + Configurations = Context.CONFIGURATIONS.Where(x => !x.DELETED).ToList().OrderBy(x => x.LAST_UPDATED).Select(x => ObservableEntity.CreateObservableFromEntity<Configuration>(x)).ToObservableCollection(); - private ICollectionView _organizationsViewSource; - public ICollectionView OrganizationsViewSource - { - get { return _organizationsViewSource; } - set { _organizationsViewSource = value; RaisePropertyChangedAuto(); } - } - - private ObservableCollection<Machine> _machines; - public ObservableCollection<Machine> Machines - { - get { return _machines; } - set + foreach (var config in Configurations) { - _machines = value; RaisePropertyChangedAuto(); + config.IdsPacks = config.IdsPacks.Where(x => !x.Deleted).ToObservableCollection(); } - } - private ObservableCollection<MachineVersion> _machineVersions; - public ObservableCollection<MachineVersion> MachineVersions - { - get { return _machineVersions; } - set { _machineVersions = value; RaisePropertyChangedAuto(); } - } + ApplicationVersions = Context.APPLICATION_VERSIONS.Where(x => !x.DELETED).ToList().OrderBy(x => x.VERSION).Select(x => ObservableEntity.CreateObservableFromEntity<ApplicationVersion>(x)).ToObservableCollection(); - private ObservableCollection<Address> _addresses; - public ObservableCollection<Address> Addresses - { - get { return _addresses; } - set { _addresses = value; RaisePropertyChangedAuto(); } - } + ApplicationOsVersions = Context.APPLICATION_OS_VERSIONS.Where(x => !x.DELETED).ToList().OrderBy(x => x.VERSION).Select(x => ObservableEntity.CreateObservableFromEntity<ApplicationOsVersion>(x)).ToObservableCollection(); - private ObservableCollection<Contact> _contacts; - public ObservableCollection<Contact> Contacts - { - get { return _contacts; } - set { _contacts = value; RaisePropertyChangedAuto(); } - } + ApplicationFirmwareVersions = Context.APPLICATION_FIRMWARE_VERSIONS.Where(x => !x.DELETED).ToList().OrderBy(x => x.VERSION).Select(x => ObservableEntity.CreateObservableFromEntity<ApplicationFirmwareVersion>(x)).ToObservableCollection(); - private ObservableCollection<User> _users; - public ObservableCollection<User> Users - { - get { return _users; } - set { _users = value; RaisePropertyChangedAuto(); } - } + ApplicationDisplayPanelVersions = Context.APPLICATION_DISPLAY_PANEL_VERSIONS.Where(x => !x.DELETED).ToList().OrderBy(x => x.VERSION).Select(x => ObservableEntity.CreateObservableFromEntity<ApplicationDisplayPanelVersion>(x)).ToObservableCollection(); - private ObservableCollection<Role> _roles; - public ObservableCollection<Role> Roles - { - get { return _roles; } - set { _roles = value; RaisePropertyChangedAuto(); } - } + EmbeddedFirmwareVersions = Context.EMBEDDED_FIRMWARE_VERSIONS.Where(x => !x.DELETED).ToList().OrderBy(x => x.VERSION).Select(x => ObservableEntity.CreateObservableFromEntity<EmbeddedFirmwareVersion>(x)).ToObservableCollection(); - private ObservableCollection<Permission> _permissions; - public ObservableCollection<Permission> Permissions - { - get { return _permissions; } - set { _permissions = value; RaisePropertyChangedAuto(); } + EmbeddedSoftwareVersions = Context.EMBEDDED_SOFTWARE_VERSIONS.Where(x => !x.DELETED).ToList().OrderBy(x => x.VERSION).Select(x => ObservableEntity.CreateObservableFromEntity<EmbeddedSoftwareVersion>(x)).ToObservableCollection(); + + HardwareVersions = Context.HARDWARE_VERSIONS.Where(x => !x.DELETED).ToList().OrderBy(x => x.VERSION).Select(x => ObservableEntity.CreateObservableFromEntity<HardwareVersion>(x)).ToObservableCollection(); + + IdsPacks = Context.IDS_PACKS.Where(x => !x.DELETED).ToList().OrderBy(x => x.CONFIGURATION_GUID).Select(x => ObservableEntity.CreateObservableFromEntity<IdsPack>(x)).ToObservableCollection(); + + Dispensers = Context.DISPENSERS.Where(x => !x.DELETED).ToList().Select(x => ObservableEntity.CreateObservableFromEntity<Dispenser>(x)).ToObservableCollection(); + + DispenserTypes = Context.DISPENSER_TYPES.Where(x => !x.DELETED).ToList().Select(x => ObservableEntity.CreateObservableFromEntity<DispenserType>(x)).ToObservableCollection(); + + Liquids = Context.LIQUIDS.Where(x => !x.DELETED).ToList().Select(x => ObservableEntity.CreateObservableFromEntity<Liquid>(x)).ToObservableCollection(); + + Cartridges = Context.CARTRIDGES.Where(x => !x.DELETED).ToList().Select(x => ObservableEntity.CreateObservableFromEntity<Cartridge>(x)).ToObservableCollection(); + + CartridgeTypes = Context.CARTRIDGE_TYPES.Where(x => !x.DELETED).ToList().Select(x => ObservableEntity.CreateObservableFromEntity<CartridgeType>(x)).ToObservableCollection(); + + InitCollectionSources(); } private ICollectionView CreateCollectionView<T>(ObservableCollection<T> collection) diff --git a/Software/Visual_Studio/Tango.DAL.Observables/ObservablesEntitiesAdapterExtension.cs b/Software/Visual_Studio/Tango.DAL.Observables/ObservablesEntitiesAdapterExtension.cs new file mode 100644 index 000000000..9fdab5b8b --- /dev/null +++ b/Software/Visual_Studio/Tango.DAL.Observables/ObservablesEntitiesAdapterExtension.cs @@ -0,0 +1,1499 @@ +using System.Collections.ObjectModel; +using System.ComponentModel; + +namespace Tango.DAL.Observables +{ + public partial class ObservablesEntitiesAdapter + { + + private ObservableCollection<Action> _actions; + /// <summary> + /// Gets or sets the Actions. + /// </summary> + public ObservableCollection<Action> Actions + { + get + { + return _actions; + } + + set + { + _actions = value; RaisePropertyChanged(nameof(Actions)); + } + + } + + private ICollectionView _actionsViewSource; + /// <summary> + /// Gets or sets the Actions View Source. + ///</summary> + public ICollectionView ActionsViewSource + { + get + { + return _actionsViewSource; + } + + set + { + _actionsViewSource = value; RaisePropertyChanged(nameof(ActionsViewSource)); + } + + } + + private ObservableCollection<Address> _addresses; + /// <summary> + /// Gets or sets the Addresses. + /// </summary> + public ObservableCollection<Address> Addresses + { + get + { + return _addresses; + } + + set + { + _addresses = value; RaisePropertyChanged(nameof(Addresses)); + } + + } + + private ICollectionView _addressesViewSource; + /// <summary> + /// Gets or sets the Addresses View Source. + ///</summary> + public ICollectionView AddressesViewSource + { + get + { + return _addressesViewSource; + } + + set + { + _addressesViewSource = value; RaisePropertyChanged(nameof(AddressesViewSource)); + } + + } + + private ObservableCollection<ApplicationDisplayPanelVersion> _applicationdisplaypanelversions; + /// <summary> + /// Gets or sets the ApplicationDisplayPanelVersions. + /// </summary> + public ObservableCollection<ApplicationDisplayPanelVersion> ApplicationDisplayPanelVersions + { + get + { + return _applicationdisplaypanelversions; + } + + set + { + _applicationdisplaypanelversions = value; RaisePropertyChanged(nameof(ApplicationDisplayPanelVersions)); + } + + } + + private ICollectionView _applicationdisplaypanelversionsViewSource; + /// <summary> + /// Gets or sets the ApplicationDisplayPanelVersions View Source. + ///</summary> + public ICollectionView ApplicationDisplayPanelVersionsViewSource + { + get + { + return _applicationdisplaypanelversionsViewSource; + } + + set + { + _applicationdisplaypanelversionsViewSource = value; RaisePropertyChanged(nameof(ApplicationDisplayPanelVersionsViewSource)); + } + + } + + private ObservableCollection<ApplicationFirmwareVersion> _applicationfirmwareversions; + /// <summary> + /// Gets or sets the ApplicationFirmwareVersions. + /// </summary> + public ObservableCollection<ApplicationFirmwareVersion> ApplicationFirmwareVersions + { + get + { + return _applicationfirmwareversions; + } + + set + { + _applicationfirmwareversions = value; RaisePropertyChanged(nameof(ApplicationFirmwareVersions)); + } + + } + + private ICollectionView _applicationfirmwareversionsViewSource; + /// <summary> + /// Gets or sets the ApplicationFirmwareVersions View Source. + ///</summary> + public ICollectionView ApplicationFirmwareVersionsViewSource + { + get + { + return _applicationfirmwareversionsViewSource; + } + + set + { + _applicationfirmwareversionsViewSource = value; RaisePropertyChanged(nameof(ApplicationFirmwareVersionsViewSource)); + } + + } + + private ObservableCollection<ApplicationOsVersion> _applicationosversions; + /// <summary> + /// Gets or sets the ApplicationOsVersions. + /// </summary> + public ObservableCollection<ApplicationOsVersion> ApplicationOsVersions + { + get + { + return _applicationosversions; + } + + set + { + _applicationosversions = value; RaisePropertyChanged(nameof(ApplicationOsVersions)); + } + + } + + private ICollectionView _applicationosversionsViewSource; + /// <summary> + /// Gets or sets the ApplicationOsVersions View Source. + ///</summary> + public ICollectionView ApplicationOsVersionsViewSource + { + get + { + return _applicationosversionsViewSource; + } + + set + { + _applicationosversionsViewSource = value; RaisePropertyChanged(nameof(ApplicationOsVersionsViewSource)); + } + + } + + private ObservableCollection<ApplicationVersion> _applicationversions; + /// <summary> + /// Gets or sets the ApplicationVersions. + /// </summary> + public ObservableCollection<ApplicationVersion> ApplicationVersions + { + get + { + return _applicationversions; + } + + set + { + _applicationversions = value; RaisePropertyChanged(nameof(ApplicationVersions)); + } + + } + + private ICollectionView _applicationversionsViewSource; + /// <summary> + /// Gets or sets the ApplicationVersions View Source. + ///</summary> + public ICollectionView ApplicationVersionsViewSource + { + get + { + return _applicationversionsViewSource; + } + + set + { + _applicationversionsViewSource = value; RaisePropertyChanged(nameof(ApplicationVersionsViewSource)); + } + + } + + private ObservableCollection<CartridgeType> _cartridgetypes; + /// <summary> + /// Gets or sets the CartridgeTypes. + /// </summary> + public ObservableCollection<CartridgeType> CartridgeTypes + { + get + { + return _cartridgetypes; + } + + set + { + _cartridgetypes = value; RaisePropertyChanged(nameof(CartridgeTypes)); + } + + } + + private ICollectionView _cartridgetypesViewSource; + /// <summary> + /// Gets or sets the CartridgeTypes View Source. + ///</summary> + public ICollectionView CartridgeTypesViewSource + { + get + { + return _cartridgetypesViewSource; + } + + set + { + _cartridgetypesViewSource = value; RaisePropertyChanged(nameof(CartridgeTypesViewSource)); + } + + } + + private ObservableCollection<Cartridge> _cartridges; + /// <summary> + /// Gets or sets the Cartridges. + /// </summary> + public ObservableCollection<Cartridge> Cartridges + { + get + { + return _cartridges; + } + + set + { + _cartridges = value; RaisePropertyChanged(nameof(Cartridges)); + } + + } + + private ICollectionView _cartridgesViewSource; + /// <summary> + /// Gets or sets the Cartridges View Source. + ///</summary> + public ICollectionView CartridgesViewSource + { + get + { + return _cartridgesViewSource; + } + + set + { + _cartridgesViewSource = value; RaisePropertyChanged(nameof(CartridgesViewSource)); + } + + } + + private ObservableCollection<Configuration> _configurations; + /// <summary> + /// Gets or sets the Configurations. + /// </summary> + public ObservableCollection<Configuration> Configurations + { + get + { + return _configurations; + } + + set + { + _configurations = value; RaisePropertyChanged(nameof(Configurations)); + } + + } + + private ICollectionView _configurationsViewSource; + /// <summary> + /// Gets or sets the Configurations View Source. + ///</summary> + public ICollectionView ConfigurationsViewSource + { + get + { + return _configurationsViewSource; + } + + set + { + _configurationsViewSource = value; RaisePropertyChanged(nameof(ConfigurationsViewSource)); + } + + } + + private ObservableCollection<Contact> _contacts; + /// <summary> + /// Gets or sets the Contacts. + /// </summary> + public ObservableCollection<Contact> Contacts + { + get + { + return _contacts; + } + + set + { + _contacts = value; RaisePropertyChanged(nameof(Contacts)); + } + + } + + private ICollectionView _contactsViewSource; + /// <summary> + /// Gets or sets the Contacts View Source. + ///</summary> + public ICollectionView ContactsViewSource + { + get + { + return _contactsViewSource; + } + + set + { + _contactsViewSource = value; RaisePropertyChanged(nameof(ContactsViewSource)); + } + + } + + private ObservableCollection<DispenserType> _dispensertypes; + /// <summary> + /// Gets or sets the DispenserTypes. + /// </summary> + public ObservableCollection<DispenserType> DispenserTypes + { + get + { + return _dispensertypes; + } + + set + { + _dispensertypes = value; RaisePropertyChanged(nameof(DispenserTypes)); + } + + } + + private ICollectionView _dispensertypesViewSource; + /// <summary> + /// Gets or sets the DispenserTypes View Source. + ///</summary> + public ICollectionView DispenserTypesViewSource + { + get + { + return _dispensertypesViewSource; + } + + set + { + _dispensertypesViewSource = value; RaisePropertyChanged(nameof(DispenserTypesViewSource)); + } + + } + + private ObservableCollection<Dispenser> _dispensers; + /// <summary> + /// Gets or sets the Dispensers. + /// </summary> + public ObservableCollection<Dispenser> Dispensers + { + get + { + return _dispensers; + } + + set + { + _dispensers = value; RaisePropertyChanged(nameof(Dispensers)); + } + + } + + private ICollectionView _dispensersViewSource; + /// <summary> + /// Gets or sets the Dispensers View Source. + ///</summary> + public ICollectionView DispensersViewSource + { + get + { + return _dispensersViewSource; + } + + set + { + _dispensersViewSource = value; RaisePropertyChanged(nameof(DispensersViewSource)); + } + + } + + private ObservableCollection<EmbeddedFirmwareVersion> _embeddedfirmwareversions; + /// <summary> + /// Gets or sets the EmbeddedFirmwareVersions. + /// </summary> + public ObservableCollection<EmbeddedFirmwareVersion> EmbeddedFirmwareVersions + { + get + { + return _embeddedfirmwareversions; + } + + set + { + _embeddedfirmwareversions = value; RaisePropertyChanged(nameof(EmbeddedFirmwareVersions)); + } + + } + + private ICollectionView _embeddedfirmwareversionsViewSource; + /// <summary> + /// Gets or sets the EmbeddedFirmwareVersions View Source. + ///</summary> + public ICollectionView EmbeddedFirmwareVersionsViewSource + { + get + { + return _embeddedfirmwareversionsViewSource; + } + + set + { + _embeddedfirmwareversionsViewSource = value; RaisePropertyChanged(nameof(EmbeddedFirmwareVersionsViewSource)); + } + + } + + private ObservableCollection<EmbeddedSoftwareVersion> _embeddedsoftwareversions; + /// <summary> + /// Gets or sets the EmbeddedSoftwareVersions. + /// </summary> + public ObservableCollection<EmbeddedSoftwareVersion> EmbeddedSoftwareVersions + { + get + { + return _embeddedsoftwareversions; + } + + set + { + _embeddedsoftwareversions = value; RaisePropertyChanged(nameof(EmbeddedSoftwareVersions)); + } + + } + + private ICollectionView _embeddedsoftwareversionsViewSource; + /// <summary> + /// Gets or sets the EmbeddedSoftwareVersions View Source. + ///</summary> + public ICollectionView EmbeddedSoftwareVersionsViewSource + { + get + { + return _embeddedsoftwareversionsViewSource; + } + + set + { + _embeddedsoftwareversionsViewSource = value; RaisePropertyChanged(nameof(EmbeddedSoftwareVersionsViewSource)); + } + + } + + private ObservableCollection<Event> _events; + /// <summary> + /// Gets or sets the Events. + /// </summary> + public ObservableCollection<Event> Events + { + get + { + return _events; + } + + set + { + _events = value; RaisePropertyChanged(nameof(Events)); + } + + } + + private ICollectionView _eventsViewSource; + /// <summary> + /// Gets or sets the Events View Source. + ///</summary> + public ICollectionView EventsViewSource + { + get + { + return _eventsViewSource; + } + + set + { + _eventsViewSource = value; RaisePropertyChanged(nameof(EventsViewSource)); + } + + } + + private ObservableCollection<EventsAction> _eventsactions; + /// <summary> + /// Gets or sets the EventsActions. + /// </summary> + public ObservableCollection<EventsAction> EventsActions + { + get + { + return _eventsactions; + } + + set + { + _eventsactions = value; RaisePropertyChanged(nameof(EventsActions)); + } + + } + + private ICollectionView _eventsactionsViewSource; + /// <summary> + /// Gets or sets the EventsActions View Source. + ///</summary> + public ICollectionView EventsActionsViewSource + { + get + { + return _eventsactionsViewSource; + } + + set + { + _eventsactionsViewSource = value; RaisePropertyChanged(nameof(EventsActionsViewSource)); + } + + } + + private ObservableCollection<FiberShape> _fibershapes; + /// <summary> + /// Gets or sets the FiberShapes. + /// </summary> + public ObservableCollection<FiberShape> FiberShapes + { + get + { + return _fibershapes; + } + + set + { + _fibershapes = value; RaisePropertyChanged(nameof(FiberShapes)); + } + + } + + private ICollectionView _fibershapesViewSource; + /// <summary> + /// Gets or sets the FiberShapes View Source. + ///</summary> + public ICollectionView FiberShapesViewSource + { + get + { + return _fibershapesViewSource; + } + + set + { + _fibershapesViewSource = value; RaisePropertyChanged(nameof(FiberShapesViewSource)); + } + + } + + private ObservableCollection<FiberSynth> _fibersynths; + /// <summary> + /// Gets or sets the FiberSynths. + /// </summary> + public ObservableCollection<FiberSynth> FiberSynths + { + get + { + return _fibersynths; + } + + set + { + _fibersynths = value; RaisePropertyChanged(nameof(FiberSynths)); + } + + } + + private ICollectionView _fibersynthsViewSource; + /// <summary> + /// Gets or sets the FiberSynths View Source. + ///</summary> + public ICollectionView FiberSynthsViewSource + { + get + { + return _fibersynthsViewSource; + } + + set + { + _fibersynthsViewSource = value; RaisePropertyChanged(nameof(FiberSynthsViewSource)); + } + + } + + private ObservableCollection<HardwareVersion> _hardwareversions; + /// <summary> + /// Gets or sets the HardwareVersions. + /// </summary> + public ObservableCollection<HardwareVersion> HardwareVersions + { + get + { + return _hardwareversions; + } + + set + { + _hardwareversions = value; RaisePropertyChanged(nameof(HardwareVersions)); + } + + } + + private ICollectionView _hardwareversionsViewSource; + /// <summary> + /// Gets or sets the HardwareVersions View Source. + ///</summary> + public ICollectionView HardwareVersionsViewSource + { + get + { + return _hardwareversionsViewSource; + } + + set + { + _hardwareversionsViewSource = value; RaisePropertyChanged(nameof(HardwareVersionsViewSource)); + } + + } + + private ObservableCollection<IdsPack> _idspacks; + /// <summary> + /// Gets or sets the IdsPacks. + /// </summary> + public ObservableCollection<IdsPack> IdsPacks + { + get + { + return _idspacks; + } + + set + { + _idspacks = value; RaisePropertyChanged(nameof(IdsPacks)); + } + + } + + private ICollectionView _idspacksViewSource; + /// <summary> + /// Gets or sets the IdsPacks View Source. + ///</summary> + public ICollectionView IdsPacksViewSource + { + get + { + return _idspacksViewSource; + } + + set + { + _idspacksViewSource = value; RaisePropertyChanged(nameof(IdsPacksViewSource)); + } + + } + + private ObservableCollection<LinearMassDensityUnit> _linearmassdensityunits; + /// <summary> + /// Gets or sets the LinearMassDensityUnits. + /// </summary> + public ObservableCollection<LinearMassDensityUnit> LinearMassDensityUnits + { + get + { + return _linearmassdensityunits; + } + + set + { + _linearmassdensityunits = value; RaisePropertyChanged(nameof(LinearMassDensityUnits)); + } + + } + + private ICollectionView _linearmassdensityunitsViewSource; + /// <summary> + /// Gets or sets the LinearMassDensityUnits View Source. + ///</summary> + public ICollectionView LinearMassDensityUnitsViewSource + { + get + { + return _linearmassdensityunitsViewSource; + } + + set + { + _linearmassdensityunitsViewSource = value; RaisePropertyChanged(nameof(LinearMassDensityUnitsViewSource)); + } + + } + + private ObservableCollection<Liquid> _liquids; + /// <summary> + /// Gets or sets the Liquids. + /// </summary> + public ObservableCollection<Liquid> Liquids + { + get + { + return _liquids; + } + + set + { + _liquids = value; RaisePropertyChanged(nameof(Liquids)); + } + + } + + private ICollectionView _liquidsViewSource; + /// <summary> + /// Gets or sets the Liquids View Source. + ///</summary> + public ICollectionView LiquidsViewSource + { + get + { + return _liquidsViewSource; + } + + set + { + _liquidsViewSource = value; RaisePropertyChanged(nameof(LiquidsViewSource)); + } + + } + + private ObservableCollection<LiquidsRml> _liquidsrmls; + /// <summary> + /// Gets or sets the LiquidsRmls. + /// </summary> + public ObservableCollection<LiquidsRml> LiquidsRmls + { + get + { + return _liquidsrmls; + } + + set + { + _liquidsrmls = value; RaisePropertyChanged(nameof(LiquidsRmls)); + } + + } + + private ICollectionView _liquidsrmlsViewSource; + /// <summary> + /// Gets or sets the LiquidsRmls View Source. + ///</summary> + public ICollectionView LiquidsRmlsViewSource + { + get + { + return _liquidsrmlsViewSource; + } + + set + { + _liquidsrmlsViewSource = value; RaisePropertyChanged(nameof(LiquidsRmlsViewSource)); + } + + } + + private ObservableCollection<MachineVersion> _machineversions; + /// <summary> + /// Gets or sets the MachineVersions. + /// </summary> + public ObservableCollection<MachineVersion> MachineVersions + { + get + { + return _machineversions; + } + + set + { + _machineversions = value; RaisePropertyChanged(nameof(MachineVersions)); + } + + } + + private ICollectionView _machineversionsViewSource; + /// <summary> + /// Gets or sets the MachineVersions View Source. + ///</summary> + public ICollectionView MachineVersionsViewSource + { + get + { + return _machineversionsViewSource; + } + + set + { + _machineversionsViewSource = value; RaisePropertyChanged(nameof(MachineVersionsViewSource)); + } + + } + + private ObservableCollection<Machine> _machines; + /// <summary> + /// Gets or sets the Machines. + /// </summary> + public ObservableCollection<Machine> Machines + { + get + { + return _machines; + } + + set + { + _machines = value; RaisePropertyChanged(nameof(Machines)); + } + + } + + private ICollectionView _machinesViewSource; + /// <summary> + /// Gets or sets the Machines View Source. + ///</summary> + public ICollectionView MachinesViewSource + { + get + { + return _machinesViewSource; + } + + set + { + _machinesViewSource = value; RaisePropertyChanged(nameof(MachinesViewSource)); + } + + } + + private ObservableCollection<MachinesConfiguration> _machinesconfigurations; + /// <summary> + /// Gets or sets the MachinesConfigurations. + /// </summary> + public ObservableCollection<MachinesConfiguration> MachinesConfigurations + { + get + { + return _machinesconfigurations; + } + + set + { + _machinesconfigurations = value; RaisePropertyChanged(nameof(MachinesConfigurations)); + } + + } + + private ICollectionView _machinesconfigurationsViewSource; + /// <summary> + /// Gets or sets the MachinesConfigurations View Source. + ///</summary> + public ICollectionView MachinesConfigurationsViewSource + { + get + { + return _machinesconfigurationsViewSource; + } + + set + { + _machinesconfigurationsViewSource = value; RaisePropertyChanged(nameof(MachinesConfigurationsViewSource)); + } + + } + + private ObservableCollection<MachinesEvent> _machinesevents; + /// <summary> + /// Gets or sets the MachinesEvents. + /// </summary> + public ObservableCollection<MachinesEvent> MachinesEvents + { + get + { + return _machinesevents; + } + + set + { + _machinesevents = value; RaisePropertyChanged(nameof(MachinesEvents)); + } + + } + + private ICollectionView _machineseventsViewSource; + /// <summary> + /// Gets or sets the MachinesEvents View Source. + ///</summary> + public ICollectionView MachinesEventsViewSource + { + get + { + return _machineseventsViewSource; + } + + set + { + _machineseventsViewSource = value; RaisePropertyChanged(nameof(MachinesEventsViewSource)); + } + + } + + private ObservableCollection<MediaColor> _mediacolors; + /// <summary> + /// Gets or sets the MediaColors. + /// </summary> + public ObservableCollection<MediaColor> MediaColors + { + get + { + return _mediacolors; + } + + set + { + _mediacolors = value; RaisePropertyChanged(nameof(MediaColors)); + } + + } + + private ICollectionView _mediacolorsViewSource; + /// <summary> + /// Gets or sets the MediaColors View Source. + ///</summary> + public ICollectionView MediaColorsViewSource + { + get + { + return _mediacolorsViewSource; + } + + set + { + _mediacolorsViewSource = value; RaisePropertyChanged(nameof(MediaColorsViewSource)); + } + + } + + private ObservableCollection<MediaCondition> _mediaconditions; + /// <summary> + /// Gets or sets the MediaConditions. + /// </summary> + public ObservableCollection<MediaCondition> MediaConditions + { + get + { + return _mediaconditions; + } + + set + { + _mediaconditions = value; RaisePropertyChanged(nameof(MediaConditions)); + } + + } + + private ICollectionView _mediaconditionsViewSource; + /// <summary> + /// Gets or sets the MediaConditions View Source. + ///</summary> + public ICollectionView MediaConditionsViewSource + { + get + { + return _mediaconditionsViewSource; + } + + set + { + _mediaconditionsViewSource = value; RaisePropertyChanged(nameof(MediaConditionsViewSource)); + } + + } + + private ObservableCollection<MediaMaterial> _mediamaterials; + /// <summary> + /// Gets or sets the MediaMaterials. + /// </summary> + public ObservableCollection<MediaMaterial> MediaMaterials + { + get + { + return _mediamaterials; + } + + set + { + _mediamaterials = value; RaisePropertyChanged(nameof(MediaMaterials)); + } + + } + + private ICollectionView _mediamaterialsViewSource; + /// <summary> + /// Gets or sets the MediaMaterials View Source. + ///</summary> + public ICollectionView MediaMaterialsViewSource + { + get + { + return _mediamaterialsViewSource; + } + + set + { + _mediamaterialsViewSource = value; RaisePropertyChanged(nameof(MediaMaterialsViewSource)); + } + + } + + private ObservableCollection<MediaPurpos> _mediapurposes; + /// <summary> + /// Gets or sets the MediaPurposes. + /// </summary> + public ObservableCollection<MediaPurpos> MediaPurposes + { + get + { + return _mediapurposes; + } + + set + { + _mediapurposes = value; RaisePropertyChanged(nameof(MediaPurposes)); + } + + } + + private ICollectionView _mediapurposesViewSource; + /// <summary> + /// Gets or sets the MediaPurposes View Source. + ///</summary> + public ICollectionView MediaPurposesViewSource + { + get + { + return _mediapurposesViewSource; + } + + set + { + _mediapurposesViewSource = value; RaisePropertyChanged(nameof(MediaPurposesViewSource)); + } + + } + + private ObservableCollection<Organization> _organizations; + /// <summary> + /// Gets or sets the Organizations. + /// </summary> + public ObservableCollection<Organization> Organizations + { + get + { + return _organizations; + } + + set + { + _organizations = value; RaisePropertyChanged(nameof(Organizations)); + } + + } + + private ICollectionView _organizationsViewSource; + /// <summary> + /// Gets or sets the Organizations View Source. + ///</summary> + public ICollectionView OrganizationsViewSource + { + get + { + return _organizationsViewSource; + } + + set + { + _organizationsViewSource = value; RaisePropertyChanged(nameof(OrganizationsViewSource)); + } + + } + + private ObservableCollection<Permission> _permissions; + /// <summary> + /// Gets or sets the Permissions. + /// </summary> + public ObservableCollection<Permission> Permissions + { + get + { + return _permissions; + } + + set + { + _permissions = value; RaisePropertyChanged(nameof(Permissions)); + } + + } + + private ICollectionView _permissionsViewSource; + /// <summary> + /// Gets or sets the Permissions View Source. + ///</summary> + public ICollectionView PermissionsViewSource + { + get + { + return _permissionsViewSource; + } + + set + { + _permissionsViewSource = value; RaisePropertyChanged(nameof(PermissionsViewSource)); + } + + } + + private ObservableCollection<Rml> _rmls; + /// <summary> + /// Gets or sets the Rmls. + /// </summary> + public ObservableCollection<Rml> Rmls + { + get + { + return _rmls; + } + + set + { + _rmls = value; RaisePropertyChanged(nameof(Rmls)); + } + + } + + private ICollectionView _rmlsViewSource; + /// <summary> + /// Gets or sets the Rmls View Source. + ///</summary> + public ICollectionView RmlsViewSource + { + get + { + return _rmlsViewSource; + } + + set + { + _rmlsViewSource = value; RaisePropertyChanged(nameof(RmlsViewSource)); + } + + } + + private ObservableCollection<Role> _roles; + /// <summary> + /// Gets or sets the Roles. + /// </summary> + public ObservableCollection<Role> Roles + { + get + { + return _roles; + } + + set + { + _roles = value; RaisePropertyChanged(nameof(Roles)); + } + + } + + private ICollectionView _rolesViewSource; + /// <summary> + /// Gets or sets the Roles View Source. + ///</summary> + public ICollectionView RolesViewSource + { + get + { + return _rolesViewSource; + } + + set + { + _rolesViewSource = value; RaisePropertyChanged(nameof(RolesViewSource)); + } + + } + + private ObservableCollection<RolesPermission> _rolespermissions; + /// <summary> + /// Gets or sets the RolesPermissions. + /// </summary> + public ObservableCollection<RolesPermission> RolesPermissions + { + get + { + return _rolespermissions; + } + + set + { + _rolespermissions = value; RaisePropertyChanged(nameof(RolesPermissions)); + } + + } + + private ICollectionView _rolespermissionsViewSource; + /// <summary> + /// Gets or sets the RolesPermissions View Source. + ///</summary> + public ICollectionView RolesPermissionsViewSource + { + get + { + return _rolespermissionsViewSource; + } + + set + { + _rolespermissionsViewSource = value; RaisePropertyChanged(nameof(RolesPermissionsViewSource)); + } + + } + + private ObservableCollection<SyncConfiguration> _syncconfigurations; + /// <summary> + /// Gets or sets the SyncConfigurations. + /// </summary> + public ObservableCollection<SyncConfiguration> SyncConfigurations + { + get + { + return _syncconfigurations; + } + + set + { + _syncconfigurations = value; RaisePropertyChanged(nameof(SyncConfigurations)); + } + + } + + private ICollectionView _syncconfigurationsViewSource; + /// <summary> + /// Gets or sets the SyncConfigurations View Source. + ///</summary> + public ICollectionView SyncConfigurationsViewSource + { + get + { + return _syncconfigurationsViewSource; + } + + set + { + _syncconfigurationsViewSource = value; RaisePropertyChanged(nameof(SyncConfigurationsViewSource)); + } + + } + + private ObservableCollection<User> _users; + /// <summary> + /// Gets or sets the Users. + /// </summary> + public ObservableCollection<User> Users + { + get + { + return _users; + } + + set + { + _users = value; RaisePropertyChanged(nameof(Users)); + } + + } + + private ICollectionView _usersViewSource; + /// <summary> + /// Gets or sets the Users View Source. + ///</summary> + public ICollectionView UsersViewSource + { + get + { + return _usersViewSource; + } + + set + { + _usersViewSource = value; RaisePropertyChanged(nameof(UsersViewSource)); + } + + } + + private ObservableCollection<UsersRole> _usersroles; + /// <summary> + /// Gets or sets the UsersRoles. + /// </summary> + public ObservableCollection<UsersRole> UsersRoles + { + get + { + return _usersroles; + } + + set + { + _usersroles = value; RaisePropertyChanged(nameof(UsersRoles)); + } + + } + + private ICollectionView _usersrolesViewSource; + /// <summary> + /// Gets or sets the UsersRoles View Source. + ///</summary> + public ICollectionView UsersRolesViewSource + { + get + { + return _usersrolesViewSource; + } + + set + { + _usersrolesViewSource = value; RaisePropertyChanged(nameof(UsersRolesViewSource)); + } + + } + + /// <summary> + /// Initialize collection sources. + /// </summary> + private void InitCollectionSources() + { + + ActionsViewSource = CreateCollectionView(Actions); + + AddressesViewSource = CreateCollectionView(Addresses); + + ApplicationDisplayPanelVersionsViewSource = CreateCollectionView(ApplicationDisplayPanelVersions); + + ApplicationFirmwareVersionsViewSource = CreateCollectionView(ApplicationFirmwareVersions); + + ApplicationOsVersionsViewSource = CreateCollectionView(ApplicationOsVersions); + + ApplicationVersionsViewSource = CreateCollectionView(ApplicationVersions); + + CartridgeTypesViewSource = CreateCollectionView(CartridgeTypes); + + CartridgesViewSource = CreateCollectionView(Cartridges); + + ConfigurationsViewSource = CreateCollectionView(Configurations); + + ContactsViewSource = CreateCollectionView(Contacts); + + DispenserTypesViewSource = CreateCollectionView(DispenserTypes); + + DispensersViewSource = CreateCollectionView(Dispensers); + + EmbeddedFirmwareVersionsViewSource = CreateCollectionView(EmbeddedFirmwareVersions); + + EmbeddedSoftwareVersionsViewSource = CreateCollectionView(EmbeddedSoftwareVersions); + + EventsViewSource = CreateCollectionView(Events); + + EventsActionsViewSource = CreateCollectionView(EventsActions); + + FiberShapesViewSource = CreateCollectionView(FiberShapes); + + FiberSynthsViewSource = CreateCollectionView(FiberSynths); + + HardwareVersionsViewSource = CreateCollectionView(HardwareVersions); + + IdsPacksViewSource = CreateCollectionView(IdsPacks); + + LinearMassDensityUnitsViewSource = CreateCollectionView(LinearMassDensityUnits); + + LiquidsViewSource = CreateCollectionView(Liquids); + + LiquidsRmlsViewSource = CreateCollectionView(LiquidsRmls); + + MachineVersionsViewSource = CreateCollectionView(MachineVersions); + + MachinesViewSource = CreateCollectionView(Machines); + + MachinesConfigurationsViewSource = CreateCollectionView(MachinesConfigurations); + + MachinesEventsViewSource = CreateCollectionView(MachinesEvents); + + MediaColorsViewSource = CreateCollectionView(MediaColors); + + MediaConditionsViewSource = CreateCollectionView(MediaConditions); + + MediaMaterialsViewSource = CreateCollectionView(MediaMaterials); + + MediaPurposesViewSource = CreateCollectionView(MediaPurposes); + + OrganizationsViewSource = CreateCollectionView(Organizations); + + PermissionsViewSource = CreateCollectionView(Permissions); + + RmlsViewSource = CreateCollectionView(Rmls); + + RolesViewSource = CreateCollectionView(Roles); + + RolesPermissionsViewSource = CreateCollectionView(RolesPermissions); + + SyncConfigurationsViewSource = CreateCollectionView(SyncConfigurations); + + UsersViewSource = CreateCollectionView(Users); + + UsersRolesViewSource = CreateCollectionView(UsersRoles); + + } + } +} diff --git a/Software/Visual_Studio/Tango.DAL.Observables/ObservablesGenerator.cs b/Software/Visual_Studio/Tango.DAL.Observables/ObservablesGenerator.cs index 8bce28920..b6788ccfe 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/ObservablesGenerator.cs +++ b/Software/Visual_Studio/Tango.DAL.Observables/ObservablesGenerator.cs @@ -1,25 +1,29 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Data.Entity; using System.IO; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; using Tango.CodeGeneration; using Tango.DAL.Remote.DB; using Tango.Settings; +using Humanizer; namespace Tango.DAL.Observables { public class ObservablesGenerator { - public void Generate(String targetPath) + public void GenerateCSharp(String targetPath) { + //Generate Entities... foreach (var table in typeof(RemoteDB).GetProperties().Where(x => typeof(IEnumerable).IsAssignableFrom(x.PropertyType))) { - EntityCodeFile codeFile = new EntityCodeFile(ObservableEntity.DalNameToStandardName(table.Name).Singularize()) + EntityCodeFile codeFile = new EntityCodeFile(ObservableEntity.DalNameToStandardName(table.Name).SingularizeMVC()) { - EntityName = table.Name.Singularize(), + EntityName = table.Name.SingularizeMVC(), TableName = table.Name, }; @@ -33,14 +37,14 @@ namespace Tango.DAL.Observables if (field.PropertyType.IsGenericType) { - codeField.Type = String.Format("ObservableCollection<{0}>", ObservableEntity.DalNameToStandardName(field.PropertyType.GenericTypeArguments.Single().Name).Singularize()); + codeField.Type = String.Format("ObservableCollection<{0}>", ObservableEntity.DalNameToStandardName(field.PropertyType.GenericTypeArguments.Single().Name).SingularizeMVC()); codeField.Construct = true; } else { if (field.PropertyType.IsClass && field.PropertyType != typeof(String)) { - codeField.Type = ObservableEntity.DalNameToStandardName(field.PropertyType.Name).Singularize(); + codeField.Type = ObservableEntity.DalNameToStandardName(field.PropertyType.Name).SingularizeMVC(); } else { @@ -52,42 +56,195 @@ namespace Tango.DAL.Observables String code = codeFile.GenerateCode(); - File.WriteAllText(Path.Combine(targetPath, codeFile.Name + ".cs"), code); + String entitiesPath = Path.Combine(targetPath, "Entities"); + Directory.CreateDirectory(entitiesPath); + File.WriteAllText(Path.Combine(entitiesPath, codeFile.Name + ".cs"), code); } + //Generate Entities... //Generate Enumerations... using (RemoteDB db = new RemoteDB(SettingsManager.Default.DataBase.SQLServerAddress, false)) { - EnumerationFile enumFile = new EnumerationFile(); - enumFile.Name = "RolesEnum"; + foreach (var tableProp in db.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsGenericType)) + { + try + { + var a = tableProp.PropertyType.GenericTypeArguments.FirstOrDefault(); + var codeProp = tableProp.PropertyType.GenericTypeArguments.First().GetProperty("CODE"); + var nameProp = tableProp.PropertyType.GenericTypeArguments.First().GetProperty("NAME"); + var descriptionProp = tableProp.PropertyType.GenericTypeArguments.First().GetProperty("DESCRIPTION"); + + if (codeProp != null && nameProp != null) + { + EnumerationFile enumFile = new EnumerationFile(); + enumFile.Name = ObservableEntity.DalNameToStandardName(tableProp.Name); + + foreach (var row in tableProp.GetValue(db) as IEnumerable) + { + EnumerationField field = new EnumerationField(); + field.Name = nameProp.GetValue(row).ToString().Replace(" ", ""); + field.Value = (int)codeProp.GetValue(row); + + if (descriptionProp != null) + { + field.Description = descriptionProp.GetValue(row).ToString(); + } + else + { + field.Description = nameProp.GetValue(row).ToString(); + } + enumFile.Fields.Add(field); + } + + String enumerationsPath = Path.Combine(targetPath, "Enumerations"); + Directory.CreateDirectory(enumerationsPath); + String code = enumFile.GenerateCode(); + File.WriteAllText(Path.Combine(enumerationsPath, enumFile.Name + ".cs"), code); + } + } + catch { } + } + } + //Generate Enumerations... - foreach (var row in db.ROLES) + //Generate Observables Adapter Extensions... + ObservablesAdapterFile adapterFile = new ObservablesAdapterFile(); + adapterFile.Name = nameof(ObservablesEntitiesAdapter); + + foreach (var table in typeof(RemoteDB).GetProperties().Where(x => typeof(IEnumerable).IsAssignableFrom(x.PropertyType))) + { + adapterFile.Properties.Add(new Property() { - EnumerationField field = new EnumerationField(); - field.Name = row.NAME.Replace(" ", ""); - field.Description = row.DESCRIPTION; - field.Value = row.CODE; - enumFile.Fields.Add(field); + Name = ObservableEntity.DalNameToStandardName(table.Name), + Type = String.Format("ObservableCollection<{0}>", ObservableEntity.DalNameToStandardName(table.PropertyType.GenericTypeArguments.Single().Name).SingularizeMVC()), + }); + } + + String adapterCode = adapterFile.GenerateCode(); + File.WriteAllText(Path.Combine(targetPath, "ObservablesEntitiesAdapterExtension.cs"), adapterCode); + //Generate Observables Adapter Extensions... + } + + public void GenerateJava(String targetPath) + { + //Generate Entities... + foreach (var table in typeof(RemoteDB).GetProperties().Where(x => typeof(IEnumerable).IsAssignableFrom(x.PropertyType))) + { + EntityCodeFileJava codeFile = new EntityCodeFileJava(ObservableEntity.DalNameToStandardName(table.Name).Singularize(false)) + { + EntityName = table.Name.Singularize(false), + TableName = table.Name, + }; + + + + foreach (var field in table.PropertyType.GenericTypeArguments.First().GetProperties().Skip(4).Where(x => !x.Name.Contains("GUID"))) + { + EntityCodeFileField codeField = new EntityCodeFileField(); + codeField.FieldName = field.Name.Singularize(false); + codeField.Name = ObservableEntity.DalNameToStandardName(field.Name.Singularize(false)); + codeField.Description = FirstCharacterToLower(ObservableEntity.DalNameToStandardName(field.Name).Singularize(false)); + + + if (field.PropertyType.IsGenericType) + { + continue; + } + else + { + if (field.PropertyType.IsClass && field.PropertyType != typeof(String)) + { + codeField.Type = ObservableEntity.DalNameToStandardName(field.PropertyType.Name).Singularize(false); + codeField.Construct = true; + } + else + { + codeField.Type = field.PropertyType.Name == "Int32" ? "int" : field.PropertyType.Name; + } + } + codeFile.Fields.Add(codeField); } - String code = enumFile.GenerateCode(); - File.WriteAllText(Path.Combine(targetPath, enumFile.Name + ".cs"), code); + codeFile.IndentResult = false; + String code = codeFile.GenerateCode(); - enumFile = new EnumerationFile(); - enumFile.Name = "PermissionsEnum"; + String entitiesPath = Path.Combine(targetPath, "entities"); + Directory.CreateDirectory(entitiesPath); + File.WriteAllText(Path.Combine(entitiesPath, codeFile.Name + ".java"), code); + } + //Generate Entities... - foreach (var row in db.PERMISSIONS) + //Generate Enumerations... + using (RemoteDB db = new RemoteDB(SettingsManager.Default.DataBase.SQLServerAddress, false)) + { + foreach (var tableProp in db.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsGenericType)) { - EnumerationField field = new EnumerationField(); - field.Name = row.NAME.Replace(" ", ""); - field.Description = row.DESCRIPTION; - field.Value = row.CODE; - enumFile.Fields.Add(field); + try + { + var a = tableProp.PropertyType.GenericTypeArguments.FirstOrDefault(); + var codeProp = tableProp.PropertyType.GenericTypeArguments.First().GetProperty("CODE"); + var nameProp = tableProp.PropertyType.GenericTypeArguments.First().GetProperty("NAME"); + var descriptionProp = tableProp.PropertyType.GenericTypeArguments.First().GetProperty("DESCRIPTION"); + + if (codeProp != null && nameProp != null) + { + EnumerationFileJava enumFile = new EnumerationFileJava(); + enumFile.Name = ObservableEntity.DalNameToStandardName(tableProp.Name); + + foreach (var row in tableProp.GetValue(db) as IEnumerable) + { + EnumerationField field = new EnumerationField(); + field.Name = nameProp.GetValue(row).ToString().Replace(" ", ""); + field.Value = (int)codeProp.GetValue(row); + + if (descriptionProp != null) + { + field.Description = descriptionProp.GetValue(row).ToString(); + } + else + { + field.Description = nameProp.GetValue(row).ToString(); + } + enumFile.Fields.Add(field); + } + + String enumerationsPath = Path.Combine(targetPath, "enumerations"); + Directory.CreateDirectory(enumerationsPath); + String code = enumFile.GenerateCode(); + File.WriteAllText(Path.Combine(enumerationsPath, enumFile.Name + ".java"), code); + } + } + catch { } } + } + //Generate Enumerations... + + //Generate DAO... + TangoDAOJavaFile daoFile = new TangoDAOJavaFile(); + daoFile.Name = "TangoDAO"; - code = enumFile.GenerateCode(); - File.WriteAllText(Path.Combine(targetPath, enumFile.Name + ".cs"), code); + foreach (var table in typeof(RemoteDB).GetProperties().Where(x => typeof(IEnumerable).IsAssignableFrom(x.PropertyType))) + { + daoFile.Entities.Add(new TangoDAOJavaFile.TangoDAOEntity() + { + Name = ObservableEntity.DalNameToStandardName(table.Name).Singularize(false), + TableName = ObservableEntity.DalNameToStandardName(table.Name), + }); } + + String daoCode = daoFile.GenerateCode(); + String daoFolder = Path.Combine(targetPath, "dao"); + Directory.CreateDirectory(daoFolder); + File.WriteAllText(Path.Combine(daoFolder, "TangoDAO.java"), daoCode); + //Generate DAO... + } + + private static string FirstCharacterToLower(string str) + { + if (String.IsNullOrEmpty(str) || Char.IsLower(str, 0)) + return str; + + return Char.ToLowerInvariant(str[0]) + str.Substring(1); } } } diff --git a/Software/Visual_Studio/Tango.DAL.Observables/Tango.DAL.Observables.csproj b/Software/Visual_Studio/Tango.DAL.Observables/Tango.DAL.Observables.csproj index 5a8921a2d..69f4670ba 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/Tango.DAL.Observables.csproj +++ b/Software/Visual_Studio/Tango.DAL.Observables/Tango.DAL.Observables.csproj @@ -36,6 +36,9 @@ <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="Humanizer, Version=2.2.0.0, Culture=neutral, PublicKeyToken=979442b78dfc278e, processorArchitecture=MSIL"> + <HintPath>..\packages\Humanizer.Core.2.2.0\lib\netstandard1.0\Humanizer.dll</HintPath> + </Reference> <Reference Include="PresentationFramework" /> <Reference Include="System" /> <Reference Include="System.ComponentModel.DataAnnotations" /> @@ -53,14 +56,27 @@ <Compile Include="..\Versioning\GlobalVersionInfo.cs"> <Link>GlobalVersionInfo.cs</Link> </Compile> - <Compile Include="Entities\PermissionsEnum.cs" /> - <Compile Include="Entities\RolesEnum.cs" /> + <Compile Include="Entities\FiberSynth.cs" /> <Compile Include="EntityFieldNameAttribute.cs" /> + <Compile Include="Enumerations\Actions.cs" /> + <Compile Include="Enumerations\CartridgeTypes.cs" /> + <Compile Include="Enumerations\DispenserTypes.cs" /> + <Compile Include="Enumerations\Events.cs" /> + <Compile Include="Enumerations\FiberShapes.cs" /> + <Compile Include="Enumerations\FiberSynthesises.cs" /> + <Compile Include="Enumerations\LinearMassDensityUnits.cs" /> + <Compile Include="Enumerations\Liquids.cs" /> + <Compile Include="Enumerations\MediaConditions.cs" /> + <Compile Include="Enumerations\MediaMaterials.cs" /> + <Compile Include="Enumerations\MediaPurposes.cs" /> + <Compile Include="Enumerations\Permissions.cs" /> + <Compile Include="Enumerations\Roles.cs" /> <Compile Include="ExtensionMethods.cs" /> <Compile Include="IObservableEntity.cs" /> <Compile Include="LoadedObjectsService.cs" /> <Compile Include="ObservableEntity.cs" /> <Compile Include="ObservablesEntitiesAdapter.cs" /> + <Compile Include="ObservablesEntitiesAdapterExtension.cs" /> <Compile Include="ObservablesGenerator.cs" /> <Compile Include="Entities\Action.cs" /> <Compile Include="Entities\Address.cs" /> @@ -79,7 +95,6 @@ <Compile Include="Entities\Event.cs" /> <Compile Include="Entities\EventsAction.cs" /> <Compile Include="Entities\FiberShape.cs" /> - <Compile Include="Entities\FiberSynthesis.cs" /> <Compile Include="Entities\HardwareVersion.cs" /> <Compile Include="Entities\IdsPack.cs" /> <Compile Include="Entities\LinearMassDensityUnit.cs" /> @@ -89,7 +104,6 @@ <Compile Include="Entities\MachinesConfiguration.cs" /> <Compile Include="Entities\MachinesEvent.cs" /> <Compile Include="Entities\MachineVersion.cs" /> - <Compile Include="Entities\MachineVersionsConfiguration.cs" /> <Compile Include="Entities\MediaColor.cs" /> <Compile Include="Entities\MediaCondition.cs" /> <Compile Include="Entities\MediaMaterial.cs" /> @@ -133,6 +147,6 @@ </PreBuildEvent> </PropertyGroup> <PropertyGroup> - <PostBuildEvent>"$(TargetDir)dbobgen.exe" "$(SolutionDir)Tango.DAL.Observables\Entities"</PostBuildEvent> + <PostBuildEvent>"$(TargetDir)dbobgen.exe" "$(SolutionDir)Tango.DAL.Observables" -csharp</PostBuildEvent> </PropertyGroup> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DAL.Observables/packages.config b/Software/Visual_Studio/Tango.DAL.Observables/packages.config index 9256e1591..5148e8474 100644 --- a/Software/Visual_Studio/Tango.DAL.Observables/packages.config +++ b/Software/Visual_Studio/Tango.DAL.Observables/packages.config @@ -1,4 +1,46 @@ <?xml version="1.0" encoding="utf-8"?> <packages> <package id="EntityFramework" version="6.0.0" targetFramework="net46" /> + <package id="Humanizer" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.af" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.ar" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.bg" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.bn-BD" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.cs" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.da" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.de" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.el" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.es" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.fa" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.fi-FI" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.fr" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.fr-BE" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.he" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.hr" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.hu" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.id" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.it" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.ja" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.lv" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.nb" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.nb-NO" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.nl" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.pl" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.pt" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.ro" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.ru" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.sk" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.sl" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.sr" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.sr-Latn" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.sv" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.tr" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.uk" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.uz-Cyrl-UZ" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.uz-Latn-UZ" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.vi" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.zh-CN" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.zh-Hans" version="2.2.0" targetFramework="net46" /> + <package id="Humanizer.Core.zh-Hant" version="2.2.0" targetFramework="net46" /> </packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/APPLICATION_DISPLAY_PANEL_VERSIONS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/APPLICATION_DISPLAY_PANEL_VERSIONS.cs index 703011569..5d5c329e0 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/APPLICATION_DISPLAY_PANEL_VERSIONS.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/APPLICATION_DISPLAY_PANEL_VERSIONS.cs @@ -24,6 +24,8 @@ namespace Tango.DAL.Remote.DB public string GUID { get; set; } public System.DateTime LAST_UPDATED { get; set; } public bool DELETED { get; set; } + public double VERSION { get; set; } + public string NAME { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection<CONFIGURATION> CONFIGURATIONS { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/APPLICATION_FIRMWARE_VERSIONS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/APPLICATION_FIRMWARE_VERSIONS.cs index c1c51b057..249dcfe2b 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/APPLICATION_FIRMWARE_VERSIONS.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/APPLICATION_FIRMWARE_VERSIONS.cs @@ -24,6 +24,8 @@ namespace Tango.DAL.Remote.DB public string GUID { get; set; } public System.DateTime LAST_UPDATED { get; set; } public bool DELETED { get; set; } + public double VERSION { get; set; } + public string NAME { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection<CONFIGURATION> CONFIGURATIONS { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/APPLICATION_OS_VERSIONS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/APPLICATION_OS_VERSIONS.cs index 4c0535134..677e7f099 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/APPLICATION_OS_VERSIONS.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/APPLICATION_OS_VERSIONS.cs @@ -24,6 +24,8 @@ namespace Tango.DAL.Remote.DB public string GUID { get; set; } public System.DateTime LAST_UPDATED { get; set; } public bool DELETED { get; set; } + public double VERSION { get; set; } + public string NAME { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection<CONFIGURATION> CONFIGURATIONS { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/APPLICATION_VERSIONS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/APPLICATION_VERSIONS.cs index beeb8c59e..f5f0d29aa 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/APPLICATION_VERSIONS.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/APPLICATION_VERSIONS.cs @@ -24,6 +24,8 @@ namespace Tango.DAL.Remote.DB public string GUID { get; set; } public System.DateTime LAST_UPDATED { get; set; } public bool DELETED { get; set; } + public double VERSION { get; set; } + public string NAME { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection<CONFIGURATION> CONFIGURATIONS { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/CARTRIDGE.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/CARTRIDGE.cs index 282117f7f..9aea9e037 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/CARTRIDGE.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/CARTRIDGE.cs @@ -24,6 +24,7 @@ namespace Tango.DAL.Remote.DB public string GUID { get; set; } public System.DateTime LAST_UPDATED { get; set; } public bool DELETED { get; set; } + public string SERIAL_NUMBER { get; set; } public string CARTRIDGE_TYPE_GUID { get; set; } public virtual CARTRIDGE_TYPES CARTRIDGE_TYPES { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/CARTRIDGE_TYPES.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/CARTRIDGE_TYPES.cs index 5962542b0..c5c4227c5 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/CARTRIDGE_TYPES.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/CARTRIDGE_TYPES.cs @@ -24,6 +24,8 @@ namespace Tango.DAL.Remote.DB public string GUID { get; set; } public System.DateTime LAST_UPDATED { get; set; } public bool DELETED { get; set; } + public int CODE { get; set; } + public string NAME { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection<CARTRIDGE> CARTRIDGES { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/CONFIGURATION.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/CONFIGURATION.cs index 6afa03afd..041e8a403 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/CONFIGURATION.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/CONFIGURATION.cs @@ -18,7 +18,7 @@ namespace Tango.DAL.Remote.DB public CONFIGURATION() { this.IDS_PACKS = new HashSet<IDS_PACKS>(); - this.MACHINE_VERSIONS_CONFIGURATIONS = new HashSet<MACHINE_VERSIONS_CONFIGURATIONS>(); + this.MACHINE_VERSIONS = new HashSet<MACHINE_VERSIONS>(); this.MACHINES_CONFIGURATIONS = new HashSet<MACHINES_CONFIGURATIONS>(); } @@ -40,13 +40,13 @@ namespace Tango.DAL.Remote.DB public virtual APPLICATION_FIRMWARE_VERSIONS APPLICATION_FIRMWARE_VERSIONS { get; set; } public virtual APPLICATION_OS_VERSIONS APPLICATION_OS_VERSIONS { get; set; } public virtual APPLICATION_VERSIONS APPLICATION_VERSIONS { get; set; } - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] - public virtual ICollection<IDS_PACKS> IDS_PACKS { get; set; } public virtual EMBEDDED_FIRMWARE_VERSIONS EMBEDDED_FIRMWARE_VERSIONS { get; set; } public virtual EMBEDDED_SOFTWARE_VERSIONS EMBEDDED_SOFTWARE_VERSIONS { get; set; } public virtual HARDWARE_VERSIONS HARDWARE_VERSIONS { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] - public virtual ICollection<MACHINE_VERSIONS_CONFIGURATIONS> MACHINE_VERSIONS_CONFIGURATIONS { get; set; } + public virtual ICollection<IDS_PACKS> IDS_PACKS { get; set; } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] + public virtual ICollection<MACHINE_VERSIONS> MACHINE_VERSIONS { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection<MACHINES_CONFIGURATIONS> MACHINES_CONFIGURATIONS { get; set; } } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/DISPENSER.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/DISPENSER.cs index d93806560..60df18ed3 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/DISPENSER.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/DISPENSER.cs @@ -24,6 +24,7 @@ namespace Tango.DAL.Remote.DB public string GUID { get; set; } public System.DateTime LAST_UPDATED { get; set; } public bool DELETED { get; set; } + public string SERIAL_NUMBER { get; set; } public string DISPENSER_TYPE_GUID { get; set; } public virtual DISPENSER_TYPES DISPENSER_TYPES { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/DISPENSER_TYPES.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/DISPENSER_TYPES.cs index 29996cd88..c474764b8 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/DISPENSER_TYPES.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/DISPENSER_TYPES.cs @@ -24,6 +24,8 @@ namespace Tango.DAL.Remote.DB public string GUID { get; set; } public System.DateTime LAST_UPDATED { get; set; } public bool DELETED { get; set; } + public int CODE { get; set; } + public string NAME { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection<DISPENSER> DISPENSERS { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/EMBEDDED_FIRMWARE_VERSIONS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/EMBEDDED_FIRMWARE_VERSIONS.cs index 2c251b5e2..2ebc41626 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/EMBEDDED_FIRMWARE_VERSIONS.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/EMBEDDED_FIRMWARE_VERSIONS.cs @@ -24,6 +24,8 @@ namespace Tango.DAL.Remote.DB public string GUID { get; set; } public System.DateTime LAST_UPDATED { get; set; } public bool DELETED { get; set; } + public double VERSION { get; set; } + public string NAME { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection<CONFIGURATION> CONFIGURATIONS { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/EMBEDDED_SOFTWARE_VERSIONS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/EMBEDDED_SOFTWARE_VERSIONS.cs index 5e1546b20..470cbaa49 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/EMBEDDED_SOFTWARE_VERSIONS.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/EMBEDDED_SOFTWARE_VERSIONS.cs @@ -24,6 +24,8 @@ namespace Tango.DAL.Remote.DB public string GUID { get; set; } public System.DateTime LAST_UPDATED { get; set; } public bool DELETED { get; set; } + public double VERSION { get; set; } + public string NAME { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection<CONFIGURATION> CONFIGURATIONS { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/FIBER_SYNTHESISES.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/FIBER_SYNTHS.cs index 551041fa3..885eff2c7 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/FIBER_SYNTHESISES.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/FIBER_SYNTHS.cs @@ -12,10 +12,10 @@ namespace Tango.DAL.Remote.DB using System; using System.Collections.Generic; - public partial class FIBER_SYNTHESISES + public partial class FIBER_SYNTHS { [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] - public FIBER_SYNTHESISES() + public FIBER_SYNTHS() { this.RMLS = new HashSet<RML>(); } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/HARDWARE_VERSIONS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/HARDWARE_VERSIONS.cs index 237448341..ba114fe3c 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/HARDWARE_VERSIONS.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/HARDWARE_VERSIONS.cs @@ -24,6 +24,8 @@ namespace Tango.DAL.Remote.DB public string GUID { get; set; } public System.DateTime LAST_UPDATED { get; set; } public bool DELETED { get; set; } + public double VERSION { get; set; } + public string NAME { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection<CONFIGURATION> CONFIGURATIONS { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/IDS_PACKS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/IDS_PACKS.cs index a29ec7795..3f9a3da78 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/IDS_PACKS.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/IDS_PACKS.cs @@ -22,6 +22,7 @@ namespace Tango.DAL.Remote.DB public string DISPENSER_GUID { get; set; } public string LIQUID_GUID { get; set; } public string CARTRIDGE_GUID { get; set; } + public string NAME { get; set; } public virtual CARTRIDGE CARTRIDGE { get; set; } public virtual CONFIGURATION CONFIGURATION { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/LIQUID.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/LIQUID.cs index 85bded1c8..b6a4ce67c 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/LIQUID.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/LIQUID.cs @@ -28,6 +28,7 @@ namespace Tango.DAL.Remote.DB public int CODE { get; set; } public string NAME { get; set; } public double VERSION { get; set; } + public int COLOR { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection<IDS_PACKS> IDS_PACKS { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE_VERSIONS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE_VERSIONS.cs index bb4ef6e58..a93d8e5b8 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE_VERSIONS.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE_VERSIONS.cs @@ -17,7 +17,6 @@ namespace Tango.DAL.Remote.DB [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")] public MACHINE_VERSIONS() { - this.MACHINE_VERSIONS_CONFIGURATIONS = new HashSet<MACHINE_VERSIONS_CONFIGURATIONS>(); this.MACHINES = new HashSet<MACHINE>(); } @@ -26,9 +25,10 @@ namespace Tango.DAL.Remote.DB public System.DateTime LAST_UPDATED { get; set; } public bool DELETED { get; set; } public double VERSION { get; set; } + public string NAME { get; set; } + public string DEFAULT_CONFIGURATION_GUID { get; set; } - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] - public virtual ICollection<MACHINE_VERSIONS_CONFIGURATIONS> MACHINE_VERSIONS_CONFIGURATIONS { get; set; } + public virtual CONFIGURATION CONFIGURATION { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection<MACHINE> MACHINES { get; set; } } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE_VERSIONS_CONFIGURATIONS.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE_VERSIONS_CONFIGURATIONS.cs deleted file mode 100644 index c0f440300..000000000 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/MACHINE_VERSIONS_CONFIGURATIONS.cs +++ /dev/null @@ -1,27 +0,0 @@ -//------------------------------------------------------------------------------ -// <auto-generated> -// This code was generated from a template. -// -// Manual changes to this file may cause unexpected behavior in your application. -// Manual changes to this file will be overwritten if the code is regenerated. -// </auto-generated> -//------------------------------------------------------------------------------ - -namespace Tango.DAL.Remote.DB -{ - using System; - using System.Collections.Generic; - - public partial class MACHINE_VERSIONS_CONFIGURATIONS - { - public int ID { get; set; } - public System.Guid GUID { get; set; } - public System.DateTime LAST_UPDATED { get; set; } - public bool DELETED { get; set; } - public string MACHINE_VERSION_GUID { get; set; } - public string CONFIGURATION_GUID { get; set; } - - public virtual CONFIGURATION CONFIGURATION { get; set; } - public virtual MACHINE_VERSIONS MACHINE_VERSIONS { get; set; } - } -} diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs index 89a4fe609..3e7ff1dd4 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RML.cs @@ -31,7 +31,7 @@ namespace Tango.DAL.Remote.DB public string CONDITION_GUID { get; set; } public string LINEAR_MASS_DENSITY_UNIT_GUID { get; set; } public string FIBER_SHAPE_GUID { get; set; } - public string FIBER_SYNTHESIS_GUID { get; set; } + public string FIBER_SYNTH_GUID { get; set; } public double FIBER_SIZE { get; set; } public int NUMBER_OF_FIBERS { get; set; } public int PLIES_PER_FIBER { get; set; } @@ -44,7 +44,7 @@ namespace Tango.DAL.Remote.DB public double ESTIMATED_THREAD_DIAMETER { get; set; } public virtual FIBER_SHAPES FIBER_SHAPES { get; set; } - public virtual FIBER_SYNTHESISES FIBER_SYNTHESISES { get; set; } + public virtual FIBER_SYNTHS FIBER_SYNTHS { get; set; } public virtual LINEAR_MASS_DENSITY_UNITS LINEAR_MASS_DENSITY_UNITS { get; set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public virtual ICollection<LIQUIDS_RMLS> LIQUIDS_RMLS { get; set; } diff --git a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs index 2da6d31b1..1122fee30 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.Context.cs @@ -42,14 +42,13 @@ namespace Tango.DAL.Remote.DB public virtual DbSet<EVENT> EVENTS { get; set; } public virtual DbSet<EVENTS_ACTIONS> EVENTS_ACTIONS { get; set; } public virtual DbSet<FIBER_SHAPES> FIBER_SHAPES { get; set; } - public virtual DbSet<FIBER_SYNTHESISES> FIBER_SYNTHESISES { get; set; } + public virtual DbSet<FIBER_SYNTHS> FIBER_SYNTHS { get; set; } public virtual DbSet<HARDWARE_VERSIONS> HARDWARE_VERSIONS { get; set; } public virtual DbSet<IDS_PACKS> IDS_PACKS { get; set; } public virtual DbSet<LINEAR_MASS_DENSITY_UNITS> LINEAR_MASS_DENSITY_UNITS { get; set; } public virtual DbSet<LIQUID> LIQUIDS { get; set; } public virtual DbSet<LIQUIDS_RMLS> LIQUIDS_RMLS { get; set; } public virtual DbSet<MACHINE_VERSIONS> MACHINE_VERSIONS { get; set; } - public virtual DbSet<MACHINE_VERSIONS_CONFIGURATIONS> MACHINE_VERSIONS_CONFIGURATIONS { get; set; } public virtual DbSet<MACHINE> MACHINES { get; set; } public virtual DbSet<MACHINES_CONFIGURATIONS> MACHINES_CONFIGURATIONS { get; set; } public virtual DbSet<MACHINES_EVENTS> MACHINES_EVENTS { 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 618616584..d730ff6cc 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx +++ b/Software/Visual_Studio/Tango.DAL.Remote/DB/RemoteADO.edmx @@ -41,6 +41,8 @@ <Property Name="GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="LAST_UPDATED" Type="datetime" Nullable="false" /> <Property Name="DELETED" Type="bit" Nullable="false" /> + <Property Name="VERSION" Type="float" Nullable="false" /> + <Property Name="NAME" Type="nvarchar" MaxLength="50" Nullable="false" /> </EntityType> <EntityType Name="APPLICATION_FIRMWARE_VERSIONS"> <Key> @@ -50,6 +52,8 @@ <Property Name="GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="LAST_UPDATED" Type="datetime" Nullable="false" /> <Property Name="DELETED" Type="bit" Nullable="false" /> + <Property Name="VERSION" Type="float" Nullable="false" /> + <Property Name="NAME" Type="nvarchar" MaxLength="50" Nullable="false" /> </EntityType> <EntityType Name="APPLICATION_OS_VERSIONS"> <Key> @@ -59,6 +63,8 @@ <Property Name="GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="LAST_UPDATED" Type="datetime" Nullable="false" /> <Property Name="DELETED" Type="bit" Nullable="false" /> + <Property Name="VERSION" Type="float" Nullable="false" /> + <Property Name="NAME" Type="nvarchar" MaxLength="50" Nullable="false" /> </EntityType> <EntityType Name="APPLICATION_VERSIONS"> <Key> @@ -68,6 +74,8 @@ <Property Name="GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="LAST_UPDATED" Type="datetime" Nullable="false" /> <Property Name="DELETED" Type="bit" Nullable="false" /> + <Property Name="VERSION" Type="float" Nullable="false" /> + <Property Name="NAME" Type="nvarchar" MaxLength="50" Nullable="false" /> </EntityType> <EntityType Name="CARTRIDGE_TYPES"> <Key> @@ -77,6 +85,8 @@ <Property Name="GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="LAST_UPDATED" Type="datetime" Nullable="false" /> <Property Name="DELETED" Type="bit" Nullable="false" /> + <Property Name="CODE" Type="int" Nullable="false" /> + <Property Name="NAME" Type="nvarchar" MaxLength="50" Nullable="false" /> </EntityType> <EntityType Name="CARTRIDGES"> <Key> @@ -86,6 +96,7 @@ <Property Name="GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="LAST_UPDATED" Type="datetime" Nullable="false" /> <Property Name="DELETED" Type="bit" Nullable="false" /> + <Property Name="SERIAL_NUMBER" Type="nvarchar" MaxLength="50" Nullable="false" /> <Property Name="CARTRIDGE_TYPE_GUID" Type="varchar" MaxLength="36" Nullable="false" /> </EntityType> <EntityType Name="CONFIGURATIONS"> @@ -129,6 +140,8 @@ <Property Name="GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="LAST_UPDATED" Type="datetime" Nullable="false" /> <Property Name="DELETED" Type="bit" Nullable="false" /> + <Property Name="CODE" Type="int" Nullable="false" /> + <Property Name="NAME" Type="nvarchar" MaxLength="50" Nullable="false" /> </EntityType> <EntityType Name="DISPENSERS"> <Key> @@ -138,6 +151,7 @@ <Property Name="GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="LAST_UPDATED" Type="datetime" Nullable="false" /> <Property Name="DELETED" Type="bit" Nullable="false" /> + <Property Name="SERIAL_NUMBER" Type="nvarchar" MaxLength="50" Nullable="false" /> <Property Name="DISPENSER_TYPE_GUID" Type="varchar" MaxLength="36" Nullable="false" /> </EntityType> <EntityType Name="EMBEDDED_FIRMWARE_VERSIONS"> @@ -148,6 +162,8 @@ <Property Name="GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="LAST_UPDATED" Type="datetime" Nullable="false" /> <Property Name="DELETED" Type="bit" Nullable="false" /> + <Property Name="VERSION" Type="float" Nullable="false" /> + <Property Name="NAME" Type="nvarchar" MaxLength="50" Nullable="false" /> </EntityType> <EntityType Name="EMBEDDED_SOFTWARE_VERSIONS"> <Key> @@ -157,6 +173,8 @@ <Property Name="GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="LAST_UPDATED" Type="datetime" Nullable="false" /> <Property Name="DELETED" Type="bit" Nullable="false" /> + <Property Name="VERSION" Type="float" Nullable="false" /> + <Property Name="NAME" Type="nvarchar" MaxLength="50" Nullable="false" /> </EntityType> <EntityType Name="EVENTS"> <Key> @@ -192,7 +210,7 @@ <Property Name="NAME" Type="nvarchar" MaxLength="50" Nullable="false" /> <Property Name="CODE" Type="int" Nullable="false" /> </EntityType> - <EntityType Name="FIBER_SYNTHESISES"> + <EntityType Name="FIBER_SYNTHS"> <Key> <PropertyRef Name="GUID" /> </Key> @@ -211,6 +229,8 @@ <Property Name="GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="LAST_UPDATED" Type="datetime" Nullable="false" /> <Property Name="DELETED" Type="bit" Nullable="false" /> + <Property Name="VERSION" Type="float" Nullable="false" /> + <Property Name="NAME" Type="nvarchar" MaxLength="50" Nullable="false" /> </EntityType> <EntityType Name="IDS_PACKS"> <Key> @@ -224,6 +244,7 @@ <Property Name="DISPENSER_GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="LIQUID_GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="CARTRIDGE_GUID" Type="varchar" MaxLength="36" Nullable="false" /> + <Property Name="NAME" Type="nvarchar" MaxLength="50" Nullable="false" /> </EntityType> <EntityType Name="LINEAR_MASS_DENSITY_UNITS"> <Key> @@ -247,6 +268,7 @@ <Property Name="CODE" Type="int" Nullable="false" /> <Property Name="NAME" Type="nvarchar" MaxLength="50" Nullable="false" /> <Property Name="VERSION" Type="float" Nullable="false" /> + <Property Name="COLOR" Type="int" Nullable="false" /> </EntityType> <EntityType Name="LIQUIDS_RMLS"> <Key> @@ -268,17 +290,8 @@ <Property Name="LAST_UPDATED" Type="datetime" Nullable="false" /> <Property Name="DELETED" Type="bit" Nullable="false" /> <Property Name="VERSION" Type="float" Nullable="false" /> - </EntityType> - <EntityType Name="MACHINE_VERSIONS_CONFIGURATIONS"> - <Key> - <PropertyRef Name="GUID" /> - </Key> - <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" /> - <Property Name="GUID" Type="uniqueidentifier" Nullable="false" /> - <Property Name="LAST_UPDATED" Type="datetime" Nullable="false" /> - <Property Name="DELETED" Type="bit" Nullable="false" /> - <Property Name="MACHINE_VERSION_GUID" Type="varchar" MaxLength="36" Nullable="false" /> - <Property Name="CONFIGURATION_GUID" Type="varchar" MaxLength="36" Nullable="false" /> + <Property Name="NAME" Type="nvarchar" MaxLength="50" Nullable="false" /> + <Property Name="DEFAULT_CONFIGURATION_GUID" Type="varchar" MaxLength="36" Nullable="false" /> </EntityType> <EntityType Name="MACHINES"> <Key> @@ -401,7 +414,7 @@ <Property Name="CONDITION_GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="LINEAR_MASS_DENSITY_UNIT_GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="FIBER_SHAPE_GUID" Type="varchar" MaxLength="36" Nullable="false" /> - <Property Name="FIBER_SYNTHESIS_GUID" Type="varchar" MaxLength="36" Nullable="false" /> + <Property Name="FIBER_SYNTH_GUID" Type="varchar" MaxLength="36" Nullable="false" /> <Property Name="FIBER_SIZE" Type="float" Nullable="false" /> <Property Name="NUMBER_OF_FIBERS" Type="int" Nullable="false" /> <Property Name="PLIES_PER_FIBER" Type="int" Nullable="false" /> @@ -541,18 +554,6 @@ </Dependent> </ReferentialConstraint> </Association> - <Association Name="FK_CONFIGURATIONS_DISPENSERS_CONFIGURATIONS"> - <End Role="CONFIGURATIONS" Type="Self.CONFIGURATIONS" Multiplicity="1" /> - <End Role="IDS_PACKS" Type="Self.IDS_PACKS" Multiplicity="*" /> - <ReferentialConstraint> - <Principal Role="CONFIGURATIONS"> - <PropertyRef Name="GUID" /> - </Principal> - <Dependent Role="IDS_PACKS"> - <PropertyRef Name="DISPENSER_GUID" /> - </Dependent> - </ReferentialConstraint> - </Association> <Association Name="FK_CONFIGURATIONS_DISPENSERS_DISPENSERS"> <End Role="DISPENSERS" Type="Self.DISPENSERS" Multiplicity="1" /> <End Role="IDS_PACKS" Type="Self.IDS_PACKS" Multiplicity="*" /> @@ -649,6 +650,18 @@ </Dependent> </ReferentialConstraint> </Association> + <Association Name="FK_IDS_PACKS_CONFIGURATIONS"> + <End Role="CONFIGURATIONS" Type="Self.CONFIGURATIONS" Multiplicity="1" /> + <End Role="IDS_PACKS" Type="Self.IDS_PACKS" Multiplicity="*" /> + <ReferentialConstraint> + <Principal Role="CONFIGURATIONS"> + <PropertyRef Name="GUID" /> + </Principal> + <Dependent Role="IDS_PACKS"> + <PropertyRef Name="CONFIGURATION_GUID" /> + </Dependent> + </ReferentialConstraint> + </Association> <Association Name="FK_LIQUIDS_RML_LIQUIDS"> <End Role="LIQUIDS" Type="Self.LIQUIDS" Multiplicity="1" /> <End Role="LIQUIDS_RMLS" Type="Self.LIQUIDS_RMLS" Multiplicity="*" /> @@ -673,27 +686,15 @@ </Dependent> </ReferentialConstraint> </Association> - <Association Name="FK_MACHINE_VERSIONS_CONFIGURATIONS_CONFIGURATIONS"> + <Association Name="FK_MACHINE_VERSIONS_CONFIGURATIONS"> <End Role="CONFIGURATIONS" Type="Self.CONFIGURATIONS" Multiplicity="1" /> - <End Role="MACHINE_VERSIONS_CONFIGURATIONS" Type="Self.MACHINE_VERSIONS_CONFIGURATIONS" Multiplicity="*" /> + <End Role="MACHINE_VERSIONS" Type="Self.MACHINE_VERSIONS" Multiplicity="*" /> <ReferentialConstraint> <Principal Role="CONFIGURATIONS"> <PropertyRef Name="GUID" /> </Principal> - <Dependent Role="MACHINE_VERSIONS_CONFIGURATIONS"> - <PropertyRef Name="CONFIGURATION_GUID" /> - </Dependent> - </ReferentialConstraint> - </Association> - <Association Name="FK_MACHINE_VERSIONS_CONFIGURATIONS_MACHINE_VERSIONS"> - <End Role="MACHINE_VERSIONS" Type="Self.MACHINE_VERSIONS" Multiplicity="1" /> - <End Role="MACHINE_VERSIONS_CONFIGURATIONS" Type="Self.MACHINE_VERSIONS_CONFIGURATIONS" Multiplicity="*" /> - <ReferentialConstraint> - <Principal Role="MACHINE_VERSIONS"> - <PropertyRef Name="GUID" /> - </Principal> - <Dependent Role="MACHINE_VERSIONS_CONFIGURATIONS"> - <PropertyRef Name="MACHINE_VERSION_GUID" /> + <Dependent Role="MACHINE_VERSIONS"> + <PropertyRef Name="DEFAULT_CONFIGURATION_GUID" /> </Dependent> </ReferentialConstraint> </Association> @@ -826,14 +827,14 @@ </ReferentialConstraint> </Association> <Association Name="FK_RML_FIBER_SYNTHESIS"> - <End Role="FIBER_SYNTHESISES" Type="Self.FIBER_SYNTHESISES" Multiplicity="1" /> + <End Role="FIBER_SYNTHS" Type="Self.FIBER_SYNTHS" Multiplicity="1" /> <End Role="RMLS" Type="Self.RMLS" Multiplicity="*" /> <ReferentialConstraint> - <Principal Role="FIBER_SYNTHESISES"> + <Principal Role="FIBER_SYNTHS"> <PropertyRef Name="GUID" /> </Principal> <Dependent Role="RMLS"> - <PropertyRef Name="FIBER_SYNTHESIS_GUID" /> + <PropertyRef Name="FIBER_SYNTH_GUID" /> </Dependent> </ReferentialConstraint> </Association> @@ -1001,14 +1002,13 @@ <EntitySet Name="EVENTS" EntityType="Self.EVENTS" Schema="dbo" store:Type="Tables" /> <EntitySet Name="EVENTS_ACTIONS" EntityType="Self.EVENTS_ACTIONS" Schema="dbo" store:Type="Tables" /> <EntitySet Name="FIBER_SHAPES" EntityType="Self.FIBER_SHAPES" Schema="dbo" store:Type="Tables" /> - <EntitySet Name="FIBER_SYNTHESISES" EntityType="Self.FIBER_SYNTHESISES" Schema="dbo" store:Type="Tables" /> + <EntitySet Name="FIBER_SYNTHS" EntityType="Self.FIBER_SYNTHS" Schema="dbo" store:Type="Tables" /> <EntitySet Name="HARDWARE_VERSIONS" EntityType="Self.HARDWARE_VERSIONS" Schema="dbo" store:Type="Tables" /> <EntitySet Name="IDS_PACKS" EntityType="Self.IDS_PACKS" Schema="dbo" store:Type="Tables" /> <EntitySet Name="LINEAR_MASS_DENSITY_UNITS" EntityType="Self.LINEAR_MASS_DENSITY_UNITS" Schema="dbo" store:Type="Tables" /> <EntitySet Name="LIQUIDS" EntityType="Self.LIQUIDS" Schema="dbo" store:Type="Tables" /> <EntitySet Name="LIQUIDS_RMLS" EntityType="Self.LIQUIDS_RMLS" Schema="dbo" store:Type="Tables" /> <EntitySet Name="MACHINE_VERSIONS" EntityType="Self.MACHINE_VERSIONS" Schema="dbo" store:Type="Tables" /> - <EntitySet Name="MACHINE_VERSIONS_CONFIGURATIONS" EntityType="Self.MACHINE_VERSIONS_CONFIGURATIONS" Schema="dbo" store:Type="Tables" /> <EntitySet Name="MACHINES" EntityType="Self.MACHINES" Schema="dbo" store:Type="Tables" /> <EntitySet Name="MACHINES_CONFIGURATIONS" EntityType="Self.MACHINES_CONFIGURATIONS" Schema="dbo" store:Type="Tables" /> <EntitySet Name="MACHINES_EVENTS" EntityType="Self.MACHINES_EVENTS" Schema="dbo" store:Type="Tables" /> @@ -1048,10 +1048,6 @@ <End Role="CARTRIDGES" EntitySet="CARTRIDGES" /> <End Role="IDS_PACKS" EntitySet="IDS_PACKS" /> </AssociationSet> - <AssociationSet Name="FK_CONFIGURATIONS_DISPENSERS_CONFIGURATIONS" Association="Self.FK_CONFIGURATIONS_DISPENSERS_CONFIGURATIONS"> - <End Role="CONFIGURATIONS" EntitySet="CONFIGURATIONS" /> - <End Role="IDS_PACKS" EntitySet="IDS_PACKS" /> - </AssociationSet> <AssociationSet Name="FK_CONFIGURATIONS_DISPENSERS_DISPENSERS" Association="Self.FK_CONFIGURATIONS_DISPENSERS_DISPENSERS"> <End Role="DISPENSERS" EntitySet="DISPENSERS" /> <End Role="IDS_PACKS" EntitySet="IDS_PACKS" /> @@ -1084,6 +1080,10 @@ <End Role="EVENTS" EntitySet="EVENTS" /> <End Role="EVENTS_ACTIONS" EntitySet="EVENTS_ACTIONS" /> </AssociationSet> + <AssociationSet Name="FK_IDS_PACKS_CONFIGURATIONS" Association="Self.FK_IDS_PACKS_CONFIGURATIONS"> + <End Role="CONFIGURATIONS" EntitySet="CONFIGURATIONS" /> + <End Role="IDS_PACKS" EntitySet="IDS_PACKS" /> + </AssociationSet> <AssociationSet Name="FK_LIQUIDS_RML_LIQUIDS" Association="Self.FK_LIQUIDS_RML_LIQUIDS"> <End Role="LIQUIDS" EntitySet="LIQUIDS" /> <End Role="LIQUIDS_RMLS" EntitySet="LIQUIDS_RMLS" /> @@ -1092,13 +1092,9 @@ <End Role="RMLS" EntitySet="RMLS" /> <End Role="LIQUIDS_RMLS" EntitySet="LIQUIDS_RMLS" /> </AssociationSet> - <AssociationSet Name="FK_MACHINE_VERSIONS_CONFIGURATIONS_CONFIGURATIONS" Association="Self.FK_MACHINE_VERSIONS_CONFIGURATIONS_CONFIGURATIONS"> + <AssociationSet Name="FK_MACHINE_VERSIONS_CONFIGURATIONS" Association="Self.FK_MACHINE_VERSIONS_CONFIGURATIONS"> <End Role="CONFIGURATIONS" EntitySet="CONFIGURATIONS" /> - <End Role="MACHINE_VERSIONS_CONFIGURATIONS" EntitySet="MACHINE_VERSIONS_CONFIGURATIONS" /> - </AssociationSet> - <AssociationSet Name="FK_MACHINE_VERSIONS_CONFIGURATIONS_MACHINE_VERSIONS" Association="Self.FK_MACHINE_VERSIONS_CONFIGURATIONS_MACHINE_VERSIONS"> <End Role="MACHINE_VERSIONS" EntitySet="MACHINE_VERSIONS" /> - <End Role="MACHINE_VERSIONS_CONFIGURATIONS" EntitySet="MACHINE_VERSIONS_CONFIGURATIONS" /> </AssociationSet> <AssociationSet Name="FK_MACHINES_CONFIGURATIONS_CONFIGURATIONS" Association="Self.FK_MACHINES_CONFIGURATIONS_CONFIGURATIONS"> <End Role="CONFIGURATIONS" EntitySet="CONFIGURATIONS" /> @@ -1141,7 +1137,7 @@ <End Role="RMLS" EntitySet="RMLS" /> </AssociationSet> <AssociationSet Name="FK_RML_FIBER_SYNTHESIS" Association="Self.FK_RML_FIBER_SYNTHESIS"> - <End Role="FIBER_SYNTHESISES" EntitySet="FIBER_SYNTHESISES" /> + <End Role="FIBER_SYNTHS" EntitySet="FIBER_SYNTHS" /> <End Role="RMLS" EntitySet="RMLS" /> </AssociationSet> <AssociationSet Name="FK_RML_LINEAR_MASS_DENSITY_UNITS" Association="Self.FK_RML_LINEAR_MASS_DENSITY_UNITS"> @@ -1215,14 +1211,13 @@ <EntitySet Name="EVENTS" EntityType="RemoteModel.EVENT" /> <EntitySet Name="EVENTS_ACTIONS" EntityType="RemoteModel.EVENTS_ACTIONS" /> <EntitySet Name="FIBER_SHAPES" EntityType="RemoteModel.FIBER_SHAPES" /> - <EntitySet Name="FIBER_SYNTHESISES" EntityType="RemoteModel.FIBER_SYNTHESISES" /> + <EntitySet Name="FIBER_SYNTHS" EntityType="RemoteModel.FIBER_SYNTHS" /> <EntitySet Name="HARDWARE_VERSIONS" EntityType="RemoteModel.HARDWARE_VERSIONS" /> <EntitySet Name="IDS_PACKS" EntityType="RemoteModel.IDS_PACKS" /> <EntitySet Name="LINEAR_MASS_DENSITY_UNITS" EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" /> <EntitySet Name="LIQUIDS" EntityType="RemoteModel.LIQUID" /> <EntitySet Name="LIQUIDS_RMLS" EntityType="RemoteModel.LIQUIDS_RMLS" /> <EntitySet Name="MACHINE_VERSIONS" EntityType="RemoteModel.MACHINE_VERSIONS" /> - <EntitySet Name="MACHINE_VERSIONS_CONFIGURATIONS" EntityType="RemoteModel.MACHINE_VERSIONS_CONFIGURATIONS" /> <EntitySet Name="MACHINES" EntityType="RemoteModel.MACHINE" /> <EntitySet Name="MACHINES_CONFIGURATIONS" EntityType="RemoteModel.MACHINES_CONFIGURATIONS" /> <EntitySet Name="MACHINES_EVENTS" EntityType="RemoteModel.MACHINES_EVENTS" /> @@ -1274,10 +1269,6 @@ <End Role="CARTRIDGE" EntitySet="CARTRIDGES" /> <End Role="IDS_PACKS" EntitySet="IDS_PACKS" /> </AssociationSet> - <AssociationSet Name="FK_CONFIGURATIONS_DISPENSERS_CONFIGURATIONS" Association="RemoteModel.FK_CONFIGURATIONS_DISPENSERS_CONFIGURATIONS"> - <End Role="CONFIGURATION" EntitySet="CONFIGURATIONS" /> - <End Role="IDS_PACKS" EntitySet="IDS_PACKS" /> - </AssociationSet> <AssociationSet Name="FK_CONFIGURATIONS_EMBEDDED_FIRMWARE_VERSIONS" Association="RemoteModel.FK_CONFIGURATIONS_EMBEDDED_FIRMWARE_VERSIONS"> <End Role="EMBEDDED_FIRMWARE_VERSIONS" EntitySet="EMBEDDED_FIRMWARE_VERSIONS" /> <End Role="CONFIGURATION" EntitySet="CONFIGURATIONS" /> @@ -1290,9 +1281,13 @@ <End Role="HARDWARE_VERSIONS" EntitySet="HARDWARE_VERSIONS" /> <End Role="CONFIGURATION" EntitySet="CONFIGURATIONS" /> </AssociationSet> - <AssociationSet Name="FK_MACHINE_VERSIONS_CONFIGURATIONS_CONFIGURATIONS" Association="RemoteModel.FK_MACHINE_VERSIONS_CONFIGURATIONS_CONFIGURATIONS"> + <AssociationSet Name="FK_IDS_PACKS_CONFIGURATIONS" Association="RemoteModel.FK_IDS_PACKS_CONFIGURATIONS"> <End Role="CONFIGURATION" EntitySet="CONFIGURATIONS" /> - <End Role="MACHINE_VERSIONS_CONFIGURATIONS" EntitySet="MACHINE_VERSIONS_CONFIGURATIONS" /> + <End Role="IDS_PACKS" EntitySet="IDS_PACKS" /> + </AssociationSet> + <AssociationSet Name="FK_MACHINE_VERSIONS_CONFIGURATIONS" Association="RemoteModel.FK_MACHINE_VERSIONS_CONFIGURATIONS"> + <End Role="CONFIGURATION" EntitySet="CONFIGURATIONS" /> + <End Role="MACHINE_VERSIONS" EntitySet="MACHINE_VERSIONS" /> </AssociationSet> <AssociationSet Name="FK_MACHINES_CONFIGURATIONS_CONFIGURATIONS" Association="RemoteModel.FK_MACHINES_CONFIGURATIONS_CONFIGURATIONS"> <End Role="CONFIGURATION" EntitySet="CONFIGURATIONS" /> @@ -1327,7 +1322,7 @@ <End Role="RML" EntitySet="RMLS" /> </AssociationSet> <AssociationSet Name="FK_RML_FIBER_SYNTHESIS" Association="RemoteModel.FK_RML_FIBER_SYNTHESIS"> - <End Role="FIBER_SYNTHESISES" EntitySet="FIBER_SYNTHESISES" /> + <End Role="FIBER_SYNTHS" EntitySet="FIBER_SYNTHS" /> <End Role="RML" EntitySet="RMLS" /> </AssociationSet> <AssociationSet Name="FK_CONFIGURATIONS_DISPENSERS_LIQUIDS" Association="RemoteModel.FK_CONFIGURATIONS_DISPENSERS_LIQUIDS"> @@ -1346,10 +1341,6 @@ <End Role="RML" EntitySet="RMLS" /> <End Role="LIQUIDS_RMLS" EntitySet="LIQUIDS_RMLS" /> </AssociationSet> - <AssociationSet Name="FK_MACHINE_VERSIONS_CONFIGURATIONS_MACHINE_VERSIONS" Association="RemoteModel.FK_MACHINE_VERSIONS_CONFIGURATIONS_MACHINE_VERSIONS"> - <End Role="MACHINE_VERSIONS" EntitySet="MACHINE_VERSIONS" /> - <End Role="MACHINE_VERSIONS_CONFIGURATIONS" EntitySet="MACHINE_VERSIONS_CONFIGURATIONS" /> - </AssociationSet> <AssociationSet Name="FK_MACHINES_MACHINE_VERSIONS" Association="RemoteModel.FK_MACHINES_MACHINE_VERSIONS"> <End Role="MACHINE_VERSIONS" EntitySet="MACHINE_VERSIONS" /> <End Role="MACHINE" EntitySet="MACHINES" /> @@ -1446,6 +1437,8 @@ <Property Name="GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="LAST_UPDATED" Type="DateTime" Nullable="false" Precision="3" /> <Property Name="DELETED" Type="Boolean" Nullable="false" /> + <Property Name="VERSION" Type="Double" Nullable="false" /> + <Property Name="NAME" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" /> <NavigationProperty Name="CONFIGURATIONS" Relationship="RemoteModel.FK_CONFIGURATIONS_APPLICATION_DISPLAY_PANEL_VERSIONS" FromRole="APPLICATION_DISPLAY_PANEL_VERSIONS" ToRole="CONFIGURATION" /> </EntityType> <EntityType Name="APPLICATION_FIRMWARE_VERSIONS"> @@ -1456,6 +1449,8 @@ <Property Name="GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="LAST_UPDATED" Type="DateTime" Nullable="false" Precision="3" /> <Property Name="DELETED" Type="Boolean" Nullable="false" /> + <Property Name="VERSION" Type="Double" Nullable="false" /> + <Property Name="NAME" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" /> <NavigationProperty Name="CONFIGURATIONS" Relationship="RemoteModel.FK_CONFIGURATIONS_APPLICATION_FIRMWARE_VERSIONS" FromRole="APPLICATION_FIRMWARE_VERSIONS" ToRole="CONFIGURATION" /> </EntityType> <EntityType Name="APPLICATION_OS_VERSIONS"> @@ -1466,6 +1461,8 @@ <Property Name="GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="LAST_UPDATED" Type="DateTime" Nullable="false" Precision="3" /> <Property Name="DELETED" Type="Boolean" Nullable="false" /> + <Property Name="VERSION" Type="Double" Nullable="false" /> + <Property Name="NAME" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" /> <NavigationProperty Name="CONFIGURATIONS" Relationship="RemoteModel.FK_CONFIGURATIONS_APPLICATION_OS_VERSIONS" FromRole="APPLICATION_OS_VERSIONS" ToRole="CONFIGURATION" /> </EntityType> <EntityType Name="APPLICATION_VERSIONS"> @@ -1476,6 +1473,8 @@ <Property Name="GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="LAST_UPDATED" Type="DateTime" Nullable="false" Precision="3" /> <Property Name="DELETED" Type="Boolean" Nullable="false" /> + <Property Name="VERSION" Type="Double" Nullable="false" /> + <Property Name="NAME" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" /> <NavigationProperty Name="CONFIGURATIONS" Relationship="RemoteModel.FK_CONFIGURATIONS_APPLICATION_VERSIONS" FromRole="APPLICATION_VERSIONS" ToRole="CONFIGURATION" /> </EntityType> <EntityType Name="CARTRIDGE_TYPES"> @@ -1486,6 +1485,8 @@ <Property Name="GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="LAST_UPDATED" Type="DateTime" Nullable="false" Precision="3" /> <Property Name="DELETED" Type="Boolean" Nullable="false" /> + <Property Name="CODE" Type="Int32" Nullable="false" /> + <Property Name="NAME" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" /> <NavigationProperty Name="CARTRIDGES" Relationship="RemoteModel.FK_CARTRIDGES_CARTRIDGE_TYPES" FromRole="CARTRIDGE_TYPES" ToRole="CARTRIDGE" /> </EntityType> <EntityType Name="CARTRIDGE"> @@ -1496,6 +1497,7 @@ <Property Name="GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <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="true" /> <Property Name="CARTRIDGE_TYPE_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <NavigationProperty Name="CARTRIDGE_TYPES" Relationship="RemoteModel.FK_CARTRIDGES_CARTRIDGE_TYPES" FromRole="CARTRIDGE" ToRole="CARTRIDGE_TYPES" /> <NavigationProperty Name="IDS_PACKS" Relationship="RemoteModel.FK_CONFIGURATIONS_DISPENSERS_CARTRIDGES" FromRole="CARTRIDGE" ToRole="IDS_PACKS" /> @@ -1521,11 +1523,11 @@ <NavigationProperty Name="APPLICATION_FIRMWARE_VERSIONS" Relationship="RemoteModel.FK_CONFIGURATIONS_APPLICATION_FIRMWARE_VERSIONS" FromRole="CONFIGURATION" ToRole="APPLICATION_FIRMWARE_VERSIONS" /> <NavigationProperty Name="APPLICATION_OS_VERSIONS" Relationship="RemoteModel.FK_CONFIGURATIONS_APPLICATION_OS_VERSIONS" FromRole="CONFIGURATION" ToRole="APPLICATION_OS_VERSIONS" /> <NavigationProperty Name="APPLICATION_VERSIONS" Relationship="RemoteModel.FK_CONFIGURATIONS_APPLICATION_VERSIONS" FromRole="CONFIGURATION" ToRole="APPLICATION_VERSIONS" /> - <NavigationProperty Name="IDS_PACKS" Relationship="RemoteModel.FK_CONFIGURATIONS_DISPENSERS_CONFIGURATIONS" FromRole="CONFIGURATION" ToRole="IDS_PACKS" /> <NavigationProperty Name="EMBEDDED_FIRMWARE_VERSIONS" Relationship="RemoteModel.FK_CONFIGURATIONS_EMBEDDED_FIRMWARE_VERSIONS" FromRole="CONFIGURATION" ToRole="EMBEDDED_FIRMWARE_VERSIONS" /> <NavigationProperty Name="EMBEDDED_SOFTWARE_VERSIONS" Relationship="RemoteModel.FK_CONFIGURATIONS_EMBEDDED_SOFTWARE_VERSIONS" FromRole="CONFIGURATION" ToRole="EMBEDDED_SOFTWARE_VERSIONS" /> <NavigationProperty Name="HARDWARE_VERSIONS" Relationship="RemoteModel.FK_CONFIGURATIONS_HARDWARE_VERSIONS" FromRole="CONFIGURATION" ToRole="HARDWARE_VERSIONS" /> - <NavigationProperty Name="MACHINE_VERSIONS_CONFIGURATIONS" Relationship="RemoteModel.FK_MACHINE_VERSIONS_CONFIGURATIONS_CONFIGURATIONS" FromRole="CONFIGURATION" ToRole="MACHINE_VERSIONS_CONFIGURATIONS" /> + <NavigationProperty Name="IDS_PACKS" Relationship="RemoteModel.FK_IDS_PACKS_CONFIGURATIONS" FromRole="CONFIGURATION" ToRole="IDS_PACKS" /> + <NavigationProperty Name="MACHINE_VERSIONS" Relationship="RemoteModel.FK_MACHINE_VERSIONS_CONFIGURATIONS" FromRole="CONFIGURATION" ToRole="MACHINE_VERSIONS" /> <NavigationProperty Name="MACHINES_CONFIGURATIONS" Relationship="RemoteModel.FK_MACHINES_CONFIGURATIONS_CONFIGURATIONS" FromRole="CONFIGURATION" ToRole="MACHINES_CONFIGURATIONS" /> </EntityType> <EntityType Name="CONTACT"> @@ -1553,6 +1555,8 @@ <Property Name="GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="LAST_UPDATED" Type="DateTime" Nullable="false" Precision="3" /> <Property Name="DELETED" Type="Boolean" Nullable="false" /> + <Property Name="CODE" Type="Int32" Nullable="false" /> + <Property Name="NAME" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" /> <NavigationProperty Name="DISPENSERS" Relationship="RemoteModel.FK_DISPENSERS_DISPENSER_TYPES" FromRole="DISPENSER_TYPES" ToRole="DISPENSER" /> </EntityType> <EntityType Name="DISPENSER"> @@ -1563,6 +1567,7 @@ <Property Name="GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <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="true" /> <Property Name="DISPENSER_TYPE_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <NavigationProperty Name="DISPENSER_TYPES" Relationship="RemoteModel.FK_DISPENSERS_DISPENSER_TYPES" FromRole="DISPENSER" ToRole="DISPENSER_TYPES" /> <NavigationProperty Name="IDS_PACKS" Relationship="RemoteModel.FK_CONFIGURATIONS_DISPENSERS_DISPENSERS" FromRole="DISPENSER" ToRole="IDS_PACKS" /> @@ -1575,6 +1580,8 @@ <Property Name="GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="LAST_UPDATED" Type="DateTime" Nullable="false" Precision="3" /> <Property Name="DELETED" Type="Boolean" Nullable="false" /> + <Property Name="VERSION" Type="Double" Nullable="false" /> + <Property Name="NAME" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" /> <NavigationProperty Name="CONFIGURATIONS" Relationship="RemoteModel.FK_CONFIGURATIONS_EMBEDDED_FIRMWARE_VERSIONS" FromRole="EMBEDDED_FIRMWARE_VERSIONS" ToRole="CONFIGURATION" /> </EntityType> <EntityType Name="EMBEDDED_SOFTWARE_VERSIONS"> @@ -1585,6 +1592,8 @@ <Property Name="GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="LAST_UPDATED" Type="DateTime" Nullable="false" Precision="3" /> <Property Name="DELETED" Type="Boolean" Nullable="false" /> + <Property Name="VERSION" Type="Double" Nullable="false" /> + <Property Name="NAME" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" /> <NavigationProperty Name="CONFIGURATIONS" Relationship="RemoteModel.FK_CONFIGURATIONS_EMBEDDED_SOFTWARE_VERSIONS" FromRole="EMBEDDED_SOFTWARE_VERSIONS" ToRole="CONFIGURATION" /> </EntityType> <EntityType Name="EVENT"> @@ -1626,7 +1635,7 @@ <Property Name="CODE" Type="Int32" Nullable="false" /> <NavigationProperty Name="RMLS" Relationship="RemoteModel.FK_RML_FIBER_SHAPES" FromRole="FIBER_SHAPES" ToRole="RML" /> </EntityType> - <EntityType Name="FIBER_SYNTHESISES"> + <EntityType Name="FIBER_SYNTHS"> <Key> <PropertyRef Name="GUID" /> </Key> @@ -1636,7 +1645,7 @@ <Property Name="DELETED" Type="Boolean" Nullable="false" /> <Property Name="NAME" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" /> <Property Name="CODE" Type="Int32" Nullable="false" /> - <NavigationProperty Name="RMLS" Relationship="RemoteModel.FK_RML_FIBER_SYNTHESIS" FromRole="FIBER_SYNTHESISES" ToRole="RML" /> + <NavigationProperty Name="RMLS" Relationship="RemoteModel.FK_RML_FIBER_SYNTHESIS" FromRole="FIBER_SYNTHS" ToRole="RML" /> </EntityType> <EntityType Name="HARDWARE_VERSIONS"> <Key> @@ -1646,6 +1655,8 @@ <Property Name="GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="LAST_UPDATED" Type="DateTime" Nullable="false" Precision="3" /> <Property Name="DELETED" Type="Boolean" Nullable="false" /> + <Property Name="VERSION" Type="Double" Nullable="false" /> + <Property Name="NAME" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" /> <NavigationProperty Name="CONFIGURATIONS" Relationship="RemoteModel.FK_CONFIGURATIONS_HARDWARE_VERSIONS" FromRole="HARDWARE_VERSIONS" ToRole="CONFIGURATION" /> </EntityType> <EntityType Name="IDS_PACKS"> @@ -1660,8 +1671,9 @@ <Property Name="DISPENSER_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="LIQUID_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="CARTRIDGE_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> + <Property Name="NAME" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" /> <NavigationProperty Name="CARTRIDGE" Relationship="RemoteModel.FK_CONFIGURATIONS_DISPENSERS_CARTRIDGES" FromRole="IDS_PACKS" ToRole="CARTRIDGE" /> - <NavigationProperty Name="CONFIGURATION" Relationship="RemoteModel.FK_CONFIGURATIONS_DISPENSERS_CONFIGURATIONS" FromRole="IDS_PACKS" ToRole="CONFIGURATION" /> + <NavigationProperty Name="CONFIGURATION" Relationship="RemoteModel.FK_IDS_PACKS_CONFIGURATIONS" FromRole="IDS_PACKS" ToRole="CONFIGURATION" /> <NavigationProperty Name="DISPENSER" Relationship="RemoteModel.FK_CONFIGURATIONS_DISPENSERS_DISPENSERS" FromRole="IDS_PACKS" ToRole="DISPENSER" /> <NavigationProperty Name="LIQUID" Relationship="RemoteModel.FK_CONFIGURATIONS_DISPENSERS_LIQUIDS" FromRole="IDS_PACKS" ToRole="LIQUID" /> </EntityType> @@ -1688,6 +1700,7 @@ <Property Name="CODE" Type="Int32" Nullable="false" /> <Property Name="NAME" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" /> <Property Name="VERSION" Type="Double" Nullable="false" /> + <Property Name="COLOR" Type="Int32" Nullable="false" /> <NavigationProperty Name="IDS_PACKS" Relationship="RemoteModel.FK_CONFIGURATIONS_DISPENSERS_LIQUIDS" FromRole="LIQUID" ToRole="IDS_PACKS" /> <NavigationProperty Name="LIQUIDS_RMLS" Relationship="RemoteModel.FK_LIQUIDS_RML_LIQUIDS" FromRole="LIQUID" ToRole="LIQUIDS_RMLS" /> </EntityType> @@ -1713,22 +1726,11 @@ <Property Name="LAST_UPDATED" Type="DateTime" Nullable="false" Precision="3" /> <Property Name="DELETED" Type="Boolean" Nullable="false" /> <Property Name="VERSION" Type="Double" Nullable="false" /> - <NavigationProperty Name="MACHINE_VERSIONS_CONFIGURATIONS" Relationship="RemoteModel.FK_MACHINE_VERSIONS_CONFIGURATIONS_MACHINE_VERSIONS" FromRole="MACHINE_VERSIONS" ToRole="MACHINE_VERSIONS_CONFIGURATIONS" /> + <Property Name="NAME" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" /> + <Property Name="DEFAULT_CONFIGURATION_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> + <NavigationProperty Name="CONFIGURATION" Relationship="RemoteModel.FK_MACHINE_VERSIONS_CONFIGURATIONS" FromRole="MACHINE_VERSIONS" ToRole="CONFIGURATION" /> <NavigationProperty Name="MACHINES" Relationship="RemoteModel.FK_MACHINES_MACHINE_VERSIONS" FromRole="MACHINE_VERSIONS" ToRole="MACHINE" /> </EntityType> - <EntityType Name="MACHINE_VERSIONS_CONFIGURATIONS"> - <Key> - <PropertyRef Name="GUID" /> - </Key> - <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" /> - <Property Name="GUID" Type="Guid" Nullable="false" /> - <Property Name="LAST_UPDATED" Type="DateTime" Nullable="false" Precision="3" /> - <Property Name="DELETED" Type="Boolean" Nullable="false" /> - <Property Name="MACHINE_VERSION_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> - <Property Name="CONFIGURATION_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> - <NavigationProperty Name="CONFIGURATION" Relationship="RemoteModel.FK_MACHINE_VERSIONS_CONFIGURATIONS_CONFIGURATIONS" FromRole="MACHINE_VERSIONS_CONFIGURATIONS" ToRole="CONFIGURATION" /> - <NavigationProperty Name="MACHINE_VERSIONS" Relationship="RemoteModel.FK_MACHINE_VERSIONS_CONFIGURATIONS_MACHINE_VERSIONS" FromRole="MACHINE_VERSIONS_CONFIGURATIONS" ToRole="MACHINE_VERSIONS" /> - </EntityType> <EntityType Name="MACHINE"> <Key> <PropertyRef Name="GUID" /> @@ -1868,7 +1870,7 @@ <Property Name="CONDITION_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="LINEAR_MASS_DENSITY_UNIT_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="FIBER_SHAPE_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> - <Property Name="FIBER_SYNTHESIS_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> + <Property Name="FIBER_SYNTH_GUID" Type="String" Nullable="false" MaxLength="36" FixedLength="false" Unicode="false" /> <Property Name="FIBER_SIZE" Type="Double" Nullable="false" /> <Property Name="NUMBER_OF_FIBERS" Type="Int32" Nullable="false" /> <Property Name="PLIES_PER_FIBER" Type="Int32" Nullable="false" /> @@ -1880,7 +1882,7 @@ <Property Name="ELONGATION_AT_BREAK_PERCENTAGE" Type="Double" Nullable="false" /> <Property Name="ESTIMATED_THREAD_DIAMETER" Type="Double" Nullable="false" /> <NavigationProperty Name="FIBER_SHAPES" Relationship="RemoteModel.FK_RML_FIBER_SHAPES" FromRole="RML" ToRole="FIBER_SHAPES" /> - <NavigationProperty Name="FIBER_SYNTHESISES" Relationship="RemoteModel.FK_RML_FIBER_SYNTHESIS" FromRole="RML" ToRole="FIBER_SYNTHESISES" /> + <NavigationProperty Name="FIBER_SYNTHS" Relationship="RemoteModel.FK_RML_FIBER_SYNTHESIS" FromRole="RML" ToRole="FIBER_SYNTHS" /> <NavigationProperty Name="LINEAR_MASS_DENSITY_UNITS" Relationship="RemoteModel.FK_RML_LINEAR_MASS_DENSITY_UNITS" FromRole="RML" ToRole="LINEAR_MASS_DENSITY_UNITS" /> <NavigationProperty Name="LIQUIDS_RMLS" Relationship="RemoteModel.FK_LIQUIDS_RML_RML" FromRole="RML" ToRole="LIQUIDS_RMLS" /> <NavigationProperty Name="MEDIA_COLORS" Relationship="RemoteModel.FK_RML_MEDIA_COLORS" FromRole="RML" ToRole="MEDIA_COLORS" /> @@ -2065,18 +2067,6 @@ </Dependent> </ReferentialConstraint> </Association> - <Association Name="FK_CONFIGURATIONS_DISPENSERS_CONFIGURATIONS"> - <End Type="RemoteModel.CONFIGURATION" Role="CONFIGURATION" Multiplicity="1" /> - <End Type="RemoteModel.IDS_PACKS" Role="IDS_PACKS" Multiplicity="*" /> - <ReferentialConstraint> - <Principal Role="CONFIGURATION"> - <PropertyRef Name="GUID" /> - </Principal> - <Dependent Role="IDS_PACKS"> - <PropertyRef Name="DISPENSER_GUID" /> - </Dependent> - </ReferentialConstraint> - </Association> <Association Name="FK_CONFIGURATIONS_EMBEDDED_FIRMWARE_VERSIONS"> <End Type="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Role="EMBEDDED_FIRMWARE_VERSIONS" Multiplicity="1" /> <End Type="RemoteModel.CONFIGURATION" Role="CONFIGURATION" Multiplicity="*" /> @@ -2113,18 +2103,30 @@ </Dependent> </ReferentialConstraint> </Association> - <Association Name="FK_MACHINE_VERSIONS_CONFIGURATIONS_CONFIGURATIONS"> + <Association Name="FK_IDS_PACKS_CONFIGURATIONS"> <End Type="RemoteModel.CONFIGURATION" Role="CONFIGURATION" Multiplicity="1" /> - <End Type="RemoteModel.MACHINE_VERSIONS_CONFIGURATIONS" Role="MACHINE_VERSIONS_CONFIGURATIONS" Multiplicity="*" /> + <End Type="RemoteModel.IDS_PACKS" Role="IDS_PACKS" Multiplicity="*" /> <ReferentialConstraint> <Principal Role="CONFIGURATION"> <PropertyRef Name="GUID" /> </Principal> - <Dependent Role="MACHINE_VERSIONS_CONFIGURATIONS"> + <Dependent Role="IDS_PACKS"> <PropertyRef Name="CONFIGURATION_GUID" /> </Dependent> </ReferentialConstraint> </Association> + <Association Name="FK_MACHINE_VERSIONS_CONFIGURATIONS"> + <End Type="RemoteModel.CONFIGURATION" Role="CONFIGURATION" Multiplicity="1" /> + <End Type="RemoteModel.MACHINE_VERSIONS" Role="MACHINE_VERSIONS" Multiplicity="*" /> + <ReferentialConstraint> + <Principal Role="CONFIGURATION"> + <PropertyRef Name="GUID" /> + </Principal> + <Dependent Role="MACHINE_VERSIONS"> + <PropertyRef Name="DEFAULT_CONFIGURATION_GUID" /> + </Dependent> + </ReferentialConstraint> + </Association> <Association Name="FK_MACHINES_CONFIGURATIONS_CONFIGURATIONS"> <End Type="RemoteModel.CONFIGURATION" Role="CONFIGURATION" Multiplicity="1" /> <End Type="RemoteModel.MACHINES_CONFIGURATIONS" Role="MACHINES_CONFIGURATIONS" Multiplicity="*" /> @@ -2224,14 +2226,14 @@ </ReferentialConstraint> </Association> <Association Name="FK_RML_FIBER_SYNTHESIS"> - <End Type="RemoteModel.FIBER_SYNTHESISES" Role="FIBER_SYNTHESISES" Multiplicity="1" /> + <End Type="RemoteModel.FIBER_SYNTHS" Role="FIBER_SYNTHS" Multiplicity="1" /> <End Type="RemoteModel.RML" Role="RML" Multiplicity="*" /> <ReferentialConstraint> - <Principal Role="FIBER_SYNTHESISES"> + <Principal Role="FIBER_SYNTHS"> <PropertyRef Name="GUID" /> </Principal> <Dependent Role="RML"> - <PropertyRef Name="FIBER_SYNTHESIS_GUID" /> + <PropertyRef Name="FIBER_SYNTH_GUID" /> </Dependent> </ReferentialConstraint> </Association> @@ -2283,18 +2285,6 @@ </Dependent> </ReferentialConstraint> </Association> - <Association Name="FK_MACHINE_VERSIONS_CONFIGURATIONS_MACHINE_VERSIONS"> - <End Type="RemoteModel.MACHINE_VERSIONS" Role="MACHINE_VERSIONS" Multiplicity="1" /> - <End Type="RemoteModel.MACHINE_VERSIONS_CONFIGURATIONS" Role="MACHINE_VERSIONS_CONFIGURATIONS" Multiplicity="*" /> - <ReferentialConstraint> - <Principal Role="MACHINE_VERSIONS"> - <PropertyRef Name="GUID" /> - </Principal> - <Dependent Role="MACHINE_VERSIONS_CONFIGURATIONS"> - <PropertyRef Name="MACHINE_VERSION_GUID" /> - </Dependent> - </ReferentialConstraint> - </Association> <Association Name="FK_MACHINES_MACHINE_VERSIONS"> <End Type="RemoteModel.MACHINE_VERSIONS" Role="MACHINE_VERSIONS" Multiplicity="1" /> <End Type="RemoteModel.MACHINE" Role="MACHINE" Multiplicity="*" /> @@ -2508,6 +2498,8 @@ <EntitySetMapping Name="APPLICATION_DISPLAY_PANEL_VERSIONS"> <EntityTypeMapping TypeName="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS"> <MappingFragment StoreEntitySet="APPLICATION_DISPLAY_PANEL_VERSIONS"> + <ScalarProperty Name="NAME" ColumnName="NAME" /> + <ScalarProperty Name="VERSION" ColumnName="VERSION" /> <ScalarProperty Name="DELETED" ColumnName="DELETED" /> <ScalarProperty Name="LAST_UPDATED" ColumnName="LAST_UPDATED" /> <ScalarProperty Name="GUID" ColumnName="GUID" /> @@ -2518,6 +2510,8 @@ <EntitySetMapping Name="APPLICATION_FIRMWARE_VERSIONS"> <EntityTypeMapping TypeName="RemoteModel.APPLICATION_FIRMWARE_VERSIONS"> <MappingFragment StoreEntitySet="APPLICATION_FIRMWARE_VERSIONS"> + <ScalarProperty Name="NAME" ColumnName="NAME" /> + <ScalarProperty Name="VERSION" ColumnName="VERSION" /> <ScalarProperty Name="DELETED" ColumnName="DELETED" /> <ScalarProperty Name="LAST_UPDATED" ColumnName="LAST_UPDATED" /> <ScalarProperty Name="GUID" ColumnName="GUID" /> @@ -2528,6 +2522,8 @@ <EntitySetMapping Name="APPLICATION_OS_VERSIONS"> <EntityTypeMapping TypeName="RemoteModel.APPLICATION_OS_VERSIONS"> <MappingFragment StoreEntitySet="APPLICATION_OS_VERSIONS"> + <ScalarProperty Name="NAME" ColumnName="NAME" /> + <ScalarProperty Name="VERSION" ColumnName="VERSION" /> <ScalarProperty Name="DELETED" ColumnName="DELETED" /> <ScalarProperty Name="LAST_UPDATED" ColumnName="LAST_UPDATED" /> <ScalarProperty Name="GUID" ColumnName="GUID" /> @@ -2538,6 +2534,8 @@ <EntitySetMapping Name="APPLICATION_VERSIONS"> <EntityTypeMapping TypeName="RemoteModel.APPLICATION_VERSIONS"> <MappingFragment StoreEntitySet="APPLICATION_VERSIONS"> + <ScalarProperty Name="NAME" ColumnName="NAME" /> + <ScalarProperty Name="VERSION" ColumnName="VERSION" /> <ScalarProperty Name="DELETED" ColumnName="DELETED" /> <ScalarProperty Name="LAST_UPDATED" ColumnName="LAST_UPDATED" /> <ScalarProperty Name="GUID" ColumnName="GUID" /> @@ -2548,6 +2546,8 @@ <EntitySetMapping Name="CARTRIDGE_TYPES"> <EntityTypeMapping TypeName="RemoteModel.CARTRIDGE_TYPES"> <MappingFragment StoreEntitySet="CARTRIDGE_TYPES"> + <ScalarProperty Name="NAME" ColumnName="NAME" /> + <ScalarProperty Name="CODE" ColumnName="CODE" /> <ScalarProperty Name="DELETED" ColumnName="DELETED" /> <ScalarProperty Name="LAST_UPDATED" ColumnName="LAST_UPDATED" /> <ScalarProperty Name="GUID" ColumnName="GUID" /> @@ -2559,6 +2559,7 @@ <EntityTypeMapping TypeName="RemoteModel.CARTRIDGE"> <MappingFragment StoreEntitySet="CARTRIDGES"> <ScalarProperty Name="CARTRIDGE_TYPE_GUID" ColumnName="CARTRIDGE_TYPE_GUID" /> + <ScalarProperty Name="SERIAL_NUMBER" ColumnName="SERIAL_NUMBER" /> <ScalarProperty Name="DELETED" ColumnName="DELETED" /> <ScalarProperty Name="LAST_UPDATED" ColumnName="LAST_UPDATED" /> <ScalarProperty Name="GUID" ColumnName="GUID" /> @@ -2604,6 +2605,8 @@ <EntitySetMapping Name="DISPENSER_TYPES"> <EntityTypeMapping TypeName="RemoteModel.DISPENSER_TYPES"> <MappingFragment StoreEntitySet="DISPENSER_TYPES"> + <ScalarProperty Name="NAME" ColumnName="NAME" /> + <ScalarProperty Name="CODE" ColumnName="CODE" /> <ScalarProperty Name="DELETED" ColumnName="DELETED" /> <ScalarProperty Name="LAST_UPDATED" ColumnName="LAST_UPDATED" /> <ScalarProperty Name="GUID" ColumnName="GUID" /> @@ -2615,6 +2618,7 @@ <EntityTypeMapping TypeName="RemoteModel.DISPENSER"> <MappingFragment StoreEntitySet="DISPENSERS"> <ScalarProperty Name="DISPENSER_TYPE_GUID" ColumnName="DISPENSER_TYPE_GUID" /> + <ScalarProperty Name="SERIAL_NUMBER" ColumnName="SERIAL_NUMBER" /> <ScalarProperty Name="DELETED" ColumnName="DELETED" /> <ScalarProperty Name="LAST_UPDATED" ColumnName="LAST_UPDATED" /> <ScalarProperty Name="GUID" ColumnName="GUID" /> @@ -2625,6 +2629,8 @@ <EntitySetMapping Name="EMBEDDED_FIRMWARE_VERSIONS"> <EntityTypeMapping TypeName="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS"> <MappingFragment StoreEntitySet="EMBEDDED_FIRMWARE_VERSIONS"> + <ScalarProperty Name="NAME" ColumnName="NAME" /> + <ScalarProperty Name="VERSION" ColumnName="VERSION" /> <ScalarProperty Name="DELETED" ColumnName="DELETED" /> <ScalarProperty Name="LAST_UPDATED" ColumnName="LAST_UPDATED" /> <ScalarProperty Name="GUID" ColumnName="GUID" /> @@ -2635,6 +2641,8 @@ <EntitySetMapping Name="EMBEDDED_SOFTWARE_VERSIONS"> <EntityTypeMapping TypeName="RemoteModel.EMBEDDED_SOFTWARE_VERSIONS"> <MappingFragment StoreEntitySet="EMBEDDED_SOFTWARE_VERSIONS"> + <ScalarProperty Name="NAME" ColumnName="NAME" /> + <ScalarProperty Name="VERSION" ColumnName="VERSION" /> <ScalarProperty Name="DELETED" ColumnName="DELETED" /> <ScalarProperty Name="LAST_UPDATED" ColumnName="LAST_UPDATED" /> <ScalarProperty Name="GUID" ColumnName="GUID" /> @@ -2679,9 +2687,9 @@ </MappingFragment> </EntityTypeMapping> </EntitySetMapping> - <EntitySetMapping Name="FIBER_SYNTHESISES"> - <EntityTypeMapping TypeName="RemoteModel.FIBER_SYNTHESISES"> - <MappingFragment StoreEntitySet="FIBER_SYNTHESISES"> + <EntitySetMapping Name="FIBER_SYNTHS"> + <EntityTypeMapping TypeName="RemoteModel.FIBER_SYNTHS"> + <MappingFragment StoreEntitySet="FIBER_SYNTHS"> <ScalarProperty Name="CODE" ColumnName="CODE" /> <ScalarProperty Name="NAME" ColumnName="NAME" /> <ScalarProperty Name="DELETED" ColumnName="DELETED" /> @@ -2694,6 +2702,8 @@ <EntitySetMapping Name="HARDWARE_VERSIONS"> <EntityTypeMapping TypeName="RemoteModel.HARDWARE_VERSIONS"> <MappingFragment StoreEntitySet="HARDWARE_VERSIONS"> + <ScalarProperty Name="NAME" ColumnName="NAME" /> + <ScalarProperty Name="VERSION" ColumnName="VERSION" /> <ScalarProperty Name="DELETED" ColumnName="DELETED" /> <ScalarProperty Name="LAST_UPDATED" ColumnName="LAST_UPDATED" /> <ScalarProperty Name="GUID" ColumnName="GUID" /> @@ -2704,6 +2714,7 @@ <EntitySetMapping Name="IDS_PACKS"> <EntityTypeMapping TypeName="RemoteModel.IDS_PACKS"> <MappingFragment StoreEntitySet="IDS_PACKS"> + <ScalarProperty Name="NAME" ColumnName="NAME" /> <ScalarProperty Name="CARTRIDGE_GUID" ColumnName="CARTRIDGE_GUID" /> <ScalarProperty Name="LIQUID_GUID" ColumnName="LIQUID_GUID" /> <ScalarProperty Name="DISPENSER_GUID" ColumnName="DISPENSER_GUID" /> @@ -2730,6 +2741,7 @@ <EntitySetMapping Name="LIQUIDS"> <EntityTypeMapping TypeName="RemoteModel.LIQUID"> <MappingFragment StoreEntitySet="LIQUIDS"> + <ScalarProperty Name="COLOR" ColumnName="COLOR" /> <ScalarProperty Name="VERSION" ColumnName="VERSION" /> <ScalarProperty Name="NAME" ColumnName="NAME" /> <ScalarProperty Name="CODE" ColumnName="CODE" /> @@ -2755,6 +2767,8 @@ <EntitySetMapping Name="MACHINE_VERSIONS"> <EntityTypeMapping TypeName="RemoteModel.MACHINE_VERSIONS"> <MappingFragment StoreEntitySet="MACHINE_VERSIONS"> + <ScalarProperty Name="DEFAULT_CONFIGURATION_GUID" ColumnName="DEFAULT_CONFIGURATION_GUID" /> + <ScalarProperty Name="NAME" ColumnName="NAME" /> <ScalarProperty Name="VERSION" ColumnName="VERSION" /> <ScalarProperty Name="DELETED" ColumnName="DELETED" /> <ScalarProperty Name="LAST_UPDATED" ColumnName="LAST_UPDATED" /> @@ -2763,18 +2777,6 @@ </MappingFragment> </EntityTypeMapping> </EntitySetMapping> - <EntitySetMapping Name="MACHINE_VERSIONS_CONFIGURATIONS"> - <EntityTypeMapping TypeName="RemoteModel.MACHINE_VERSIONS_CONFIGURATIONS"> - <MappingFragment StoreEntitySet="MACHINE_VERSIONS_CONFIGURATIONS"> - <ScalarProperty Name="CONFIGURATION_GUID" ColumnName="CONFIGURATION_GUID" /> - <ScalarProperty Name="MACHINE_VERSION_GUID" ColumnName="MACHINE_VERSION_GUID" /> - <ScalarProperty Name="DELETED" ColumnName="DELETED" /> - <ScalarProperty Name="LAST_UPDATED" ColumnName="LAST_UPDATED" /> - <ScalarProperty Name="GUID" ColumnName="GUID" /> - <ScalarProperty Name="ID" ColumnName="ID" /> - </MappingFragment> - </EntityTypeMapping> - </EntitySetMapping> <EntitySetMapping Name="MACHINES"> <EntityTypeMapping TypeName="RemoteModel.MACHINE"> <MappingFragment StoreEntitySet="MACHINES"> @@ -2903,7 +2905,7 @@ <ScalarProperty Name="PLIES_PER_FIBER" ColumnName="PLIES_PER_FIBER" /> <ScalarProperty Name="NUMBER_OF_FIBERS" ColumnName="NUMBER_OF_FIBERS" /> <ScalarProperty Name="FIBER_SIZE" ColumnName="FIBER_SIZE" /> - <ScalarProperty Name="FIBER_SYNTHESIS_GUID" ColumnName="FIBER_SYNTHESIS_GUID" /> + <ScalarProperty Name="FIBER_SYNTH_GUID" ColumnName="FIBER_SYNTH_GUID" /> <ScalarProperty Name="FIBER_SHAPE_GUID" ColumnName="FIBER_SHAPE_GUID" /> <ScalarProperty Name="LINEAR_MASS_DENSITY_UNIT_GUID" ColumnName="LINEAR_MASS_DENSITY_UNIT_GUID" /> <ScalarProperty Name="CONDITION_GUID" ColumnName="CONDITION_GUID" /> 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 77ddcf4bd..a01b4fd94 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,45 @@ <!-- Diagram content (shape and connector positions) --> <edmx:Diagrams> <Diagram DiagramId="f9ae01d708754bbd997add25a4bacc79" Name="Diagram1"> - <EntityTypeShape EntityType="RemoteModel.ACTION" Width="1.5" PointX="9" PointY="36.625" /> - <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="1.5" PointY="36.625" /> - <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="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.5" /> - <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="1.5" PointY="40.875" /> - <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="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="15.625" /> - <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHESISES" Width="1.5" PointX="5.75" PointY="21.875" /> - <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="23.625" /> - <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="12.375" /> - <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="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="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="30.25" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_COLORS" Width="1.5" PointX="5.75" PointY="25" /> - <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="27.875" /> - <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="5.75" PointY="18.75" /> - <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.75" /> - <EntityTypeShape EntityType="RemoteModel.RML" Width="1.5" PointX="8" PointY="10.125" /> - <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="36.125" /> - <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="6" PointY="36.75" /> + <EntityTypeShape EntityType="RemoteModel.ACTION" Width="1.5" PointX="12.5" PointY="41.125" /> + <EntityTypeShape EntityType="RemoteModel.ADDRESS" Width="1.5" PointX="3" PointY="19.5" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_DISPLAY_PANEL_VERSIONS" Width="1.5" PointX="0.75" PointY="26.625" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="6.75" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_OS_VERSIONS" Width="1.5" PointX="0.75" PointY="11" /> + <EntityTypeShape EntityType="RemoteModel.APPLICATION_VERSIONS" Width="1.5" PointX="0.75" PointY="23.5" /> + <EntityTypeShape EntityType="RemoteModel.CARTRIDGE_TYPES" Width="1.5" PointX="0.75" PointY="3.5" /> + <EntityTypeShape EntityType="RemoteModel.CARTRIDGE" Width="1.5" PointX="3" PointY="1.125" /> + <EntityTypeShape EntityType="RemoteModel.CONFIGURATION" Width="1.5" PointX="3" PointY="5.125" /> + <EntityTypeShape EntityType="RemoteModel.CONTACT" Width="1.5" PointX="3" PointY="15.375" /> + <EntityTypeShape EntityType="RemoteModel.DISPENSER_TYPES" Width="1.5" PointX="0.75" PointY="30.25" /> + <EntityTypeShape EntityType="RemoteModel.DISPENSER" Width="1.5" PointX="3" PointY="30.125" /> + <EntityTypeShape EntityType="RemoteModel.EMBEDDED_FIRMWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="17.25" /> + <EntityTypeShape EntityType="RemoteModel.EMBEDDED_SOFTWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="20.375" /> + <EntityTypeShape EntityType="RemoteModel.EVENT" Width="1.5" PointX="7.5" PointY="15" /> + <EntityTypeShape EntityType="RemoteModel.EVENTS_ACTIONS" Width="1.5" PointX="14.75" PointY="15.125" /> + <EntityTypeShape EntityType="RemoteModel.FIBER_SHAPES" Width="1.5" PointX="11.75" PointY="4.5" /> + <EntityTypeShape EntityType="RemoteModel.FIBER_SYNTHS" Width="1.5" PointX="11.75" PointY="16.875" /> + <EntityTypeShape EntityType="RemoteModel.HARDWARE_VERSIONS" Width="1.5" PointX="0.75" PointY="14.125" /> + <EntityTypeShape EntityType="RemoteModel.IDS_PACKS" Width="1.5" PointX="5.25" PointY="6.125" /> + <EntityTypeShape EntityType="RemoteModel.LINEAR_MASS_DENSITY_UNITS" Width="1.5" PointX="11.75" PointY="0.75" /> + <EntityTypeShape EntityType="RemoteModel.LIQUID" Width="1.5" PointX="3" PointY="11.375" /> + <EntityTypeShape EntityType="RemoteModel.LIQUIDS_RMLS" Width="1.5" PointX="16.25" PointY="7" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE_VERSIONS" Width="1.5" PointX="5.25" PointY="10.75" /> + <EntityTypeShape EntityType="RemoteModel.MACHINE" Width="1.5" PointX="7.5" PointY="10.375" /> + <EntityTypeShape EntityType="RemoteModel.MACHINES_CONFIGURATIONS" Width="1.5" PointX="9.75" PointY="8.25" /> + <EntityTypeShape EntityType="RemoteModel.MACHINES_EVENTS" Width="1.5" PointX="9.75" PointY="12.5" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_COLORS" Width="1.5" PointX="11.75" PointY="26.25" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_CONDITIONS" Width="1.5" PointX="11.75" PointY="23.125" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_MATERIALS" Width="1.5" PointX="11.75" PointY="20" /> + <EntityTypeShape EntityType="RemoteModel.MEDIA_PURPOSES" Width="1.5" PointX="11.75" PointY="29.125" /> + <EntityTypeShape EntityType="RemoteModel.ORGANIZATION" Width="1.5" PointX="5.25" PointY="17.625" /> + <EntityTypeShape EntityType="RemoteModel.PERMISSION" Width="1.5" PointX="10.5" PointY="37.125" /> + <EntityTypeShape EntityType="RemoteModel.RML" Width="1.5" PointX="14" PointY="2.25" /> + <EntityTypeShape EntityType="RemoteModel.ROLE" Width="1.5" PointX="10.5" PointY="33" /> + <EntityTypeShape EntityType="RemoteModel.ROLES_PERMISSIONS" Width="1.5" PointX="12.75" PointY="33.125" /> + <EntityTypeShape EntityType="RemoteModel.SYNC_CONFIGURATIONS" Width="1.5" PointX="5.75" PointY="1.875" /> + <EntityTypeShape EntityType="RemoteModel.USER" Width="1.5" PointX="7.5" PointY="5.5" /> + <EntityTypeShape EntityType="RemoteModel.USERS_ROLES" Width="1.5" PointX="12.75" PointY="10.125" /> <AssociationConnector Association="RemoteModel.FK_EVENTS_ACTIONS_ACTIONS" /> <AssociationConnector Association="RemoteModel.FK_ORGANIZATIONS_ADDRESSES" /> <AssociationConnector Association="RemoteModel.FK_USERS_ADDRESSES" /> @@ -54,11 +53,11 @@ <AssociationConnector Association="RemoteModel.FK_CONFIGURATIONS_APPLICATION_VERSIONS" /> <AssociationConnector Association="RemoteModel.FK_CARTRIDGES_CARTRIDGE_TYPES" /> <AssociationConnector Association="RemoteModel.FK_CONFIGURATIONS_DISPENSERS_CARTRIDGES" /> - <AssociationConnector Association="RemoteModel.FK_CONFIGURATIONS_DISPENSERS_CONFIGURATIONS" /> <AssociationConnector Association="RemoteModel.FK_CONFIGURATIONS_EMBEDDED_FIRMWARE_VERSIONS" /> <AssociationConnector Association="RemoteModel.FK_CONFIGURATIONS_EMBEDDED_SOFTWARE_VERSIONS" /> <AssociationConnector Association="RemoteModel.FK_CONFIGURATIONS_HARDWARE_VERSIONS" /> - <AssociationConnector Association="RemoteModel.FK_MACHINE_VERSIONS_CONFIGURATIONS_CONFIGURATIONS" /> + <AssociationConnector Association="RemoteModel.FK_IDS_PACKS_CONFIGURATIONS" /> + <AssociationConnector Association="RemoteModel.FK_MACHINE_VERSIONS_CONFIGURATIONS" /> <AssociationConnector Association="RemoteModel.FK_MACHINES_CONFIGURATIONS_CONFIGURATIONS" /> <AssociationConnector Association="RemoteModel.FK_ORGANIZATIONS_CONTACTS" /> <AssociationConnector Association="RemoteModel.FK_USERS_CONTACTS" /> @@ -72,7 +71,6 @@ <AssociationConnector Association="RemoteModel.FK_RML_LINEAR_MASS_DENSITY_UNITS" /> <AssociationConnector Association="RemoteModel.FK_LIQUIDS_RML_LIQUIDS" /> <AssociationConnector Association="RemoteModel.FK_LIQUIDS_RML_RML" /> - <AssociationConnector Association="RemoteModel.FK_MACHINE_VERSIONS_CONFIGURATIONS_MACHINE_VERSIONS" /> <AssociationConnector Association="RemoteModel.FK_MACHINES_MACHINE_VERSIONS" /> <AssociationConnector Association="RemoteModel.FK_MACHINES_CONFIGURATIONS_MACHINES" /> <AssociationConnector Association="RemoteModel.FK_MACHINES_EVENTS_MACHINES" /> diff --git a/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj b/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj index 6ac6c35c3..a1241d0bc 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj +++ b/Software/Visual_Studio/Tango.DAL.Remote/Tango.DAL.Remote.csproj @@ -116,7 +116,7 @@ <Compile Include="DB\FIBER_SHAPES.cs"> <DependentUpon>RemoteADO.tt</DependentUpon> </Compile> - <Compile Include="DB\FIBER_SYNTHESISES.cs"> + <Compile Include="DB\FIBER_SYNTHS.cs"> <DependentUpon>RemoteADO.tt</DependentUpon> </Compile> <Compile Include="DB\HARDWARE_VERSIONS.cs"> @@ -146,9 +146,6 @@ <Compile Include="DB\MACHINE_VERSIONS.cs"> <DependentUpon>RemoteADO.tt</DependentUpon> </Compile> - <Compile Include="DB\MACHINE_VERSIONS_CONFIGURATIONS.cs"> - <DependentUpon>RemoteADO.tt</DependentUpon> - </Compile> <Compile Include="DB\MEDIA_COLORS.cs"> <DependentUpon>RemoteADO.tt</DependentUpon> </Compile> diff --git a/Software/Visual_Studio/Tango.Settings/MachineStudio.cs b/Software/Visual_Studio/Tango.Settings/MachineStudio.cs new file mode 100644 index 000000000..bc486b6c3 --- /dev/null +++ b/Software/Visual_Studio/Tango.Settings/MachineStudio.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Cryptography; + +namespace Tango.Settings +{ + public class MachineStudio + { + public String LastLoginEmail { get; set; } + + public String LastLoginPassword { get; set; } + + public bool RememberMe { get; set; } + } +} diff --git a/Software/Visual_Studio/Tango.Settings/SettingsCollection.cs b/Software/Visual_Studio/Tango.Settings/SettingsCollection.cs index c6f98f187..174be81f0 100644 --- a/Software/Visual_Studio/Tango.Settings/SettingsCollection.cs +++ b/Software/Visual_Studio/Tango.Settings/SettingsCollection.cs @@ -13,12 +13,15 @@ namespace Tango.Settings { public DataBase DataBase { get; set; } + public MachineStudio MachineStudio { get; set; } + /// <summary> /// Initializes a new instance of the <see cref="SettingsCollection"/> class. /// </summary> public SettingsCollection() { DataBase = new DataBase(); + MachineStudio = new MachineStudio(); } } } diff --git a/Software/Visual_Studio/Tango.Settings/Tango.Settings.csproj b/Software/Visual_Studio/Tango.Settings/Tango.Settings.csproj index 2d77a1b02..4b57b1f4d 100644 --- a/Software/Visual_Studio/Tango.Settings/Tango.Settings.csproj +++ b/Software/Visual_Studio/Tango.Settings/Tango.Settings.csproj @@ -44,6 +44,7 @@ <Link>GlobalVersionInfo.cs</Link> </Compile> <Compile Include="DataBase.cs" /> + <Compile Include="MachineStudio.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="SettingsCollection.cs" /> <Compile Include="SettingsManager.cs" /> diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/MultiTransitionControl.xaml.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/MultiTransitionControl.xaml.cs index 83cb49de2..8a74753f3 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Controls/MultiTransitionControl.xaml.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Controls/MultiTransitionControl.xaml.cs @@ -466,6 +466,19 @@ namespace Tango.SharedUI.Controls navigationCompleteAction(); navigationCompleteAction = null; } + + if (SelectedControl != null) + { + if (SelectedControl.Content is ITransitionView) + { + (SelectedControl.Content as ITransitionView).OnTransitionCompleted(); + } + } + } + + public interface ITransitionView + { + void OnTransitionCompleted(); } #endregion diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/ColorToIntegerConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/ColorToIntegerConverter.cs new file mode 100644 index 000000000..ef0896395 --- /dev/null +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/ColorToIntegerConverter.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using System.Windows.Media; +using Tango.Core.Helpers; + +namespace Tango.SharedUI.Converters +{ + public class ColorToIntegerConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return ColorHelper.IntegerToColor((int)value); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return ColorHelper.ColorToInteger((Color)value); + } + } +} diff --git a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj index 228322297..3d8bc2701 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj +++ b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj @@ -48,6 +48,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> @@ -81,6 +82,7 @@ <Compile Include="Converters\BooleanInverseConverter.cs" /> <Compile Include="Converters\BooleanToVisibilityConverter.cs" /> <Compile Include="Converters\BooleanToVisibilityInverseConverter.cs" /> + <Compile Include="Converters\ColorToIntegerConverter.cs" /> <Compile Include="Converters\DoubleToIntConverter.cs" /> <Compile Include="Converters\EnumToDescriptionConverter.cs" /> <Compile Include="Converters\EnumToItemsSourceConverter.cs" /> diff --git a/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs b/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs index 281a6c03d..0dac0ce48 100644 --- a/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs +++ b/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs @@ -1,6 +1,10 @@ using System; +using System.Collections; using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; using System.Linq; +using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -8,9 +12,56 @@ using Tango.Core; namespace Tango.SharedUI { - public abstract class ViewModel : ExtendedObject + public abstract class ViewModel : ExtendedObject, INotifyDataErrorInfo { + private List<KeyValuePair<String, String>> _currentErrors = new List<KeyValuePair<string, string>>(); + private bool _hasErrors; + public bool HasErrors + { + get { return _hasErrors; } + set { _hasErrors = value; RaisePropertyChangedAuto(); } + } + + public event EventHandler<DataErrorsChangedEventArgs> ErrorsChanged; + + public virtual IEnumerable GetErrors(string propertyName) + { + return _currentErrors.Where(x => x.Key == propertyName).Select(x => x.Value).ToList(); + } + + protected void RaiseError(String propName) + { + ErrorsChanged?.Invoke(this, new DataErrorsChangedEventArgs(propName)); + } + + protected bool Validate() + { + OnValidating(); + + HasErrors = false; + _currentErrors.Clear(); + + foreach (var prop in this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) + { + foreach (var validation in prop.GetCustomAttributes<ValidationAttribute>()) + { + if (!validation.IsValid(prop.GetValue(this))) + { + HasErrors = true; + _currentErrors.Add(new KeyValuePair<string, string>(prop.Name, validation.ErrorMessage)); + RaiseError(prop.Name); + } + } + } + + return !HasErrors; + } + + protected virtual void OnValidating() + { + + } } public abstract class ViewModel<T> : ViewModel where T : IView @@ -29,13 +80,13 @@ namespace Tango.SharedUI public ViewModel(T view, bool delayed) { - Task.Factory.StartNew(() => + Task.Factory.StartNew(() => { while (view == null) { Thread.Sleep(10); } - }).ContinueWith((c) => + }).ContinueWith((c) => { View = view; View.ViewAttached += (x, e) => diff --git a/Software/Visual_Studio/Tango.UnitTesting/CodeGeneration_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/CodeGeneration_TST.cs index abdded03e..a5f62b4a4 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/CodeGeneration_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/CodeGeneration_TST.cs @@ -18,7 +18,7 @@ namespace Tango.UnitTesting String tempPath = Helper.GetTempFolderPath(); ObservablesGenerator generator = new ObservablesGenerator(); - generator.Generate(tempPath); + generator.GenerateCSharp(tempPath); Helper.ShowInExplorer(tempPath); } diff --git a/Software/Visual_Studio/Tango.sln b/Software/Visual_Studio/Tango.sln index 53f85835e..831c15e13 100644 --- a/Software/Visual_Studio/Tango.sln +++ b/Software/Visual_Studio/Tango.sln @@ -1,7 +1,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26430.16 +VisualStudioVersion = 15.0.26430.14 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.Protobuf", "Tango.Protobuf\Tango.Protobuf.csproj", "{40073806-914E-4E78-97AB-FA9639308EBE}" EndProject @@ -93,6 +93,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.MachineStudio.Common" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.MachineStudio.Developer", "MachineStudio\Modules\Tango.MachineStudio.Developer\Tango.MachineStudio.Developer.csproj", "{CE4A0D11-08A2-4CD6-9908-D6C62E80D805}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.ColorPicker", "Tango.ColorPicker\Tango.ColorPicker.csproj", "{A2F5AF44-29FF-45D6-9D25-ECDA5CCE88B5}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -508,6 +510,18 @@ Global {CE4A0D11-08A2-4CD6-9908-D6C62E80D805}.Release|x64.Build.0 = Release|Any CPU {CE4A0D11-08A2-4CD6-9908-D6C62E80D805}.Release|x86.ActiveCfg = Release|Any CPU {CE4A0D11-08A2-4CD6-9908-D6C62E80D805}.Release|x86.Build.0 = Release|Any CPU + {A2F5AF44-29FF-45D6-9D25-ECDA5CCE88B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A2F5AF44-29FF-45D6-9D25-ECDA5CCE88B5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A2F5AF44-29FF-45D6-9D25-ECDA5CCE88B5}.Debug|x64.ActiveCfg = Debug|Any CPU + {A2F5AF44-29FF-45D6-9D25-ECDA5CCE88B5}.Debug|x64.Build.0 = Debug|Any CPU + {A2F5AF44-29FF-45D6-9D25-ECDA5CCE88B5}.Debug|x86.ActiveCfg = Debug|Any CPU + {A2F5AF44-29FF-45D6-9D25-ECDA5CCE88B5}.Debug|x86.Build.0 = Debug|Any CPU + {A2F5AF44-29FF-45D6-9D25-ECDA5CCE88B5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A2F5AF44-29FF-45D6-9D25-ECDA5CCE88B5}.Release|Any CPU.Build.0 = Release|Any CPU + {A2F5AF44-29FF-45D6-9D25-ECDA5CCE88B5}.Release|x64.ActiveCfg = Release|Any CPU + {A2F5AF44-29FF-45D6-9D25-ECDA5CCE88B5}.Release|x64.Build.0 = Release|Any CPU + {A2F5AF44-29FF-45D6-9D25-ECDA5CCE88B5}.Release|x86.ActiveCfg = Release|Any CPU + {A2F5AF44-29FF-45D6-9D25-ECDA5CCE88B5}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/Program.cs b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/Program.cs index 742b1428d..1b9b4c96a 100644 --- a/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/Program.cs +++ b/Software/Visual_Studio/Utilities/Tango.DBObservablesGenerator.CLI/Program.cs @@ -15,23 +15,26 @@ namespace Tango.DBObservablesGenerator.CLI { try { - if (args == null || args.Length == 0) + if (args == null || args.Length < 2) { ExitError("Invalid arguments!"); } String targetPath = args[0]; + String language = args[1]; ObservablesGenerator generator = new ObservablesGenerator(); - foreach (var file in Directory.GetFiles(targetPath)) - { - PathHelper.TryDeleteFile(file); - } - try { - generator.Generate(targetPath); + if (language.ToLower() == "-csharp") + { + generator.GenerateCSharp(targetPath); + } + else if (language.ToLower() == "-java") + { + generator.GenerateJava(targetPath); + } } catch (Exception ex) { |
