diff options
| author | Mirta <mirta@twine-s.com> | 2020-11-23 16:13:53 +0200 |
|---|---|---|
| committer | Mirta <mirta@twine-s.com> | 2020-11-23 16:13:53 +0200 |
| commit | 91c007adced573e09b77ab4be4a5aba623a816cc (patch) | |
| tree | 250221fc2def7d59f1393be8394f766faf576656 /Software/Visual_Studio/FSE | |
| parent | 4e9af2b852eb3b9eecfa09e9bc76869558e183cb (diff) | |
| parent | 50a3c0b857b4aa88a9e3970d69256f12b5b24eb8 (diff) | |
| download | Tango-91c007adced573e09b77ab4be4a5aba623a816cc.tar.gz Tango-91c007adced573e09b77ab4be4a5aba623a816cc.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/FSE')
97 files changed, 4665 insertions, 149 deletions
diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/Tango.FSE.Firmware_0qifchtm_wpftmp.csproj b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/Tango.FSE.Firmware_0qifchtm_wpftmp.csproj new file mode 100644 index 000000000..8708fb9b0 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/Tango.FSE.Firmware_0qifchtm_wpftmp.csproj @@ -0,0 +1,203 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" 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>{7CB96D74-8B71-4A81-B4E1-6DE7BFCA6174}</ProjectGuid> + <OutputType>library</OutputType> + <RootNamespace>Tango.FSE.Firmware</RootNamespace> + <AssemblyName>Tango.FSE.Firmware</AssemblyName> + <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + <Deterministic>true</Deterministic> + <NuGetPackageImportStamp> + </NuGetPackageImportStamp> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\..\..\Build\FSE\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>..\..\..\Build\FSE\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + </ItemGroup> + <ItemGroup> + <Compile Include="Contracts\ILogsView.cs" /> + <Compile Include="Dialogs\FirmwareUpdateView.xaml.cs"> + <DependentUpon>FirmwareUpdateView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\FirmwareUpdateViewVM.cs" /> + <Compile Include="Navigation\PeekLogsNavigationObject.cs" /> + <Compile Include="ViewModelLocator.cs" /> + <Compile Include="FirmwareModule.cs" /> + <Compile Include="ViewModels\FileSystemViewVM.cs" /> + <Compile Include="ViewModels\LogsViewVM.cs" /> + <Compile Include="ViewModels\MainViewVM.cs" /> + <Compile Include="ViewModels\UpdatesViewVM.cs" /> + <Compile Include="Views\FileSystemView.xaml.cs"> + <DependentUpon>FileSystemView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\LogsView.xaml.cs"> + <DependentUpon>LogsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\MainView.xaml.cs"> + <DependentUpon>MainView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\UpdatesView.xaml.cs"> + <DependentUpon>UpdatesView.xaml</DependentUpon> + </Compile> + </ItemGroup> + <ItemGroup> + <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> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <None Include="app.config" /> + <None Include="packages.config" /> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\PPC\Tango.PPC.Shared\Tango.PPC.Shared.csproj"> + <Project>{208C8BD8-72C6-4E3C-ACAA-351091A2ACC7}</Project> + <Name>Tango.PPC.Shared</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\SideChains\Tango.AutoComplete\Tango.AutoComplete.csproj"> + <Project>{bb2abb74-ba58-4812-83aa-ec8171f42df4}</Project> + <Name>Tango.AutoComplete</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.BL\Tango.BL.csproj"> + <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> + <Name>Tango.BL</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.FileSystem\Tango.FileSystem.csproj"> + <Project>{c6ebbbbe-2123-44dc-aef7-a0d47d736ac0}</Project> + <Name>Tango.FileSystem</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Integration\Tango.Integration.csproj"> + <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project> + <Name>Tango.Integration</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Logging\Tango.Logging.csproj"> + <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> + <Name>Tango.Logging</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.PMR\Tango.PMR.csproj"> + <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project> + <Name>Tango.PMR</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Settings\Tango.Settings.csproj"> + <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project> + <Name>Tango.Settings</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.SharedUI\Tango.SharedUI.csproj"> + <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> + <Name>Tango.SharedUI</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Transport\Tango.Transport.csproj"> + <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> + <Name>Tango.Transport</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.FSE.BL\Tango.FSE.BL.csproj"> + <Project>{834c81c3-09b5-45d7-be12-e7d1e6655a7c}</Project> + <Name>Tango.FSE.BL</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.FSE.Common\Tango.FSE.Common.csproj"> + <Project>{bc37cccb-7392-4f78-8d1c-e9629e6e046e}</Project> + <Name>Tango.FSE.Common</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + </ItemGroup> + <ItemGroup> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <Import Project="..\..\..\packages\MaterialDesignThemes.3.0.1\build\MaterialDesignThemes.targets" Condition="Exists('..\..\..\packages\MaterialDesignThemes.3.0.1\build\MaterialDesignThemes.targets')" /> + <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> + <PropertyGroup> + <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> + </PropertyGroup> + <Error Condition="!Exists('..\..\..\packages\MaterialDesignThemes.3.0.1\build\MaterialDesignThemes.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\MaterialDesignThemes.3.0.1\build\MaterialDesignThemes.targets'))" /> + </Target> + <ItemGroup> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\packages\ControlzEx.3.0.2.4\lib\net45\ControlzEx.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\packages\MahApps.Metro.1.6.5\lib\net46\MahApps.Metro.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\packages\MaterialDesignColors.1.2.2\lib\net45\MaterialDesignColors.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\packages\MaterialDesignThemes.3.0.1\lib\net45\MaterialDesignThemes.Wpf.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\Microsoft.CSharp.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\mscorlib.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\PresentationCore.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\PresentationFramework.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.ComponentModel.DataAnnotations.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Core.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Data.DataSetExtensions.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Data.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Net.Http.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\packages\ControlzEx.3.0.2.4\lib\net45\System.Windows.Interactivity.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Xaml.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Xml.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Xml.Linq.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\SideChains\Tango.AutoComplete\bin\Debug\Tango.AutoComplete.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.BL.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.Core.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Tango.FileSystem\bin\Debug\Tango.FileSystem.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\FSE\Debug\Tango.FSE.BL.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\FSE\Debug\Tango.FSE.Common.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.Integration.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.Logging.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.PMR.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\PPC\Debug\Tango.PPC.Shared.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.Settings.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.SharedUI.dll" /> + <ReferencePath Include="C:\DATA\Development\Tango\Software\Visual_Studio\Build\Core\Debug\Tango.Transport.dll" /> + <ReferencePath Include="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\WindowsBase.dll" /> + </ItemGroup> + <ItemGroup> + <Compile Include="C:\DATA\Development\Tango\Software\Visual_Studio\FSE\Modules\Tango.FSE.Firmware\obj\Debug\App.g.cs" /> + <Compile Include="C:\DATA\Development\Tango\Software\Visual_Studio\FSE\Modules\Tango.FSE.Firmware\obj\Debug\Dialogs\FirmwareUpdateView.g.cs" /> + <Compile Include="C:\DATA\Development\Tango\Software\Visual_Studio\FSE\Modules\Tango.FSE.Firmware\obj\Debug\Views\FileSystemView.g.cs" /> + <Compile Include="C:\DATA\Development\Tango\Software\Visual_Studio\FSE\Modules\Tango.FSE.Firmware\obj\Debug\Views\LogsView.g.cs" /> + <Compile Include="C:\DATA\Development\Tango\Software\Visual_Studio\FSE\Modules\Tango.FSE.Firmware\obj\Debug\Views\MainView.g.cs" /> + <Compile Include="C:\DATA\Development\Tango\Software\Visual_Studio\FSE\Modules\Tango.FSE.Firmware\obj\Debug\Views\UpdatesView.g.cs" /> + <Compile Include="C:\DATA\Development\Tango\Software\Visual_Studio\FSE\Modules\Tango.FSE.Firmware\obj\Debug\GeneratedInternalTypeHelper.g.cs" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/ViewModels/LogsViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/ViewModels/LogsViewVM.cs index ead8366ad..70c73a7be 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/ViewModels/LogsViewVM.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/ViewModels/LogsViewVM.cs @@ -200,8 +200,8 @@ namespace Tango.FSE.Firmware.ViewModels } catch (Exception ex) { - LogManager.Log(ex, "Error loading log files."); - NotificationProvider.PushErrorReportingSnackbar(ex, "PPC Module Error", "Could not initialize the remote PPC logs history."); + LogManager.Log(ex, "Error loading remote firmware log files."); + NotificationProvider.PushErrorReportingSnackbar(ex, "Firmware Module Error", "Could not initialize the remote Firmware logs history."); } finally { diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/App.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/App.xaml new file mode 100644 index 000000000..28a976e78 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/App.xaml @@ -0,0 +1,16 @@ +<Application x:Class="Tango.FSE.MachineConfiguration.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> + <Application.Resources> + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="pack://application:,,,/Tango.FSE.Common;component/Resources/Converters.xaml" /> + <ResourceDictionary Source="pack://application:,,,/Tango.FSE.Common;component/Resources/Colors.xaml" /> + <ResourceDictionary Source="pack://application:,,,/Tango.FSE.Common;component/Resources/Fonts.xaml" /> + <ResourceDictionary Source="pack://application:,,,/Tango.FSE.Common;component/Resources/Images.xaml" /> + <ResourceDictionary Source="pack://application:,,,/Tango.FSE.Common;component/Resources/Styles.xaml" /> + <ResourceDictionary Source="pack://application:,,,/Tango.FSE.Common;component/Resources/Controls.xaml" /> + </ResourceDictionary.MergedDictionaries> + </ResourceDictionary> + </Application.Resources> +</Application>
\ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ConfigurationModule.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ConfigurationModule.cs new file mode 100644 index 000000000..2f2c0dbb1 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ConfigurationModule.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; +using Tango.BL.Enumerations; +using Tango.FSE.Common; +using Tango.FSE.MachineConfiguration.Views; + +namespace Tango.FSE.MachineConfiguration +{ + [FSEModule(index: 7)] + public class ConfigurationModule : FSEModuleBase + { + public override string Name { get; } = "Configuration"; + public override string Description { get; } = "Configuration Module"; + public override Type MainViewType { get; } = typeof(MainView); + public override Permissions Permission { get; } = Permissions.FSE_RunFSE; + + public override void Dispose() + { + + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ConfigurationViewModel.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ConfigurationViewModel.cs new file mode 100644 index 000000000..bfcc60bcf --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ConfigurationViewModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.FSE.Common.Navigation; +using Tango.FSE.MachineConfiguration.Navigation; + +namespace Tango.FSE.MachineConfiguration +{ + public class ConfigurationViewModel : ModularNavigationFSEViewModel<ConfigurationView> + { + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Converters/DataStoreValueToStringConverter.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Converters/DataStoreValueToStringConverter.cs new file mode 100644 index 000000000..4acf7fd8e --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Converters/DataStoreValueToStringConverter.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.DataStore; + +namespace Tango.FSE.MachineConfiguration.Converters +{ + public class DataStoreValueToStringConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is IDataStoreItem item) + { + if (item != null) + { + return DataStoreHelper.FormatDataStoreItem(item).ToOneLine().Ellipsis(100); + } + } + + return value; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogView.xaml new file mode 100644 index 000000000..2fd3b9cdf --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogView.xaml @@ -0,0 +1,53 @@ +<UserControl x:Class="Tango.FSE.MachineConfiguration.Dialogs.DataStoreItemEditDialogView" + 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:material="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:local="clr-namespace:Tango.FSE.MachineConfiguration.Dialogs" + xmlns:controls="clr-namespace:Tango.FSE.Common.Controls;assembly=Tango.FSE.Common" + xmlns:sharedControls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:datastore="clr-namespace:Tango.DataStore;assembly=Tango.DataStore" + xmlns:pmr="clr-namespace:Tango.PMR.Common;assembly=Tango.PMR" + mc:Ignorable="d" + Width="400" Height="500" d:DataContext="{d:DesignInstance Type=local:DataStoreItemEditDialogViewVM, IsDesignTimeCreatable=False}" Background="{StaticResource FSE_PrimaryBackgroundLightBrush}" Foreground="{StaticResource FSE_PrimaryForegroundBrush}"> + <Grid Margin="10"> + <DockPanel> + <StackPanel DockPanel.Dock="Top" > + <StackPanel Orientation="Horizontal"> + <material:PackIcon Width="40" Height="40" Kind="Key" /> + <TextBlock Margin="10 0 0 0" FontSize="{StaticResource FSE_LargerFontSize}" VerticalAlignment="Center" Text="{Binding Item.Key}"></TextBlock> + </StackPanel> + </StackPanel> + + <StackPanel Margin="0 10 0 0" DockPanel.Dock="Top"> + <TextBlock FontSize="{StaticResource FSE_SmallerFontSize}" Foreground="{StaticResource FSE_GrayBrush}">Data Type</TextBlock> + + <DockPanel> + <Button Visibility="{Binding Type,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='Proto'}" DockPanel.Dock="Right" Style="{StaticResource FSE_RaisedButton_Dark_Hover_Accent_Foreground}" Margin="5 5 0 0" Padding="10 0" FontSize="{StaticResource FSE_SmallFontSize}" Height="20" VerticalAlignment="Center" Command="{Binding InitProtoCommand}" ToolTip="Create the basic structure for this proto message">Init</Button> + <Button Visibility="{Binding Type,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='Bytes'}" DockPanel.Dock="Right" Style="{StaticResource FSE_RaisedButton_Dark_Hover_Accent_Foreground}" Margin="5 5 0 0" Padding="10 0" FontSize="{StaticResource FSE_SmallFontSize}" Height="20" VerticalAlignment="Center" Command="{Binding LoadFileCommand}" ToolTip="Load bytes from file">Load File</Button> + <controls:FSERoundedCornersComboBox IsEnabled="{Binding EnableTypeChange}" FontSize="{StaticResource FSE_SmallFontSize}" Margin="0 5 0 0" ItemsSource="{Binding Source={x:Type datastore:DataType},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding Type,Mode=TwoWay}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></controls:FSERoundedCornersComboBox> + </DockPanel> + + <StackPanel Margin="0 10 0 0" Visibility="{Binding Type,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='Proto'}"> + <TextBlock Foreground="{StaticResource FSE_GrayBrush}" FontSize="{StaticResource FSE_SmallerFontSize}">Message Type</TextBlock> + <sharedControls:SearchComboBox IsEnabled="{Binding EnableTypeChange}" FontSize="{StaticResource FSE_SmallFontSize}" Margin="0 -5 5 0" ItemsSource="{Binding Source={x:Type pmr:MessageType},Converter={StaticResource EnumToItemsSourceConverter},ConverterParameter='false'}" SelectedItem="{Binding ProtoMessageType,Mode=TwoWay}"></sharedControls:SearchComboBox> + </StackPanel> + </StackPanel> + + <DockPanel DockPanel.Dock="Bottom" Margin="0 5 0 0" MinHeight="15"> + <DockPanel Visibility="{Binding HasError,Converter={StaticResource BooleanToVisibilityConverter}}"> + <material:PackIcon Margin="0 0 0 0" VerticalAlignment="Top" Kind="Alert" Foreground="{StaticResource FSE_ErrorBrush}" Width="12" Height="12" /> + <TextBlock Foreground="{StaticResource FSE_ErrorBrush}" Margin="5 0 0 0" Text="{Binding Error}" FontSize="{StaticResource FSE_SmallerFontSize}" TextWrapping="Wrap"></TextBlock> + </DockPanel> + </DockPanel> + + <Grid Margin="0 10 0 0"> + <TextBox Style="{StaticResource FSE_Rounded_Corners_TextBox_Multiline}" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" TextWrapping="NoWrap" Background="{StaticResource FSE_PrimaryBackgroundDarkBrush}" FontSize="{StaticResource FSE_SmallFontSize}" Text="{Binding EditingValue,UpdateSourceTrigger=PropertyChanged}"> + + </TextBox> + </Grid> + + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogView.xaml.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogView.xaml.cs new file mode 100644 index 000000000..b0f741759 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogView.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.FSE.MachineConfiguration.Dialogs +{ + /// <summary> + /// Interaction logic for DataStoreItemEditDialogView.xaml + /// </summary> + public partial class DataStoreItemEditDialogView : UserControl + { + public DataStoreItemEditDialogView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogViewVM.cs new file mode 100644 index 000000000..9cde14c6f --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/DataStoreItemEditDialogViewVM.cs @@ -0,0 +1,173 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.Core.DI; +using Tango.Core.ExtensionMethods; +using Tango.Core.Helpers; +using Tango.DataStore; +using Tango.DataStore.Editing; +using Tango.FSE.Common; +using Tango.FSE.Common.Storage; +using Tango.PMR; +using Tango.PMR.Common; + +namespace Tango.FSE.MachineConfiguration.Dialogs +{ + public class DataStoreItemEditDialogViewVM : FSEDialogViewVM + { + private const int MAX_FILE_SIZE_KB = 100; + + [TangoInject] + private IStorageProvider StorageProvider { get; set; } + + [TangoInject] + private Common.Notifications.INotificationProvider NotificationProvider { get; set; } + + private DataStoreItemModel _item; + public DataStoreItemModel Item + { + get { return _item; } + set + { + _item = value; + RaisePropertyChangedAuto(); + + if (_item.IsGlobal) + { + Value = _item.GlobalItem.Value; + } + else + { + Value = _item.Value; + } + + Type = _item.Type; + + if (Type == DataType.Proto) + { + ProtoMessageType = (Value as DataStoreProtoObject).MessageType; + } + + if (_item.IsGlobal) + { + EditingValue = _item.GlobalItem.ToString(); + } + else + { + EditingValue = _item.ToString(); + } + } + } + + public bool EnableTypeChange { get; set; } + + private Object _value; + public Object Value + { + get { return _value; } + set { _value = value; RaisePropertyChangedAuto(); } + } + + private DataType _type; + public DataType Type + { + get { return _type; } + set { _type = value; RaisePropertyChangedAuto(); OnEditingValueChanged(); } + } + + private MessageType _protoMessageType; + public MessageType ProtoMessageType + { + get { return _protoMessageType; } + set { _protoMessageType = value; RaisePropertyChangedAuto(); OnEditingValueChanged(); } + } + + private String _editingValue; + public String EditingValue + { + get { return _editingValue; } + set { _editingValue = value; RaisePropertyChangedAuto(); OnEditingValueChanged(); } + } + + private String _error; + public String Error + { + get { return _error; } + set { _error = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(HasError)); InvalidateRelayCommands(); } + } + + public bool HasError + { + get { return Error != null; } + } + + public RelayCommand LoadFileCommand { get; set; } + + public RelayCommand InitProtoCommand { get; set; } + + public DataStoreItemEditDialogViewVM() + { + EnableTypeChange = true; + LoadFileCommand = new RelayCommand(LoadFile); + InitProtoCommand = new RelayCommand(InitProto); + TangoIOC.Default.Inject(this); + } + + private void InitProto() + { + if (Type == DataType.Proto) + { + var type = MessageFactory.GetPMRTypeFromMessageType(ProtoMessageType); + var instance = Activator.CreateInstance(type); + EditingValue = instance.ToJsonString(); + } + } + + private async void LoadFile() + { + if (Type == DataType.Bytes) + { + var result = await StorageProvider.OpenFile("Load a file"); + if (result) + { + if ((new FileInfo(result.SelectedItem).Length / 1024) > MAX_FILE_SIZE_KB) + { + await NotificationProvider.ShowError($"The selected file size exceeds the maximum {MAX_FILE_SIZE_KB}kb allowed."); + return; + } + + var bytes = File.ReadAllBytes(result.SelectedItem); + Value = bytes; + _editingValue = Convert.ToBase64String(bytes); + RaisePropertyChanged(nameof(EditingValue)); + } + } + } + + private void OnEditingValueChanged() + { + if (EditingValue != null) + { + try + { + Value = DataStoreHelper.ParseDataStoreValue(Type, EditingValue, ProtoMessageType); + Error = null; + } + catch (Exception ex) + { + Error = ex.Message; + } + } + } + + protected override bool CanOK() + { + return base.CanOK() && !HasError; + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ExportDialogView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ExportDialogView.xaml new file mode 100644 index 000000000..55d0efc4f --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ExportDialogView.xaml @@ -0,0 +1,114 @@ +<UserControl x:Class="Tango.FSE.MachineConfiguration.Dialogs.ExportDialogView" + 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:material="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:controls="clr-namespace:Tango.FSE.Common.Controls;assembly=Tango.FSE.Common" + xmlns:local="clr-namespace:Tango.FSE.MachineConfiguration.Dialogs" + mc:Ignorable="d" + Width="800" Height="500" d:DataContext="{d:DesignInstance Type=local:ExportDialogViewVM, IsDesignTimeCreatable=False}" Background="{StaticResource FSE_PrimaryBackgroundLightBrush}" Foreground="{StaticResource FSE_PrimaryForegroundBrush}"> + <Grid Margin="10"> + <DockPanel> + <StackPanel DockPanel.Dock="Top" > + <StackPanel Orientation="Horizontal"> + <material:PackIcon Width="40" Height="40" Kind="Export" /> + <TextBlock Margin="10 0 0 0" FontSize="{StaticResource FSE_LargerFontSize}" VerticalAlignment="Center" Text="Export Data Store"></TextBlock> + </StackPanel> + </StackPanel> + + <DockPanel Margin="0 10 0 0"> + <Border Padding="5" MinWidth="100" BorderBrush="{StaticResource FSE_PrimaryBackgroundLightBrush}" BorderThickness="1" CornerRadius="3" Background="{StaticResource FSE_PrimaryBackgroundDarkBrush}"> + <ListBox x:Name="listCollections" ItemsSource="{Binding DataStore.Collections}" SelectedIndex="0"> + <ListBox.ItemTemplate> + <DataTemplate> + <DockPanel> + <CheckBox IsChecked="{Binding IsSelected}" /> + <TextBlock Margin="10 0 0 0" Text="{Binding Name}"></TextBlock> + </DockPanel> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + </Border> + + <Border Margin="5 0 0 0" Padding="5" MinWidth="100" BorderBrush="{StaticResource FSE_PrimaryBackgroundLightBrush}" BorderThickness="1" CornerRadius="3" Background="{StaticResource FSE_PrimaryBackgroundDarkBrush}"> + <DataGrid IsReadOnly="True" AutoGenerateColumns="False" Style="{StaticResource FSE_DataGrid}" CellStyle="{StaticResource FSE_DataGrid_Cell}" CanUserReorderColumns="False" CanUserSortColumns="False" ItemsSource="{Binding ElementName=listCollections,Path=SelectedItem.Items}"> + <DataGrid.Columns> + <DataGridTemplateColumn> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <UniformGrid Columns="2"> + <CheckBox IsEnabled="{Binding IsGlobal,Converter={StaticResource BooleanInverseConverter}}" IsChecked="{Binding IsSelected,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> + <material:PackIcon Kind="Key" Width="32" /> + </UniformGrid> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="KEY" Width="Auto"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock Text="{Binding Key}"></TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="TYPE" Width="Auto"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock Text="{Binding Type}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Foreground" Value="{StaticResource FSE_PrimaryForegroundBrush}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Type}" Value="Boolean"> + <Setter Property="Foreground" Value="#FF9BFF"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Type}" Value="Bytes"> + <Setter Property="Foreground" Value="#FFFBA3"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Type}" Value="Double"> + <Setter Property="Foreground" Value="#85B1FF"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Type}" Value="Float"> + <Setter Property="Foreground" Value="#FFDCB8"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Type}" Value="Int32"> + <Setter Property="Foreground" Value="#FF858D "></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Type}" Value="String"> + <Setter Property="Foreground" Value="#B9FFA5"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Type}" Value="Proto"> + <Setter Property="Foreground" Value="#A5FFF9"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="LOCAL" Width="1*"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock Text="{Binding FormattedValue,Converter={StaticResource StringToOneLineConverter},ConverterParameter='100',Mode=OneWay}" Visibility="{Binding IsDeleted,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="FontWeight" Value="Normal"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding HasDifference}" Value="True"> + <Setter Property="FontWeight" Value="Bold"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + </DataGrid.Columns> + </DataGrid> + </Border> + </DockPanel> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ExportDialogView.xaml.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ExportDialogView.xaml.cs new file mode 100644 index 000000000..4ee37908c --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ExportDialogView.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.FSE.MachineConfiguration.Dialogs +{ + /// <summary> + /// Interaction logic for ImportDialogView.xaml + /// </summary> + public partial class ExportDialogView : UserControl + { + public ExportDialogView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ExportDialogViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ExportDialogViewVM.cs new file mode 100644 index 000000000..9f605c79e --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ExportDialogViewVM.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DataStore.Editing; +using Tango.FSE.Common; + +namespace Tango.FSE.MachineConfiguration.Dialogs +{ + public class ExportDialogViewVM : FSEDialogViewVM + { + public DataStoreModel DataStore { get; set; } + + public ExportDialogViewVM() + { + OKText = "EXPORT"; + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ImportDialogView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ImportDialogView.xaml new file mode 100644 index 000000000..5d9653eb4 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ImportDialogView.xaml @@ -0,0 +1,113 @@ +<UserControl x:Class="Tango.FSE.MachineConfiguration.Dialogs.ImportDialogView" + 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:material="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:local="clr-namespace:Tango.FSE.MachineConfiguration.Dialogs" + mc:Ignorable="d" + Width="800" Height="500" d:DataContext="{d:DesignInstance Type=local:ImportDialogViewVM, IsDesignTimeCreatable=False}" Background="{StaticResource FSE_PrimaryBackgroundLightBrush}" Foreground="{StaticResource FSE_PrimaryForegroundBrush}"> + <Grid Margin="10"> + <DockPanel> + <StackPanel DockPanel.Dock="Top" > + <StackPanel Orientation="Horizontal"> + <material:PackIcon Width="40" Height="40" Kind="Import" /> + <TextBlock Margin="10 0 0 0" FontSize="{StaticResource FSE_LargerFontSize}" VerticalAlignment="Center" Text="Import Data Store"></TextBlock> + </StackPanel> + </StackPanel> + + <DockPanel Margin="0 10 0 0"> + <Border Padding="5" MinWidth="100" BorderBrush="{StaticResource FSE_PrimaryBackgroundLightBrush}" BorderThickness="1" CornerRadius="3" Background="{StaticResource FSE_PrimaryBackgroundDarkBrush}"> + <ListBox x:Name="listCollections" ItemsSource="{Binding DataStore.Collections}" SelectedIndex="0"> + <ListBox.ItemTemplate> + <DataTemplate> + <DockPanel> + <CheckBox IsChecked="{Binding IsSelected}" /> + <TextBlock Margin="10 0 0 0" Text="{Binding Name}"></TextBlock> + </DockPanel> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + </Border> + + <Border Margin="5 0 0 0" Padding="5" MinWidth="100" BorderBrush="{StaticResource FSE_PrimaryBackgroundLightBrush}" BorderThickness="1" CornerRadius="3" Background="{StaticResource FSE_PrimaryBackgroundDarkBrush}"> + <DataGrid IsReadOnly="True" AutoGenerateColumns="False" Style="{StaticResource FSE_DataGrid}" CellStyle="{StaticResource FSE_DataGrid_Cell}" CanUserReorderColumns="False" CanUserSortColumns="False" ItemsSource="{Binding ElementName=listCollections,Path=SelectedItem.Items}"> + <DataGrid.Columns> + <DataGridTemplateColumn> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <UniformGrid Columns="2"> + <CheckBox IsEnabled="{Binding IsGlobal,Converter={StaticResource BooleanInverseConverter}}" IsChecked="{Binding IsSelected,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> + <material:PackIcon Kind="Key" Width="32" /> + </UniformGrid> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="KEY" Width="Auto"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock Text="{Binding Key}"></TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="TYPE" Width="Auto"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock Text="{Binding Type}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Foreground" Value="{StaticResource FSE_PrimaryForegroundBrush}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Type}" Value="Boolean"> + <Setter Property="Foreground" Value="#FF9BFF"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Type}" Value="Bytes"> + <Setter Property="Foreground" Value="#FFFBA3"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Type}" Value="Double"> + <Setter Property="Foreground" Value="#85B1FF"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Type}" Value="Float"> + <Setter Property="Foreground" Value="#FFDCB8"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Type}" Value="Int32"> + <Setter Property="Foreground" Value="#FF858D "></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Type}" Value="String"> + <Setter Property="Foreground" Value="#B9FFA5"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Type}" Value="Proto"> + <Setter Property="Foreground" Value="#A5FFF9"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="LOCAL" Width="1*"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock Text="{Binding FormattedValue,Converter={StaticResource StringToOneLineConverter},ConverterParameter='100',Mode=OneWay}" Visibility="{Binding IsDeleted,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="FontWeight" Value="Normal"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding HasDifference}" Value="True"> + <Setter Property="FontWeight" Value="Bold"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + </DataGrid.Columns> + </DataGrid> + </Border> + </DockPanel> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ImportDialogView.xaml.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ImportDialogView.xaml.cs new file mode 100644 index 000000000..bc729601f --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ImportDialogView.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.FSE.MachineConfiguration.Dialogs +{ + /// <summary> + /// Interaction logic for ImportDialogView.xaml + /// </summary> + public partial class ImportDialogView : UserControl + { + public ImportDialogView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ImportDialogViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ImportDialogViewVM.cs new file mode 100644 index 000000000..a4e53e85b --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Dialogs/ImportDialogViewVM.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DataStore.Editing; +using Tango.FSE.Common; + +namespace Tango.FSE.MachineConfiguration.Dialogs +{ + public class ImportDialogViewVM : FSEDialogViewVM + { + public DataStoreModel DataStore { get; set; } + + public ImportDialogViewVM() + { + OKText = "IMPORT"; + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Images/configuration.png b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Images/configuration.png Binary files differnew file mode 100644 index 000000000..f46a49d23 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Images/configuration.png diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Images/data_collection.png b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Images/data_collection.png Binary files differnew file mode 100644 index 000000000..95163a226 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Images/data_collection.png diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Messages/EditingCompositionLoadedMessage.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Messages/EditingCompositionLoadedMessage.cs new file mode 100644 index 000000000..b858c34e0 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Messages/EditingCompositionLoadedMessage.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.FSE.BL.Services; +using static Tango.FSE.BL.Services.MachineConfigurationService; + +namespace Tango.FSE.MachineConfiguration.Messages +{ + public class EditingCompositionLoadedMessage + { + public MachineEditingComposition EditingComposition { get; set; } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Models/CsvModel.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Models/CsvModel.cs new file mode 100644 index 000000000..1e12fda4b --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Models/CsvModel.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.FSE.MachineConfiguration.Models +{ + public class CsvModel + { + public String Date { get; set; } + public String Collection { get; set; } + public String Key { get; set; } + public String Type { get; set; } + public String MessageType { get; set; } + public String Value { get; set; } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Navigation/ConfigurationNavigationManager.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Navigation/ConfigurationNavigationManager.cs new file mode 100644 index 000000000..c1dfdfda7 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Navigation/ConfigurationNavigationManager.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using Tango.FSE.Common.Navigation; +using Tango.SharedUI.Controls; + +namespace Tango.FSE.MachineConfiguration.Navigation +{ + public class ConfigurationNavigationManager : ModularNavigationManager<ConfigurationView> + { + public ConfigurationNavigationManager(FrameworkElement navigationControlParent) : base(navigationControlParent) + { + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Navigation/ConfigurationView.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Navigation/ConfigurationView.cs new file mode 100644 index 000000000..187e44ac9 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Navigation/ConfigurationView.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.FSE.MachineConfiguration.Navigation +{ + public enum ConfigurationView + { + SelectionView, + MachineView, + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Properties/AssemblyInfo.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..027dd9516 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tango.FSE.MachineConfiguration")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Tango.FSE.MachineConfiguration")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file +//inside a <PropertyGroup>. For example, if you are using US english +//in your source files, set the <UICulture> to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[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) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Properties/Resources.Designer.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Properties/Resources.Designer.cs new file mode 100644 index 000000000..830d15d6a --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// <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.FSE.MachineConfiguration.Properties +{ + + + /// <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 ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.FSE.MachineConfiguration.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/FSE/Modules/Tango.FSE.MachineConfiguration/Properties/Resources.resx b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/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/FSE/Modules/Tango.FSE.MachineConfiguration/Properties/Settings.Designer.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Properties/Settings.Designer.cs new file mode 100644 index 000000000..e41736026 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// <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.FSE.MachineConfiguration.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.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/FSE/Modules/Tango.FSE.MachineConfiguration/Properties/Settings.settings b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/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/FSE/Modules/Tango.FSE.MachineConfiguration/Tango.FSE.MachineConfiguration.csproj b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Tango.FSE.MachineConfiguration.csproj new file mode 100644 index 000000000..6e48f0ee7 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Tango.FSE.MachineConfiguration.csproj @@ -0,0 +1,266 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" 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>{15BCB5BB-731E-4E2D-AA28-75485050A8DC}</ProjectGuid> + <OutputType>library</OutputType> + <RootNamespace>Tango.FSE.MachineConfiguration</RootNamespace> + <AssemblyName>Tango.FSE.MachineConfiguration</AssemblyName> + <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + <Deterministic>true</Deterministic> + <NuGetPackageImportStamp> + </NuGetPackageImportStamp> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\..\..\Build\FSE\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>..\..\..\Build\FSE\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </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="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath> + </Reference> + <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> + </Reference> + <Reference Include="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="MahApps.Metro, Version=1.6.5.1, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MahApps.Metro.1.6.5\lib\net46\MahApps.Metro.dll</HintPath> + </Reference> + <Reference Include="MaterialDesignColors, Version=1.2.2.920, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MaterialDesignColors.1.2.2\lib\net45\MaterialDesignColors.dll</HintPath> + </Reference> + <Reference Include="MaterialDesignThemes.Wpf, Version=3.0.1.920, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\MaterialDesignThemes.3.0.1\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath> + </Reference> + <Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.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\ControlzEx.3.0.2.4\lib\net45\System.Windows.Interactivity.dll</HintPath> + </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> + <Compile Include="ConfigurationViewModel.cs" /> + <Compile Include="Converters\DataStoreValueToStringConverter.cs" /> + <Compile Include="Dialogs\DataStoreItemEditDialogView.xaml.cs"> + <DependentUpon>DataStoreItemEditDialogView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\DataStoreItemEditDialogViewVM.cs" /> + <Compile Include="Dialogs\ExportDialogView.xaml.cs"> + <DependentUpon>ExportDialogView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\ImportDialogView.xaml.cs"> + <DependentUpon>ImportDialogView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\ExportDialogViewVM.cs" /> + <Compile Include="Dialogs\ImportDialogViewVM.cs" /> + <Compile Include="Messages\EditingCompositionLoadedMessage.cs" /> + <Compile Include="Models\CsvModel.cs" /> + <Compile Include="Navigation\ConfigurationNavigationManager.cs" /> + <Compile Include="Navigation\ConfigurationView.cs" /> + <Compile Include="ViewModelLocator.cs" /> + <Compile Include="ConfigurationModule.cs" /> + <Compile Include="ViewModels\SettingsViewVM.cs" /> + <Compile Include="ViewModels\DataStoreViewVM.cs" /> + <Compile Include="ViewModels\MachineViewVM.cs" /> + <Compile Include="ViewModels\MainViewVM.cs" /> + <Compile Include="ViewModels\SelectionViewVM.cs" /> + <Compile Include="Views\SettingsView.xaml.cs"> + <DependentUpon>SettingsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DataStoreView.xaml.cs"> + <DependentUpon>DataStoreView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\SelectionView.xaml.cs"> + <DependentUpon>SelectionView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\MachineView.xaml.cs"> + <DependentUpon>MachineView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\MainView.xaml.cs"> + <DependentUpon>MainView.xaml</DependentUpon> + </Compile> + </ItemGroup> + <ItemGroup> + <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> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <None Include="app.config" /> + <None Include="packages.config" /> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\SideChains\Tango.AutoComplete\Tango.AutoComplete.csproj"> + <Project>{bb2abb74-ba58-4812-83aa-ec8171f42df4}</Project> + <Name>Tango.AutoComplete</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.BL\Tango.BL.csproj"> + <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> + <Name>Tango.BL</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.CSV\Tango.CSV.csproj"> + <Project>{58e8825f-0c96-449c-b320-1e82b0aa876b}</Project> + <Name>Tango.CSV</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\DataStore\Tango.DataStore.Editing\Tango.DataStore.Editing.csproj"> + <Project>{ee088ff7-04d1-41fb-9d6a-cedeee7a7b9c}</Project> + <Name>Tango.DataStore.Editing</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\DataStore\Tango.DataStore.EF\Tango.DataStore.EF.csproj"> + <Project>{88d9906b-8fc4-4fe0-b7eb-127a0a8fcee4}</Project> + <Name>Tango.DataStore.EF</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\DataStore\Tango.DataStore.Remote\Tango.DataStore.Remote.csproj"> + <Project>{29448f3c-9b3e-4da6-8555-46a8b9a6b3aa}</Project> + <Name>Tango.DataStore.Remote</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\DataStore\Tango.DataStore\Tango.DataStore.csproj"> + <Project>{e0364dfa-0721-4637-9d32-9d22aac109d6}</Project> + <Name>Tango.DataStore</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Integration\Tango.Integration.csproj"> + <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project> + <Name>Tango.Integration</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Logging\Tango.Logging.csproj"> + <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> + <Name>Tango.Logging</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.PMR\Tango.PMR.csproj"> + <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project> + <Name>Tango.PMR</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Settings\Tango.Settings.csproj"> + <Project>{d8f1ad85-526a-4f50-b6dc-d437af63d8d8}</Project> + <Name>Tango.Settings</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.SharedUI\Tango.SharedUI.csproj"> + <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> + <Name>Tango.SharedUI</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Transport\Tango.Transport.csproj"> + <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> + <Name>Tango.Transport</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.FSE.BL\Tango.FSE.BL.csproj"> + <Project>{834c81c3-09b5-45d7-be12-e7d1e6655a7c}</Project> + <Name>Tango.FSE.BL</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.FSE.Common\Tango.FSE.Common.csproj"> + <Project>{bc37cccb-7392-4f78-8d1c-e9629e6e046e}</Project> + <Name>Tango.FSE.Common</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Page Include="App.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Dialogs\DataStoreItemEditDialogView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Dialogs\ExportDialogView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Dialogs\ImportDialogView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\SettingsView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DataStoreView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\SelectionView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\MachineView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\MainView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\configuration.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\data_collection.png" /> + </ItemGroup> + <ItemGroup /> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <Import Project="..\..\..\packages\MaterialDesignThemes.3.0.1\build\MaterialDesignThemes.targets" Condition="Exists('..\..\..\packages\MaterialDesignThemes.3.0.1\build\MaterialDesignThemes.targets')" /> + <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> + <PropertyGroup> + <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> + </PropertyGroup> + <Error Condition="!Exists('..\..\..\packages\MaterialDesignThemes.3.0.1\build\MaterialDesignThemes.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\MaterialDesignThemes.3.0.1\build\MaterialDesignThemes.targets'))" /> + </Target> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModelLocator.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModelLocator.cs new file mode 100644 index 000000000..b924868b2 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModelLocator.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.DI; +using Tango.FSE.MachineConfiguration.Navigation; +using Tango.FSE.MachineConfiguration.ViewModels; +using Tango.FSE.MachineConfiguration.Views; + +namespace Tango.FSE.MachineConfiguration +{ + public static class ViewModelLocator + { + static ViewModelLocator() + { + TangoIOC.Default.Register<ConfigurationNavigationManager>(new ConfigurationNavigationManager(MainView.Instance)); + TangoIOC.Default.Register<MainViewVM>(); + TangoIOC.Default.Register<SelectionViewVM>(); + TangoIOC.Default.Register<MachineViewVM>(); + TangoIOC.Default.Register<SettingsViewVM>(); + TangoIOC.Default.Register<DataStoreViewVM>(); + } + + public static MainViewVM MainViewVM + { + get + { + return TangoIOC.Default.GetInstance<MainViewVM>(); + } + } + + public static SelectionViewVM SelectionViewVM + { + get + { + return TangoIOC.Default.GetInstance<SelectionViewVM>(); + } + } + + public static MachineViewVM MachineViewVM + { + get + { + return TangoIOC.Default.GetInstance<MachineViewVM>(); + } + } + + public static SettingsViewVM SettingsViewVM + { + get + { + return TangoIOC.Default.GetInstance<SettingsViewVM>(); + } + } + + public static DataStoreViewVM DataStoreViewVM + { + get + { + return TangoIOC.Default.GetInstance<DataStoreViewVM>(); + } + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/DataStoreViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/DataStoreViewVM.cs new file mode 100644 index 000000000..46f388461 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/DataStoreViewVM.cs @@ -0,0 +1,517 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.Core.Commands; +using Tango.Core.DI; +using Tango.CSV; +using Tango.DataStore; +using Tango.DataStore.Editing; +using Tango.FSE.Common; +using Tango.FSE.Common.Connection; +using Tango.FSE.Common.DataStore; +using Tango.FSE.Common.Notifications; +using Tango.FSE.MachineConfiguration.Dialogs; +using Tango.FSE.MachineConfiguration.Messages; +using Tango.FSE.MachineConfiguration.Models; +using static Tango.FSE.BL.Services.MachineConfigurationService; +using static Tango.SharedUI.Controls.NavigationControl; + +namespace Tango.FSE.MachineConfiguration.ViewModels +{ + public class DataStoreViewVM : FSEViewModel, INavigationViewModel + { + private String _machineGuid; + private MachineEditingComposition _editingComposition; + private ICollectionView _selectedCollectionView; + private ICollectionView _collectionsView; + + [TangoInject] + public IDataStoreProvider DataStoreProvider { get; set; } + + private DataStoreModel _dataStore; + public DataStoreModel DataStore + { + get { return _dataStore; } + set { _dataStore = value; RaisePropertyChangedAuto(); } + } + + private DataStoreCollectionModel _selectedCollection; + public DataStoreCollectionModel SelectedCollection + { + get { return _selectedCollection; } + set { _selectedCollection = value; RaisePropertyChangedAuto(); OnSelectedCollectionChanged(); } + } + + private DataStoreItemModel _selectedItem; + public DataStoreItemModel SelectedItem + { + get { return _selectedItem; } + set { _selectedItem = value; RaisePropertyChangedAuto(); } + } + + private String _filter; + public String Filter + { + get { return _filter; } + set { _filter = value; RaisePropertyChangedAuto(); _selectedCollectionView?.Refresh(); } + } + + public bool CanSync + { + get { return MachineProvider.IsPPCAvailable && MachineProvider.Machine != null && _machineGuid == MachineProvider.Machine.Guid; } + } + + public RelayCommand<DataStoreItemModel> RemoveItemCommand { get; set; } + public RelayCommand<DataStoreCollectionModel> RemoveCollectionCommand { get; set; } + public RelayCommand AddItemCommand { get; set; } + public RelayCommand AddCollectionCommand { get; set; } + public RelayCommand<DataStoreItemModel> EditItemCommand { get; set; } + public RelayCommand SaveCommand { get; set; } + public RelayCommand ReloadCommand { get; set; } + public RelayCommand ImportCommand { get; set; } + public RelayCommand ExportCommand { get; set; } + + public DataStoreViewVM() + { + RegisterForMessage<EditingCompositionLoadedMessage>(OnEditingCompositionLoaded); + RemoveItemCommand = new RelayCommand<DataStoreItemModel>(RemoveItem); + RemoveCollectionCommand = new RelayCommand<DataStoreCollectionModel>(RemoveCollection); + AddItemCommand = new RelayCommand(AddItem); + AddCollectionCommand = new RelayCommand(AddCollection); + EditItemCommand = new RelayCommand<DataStoreItemModel>(EditItem); + SaveCommand = new RelayCommand(SaveModel); + ReloadCommand = new RelayCommand(ReloadDataStore); + ExportCommand = new RelayCommand(ExportDataStore); + ImportCommand = new RelayCommand(ImportDataStore); + } + + [TangoInject] + public DataStoreViewVM(IMachineProvider machineProvider) : this() + { + machineProvider.MachineConnected += (_, __) => RaisePropertyChanged(nameof(CanSync)); + machineProvider.MachineDisconnected += (_, __) => RaisePropertyChanged(nameof(CanSync)); + } + + private async void ReloadDataStore() + { + if (DataStore != null) + { + if (DataStore.Collections.SelectMany(x => x.Items).Any(x => x.HasDifference)) + { + if (!await NotificationProvider.ShowWarningQuestion("Reloading the data store will discard all the current changes. Are you sure?", "RELOAD")) + { + return; + } + } + } + + await LoadDataStore(); + } + + private async void EditItem(DataStoreItemModel item) + { + if (!CurrentUser.HasPermission(Tango.BL.Enumerations.Permissions.DataStoreWrite)) + { + await NotificationProvider.ShowError("The current user profile does not allow editing of the data store.\nPlease contact your administrator."); + return; + } + + var vm = await NotificationProvider.ShowDialog<DataStoreItemEditDialogViewVM>(new DataStoreItemEditDialogViewVM() { Item = item, EnableTypeChange = !item.IsGlobal && item.GlobalItem == null }); + + if (vm.DialogResult) + { + item.IsDeleted = false; + item.IsGlobal = false; + item.Type = vm.Type; + item.Value = vm.Value; + } + } + + private async void AddCollection() + { + if (!CurrentUser.HasPermission(Tango.BL.Enumerations.Permissions.DataStoreCreate)) + { + await NotificationProvider.ShowError("The current user profile does not allow creating new data store collections.\nPlease contact your administrator."); + return; + } + + var result = await NotificationProvider.ShowInputBox("Add Collection", "Please enter the collection name", MaterialDesignThemes.Wpf.PackIconKind.Collection, null, null, 20, null, null, (input) => + { + if (DataStore.Collections.ToList().Exists(x => x.Name.ToLower() == input.ToLower())) + { + return "The specified collection already exists."; + } + + if (!DataStoreHelper.ValidateCollectionOrKeyName(input)) + { + return "Collection name contains invalid characters."; + } + + return null; + }); + + if (result.Confirmed) + { + if (DataStore.Collections.ToList().Exists(x => x.Name.ToLower() == result.Input.ToLower())) + { + await NotificationProvider.ShowError("The specified collection already exists."); + AddCollection(); + return; + } + + DataStore.Collections.Add(new DataStoreCollectionModel() + { + Name = result.Input + }); + + SelectedCollection = DataStore.Collections.Last(); + } + } + + private async void AddItem() + { + if (!CurrentUser.HasPermission(Tango.BL.Enumerations.Permissions.DataStoreCreate)) + { + await NotificationProvider.ShowError("The current user profile does not allow creating new data store items.\nPlease contact your administrator."); + return; + } + + var result = await NotificationProvider.ShowInputBox("Add Item", "Please enter the item key", MaterialDesignThemes.Wpf.PackIconKind.KeyAdd, null, null, 20, null, null, (input) => + { + if (SelectedCollection.Items.ToList().Exists(x => x.Key.ToLower() == input.ToLower())) + { + return "The specified key already exists in the collection."; + } + + if (!DataStoreHelper.ValidateCollectionOrKeyName(input)) + { + return "Key name contains invalid characters."; + } + + return null; + }); + + if (result.Confirmed) + { + if (SelectedCollection.Items.ToList().Exists(x => x.Key == result.Input)) + { + await NotificationProvider.ShowError("The specified key already exists in the collection."); + AddItem(); + return; + } + + SelectedCollection.Items.Add(new DataStoreItemModel() + { + Date = DateTime.UtcNow, + Guid = Guid.NewGuid().ToString(), + Key = result.Input, + Type = DataType.Int32, + Value = 10 + }); + } + } + + private async void RemoveCollection(DataStoreCollectionModel collection) + { + if (!CurrentUser.HasPermission(Tango.BL.Enumerations.Permissions.DataStoreCreate)) + { + await NotificationProvider.ShowError("The current user profile does not allow deleting data store collections.\nPlease contact your administrator."); + return; + } + + collection.IsDeleted = true; + _collectionsView?.Refresh(); + } + + private async void RemoveItem(DataStoreItemModel item) + { + if (!CurrentUser.HasPermission(Tango.BL.Enumerations.Permissions.DataStoreCreate)) + { + await NotificationProvider.ShowError("The current user profile does not allow deleting data store items.\nPlease contact your administrator."); + return; + } + + item.IsDeleted = true; + _selectedCollectionView.Refresh(); + } + + private void OnEditingCompositionLoaded(EditingCompositionLoadedMessage obj) + { + DataStore = null; + _editingComposition = obj.EditingComposition; + _machineGuid = obj.EditingComposition.Machine.Guid; + } + + private void OnSelectedCollectionChanged() + { + if (SelectedCollection != null) + { + _selectedCollectionView = CollectionViewSource.GetDefaultView(SelectedCollection.Items); + _selectedCollectionView.Filter = (x) => FilterItems(x as DataStoreItemModel); + _selectedCollectionView.Refresh(); + } + } + + private bool FilterItems(DataStoreItemModel itemModel) + { + return (!itemModel.IsDeleted || itemModel.GlobalItem != null) && (String.IsNullOrWhiteSpace(Filter) || itemModel.Key.ToLower().Contains(Filter.ToLower())); + } + + private async void SaveModel() + { + if (!CurrentUser.HasPermission(Tango.BL.Enumerations.Permissions.DataStoreWrite)) + { + await NotificationProvider.ShowError("The current user profile does not allow editing of the data store.\nPlease contact your administrator."); + return; + } + + try + { + using (NotificationProvider.PushTaskItem("Updating data store...")) + { + await DataStoreProvider.UpdateDataStoreModel(DataStore, _machineGuid); + } + + if (MachineProvider.IsPPCAvailable) + { + await NotificationProvider.ShowSuccess("The connected machine is now synchronized with the data store."); + } + else + { + await NotificationProvider.ShowSuccess("Data store saved successfully.\nThe machine will be updated on the next synchronization pass."); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error saving data store."); + await NotificationProvider.ShowError($"Error occurred while trying to save the data store.\n{ex.FlattenMessage()}"); + return; + } + + await LoadDataStore(); + } + + private async Task LoadDataStore() + { + try + { + using (NotificationProvider.PushTaskItem("Loading data store...")) + { + IsFree = false; + RaisePropertyChanged(nameof(CanSync)); + + var dataStore = await DataStoreProvider.GetDataStoreModel(_machineGuid); + + _collectionsView = CollectionViewSource.GetDefaultView(dataStore.Collections); + _collectionsView.Filter = (x) => { return !(x as DataStoreCollectionModel).IsDeleted; }; + _collectionsView.Refresh(); + + DataStore = dataStore; + SelectedCollection = DataStore.Collections.FirstOrDefault(); + + IsFree = true; + } + } + catch (Exception ex) + { + DataStore = null; + LogManager.Log(ex, "Error loading data store."); + if (await NotificationProvider.ShowWarningQuestion($"Error occurred while trying to load the data store.\n{ex.FlattenMessage()}", "RETRY", "CANCEL")) + { + await LoadDataStore(); + return; + } + } + } + + public async override void OnNavigatedTo() + { + base.OnNavigatedTo(); + + if (!CurrentUser.HasPermission(Tango.BL.Enumerations.Permissions.DataStoreRead)) + { + return; + } + + if (DataStore == null) + { + await LoadDataStore(); + } + } + + private async void ImportDataStore() + { + var result = await StorageProvider.OpenFile("Import data store", "CSV Files|*.csv"); + + if (result) + { + try + { + DataStoreModel model = new DataStoreModel(); + + using (NotificationProvider.PushTaskItem("Analyzing file...")) + { + await Task.Delay(1000); + + await Task.Factory.StartNew(() => + { + var items = CsvFile.Read<CsvModel>(new CsvSource(result.SelectedItem)).ToList(); + + foreach (var collection in items.GroupBy(x => x.Collection)) + { + DataStoreCollectionModel collectionModel = new DataStoreCollectionModel(); + + collectionModel = new DataStoreCollectionModel(); + collectionModel.Name = collection.First().Collection; + collectionModel.IsSelected = true; + model.Collections.Add(collectionModel); + + foreach (var item in collection) + { + DataStoreItemModel itemModel = new DataStoreItemModel(); + itemModel.Guid = Guid.NewGuid().ToString(); + itemModel.Key = item.Key; + itemModel.Date = DateTime.Parse(item.Date); + itemModel.IsSelected = true; + + DataType type = (DataType)Enum.Parse(typeof(DataType), item.Type); + itemModel.OriginalType = type; + itemModel.Type = type; + + PMR.Common.MessageType? messageType = null; + if (type == DataType.Proto && item.MessageType.IsNotNullOrEmpty()) + { + messageType = (PMR.Common.MessageType)Enum.Parse(typeof(PMR.Common.MessageType), item.MessageType); + } + + itemModel.OriginalValue = DataStoreHelper.ParseDataStoreValue(type, item.Value, messageType); + itemModel.Value = itemModel.OriginalValue; + + collectionModel.Items.Add(itemModel); + } + } + }); + } + + var vm = await NotificationProvider.ShowDialog<ImportDialogViewVM>(new ImportDialogViewVM() { DataStore = model }); + + if (vm.DialogResult) + { + if (!vm.DataStore.Collections.SelectMany(x => x.Items).Any(x => x.IsSelected)) + { + await NotificationProvider.ShowInfo("No items selected to import."); + return; + } + + foreach (var collection in vm.DataStore.Collections.Where(x => x.Items.Any(y => y.IsSelected))) + { + var collectionModel = DataStore.Collections.FirstOrDefault(x => x.Name == collection.Name); + + if (collectionModel == null) + { + DataStore.Collections.Add(collection); + } + else + { + foreach (var item in collection.Items.Where(x => x.IsSelected)) + { + var itemModel = collectionModel.Items.FirstOrDefault(x => x.Key == item.Key); + + if (itemModel == null) + { + itemModel = new DataStoreItemModel(); + itemModel.Guid = item.Guid; + itemModel.Key = item.Key; + collectionModel.Items.Add(itemModel); + } + + itemModel.Date = DateTime.UtcNow; + itemModel.IsDeleted = false; + itemModel.IsGlobal = false; + itemModel.Type = item.Type; + itemModel.Value = item.Value; + } + } + } + + await NotificationProvider.ShowSuccess("Data store imported successfully."); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error importing data store."); + await NotificationProvider.ShowError($"Error importing the data store.\n{ex.FlattenMessage()}"); + } + } + } + + private async void ExportDataStore() + { + var vm = await NotificationProvider.ShowDialog<ExportDialogViewVM>(new ExportDialogViewVM() { DataStore = DataStore }); + + if (vm.DialogResult) + { + if (!vm.DataStore.Collections.SelectMany(x => x.Items).Any(x => x.IsSelected)) + { + await NotificationProvider.ShowInfo("No items selected to export."); + return; + } + + var result = await StorageProvider.SaveFile("Export data store", "CSV Files|*.csv", $"{_editingComposition.Machine.SerialNumber}_datastore_{DateTime.Now.ToFileName()}.csv", ".csv"); + + if (result) + { + try + { + using (NotificationProvider.PushTaskItem("Exporting data store...")) + { + await Task.Delay(1000); + + await Task.Factory.StartNew(() => + { + using (DynamicCsvFile csvFile = new DynamicCsvFile(result.SelectedItem)) + { + csvFile.Columns.Add(new DynamicCsvFileColumn() { Name = "Date" }); + csvFile.Columns.Add(new DynamicCsvFileColumn() { Name = "Collection" }); + csvFile.Columns.Add(new DynamicCsvFileColumn() { Name = "Key" }); + csvFile.Columns.Add(new DynamicCsvFileColumn() { Name = "Type" }); + csvFile.Columns.Add(new DynamicCsvFileColumn() { Name = "MessageType" }); + csvFile.Columns.Add(new DynamicCsvFileColumn() { Name = "Value" }); + + foreach (var collection in DataStore.Collections) + { + foreach (var item in collection.Items.Where(x => x.IsSelected && !x.IsGlobal && x.Value != null)) + { + PMR.Common.MessageType? messageType = null; + + if (item.Type == DataType.Proto) + { + messageType = (item.Value as DataStoreProtoObject).MessageType; + } + + csvFile.Append(item.Date, $"\"{collection.Name}\"", $"\"{item.Key}\"", item.Type, messageType.ToStringSafe(), $"\"{item.FormattedValue.Replace("\"", "\"\"")}\""); + } + } + } + }); + } + + NotificationProvider.PushSnackbarItem(MessageType.Success, "Export Data Store", true, "Data store exported successfully.", TimeSpan.FromSeconds(8), null, () => + { + StorageProvider.ShowInExplorer(result.SelectedItem); + }); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error exporting data store."); + await NotificationProvider.ShowError($"Error exporting the data store.\n{ex.FlattenMessage()}"); + } + } + } + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/MachineViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/MachineViewVM.cs new file mode 100644 index 000000000..fd953a0b8 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/MachineViewVM.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.FSE.Common; +using Tango.FSE.Common.Navigation; +using Tango.FSE.MachineConfiguration.Messages; +using static Tango.FSE.BL.Services.MachineConfigurationService; +using static Tango.FSE.MachineConfiguration.ViewModels.MachineViewVM; + +namespace Tango.FSE.MachineConfiguration.ViewModels +{ + public class MachineViewVM : ConfigurationViewModel, INavigationObjectReceiver<NavigationObject> + { + public class NavigationObject + { + public String MachineGuid { get; set; } + } + + public enum NavigationView + { + SettingsView, + DataStoreView, + } + + private NavigationView _selectedView; + public NavigationView SelectedView + { + get { return _selectedView; } + set + { + if (value == NavigationView.DataStoreView) + { + if (!CurrentUser.HasPermission(Tango.BL.Enumerations.Permissions.DataStoreRead)) + { + Task.Delay(500).ContinueWith((x) => + { + SelectedView = _selectedView; + NotificationProvider.ShowError("The current user profile does not allow accessing the data store.\nPlease contact your administrator."); + }); + return; + } + } + + _selectedView = value; + RaisePropertyChangedAuto(); + } + } + + private MachineEditingComposition _editingComposition; + public MachineEditingComposition EditingComposition + { + get { return _editingComposition; } + set { _editingComposition = value; RaisePropertyChangedAuto(); } + } + + public void OnNavigatedToWithObject(NavigationObject obj) + { + SelectedView = NavigationView.SettingsView; + LoadMachine(obj.MachineGuid); + } + + private async void LoadMachine(String machineGuid) + { + using (NotificationProvider.PushTaskItem("Loading machine configuration...")) + { + EditingComposition = await Services.MachineConfigurationService.GetMachineEditingComposition(machineGuid); + RaiseMessage(new EditingCompositionLoadedMessage() { EditingComposition = EditingComposition }); + } + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/MainViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/MainViewVM.cs new file mode 100644 index 000000000..250dc1046 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/MainViewVM.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.FSE.Common; +using Tango.FSE.Common.Navigation; +using Tango.FSE.MachineConfiguration.Navigation; +using Tango.SharedUI.Helpers; + +namespace Tango.FSE.MachineConfiguration.ViewModels +{ + [ModularNavigationContainer] + public class MainViewVM : ConfigurationViewModel + { + public override void OnApplicationReady() + { + if (CurrentUser.HasPermission(Tango.BL.Enumerations.Permissions.FSE_RunConfigurationModule)) + { + InvokeUI(() => + { + NavigationManager.MenuItems.Add(new NavigationMenuItem(() => + { + NavigationManager.NavigateTo<ConfigurationModule>(); + }) + { + Name = "Configuration", + Index = 8, + Description = "Access to the organization machines configuration and settings", + Image = ResourceHelper.GetImageFromResources("Images/configuration.png"), + }); + }); + } + } + + public async override Task<bool> OnApplicationLogout() + { + while (ModularNavigationManager.CurrentView != ConfigurationView.SelectionView) + { + if (!await ModularNavigationManager.NavigateBack()) + { + return false; + } + } + + return await base.OnApplicationLogout(); + } + + public async override Task<bool> OnNavigateBackRequest() + { + if (ModularNavigationManager.CurrentView == ConfigurationView.SelectionView) + { + return await base.OnNavigateBackRequest(); + } + else + { + await ModularNavigationManager.NavigateBack(); + return false; + } + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/SelectionViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/SelectionViewVM.cs new file mode 100644 index 000000000..39772a4cf --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/SelectionViewVM.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.Core.Commands; +using Tango.FSE.Common; +using Tango.FSE.MachineConfiguration.Navigation; + +namespace Tango.FSE.MachineConfiguration.ViewModels +{ + public class SelectionViewVM : ConfigurationViewModel + { + private Machine _selectedMachine; + /// <summary> + /// Gets or sets the selected machine. + /// </summary> + public Machine SelectedMachine + { + get { return _selectedMachine; } + set + { + _selectedMachine = value; + RaisePropertyChangedAuto(); + InvalidateRelayCommands(); + OnSelectedMachineChanged(); + } + } + + public RelayCommand ManageMachineCommand { get; set; } + + public SelectionViewVM() + { + ManageMachineCommand = new RelayCommand(ManageSelectedMachine, () => SelectedMachine != null); + } + + private async void OnSelectedMachineChanged() + { + if (SelectedMachine != null) + { + await Task.Delay(100); + this.SetFocus(() => ManageMachineCommand); + } + } + + private void ManageSelectedMachine() + { + if (SelectedMachine == null) + { + NotificationProvider.ShowError("No machine selected."); + return; + } + + ModularNavigationManager.NavigateTo(ConfigurationView.MachineView, new MachineViewVM.NavigationObject() + { + MachineGuid = SelectedMachine.Guid + }); + } + + public override void OnNavigatedTo() + { + base.OnNavigatedTo(); + + if (SelectedMachine == null && MachineProvider.Machine != null) + { + SelectedMachine = MachineProvider.Machine; + } + } + + public override Task<bool> OnApplicationLogout() + { + ModularNavigationManager.NavigateTo(ConfigurationView.SelectionView); + SelectedMachine = null; + return base.OnApplicationLogout(); + } + } +} + + diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/SettingsViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/SettingsViewVM.cs new file mode 100644 index 000000000..ed2cbd714 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/ViewModels/SettingsViewVM.cs @@ -0,0 +1,144 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.Core.Commands; +using Tango.Core.DI; +using Tango.FSE.BL; +using Tango.FSE.Common; +using Tango.FSE.Common.AutoComplete; +using Tango.FSE.Common.SQL; +using Tango.FSE.MachineConfiguration.Messages; +using static Tango.FSE.BL.Services.MachineConfigurationService; + +namespace Tango.FSE.MachineConfiguration.ViewModels +{ + public class SettingsViewVM : FSEViewModel + { + [TangoInject] + private IRemoteSqlProvider RemoteSqlProvider { get; set; } + + private MachineEditingComposition _editingComposition; + public MachineEditingComposition EditingComposition + { + get { return _editingComposition; } + set { _editingComposition = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand SaveCommand { get; set; } + public RelayCommand ResetCountersCommand { get; set; } + public RelayCommand ResetDeviceRegistrationCommand { get; set; } + + private List<Site> _sites; + public List<Site> Sites + { + get { return _sites; } + set { _sites = value; RaisePropertyChangedAuto(); } + } + + private Site _selectedSite; + public Site SelectedSite + { + get { return _selectedSite; } + set { _selectedSite = value; RaisePropertyChangedAuto(); } + } + + public SettingsViewVM() + { + RegisterForMessage<EditingCompositionLoadedMessage>(OnEditingCompositionLoaded); + SaveCommand = new RelayCommand(SaveConfiguration); + ResetCountersCommand = new RelayCommand(ResetCounters); + ResetDeviceRegistrationCommand = new RelayCommand(ResetDeviceRegistration); + } + + private void OnEditingCompositionLoaded(EditingCompositionLoadedMessage msg) + { + using (NotificationProvider.PushTaskItem("Loading machine configuration...")) + { + EditingComposition = msg.EditingComposition; + EditingComposition.Machine.ForceVersionUpdateChanged += (x, value) => { if (value) EditingComposition.Machine.SuspendVersionUpdate = false; }; + EditingComposition.Machine.SuspendVersionUpdateChanged += (x, value) => { if (value) EditingComposition.Machine.ForceVersionUpdate = false; }; + EditingComposition.Machine.OrganizationChanged -= OnMachine_OrganizationChanged; + EditingComposition.Machine.OrganizationChanged += OnMachine_OrganizationChanged; + OnMachine_OrganizationChanged(EditingComposition.Machine, EditingComposition.Machine.Organization); + } + } + + private void OnMachine_OrganizationChanged(object sender, Organization organization) + { + var sites = organization.Sites.ToList(); + sites.Insert(0, new Site() { Guid = null, Name = "NONE", ID = -1 }); + Sites = sites; + SelectedSite = Sites.FirstOrDefault(x => x.Guid == EditingComposition.Machine.SiteGuid); + + if (SelectedSite == null) + { + SelectedSite = Sites.First(); + } + } + + private async void SaveConfiguration() + { + using (NotificationProvider.PushTaskItem("Saving machine configuration...")) + { + EditingComposition.Machine.SiteGuid = SelectedSite.Guid; + EditingComposition = await Services.MachineConfigurationService.SaveMachineEditingComposition(EditingComposition); + await NotificationProvider.ShowSuccess("Machine configuration saved successfully."); + } + } + + private async void ResetCounters() + { + if (!CurrentUser.HasPermission(Tango.BL.Enumerations.Permissions.FSE_ResetMachineCounters)) + { + await NotificationProvider.ShowError("The current user profile does not allow resetting the machine counters.\nPlease contact your administrator."); + return; + } + + if (!MachineProvider.IsPPCAvailable) + { + await NotificationProvider.ShowError("Resetting the machine counters requires an active connection to this machine."); + return; + } + + if (!await NotificationProvider.ShowWarningQuestion("Resetting the machine counters will delete the entire job runs history. Are you sure?", "RESET COUNTERS", "CANCEL")) return; + + using (var task = NotificationProvider.PushTaskItem("Resetting machine counters...")) + { + task.UpdateProgress("Resetting local machine counters..."); + + var result = await RemoteSqlProvider.ExecuteSqlCommandAsync(new RemoteSqlCommand() + { + Mode = RemoteSqlCommandMode.Local, + Timeout = 30, + SQL = "DELETE FROM JOB_RUNS" + }); + + int localJobRuns = result.LocalAffectedRecords; + + task.UpdateProgress("Resetting global machine counters..."); + + int remoteJobRuns = await Services.MachineConfigurationService.ResetCounters(EditingComposition.Machine.Guid); + + await NotificationProvider.ShowSuccess("Machine counters deleted successfully."); + } + } + + private async void ResetDeviceRegistration() + { + if (!CurrentUser.HasPermission(Tango.BL.Enumerations.Permissions.FSE_ResetMachineDeviceRegistration)) + { + await NotificationProvider.ShowError("The current user profile does not allow resetting the device registration.\nPlease contact your administrator."); + return; + } + + if (!await NotificationProvider.ShowWarningQuestion("Resetting the machine's device registration will allow other panel PCs to perform a machine setup for this machine. Are you sure?", "RESET", "CANCEL")) return; + + EditingComposition.Machine.IsDeviceRegistered = false; + EditingComposition.Machine.DeviceId = null; + EditingComposition.Machine.DeviceName = null; + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/DataStoreView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/DataStoreView.xaml new file mode 100644 index 000000000..52a140c81 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/DataStoreView.xaml @@ -0,0 +1,239 @@ +<UserControl x:Class="Tango.FSE.MachineConfiguration.Views.DataStoreView" + 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:local="clr-namespace:Tango.FSE.MachineConfiguration.Views" + xmlns:helpers="clr-namespace:Tango.SharedUI.Helpers;assembly=Tango.SharedUI" + xmlns:global="clr-namespace:Tango.FSE.MachineConfiguration" + xmlns:controls="clr-namespace:Tango.FSE.Common.Controls;assembly=Tango.FSE.Common" + xmlns:vm="clr-namespace:Tango.FSE.MachineConfiguration.ViewModels" + xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:commonControls="clr-namespace:Tango.FSE.Common.Controls;assembly=Tango.FSE.Common" + xmlns:resolution="clr-namespace:Tango.FSE.Common.Resolution;assembly=Tango.FSE.Common" + xmlns:converters="clr-namespace:Tango.FSE.MachineConfiguration.Converters" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:DataStoreViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.DataStoreViewVM}" d:DesignStyle="{StaticResource FSE_User_Control_Designer}"> + + <UserControl.Resources> + <converters:DataStoreValueToStringConverter x:Key="DataStoreValueToStringConverter" /> + </UserControl.Resources> + + <DockPanel Margin="0 10 0 0"> + + <DockPanel DockPanel.Dock="Top"> + <DockPanel DockPanel.Dock="Left" HorizontalAlignment="Left"> + <Image Source="../Images/data_collection.png" Stretch="Uniform" Width="40" RenderOptions.BitmapScalingMode="Fant" Opacity="0.5" /> + <DockPanel Margin="10 0 0 0" > + <TextBlock Margin="0 5 0 0" FontSize="{StaticResource FSE_SmallFontSize}" Foreground="{StaticResource FSE_GrayBrush}"> + <Run>The data store contains global and local (machine) configuration and calibration parameters.</Run> + <LineBreak/> + <Run>Updating the data store parameters will take effect on the next machine cloud synchronization pass.</Run> + <LineBreak/> + <Run>If this is the currently connected machine, updating the data store will take effect immediately.</Run> + </TextBlock> + </DockPanel> + </DockPanel> + + <DockPanel DockPanel.Dock="Right" Margin="0 0 10 0" VerticalAlignment="Center" ToolTip="Allow updates on this grid based on changes that are triggered by the machine's firmware device"> + <ToggleButton IsChecked="{Binding DataStoreProvider.AcceptFirmwareChanges}" /> + <TextBlock Margin="10 0 0 0" FontSize="{StaticResource FSE_SmallFontSize}" VerticalAlignment="Center">Accept Real-Time Firmware Updates</TextBlock> + </DockPanel> + + <Grid> + + </Grid> + </DockPanel> + + <DockPanel Margin="0 20 0 0"> + <DockPanel DockPanel.Dock="Bottom" > + + <Grid DockPanel.Dock="Left"> + <DockPanel VerticalAlignment="Center" Visibility="{Binding CanSync,Converter={StaticResource BooleanToVisibilityConverter}}"> + <material:PackIcon Kind="InfoCircleOutline" Foreground="{StaticResource FSE_GreenBrush}" /> + <TextBlock FontSize="{StaticResource FSE_SmallFontSize}" Foreground="{StaticResource FSE_GreenBrush}" VerticalAlignment="Center" Margin="5 2 0 0">Machine is connected, updating the data store will be take effect immediately.</TextBlock> + </DockPanel> + </Grid> + + <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" Margin="0 10 0 5"> + <Button IsEnabled="{Binding IsFree}" ToolTip="Import a data store csv file" Width="120" VerticalAlignment="Center" Margin="0 0 10 0" Height="35" material:ButtonAssist.CornerRadius="18" Style="{StaticResource FSE_RaisedButton_Dark_Hover}" Command="{Binding ImportCommand}"> + <DockPanel> + <material:PackIcon Kind="Import" /> + <TextBlock Margin="5 0 0 0">IMPORT</TextBlock> + </DockPanel> + </Button> + <Button IsEnabled="{Binding IsFree}" ToolTip="Export this data store to a csv file" Width="120" VerticalAlignment="Center" Margin="0 0 10 0" Height="35" material:ButtonAssist.CornerRadius="18" Style="{StaticResource FSE_RaisedButton_Dark_Hover}" Command="{Binding ExportCommand}"> + <DockPanel> + <material:PackIcon Kind="Export" /> + <TextBlock Margin="5 0 0 0">EXPORT</TextBlock> + </DockPanel> + </Button> + <Button ToolTip="Apply the data store changes" IsEnabled="{Binding IsFree}" Width="200" Height="45" material:ButtonAssist.CornerRadius="25" Command="{Binding SaveCommand}"> + <DockPanel> + <material:PackIcon Kind="ContentSaveAll" /> + <TextBlock Margin="5 0 0 0"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Text" Value="UPDATE"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding CanSync}" Value="True"> + <Setter Property="Text" Value="UPDATE & SYNC"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </DockPanel> + </Button> + </StackPanel> + + <Grid> + <!--FOOTER CENTER CONTENT--> + </Grid> + </DockPanel> + <Grid> + <DockPanel> + + <Grid DockPanel.Dock="Top" Panel.ZIndex="100"> + <!--TOP BAR--> + + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0 0 5 -45"> + <DockPanel Margin="0 0 20 0" VerticalAlignment="Center"> + <material:PackIcon Kind="Search" resolution:ResolutionHelper.Mode="High" Foreground="{StaticResource FSE_PrimaryAccentBrush}" VerticalAlignment="Center" Width="24" Height="24" Margin="0 0 5 0" /> + <TextBox IsEnabled="{Binding IsFree}" material:HintAssist.Hint="Search" Text="{Binding Filter,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,Delay=500}" Background="{StaticResource FSE_PrimaryBackgroundBrush}" Width="250" Style="{StaticResource FSE_Rounded_Corners_TextBox}" Height="33"></TextBox> + </DockPanel> + <controls:TextIconButton IsEnabled="{Binding IsFree}" material:ButtonAssist.CornerRadius="15" Command="{Binding AddItemCommand}" Icon="Add" Width="150">ADD ITEM</controls:TextIconButton> + <commonControls:IconButton Margin="10 0 0 0" Icon="Refresh" Foreground="{StaticResource FSE_PrimaryAccentBrush}" Cursor="Hand" ToolTip="Reload the data store" Command="{Binding ReloadCommand}" /> + </StackPanel> + </Grid> + + <DockPanel> + <!--<TextBlock Margin="0 -25 0 0" DockPanel.Dock="Top" FontFamily="{StaticResource hand}" Foreground="{StaticResource FSE_PrimaryAccentBrush}" FontSize="{StaticResource FSE_LargerFontSize}">Collections</TextBlock>--> + + <DockPanel> + + <Border DockPanel.Dock="Bottom" Height="50" Background="#404040" CornerRadius="0 0 5 5"> + <controls:TextIconButton IsEnabled="{Binding IsFree}" material:ButtonAssist.CornerRadius="15" Command="{Binding AddCollectionCommand}" Icon="Add" Width="180">ADD COLLECTION</controls:TextIconButton> + </Border> + + <Border Padding="8" Background="{StaticResource FSE_PrimaryBackgroundMidBrush}" CornerRadius="5 5 0 0" BorderThickness="1" BorderBrush="{StaticResource FSE_PrimaryBackgroundLightBrush}"> + <ListBox IsEnabled="{Binding IsFree}" ItemsSource="{Binding DataStore.Collections}" SelectedItem="{Binding SelectedCollection}" MinWidth="200" HorizontalContentAlignment="Stretch"> + <ListBox.ItemTemplate> + <DataTemplate> + <DockPanel> + <material:PackIcon Kind="Collection" /> + <controls:IconButton DockPanel.Dock="Right" HorizontalAlignment="Right" ToolTip="Delete collection" Cursor="Hand" Width="20" Height="20" Padding="0" Icon="Close" Foreground="{StaticResource FSE_RedBrush}" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.RemoveCollectionCommand}" CommandParameter="{Binding}" /> + <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding Name}"></TextBlock> + </DockPanel> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + </Border> + </DockPanel> + </DockPanel> + + <Grid Margin="10 0 0 0"> + <Border Background="#8B202020" Padding="0 0 0 5" CornerRadius="5" BorderThickness="1" BorderBrush="{StaticResource FSE_PrimaryBackgroundLightBrush}"> + <Grid> + <Border VerticalAlignment="Top" Background="{StaticResource FSE_PrimaryBackgroundLightBrush}" Height="47" CornerRadius="5 5 0 0"> + + </Border> + <DataGrid IsEnabled="{Binding IsFree}" IsReadOnly="True" helpers:DataGridHelper.DoubleClickCommand="{Binding EditItemCommand}" AutoGenerateColumns="False" Style="{StaticResource FSE_DataGrid}" CellStyle="{StaticResource FSE_DataGrid_Cell}" CanUserReorderColumns="False" CanUserSortColumns="False" ItemsSource="{Binding SelectedCollection.Items}" SelectedItem="{Binding SelectedItem}"> + <DataGrid.Columns> + <DataGridTemplateColumn Width="50"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <material:PackIcon Kind="Key" Width="32" /> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="KEY" Width="Auto"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock Text="{Binding Key}"></TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="TYPE" Width="Auto"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock Text="{Binding Type}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Foreground" Value="{StaticResource FSE_PrimaryForegroundBrush}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Type}" Value="Boolean"> + <Setter Property="Foreground" Value="#FF9BFF"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Type}" Value="Bytes"> + <Setter Property="Foreground" Value="#FFFBA3"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Type}" Value="Double"> + <Setter Property="Foreground" Value="#85B1FF"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Type}" Value="Float"> + <Setter Property="Foreground" Value="#FFDCB8"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Type}" Value="Int32"> + <Setter Property="Foreground" Value="#FF858D "></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Type}" Value="String"> + <Setter Property="Foreground" Value="#B9FFA5"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding Type}" Value="Proto"> + <Setter Property="Foreground" Value="#A5FFF9"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="GLOBAL" Width="Auto"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock Text="{Binding GlobalItem,Converter={StaticResource DataStoreValueToStringConverter},TargetNullValue='-'}"></TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Header="LOCAL" Width="1*"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <TextBlock Text="{Binding FormattedValue,Converter={StaticResource StringToOneLineConverter},ConverterParameter='100',Mode=OneWay}" Visibility="{Binding IsDeleted,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="FontWeight" Value="Normal"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding HasDifference}" Value="True"> + <Setter Property="FontWeight" Value="Bold"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTemplateColumn Width="100"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <UniformGrid Columns="2"> + <controls:IconButton ToolTip="Edit local value" Cursor="Hand" Width="20" Padding="0" Height="20" Icon="Edit" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.EditItemCommand}" CommandParameter="{Binding}" /> + <Grid IsEnabled="{Binding IsGlobal,Converter={StaticResource BooleanInverseConverter}}"> + <controls:IconButton ToolTip="Delete local" IsEnabled="{Binding IsDeleted,Converter={StaticResource BooleanInverseConverter}}" Cursor="Hand" Width="20" Height="20" Padding="0" Icon="Close" Foreground="{StaticResource FSE_RedBrush}" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.RemoveItemCommand}" CommandParameter="{Binding}" /> + </Grid> + </UniformGrid> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + </DataGrid.Columns> + </DataGrid> + </Grid> + </Border> + </Grid> + </DockPanel> + </Grid> + </DockPanel> + </DockPanel> +</UserControl> diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/DataStoreView.xaml.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/DataStoreView.xaml.cs new file mode 100644 index 000000000..add553b35 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/DataStoreView.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.FSE.MachineConfiguration.Views +{ + /// <summary> + /// Interaction logic for MachineDataStoreView.xaml + /// </summary> + public partial class DataStoreView : UserControl + { + public DataStoreView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/MachineView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/MachineView.xaml new file mode 100644 index 000000000..d33966e18 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/MachineView.xaml @@ -0,0 +1,49 @@ +<UserControl x:Class="Tango.FSE.MachineConfiguration.Views.MachineView" + 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.FSE.MachineConfiguration" + xmlns:vm="clr-namespace:Tango.FSE.MachineConfiguration.ViewModels" + xmlns:local="clr-namespace:Tango.FSE.MachineConfiguration.Views" + xmlns:commonControls="clr-namespace:Tango.FSE.Common.Controls;assembly=Tango.FSE.Common" + xmlns:resolution="clr-namespace:Tango.FSE.Common.Resolution;assembly=Tango.FSE.Common" + mc:Ignorable="d" + d:DesignHeight="1080" d:DesignWidth="1920" d:DataContext="{d:DesignInstance Type=vm:MachineViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MachineViewVM}" d:DesignStyle="{StaticResource FSE_User_Control_Designer}"> + <Grid> + + <Grid Margin="0 20 0 0"> + <Grid> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Margin" Value="100 0"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ResolutionService.IsLowResolution}" Value="True"> + <Setter Property="Margin" Value="10"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + + <DockPanel> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Top" HorizontalAlignment="Left"> + <Image Source="{StaticResource FSE_Machine_Full}" Width="100" Stretch="Uniform" RenderOptions.BitmapScalingMode="Fant" /> + <StackPanel Margin="5 0 0 0"> + <TextBlock Text="{Binding EditingComposition.Machine.SerialNumber,FallbackValue='101010'}" FontSize="{StaticResource FSE_ModuleHeaderFontSize}"></TextBlock> + <TextBlock Text="{Binding EditingComposition.Machine.Organization.Name,FallbackValue='Organization'}" FontSize="{StaticResource FSE_LargerFontSize}" Foreground="{StaticResource FSE_GrayBrush}"></TextBlock> + </StackPanel> + </StackPanel> + <Grid Margin="0 20 0 0"> + <commonControls:FSETabControl TabsWidth="500" x:Name="tabs" SelectedObject="{Binding SelectedView,Mode=TwoWay}"> + <local:SettingsView Tag="SETTINGS"/> + <local:DataStoreView Tag="DATA STORE"/> + </commonControls:FSETabControl> + + <TextBlock resolution:ResolutionHelper.MinWidth="1500" Margin="10 0 0 0" FontFamily="{StaticResource hand}" FontSize="{StaticResource FSE_ModuleHeaderFontSize}" Foreground="{StaticResource FSE_PrimaryAccentDarkBrush}" VerticalAlignment="Top" HorizontalAlignment="Left" Text="{Binding ElementName=tabs,Path=SelectedElement.Tag,Converter={StaticResource StringToTitleCaseConverter}}"></TextBlock> + </Grid> + </DockPanel> + </Grid> + </Grid> + + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/MachineView.xaml.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/MachineView.xaml.cs new file mode 100644 index 000000000..5e4d5ed7d --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/MachineView.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.FSE.MachineConfiguration.Views +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class MachineView : UserControl + { + public MachineView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/MainView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/MainView.xaml new file mode 100644 index 000000000..a321a1bb8 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/MainView.xaml @@ -0,0 +1,18 @@ +<UserControl x:Class="Tango.FSE.MachineConfiguration.Views.MainView" + 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.FSE.MachineConfiguration" + xmlns:vm="clr-namespace:Tango.FSE.MachineConfiguration.ViewModels" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:local="clr-namespace:Tango.FSE.MachineConfiguration.Views" + mc:Ignorable="d" + d:DesignHeight="1920" d:DesignWidth="1080" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}" d:DesignStyle="{StaticResource FSE_User_Control_Designer}"> + <Grid> + <controls:NavigationControl TransitionType="Slide" TransitionDuration="00:00:0.2"> + <local:SelectionView/> + <local:MachineView/> + </controls:NavigationControl> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/MainView.xaml.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/MainView.xaml.cs new file mode 100644 index 000000000..650c297a4 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/MainView.xaml.cs @@ -0,0 +1,31 @@ +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.FSE.MachineConfiguration.Views +{ + /// <summary> + /// Interaction logic for MainView.xaml + /// </summary> + public partial class MainView : UserControl + { + public static MainView Instance { get; set; } + + public MainView() + { + Instance = this; + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/SelectionView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/SelectionView.xaml new file mode 100644 index 000000000..51039ca89 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/SelectionView.xaml @@ -0,0 +1,61 @@ +<UserControl x:Class="Tango.FSE.MachineConfiguration.Views.SelectionView" + 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:local="clr-namespace:Tango.FSE.MachineConfiguration.Views" + xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:global="clr-namespace:Tango.FSE.MachineConfiguration" + xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete" + xmlns:vm="clr-namespace:Tango.FSE.MachineConfiguration.ViewModels" + mc:Ignorable="d" + d:DesignHeight="1080" d:DesignWidth="1920" d:DataContext="{d:DesignInstance Type=vm:SelectionViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.SelectionViewVM}" d:DesignStyle="{StaticResource FSE_User_Control_Designer}"> + <Grid> + <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> + + <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource FSE_ModuleHeaderFontSize}">Machine Configuration</TextBlock> + <TextBlock TextWrapping="Wrap" Margin="0 20 0 0" TextAlignment="Center" LineHeight="25"> + <Run>The machine configuration module allows you to manage the currently connected machine configuration and other machine settings.</Run> + <LineBreak/> + <Run>Given the proper permissions, you will also be able to manage other organization machines.</Run> + </TextBlock> + + <StackPanel Margin="0 40 0 0" Width="500" HorizontalAlignment="Center"> + <Image Source="../Images/configuration.png" Stretch="None" /> + + <TextBlock Margin="60" HorizontalAlignment="Center" FontWeight="SemiBold" Foreground="{StaticResource FSE_PrimaryAccentBrush}" FontSize="{StaticResource FSE_LargerFontSize}">Select Machine</TextBlock> + <autoComplete:AutoCompleteTextBox material:HintAssist.Hint="Serial Number" MaxPopupHeight="300" Margin="0 5 0 0" Provider="{Binding MachinesAutoCompleteProvider}" SelectedItem="{Binding SelectedMachine,Mode=TwoWay}" DisplayMember="SerialNumber"> + <autoComplete:AutoCompleteTextBox.SelectedItemTemplate> + <DataTemplate> + <DockPanel VerticalAlignment="Center"> + <Image RenderOptions.BitmapScalingMode="Fant" Source="{StaticResource FSE_Machine_Small}" Width="24" /> + <StackPanel VerticalAlignment="Center" Margin="10 0 0 0" Orientation="Horizontal"> + <TextBlock Text="{Binding SerialNumber}" FontSize="{StaticResource FSE_SmallFontSize}"></TextBlock> + <TextBlock Margin="10 0 0 0" FontSize="{StaticResource FSE_SmallFontSize}" Foreground="{StaticResource FSE_GrayBrush}" Text="{Binding Name}"></TextBlock> + </StackPanel> + </DockPanel> + </DataTemplate> + </autoComplete:AutoCompleteTextBox.SelectedItemTemplate> + <autoComplete:AutoCompleteTextBox.ItemTemplate> + <DataTemplate> + <DockPanel VerticalAlignment="Center"> + <Image RenderOptions.BitmapScalingMode="Fant" Source="{StaticResource FSE_Machine_Small}" Width="32" /> + <StackPanel Margin="5 0 0 0"> + <TextBlock Text="{Binding SerialNumber}"></TextBlock> + <TextBlock Margin="0 5 0 0" FontSize="{StaticResource FSE_SmallerFontSize}" Foreground="{StaticResource FSE_GrayBrush}" Text="{Binding Name}"></TextBlock> + </StackPanel> + </DockPanel> + </DataTemplate> + </autoComplete:AutoCompleteTextBox.ItemTemplate> + </autoComplete:AutoCompleteTextBox> + + <Button material:ButtonAssist.CornerRadius="25" Command="{Binding ManageMachineCommand}" Margin="0 100 0 0" Height="50" Width="250" FocusVisualStyle="{x:Null}"> + <DockPanel> + <TextBlock>CONTINUE</TextBlock> + <material:PackIcon Margin="10 0 0 0" VerticalAlignment="Center" Kind="ArrowRight" /> + </DockPanel> + </Button> + </StackPanel> + </StackPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/SelectionView.xaml.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/SelectionView.xaml.cs new file mode 100644 index 000000000..618ae299a --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/SelectionView.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.FSE.MachineConfiguration.Views +{ + /// <summary> + /// Interaction logic for MachineSelectionView.xaml + /// </summary> + public partial class SelectionView : UserControl + { + public SelectionView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/SettingsView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/SettingsView.xaml new file mode 100644 index 000000000..88df5a0b3 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/SettingsView.xaml @@ -0,0 +1,196 @@ +<UserControl x:Class="Tango.FSE.MachineConfiguration.Views.SettingsView" + 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:local="clr-namespace:Tango.FSE.MachineConfiguration.Views" + xmlns:global="clr-namespace:Tango.FSE.MachineConfiguration" + xmlns:auth="clr-namespace:Tango.FSE.Common.Authorization;assembly=Tango.FSE.Common" + xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:vm="clr-namespace:Tango.FSE.MachineConfiguration.ViewModels" + xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" + xmlns:commonControls="clr-namespace:Tango.FSE.Common.Controls;assembly=Tango.FSE.Common" + xmlns:resolution="clr-namespace:Tango.FSE.Common.Resolution;assembly=Tango.FSE.Common" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete" + mc:Ignorable="d" + d:DesignHeight="2000" d:DesignWidth="1920" d:DataContext="{d:DesignInstance Type=vm:SettingsViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.SettingsViewVM}" d:DesignStyle="{StaticResource FSE_User_Control_Designer}"> + + <Grid Margin="0 20"> + + <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Padding="0 0 20 0" FocusVisualStyle="{x:Null}"> + + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="4*" /> + <ColumnDefinition Width="5*" /> + </Grid.ColumnDefinitions> + + <!--<Grid Grid.Column="1"> + <commonControls:MachineView Opacity="0.6" DataContext="{Binding EditingComposition.Machine}" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="50 100 50 50" MaxWidth="600" /> + </Grid>--> + + <StackPanel Grid.Column="0" > + + <GroupBox Margin="0 20" Style="{StaticResource FSE_Game_GroupBox}" Header="Provisioning" auth:AuthorizationHelper.Mode="Disabled" auth:AuthorizationHelper.Permission="FSE_ModifyMachineProvisioning"> + <StackPanel Margin="0 0 0 5"> + <DockPanel VerticalAlignment="Top" Margin="0 10 0 0" ToolTip="Activate the windows operating system license"> + <ToggleButton IsChecked="{Binding EditingComposition.Machine.SetupActivation}" /> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">Activate Windows License</TextBlock> + </DockPanel> + + <StackPanel Margin="43 0 0 0"> + <TextBlock Foreground="{StaticResource FSE_GrayBrush}" FontSize="{StaticResource FSE_SmallerFontSize}">License Key</TextBlock> + <TextBox Foreground="{StaticResource FSE_GrayBrush}" Text="{Binding EditingComposition.Machine.OsKey,UpdateSourceTrigger=PropertyChanged}" FontSize="{StaticResource FSE_SmallFontSize}" VerticalAlignment="Center" Style="{StaticResource FSE_Rounded_Corners_TextBox}" Margin="0 2 0 0" Width="250" HorizontalAlignment="Left"></TextBox> + </StackPanel> + + <DockPanel Margin="0 20 0 0" ToolTip="Install Team Viewer for remote desktop support"> + <ToggleButton IsChecked="{Binding EditingComposition.Machine.SetupRemoteAssistance}" /> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">Setup Team Viewer</TextBlock> + </DockPanel> + + <DockPanel Margin="0 20 0 0" ToolTip="Perform UWF activation for protecting the disk by resetting file system changes after each system restart"> + <ToggleButton IsChecked="{Binding EditingComposition.Machine.SetupUwf}" /> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">Activate Disk Protection</TextBlock> + </DockPanel> + + <DockPanel Margin="0 20 0 0" ToolTip="Connect the panel PC application to an in-memory emulator (for testing purpose only)"> + <ToggleButton IsChecked="{Binding EditingComposition.Machine.IsDemo}" /> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">Use Firmware Emulator (Demo Machine)</TextBlock> + </DockPanel> + <StackPanel Margin="2 40 0 0"> + + <Separator Margin="0 10" /> + + <TextBlock FontWeight="SemiBold" Foreground="{StaticResource FSE_RedBrush}">Device Registration</TextBlock> + + <DockPanel> + <StackPanel> + + <TextBlock Margin="0 5 0 0" FontSize="{StaticResource FSE_SmallFontSize}"> + <Run>Registered:</Run> + <Run Foreground="{StaticResource FSE_GrayBrush}" Text="{Binding EditingComposition.Machine.IsDeviceRegistered,Mode=OneWay,Converter={StaticResource BooleanToYesNoConverter},FallbackValue='No'}"></Run> + </TextBlock> + + <TextBlock Margin="0 5 0 0" FontSize="{StaticResource FSE_SmallFontSize}"> + <Run>Device ID:</Run> + <Run Foreground="{StaticResource FSE_GrayBrush}" Text="{Binding EditingComposition.Machine.DeviceId,Mode=OneWay,FallbackValue='N/A',TargetNullValue='N/A'}"></Run> + </TextBlock> + + <TextBlock Margin="0 5 0 0" FontSize="{StaticResource FSE_SmallFontSize}"> + <Run>Device Name:</Run> + <Run Foreground="{StaticResource FSE_GrayBrush}" Text="{Binding EditingComposition.Machine.DeviceName,Mode=OneWay,FallbackValue='N/A',TargetNullValue='N/A'}"></Run> + </TextBlock> + </StackPanel> + + <Button Width="180" Command="{Binding ResetDeviceRegistrationCommand}" Margin="0 0 10 0" ToolTip="Device registration protects the system from provisioning of the same machine on multiple devices (panel PC's). Use this reset option when replacing an existing panel PC with a new one." IsEnabled="{Binding Machine.IsDeviceRegistered}" Cursor="Hand" HorizontalAlignment="Right" FontSize="{StaticResource FSE_SmallFontSize}" VerticalAlignment="Bottom" Style="{StaticResource FSE_Button_Red}">Reset Device Registration</Button> + </DockPanel> + </StackPanel> + + <StackPanel Margin="2 40 0 0"> + + <Separator Margin="0 10" /> + + <TextBlock FontWeight="SemiBold" Foreground="{StaticResource FSE_RedBrush}">Machine Counters</TextBlock> + + <DockPanel> + <StackPanel> + + <TextBlock Margin="0 5 0 0" FontSize="{StaticResource FSE_SmallFontSize}"> + <Run>Total Dye Time:</Run> + <Run Foreground="{StaticResource FSE_GrayBrush}" Text="{Binding EditingComposition.TotalDyeTime,Mode=OneWay,FallbackValue='N/A',TargetNullValue='N/A'}"></Run> + </TextBlock> + + <TextBlock Margin="0 5 0 0" FontSize="{StaticResource FSE_SmallFontSize}"> + <Run>Total Dye Meters:</Run> + <Run Foreground="{StaticResource FSE_GrayBrush}" Text="{Binding EditingComposition.TotalDyeMeters,Mode=OneWay,FallbackValue='N/A',TargetNullValue='N/A'}"></Run> + </TextBlock> + </StackPanel> + + <Button Width="180" Command="{Binding ResetCountersCommand}" Margin="0 0 10 0" ToolTip="Reset the entire job runs history for this machine" IsEnabled="{Binding Machine.IsDeviceRegistered}" Cursor="Hand" HorizontalAlignment="Right" FontSize="{StaticResource FSE_SmallFontSize}" VerticalAlignment="Bottom" Style="{StaticResource FSE_Button_Red}">Reset Machine Counters</Button> + </DockPanel> + </StackPanel> + </StackPanel> + </GroupBox> + + <GroupBox Margin="0 20" Style="{StaticResource FSE_Game_GroupBox}" Header="Machine Update" auth:AuthorizationHelper.Mode="Disabled" auth:AuthorizationHelper.Permission="FSE_ModifyMachineUpdate"> + <StackPanel Margin="0 10 0 5"> + <DockPanel ToolTip="Prevent firmware upgrade when updating"> + <ToggleButton material:ToggleButtonAssist.SwitchTrackOnBackground="{StaticResource FSE_PrimaryBackgroundLighterBrush}" IsChecked="{Binding EditingComposition.Machine.SetupFirmware,Converter={StaticResource BooleanInverseConverter}}" /> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">Disable Firmware Upgrade</TextBlock> + </DockPanel> + + <DockPanel Margin="0 20 0 0" ToolTip="Force the machine to perform an update even if there is no update available"> + <ToggleButton IsChecked="{Binding EditingComposition.Machine.ForceVersionUpdate}" /> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">Force Version Update</TextBlock> + </DockPanel> + + <DockPanel Margin="0 20 0 0" ToolTip="Prevent this machine from updating software"> + <ToggleButton IsChecked="{Binding EditingComposition.Machine.SuspendVersionUpdate}" /> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">Suspend Version Update</TextBlock> + </DockPanel> + </StackPanel> + </GroupBox> + + <GroupBox Margin="0 20" Style="{StaticResource FSE_Game_GroupBox}" Header="Machine Identity" auth:AuthorizationHelper.Mode="Disabled" auth:AuthorizationHelper.Permission="FSE_ModifyMachineIdentity"> + <StackPanel Margin="0 0 0 5"> + + <StackPanel Margin="0 10 0 0"> + <TextBlock FontSize="{StaticResource FSE_SmallFontSize}" Foreground="{StaticResource FSE_GrayBrush}">Serial Number</TextBlock> + <TextBox Margin="0 2 0 0" Text="{Binding EditingComposition.Machine.SerialNumber}" Width="250" HorizontalAlignment="Left"></TextBox> + </StackPanel> + + <StackPanel Margin="0 20 0 0"> + <TextBlock FontSize="{StaticResource FSE_SmallFontSize}" Foreground="{StaticResource FSE_GrayBrush}">Name</TextBlock> + <TextBox Margin="0 2 0 0" Text="{Binding EditingComposition.Machine.Name}" Width="250" HorizontalAlignment="Left"></TextBox> + </StackPanel> + + <StackPanel Margin="0 20 0 0"> + <TextBlock FontSize="{StaticResource FSE_SmallFontSize}" Foreground="{StaticResource FSE_GrayBrush}">Organization</TextBlock> + <ComboBox Width="250" HorizontalAlignment="Left" ItemsSource="{Binding EditingComposition.Organizations}" SelectedItem="{Binding EditingComposition.Machine.Organization}" DisplayMemberPath="Name" /> + </StackPanel> + + <StackPanel Margin="0 20 0 0"> + <TextBlock FontSize="{StaticResource FSE_SmallFontSize}" Foreground="{StaticResource FSE_GrayBrush}">Site</TextBlock> + <ComboBox Width="250" HorizontalAlignment="Left" ItemsSource="{Binding Sites}" SelectedItem="{Binding SelectedSite}" DisplayMemberPath="Name" /> + </StackPanel> + </StackPanel> + </GroupBox> + + <GroupBox Margin="0 20" Style="{StaticResource FSE_Game_GroupBox}" Header="Hardware" auth:AuthorizationHelper.Mode="Disabled" auth:AuthorizationHelper.Permission="FSE_ModifyMachineHardware"> + <StackPanel> + <StackPanel Margin="0 10 0 0"> + <TextBlock FontSize="{StaticResource FSE_SmallFontSize}" Foreground="{StaticResource FSE_GrayBrush}">Head Type</TextBlock> + <ComboBox Width="250" HorizontalAlignment="Left" ItemsSource="{Binding Source={x:Type enumerations:HeadTypes},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding EditingComposition.Machine.MachineHeadType}" SelectedValuePath="Value" DisplayMemberPath="DisplayName" /> + </StackPanel> + + <StackPanel Margin="0 20 0 0"> + <TextBlock FontSize="{StaticResource FSE_SmallFontSize}" Foreground="{StaticResource FSE_GrayBrush}">Hardware Version</TextBlock> + <controls:SearchComboBox MinWidth="250" HorizontalAlignment="Left" ItemsSource="{Binding EditingComposition.HardwareVersions}" SelectedItem="{Binding EditingComposition.Machine.Configuration.HardwareVersion}" SearchProperty="FullName" /> + </StackPanel> + </StackPanel> + </GroupBox> + </StackPanel> + </Grid> + </ScrollViewer> + + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="4*" /> + <ColumnDefinition Width="5*" /> + </Grid.ColumnDefinitions> + + <Grid Grid.Column="1" Margin="0 0 50 0"> + <DockPanel> + <Button Command="{Binding SaveCommand}" DockPanel.Dock="Bottom" VerticalAlignment="Top" HorizontalAlignment="Center" Width="250" Height="50" Margin="0 -40 0 0" material:ButtonAssist.CornerRadius="25"> + <DockPanel> + <material:PackIcon Kind="ContentSave" /> + <TextBlock Margin="5 0 0 0">SAVE</TextBlock> + </DockPanel> + </Button> + <commonControls:MachineView Opacity="0.6" DataContext="{Binding EditingComposition.Machine}" HorizontalAlignment="Center" VerticalAlignment="Top" resolution:ResolutionHelper.HighResolutionMargin="50 50 50 50" resolution:ResolutionHelper.LowResolutionMargin="50 0 50 50" MaxWidth="600" /> + </DockPanel> + </Grid> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/SettingsView.xaml.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/SettingsView.xaml.cs new file mode 100644 index 000000000..bdf8d904d --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/Views/SettingsView.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.FSE.MachineConfiguration.Views +{ + /// <summary> + /// Interaction logic for MachineDataStoreView.xaml + /// </summary> + public partial class SettingsView : UserControl + { + public SettingsView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/app.config b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/app.config new file mode 100644 index 000000000..36bc04f85 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/app.config @@ -0,0 +1,85 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <configSections> + <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> + <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> + </configSections> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-5.0.5.0" newVersion="5.0.5.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.2.2.0" newVersion="1.2.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.4.2.0" newVersion="1.4.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> + </dependentAssembly> + </assemblyBinding> + </runtime> + <entityFramework> + <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> + <providers> + <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> + </providers> + </entityFramework> +</configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/packages.config b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/packages.config new file mode 100644 index 000000000..dd8c723e4 --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.MachineConfiguration/packages.config @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="ControlzEx" version="3.0.2.4" targetFramework="net461" /> + <package id="EntityFramework" version="6.2.0" targetFramework="net461" /> + <package id="Google.Protobuf" version="3.4.1" targetFramework="net461" /> + <package id="MahApps.Metro" version="1.6.5" targetFramework="net461" /> + <package id="MaterialDesignColors" version="1.2.2" targetFramework="net461" /> + <package id="MaterialDesignThemes" version="3.0.1" targetFramework="net461" /> + <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" /> +</packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures.Documentation/Help/proc-doc.chm b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures.Documentation/Help/proc-doc.chm Binary files differindex c77ff4e85..ef7ec26c0 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures.Documentation/Help/proc-doc.chm +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures.Documentation/Help/proc-doc.chm diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures.Documentation/Tango.FSE.Procedures.Documentation.shfbproj b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures.Documentation/Tango.FSE.Procedures.Documentation.shfbproj index dc353ec12..10bf82219 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures.Documentation/Tango.FSE.Procedures.Documentation.shfbproj +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures.Documentation/Tango.FSE.Procedures.Documentation.shfbproj @@ -34,7 +34,7 @@ <DocumentationSource sourceFile="..\Tango.FSE.Procedures\Tango.FSE.Procedures.csproj" /> <DocumentationSource sourceFile="..\..\Tango.FSE.Common\Tango.FSE.Common.csproj" /> <DocumentationSource sourceFile="..\..\..\PPC\Tango.PPC.Shared\Tango.PPC.Shared.csproj" /> - <DocumentationSource sourceFile="..\..\..\Tango.DataStore\Tango.DataStore.csproj" /> + <DocumentationSource sourceFile="..\..\..\DataStore\Tango.DataStore\Tango.DataStore.csproj" /> </DocumentationSources> <HelpFileFormat>HtmlHelp1</HelpFileFormat> <SyntaxFilters>C#</SyntaxFilters> @@ -57,106 +57,107 @@ <VisibleItems>InheritedMembers, InheritedFrameworkMembers, ProtectedInternalAsProtected, NonBrowsable</VisibleItems> <ApiFilter> <Filter entryType="Namespace" fullName="" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.DataStore" isExposed="True"> - <Filter entryType="Class" fullName="Tango.DataStore.DataStoreHelper" filterName="DataStoreHelper" isExposed="False" /> -</Filter> -<Filter entryType="Namespace" fullName="Tango.FSE.Common" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Authentication" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Authorization" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.AutoComplete" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Behaviors" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.BugReporting" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Connection" isExposed="False"> - <Filter entryType="Enumeration" fullName="Tango.FSE.Common.Connection.MachineConnectionTypes" filterName="MachineConnectionTypes" isExposed="True" /> -</Filter> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Connectivity" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Console" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Controls" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Converters" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Core" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.DemoMode" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Diagnostics" isExposed="False"> - <Filter entryType="Class" fullName="Tango.FSE.Common.Diagnostics.DiagnosticsPackage" filterName="DiagnosticsPackage" isExposed="True"> - <Filter entryType="Property" fullName="Tango.FSE.Common.Diagnostics.DiagnosticsPackage.Frame" filterName="Frame" isExposed="False" /> - <Filter entryType="Property" fullName="Tango.FSE.Common.Diagnostics.DiagnosticsPackage.MonitorsProperties" filterName="MonitorsProperties" isExposed="False" /> - </Filter> -</Filter> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Dialogs" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Events" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.EventTriggerActions" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.FileAssociation" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.FileSystem" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Firmware" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.FSEApplication" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Graphs" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Helpers" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Insights" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Logging" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.MachineUpdates" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Modules" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Navigation" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Notifications" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Performance" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.RemoteDesktop" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.RemoteJob" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.RemoteUpgrade" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Resolution" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Storage" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.SystemInfo" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Threading" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Tiles" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.Updates" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Common.WindowsManager" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Procedures" isExposed="False"> - <Filter entryType="Enumeration" fullName="Tango.FSE.Procedures.ArrayParsingStyle" filterName="ArrayParsingStyle" isExposed="True" /> - <Filter entryType="Interface" fullName="Tango.FSE.Procedures.IDialogController" filterName="IDialogController" isExposed="True" /> - <Filter entryType="Interface" fullName="Tango.FSE.Procedures.IProcedureContext" filterName="IProcedureContext" isExposed="True"> - <Filter entryType="Method" fullName="Tango.FSE.Procedures.IProcedureContext.BreakPoint" filterName="BreakPoint" isExposed="False" /> - <Filter entryType="Property" fullName="Tango.FSE.Procedures.IProcedureContext.Results" filterName="Results" isExposed="False" /> - <Filter entryType="Event" fullName="Tango.FSE.Procedures.IProcedureContext.BreakPointRequest" filterName="BreakPointRequest" isExposed="False" /> - <Filter entryType="Event" fullName="Tango.FSE.Procedures.IProcedureContext.Progress" filterName="Progress" isExposed="False" /> - </Filter> - <Filter entryType="Class" fullName="Tango.FSE.Procedures.Result" filterName="Result" isExposed="True"> - <Filter entryType="Property" fullName="Tango.FSE.Procedures.Result.IsBitmap" filterName="IsBitmap" isExposed="False" /> - <Filter entryType="Property" fullName="Tango.FSE.Procedures.Result.IsGraph" filterName="IsGraph" isExposed="False" /> - <Filter entryType="Property" fullName="Tango.FSE.Procedures.Result.IsValueArray" filterName="IsValueArray" isExposed="False" /> - </Filter> - <Filter entryType="Enumeration" fullName="Tango.FSE.Procedures.ResultType" filterName="ResultType" isExposed="True" /> - <Filter entryType="Class" fullName="Tango.FSE.Procedures.UserInput" filterName="UserInput" isExposed="True" /> -</Filter> -<Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Contracts" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Controls" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Converters" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Procedures.CSV" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Designer" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Dialogs" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Examples.AddResult" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Examples.Connection" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Examples.Csv" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Examples.Diagnostics" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Examples.RequestUserInputFor" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Examples.Send" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Examples.SendContinuous" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Examples.Sql" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Helpers" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Messages" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Navigation" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Procedures.ViewModels" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Views" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Windows" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.PPC.Shared.Information" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.PPC.Shared.Insights" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.PPC.Shared.Jobs" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.PPC.Shared.Logs" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.PPC.Shared.Performance" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.PPC.Shared.RemoteActions" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.PPC.Shared.RemoteUpgrade" isExposed="False" /> -<Filter entryType="Namespace" fullName="Tango.PPC.Shared.SQL" isExposed="True"> - <Filter entryType="Class" fullName="Tango.PPC.Shared.SQL.ExecuteSqlRequest" filterName="ExecuteSqlRequest" isExposed="False" /> - <Filter entryType="Class" fullName="Tango.PPC.Shared.SQL.ExecuteSqlResponse" filterName="ExecuteSqlResponse" isExposed="False" /> -</Filter> -<Filter entryType="Namespace" fullName="Tango.PPC.Shared.Updates" isExposed="False" /> -<Filter entryType="Namespace" fullName="" isExposed="False" /></ApiFilter> + <Filter entryType="Namespace" fullName="Tango.DataStore" isExposed="True"> + <Filter entryType="Class" fullName="Tango.DataStore.DataStoreHelper" filterName="DataStoreHelper" isExposed="False" /> + </Filter> + <Filter entryType="Namespace" fullName="Tango.FSE.Common" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Authentication" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Authorization" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.AutoComplete" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Behaviors" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.BugReporting" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Connection" isExposed="False"> + <Filter entryType="Enumeration" fullName="Tango.FSE.Common.Connection.MachineConnectionTypes" filterName="MachineConnectionTypes" isExposed="True" /> + </Filter> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Connectivity" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Console" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Controls" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Converters" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Core" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.DemoMode" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Diagnostics" isExposed="False"> + <Filter entryType="Class" fullName="Tango.FSE.Common.Diagnostics.DiagnosticsPackage" filterName="DiagnosticsPackage" isExposed="True"> + <Filter entryType="Property" fullName="Tango.FSE.Common.Diagnostics.DiagnosticsPackage.Frame" filterName="Frame" isExposed="False" /> + <Filter entryType="Property" fullName="Tango.FSE.Common.Diagnostics.DiagnosticsPackage.MonitorsProperties" filterName="MonitorsProperties" isExposed="False" /> + </Filter> + </Filter> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Dialogs" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Events" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.EventTriggerActions" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.FileAssociation" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.FileSystem" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Firmware" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.FSEApplication" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Graphs" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Helpers" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Insights" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Logging" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.MachineUpdates" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Modules" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Navigation" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Notifications" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Performance" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.RemoteDesktop" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.RemoteJob" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.RemoteUpgrade" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Resolution" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Storage" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.SystemInfo" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Threading" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Tiles" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.Updates" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Common.WindowsManager" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Procedures" isExposed="False"> + <Filter entryType="Enumeration" fullName="Tango.FSE.Procedures.ArrayParsingStyle" filterName="ArrayParsingStyle" isExposed="True" /> + <Filter entryType="Interface" fullName="Tango.FSE.Procedures.IDialogController" filterName="IDialogController" isExposed="True" /> + <Filter entryType="Interface" fullName="Tango.FSE.Procedures.IProcedureContext" filterName="IProcedureContext" isExposed="True"> + <Filter entryType="Method" fullName="Tango.FSE.Procedures.IProcedureContext.BreakPoint" filterName="BreakPoint" isExposed="False" /> + <Filter entryType="Property" fullName="Tango.FSE.Procedures.IProcedureContext.Results" filterName="Results" isExposed="False" /> + <Filter entryType="Event" fullName="Tango.FSE.Procedures.IProcedureContext.BreakPointRequest" filterName="BreakPointRequest" isExposed="False" /> + <Filter entryType="Event" fullName="Tango.FSE.Procedures.IProcedureContext.Progress" filterName="Progress" isExposed="False" /> + </Filter> + <Filter entryType="Class" fullName="Tango.FSE.Procedures.Result" filterName="Result" isExposed="True"> + <Filter entryType="Property" fullName="Tango.FSE.Procedures.Result.IsBitmap" filterName="IsBitmap" isExposed="False" /> + <Filter entryType="Property" fullName="Tango.FSE.Procedures.Result.IsGraph" filterName="IsGraph" isExposed="False" /> + <Filter entryType="Property" fullName="Tango.FSE.Procedures.Result.IsValueArray" filterName="IsValueArray" isExposed="False" /> + </Filter> + <Filter entryType="Enumeration" fullName="Tango.FSE.Procedures.ResultType" filterName="ResultType" isExposed="True" /> + <Filter entryType="Class" fullName="Tango.FSE.Procedures.UserInput" filterName="UserInput" isExposed="True" /> + </Filter> + <Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Contracts" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Controls" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Converters" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Procedures.CSV" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Designer" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Dialogs" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Examples.AddResult" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Examples.Connection" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Examples.Csv" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Examples.Diagnostics" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Examples.RequestUserInputFor" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Examples.Send" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Examples.SendContinuous" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Examples.Sql" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Helpers" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Messages" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Navigation" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Procedures.ViewModels" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Views" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.FSE.Procedures.Windows" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.PPC.Shared.Information" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.PPC.Shared.Insights" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.PPC.Shared.Jobs" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.PPC.Shared.Logs" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.PPC.Shared.Performance" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.PPC.Shared.RemoteActions" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.PPC.Shared.RemoteUpgrade" isExposed="False" /> + <Filter entryType="Namespace" fullName="Tango.PPC.Shared.SQL" isExposed="True"> + <Filter entryType="Class" fullName="Tango.PPC.Shared.SQL.ExecuteSqlRequest" filterName="ExecuteSqlRequest" isExposed="False" /> + <Filter entryType="Class" fullName="Tango.PPC.Shared.SQL.ExecuteSqlResponse" filterName="ExecuteSqlResponse" isExposed="False" /> + </Filter> + <Filter entryType="Namespace" fullName="Tango.PPC.Shared.Updates" isExposed="False" /> + <Filter entryType="Namespace" fullName="" isExposed="False" /> + </ApiFilter> <ProjectSummary>This is the global summery for the help file.</ProjectSummary> <NamespaceSummaries> <NamespaceSummaryItem name="(global)" isDocumented="True">This is the global summery for the help file.</NamespaceSummaryItem> @@ -211,10 +212,10 @@ </Content> </ItemGroup> <ItemGroup> - <ProjectReference Include="..\..\..\Tango.DataStore\Tango.DataStore.csproj"> + <ProjectReference Include="..\..\..\DataStore\Tango.DataStore\Tango.DataStore.csproj"> <Name>Tango.DataStore</Name> <Project>{e0364dfa-0721-4637-9d32-9d22aac109d6}</Project> - <Private>True</Private> + <Private>False</Private> </ProjectReference> <ProjectReference Include="..\..\Tango.FSE.Common\Tango.FSE.Common.csproj"> <Name>Tango.FSE.Common</Name> diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Dialogs/SelectFolderDialogView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Dialogs/SelectFolderDialogView.xaml new file mode 100644 index 000000000..0541c5dcb --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Dialogs/SelectFolderDialogView.xaml @@ -0,0 +1,28 @@ +<UserControl x:Class="Tango.FSE.Procedures.Dialogs.SelectFolderDialogView" + 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.FSE.Common.Controls;assembly=Tango.FSE.Common" + xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:local="clr-namespace:Tango.FSE.Procedures.Dialogs" + mc:Ignorable="d" + Width="600" Height="200" d:DataContext="{d:DesignInstance Type=local:SelectFolderDialogViewVM, IsDesignTimeCreatable=False}" Background="{StaticResource FSE_PrimaryBackgroundLightBrush}" Foreground="{StaticResource FSE_PrimaryForegroundBrush}"> + <Grid Margin="10"> + <DockPanel> + <StackPanel DockPanel.Dock="Top" Orientation="Horizontal"> + <material:PackIcon Kind="FolderOpen" Width="32" Height="32" /> + <TextBlock Margin="10 0 0 0" FontSize="{StaticResource FSE_LargeFontSize}" VerticalAlignment="Center">Select Folder</TextBlock> + </StackPanel> + + <StackPanel Margin="0 10 0 0"> + <TextBlock Text="{Binding Message}"></TextBlock> + + <DockPanel Margin="0 5 0 0"> + <controls:IconButton Command="{Binding BrowseCommand}" Margin="5 0 0 0" DockPanel.Dock="Right" Icon="FolderOpen" /> + <TextBox material:HintAssist.Hint="Selected Folder" material:HintAssist.IsFloating="True" Text="{Binding SelectedFolder}" IsReadOnly="True"></TextBox> + </DockPanel> + </StackPanel> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Dialogs/SelectFolderDialogView.xaml.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Dialogs/SelectFolderDialogView.xaml.cs new file mode 100644 index 000000000..846ffa67e --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Dialogs/SelectFolderDialogView.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.FSE.Procedures.Dialogs +{ + /// <summary> + /// Interaction logic for UserFileDialogView.xaml + /// </summary> + public partial class SelectFolderDialogView : UserControl + { + public SelectFolderDialogView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Dialogs/SelectFolderDialogViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Dialogs/SelectFolderDialogViewVM.cs new file mode 100644 index 000000000..3e871e0ca --- /dev/null +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Dialogs/SelectFolderDialogViewVM.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.Core.DI; +using Tango.FSE.Common; +using Tango.FSE.Common.Storage; + +namespace Tango.FSE.Procedures.Dialogs +{ + public class SelectFolderDialogViewVM : FSEDialogViewVM + { + [TangoInject] + protected IStorageProvider StorageProvider { get; set; } + + private String _selectedFolder; + public String SelectedFolder + { + get { return _selectedFolder; } + set { _selectedFolder = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + } + + public String Message { get; set; } + + public RelayCommand BrowseCommand { get; set; } + + public SelectFolderDialogViewVM(String message) + { + TangoIOC.Default.Inject(this); + + AutoMode = true; + Message = message; + + BrowseCommand = new RelayCommand(BrowseForFolder); + } + + private async void BrowseForFolder() + { + var result = await StorageProvider.SelectFolder("Select folder"); + + if (result.Confirmed) + { + SelectedFolder = result.SelectedItem; + } + } + + protected override bool CanOK() + { + return base.CanOK() && SelectedFolder != null; + } + + protected override void Cancel() + { + SelectedFolder = null; + base.Cancel(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/IProcedureContext.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/IProcedureContext.cs index 69b747906..ff45a7df4 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/IProcedureContext.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/IProcedureContext.cs @@ -496,6 +496,13 @@ namespace Tango.FSE.Procedures String RequestFileSave(String message, String extension = "*.*", String defaultFileName = null); /// <summary> + /// Requests a folder path from the user. + /// </summary> + /// <param name="message">The message.</param> + /// <returns></returns> + String RequestFolderSelect(String message); + + /// <summary> /// Updates the procedure user progress. /// </summary> /// <param name="message">The progress message.</param> diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/ProcedureContext.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/ProcedureContext.cs index 43c969a35..f47f1174e 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/ProcedureContext.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/ProcedureContext.cs @@ -566,6 +566,22 @@ namespace Tango.FSE.Procedures return result; } + public string RequestFolderSelect(string message) + { + SelectFolderDialogViewVM vm = new SelectFolderDialogViewVM(message); + + TaskCompletionSource<String> completion = new TaskCompletionSource<String>(); + + DispatcherProvider.Invoke(async () => + { + await NotificationProvider.ShowDialog(vm); + completion.SetResult(vm.SelectedFolder); + }); + + var result = completion.Task.GetAwaiter().GetResult(); + return result; + } + public void UpdateProgress(string message, bool isIndeterminate = true, double value = 0, double maximum = 100) { Progress?.Invoke(this, new TangoProgressChangedEventArgs<double>() diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Tango.FSE.Procedures.csproj b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Tango.FSE.Procedures.csproj index 2e7099857..72b3dadd1 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Tango.FSE.Procedures.csproj +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Tango.FSE.Procedures.csproj @@ -134,6 +134,10 @@ <DependentUpon>LoadPublishedProjectView.xaml</DependentUpon> </Compile> <Compile Include="Dialogs\LoadPublishedProjectViewVM.cs" /> + <Compile Include="Dialogs\SelectFolderDialogView.xaml.cs"> + <DependentUpon>SelectFolderDialogView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\SelectFolderDialogViewVM.cs" /> <Compile Include="Dialogs\ProcedureDialogEditorView.xaml.cs"> <DependentUpon>ProcedureDialogEditorView.xaml</DependentUpon> </Compile> @@ -284,7 +288,7 @@ <Project>{58e8825f-0c96-449c-b320-1e82b0aa876b}</Project> <Name>Tango.CSV</Name> </ProjectReference> - <ProjectReference Include="..\..\..\Tango.DataStore\Tango.DataStore.csproj"> + <ProjectReference Include="..\..\..\DataStore\Tango.DataStore\Tango.DataStore.csproj"> <Project>{e0364dfa-0721-4637-9d32-9d22aac109d6}</Project> <Name>Tango.DataStore</Name> </ProjectReference> @@ -350,6 +354,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Dialogs\SelectFolderDialogView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="Dialogs\ProcedureDialogEditorView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Themes/Generic.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Themes/Generic.xaml index 3917368f2..0e055d730 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Themes/Generic.xaml +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Procedures/Themes/Generic.xaml @@ -635,7 +635,6 @@ </Style.Triggers> </Style> - <Style x:Key="FSE_Debug_TextBoxStyle" TargetType="TextBox"> <Setter Property="Background" Value="Transparent"></Setter> <Setter Property="BorderBrush" Value="{StaticResource FSE_BorderBrush}"></Setter> diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/ViewModels/OrganizationSelectionViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/ViewModels/OrganizationSelectionViewVM.cs index 9a84cca7d..0abc285a9 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/ViewModels/OrganizationSelectionViewVM.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/ViewModels/OrganizationSelectionViewVM.cs @@ -63,7 +63,7 @@ namespace Tango.FSE.UsersAndRoles.ViewModels try { - return Services.OrganizationsService.GetCurrentUserOrganizations().Result.Where(x => x.Name.ToLower().StartsWith(key.ToLower())).Take(4).ToList(); + return Services.OrganizationsService.GetCurrentUserOrganizations().Result.Where(x => x.Name.ToLower().StartsWith(key.ToLower())).ToList(); } catch (Exception ex) { diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/ViewModels/UserDetailsViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/ViewModels/UserDetailsViewVM.cs index 0e243e02d..20953faa1 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/ViewModels/UserDetailsViewVM.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.UsersAndRoles/ViewModels/UserDetailsViewVM.cs @@ -189,9 +189,10 @@ namespace Tango.FSE.UsersAndRoles.ViewModels { collection.Add(new RoleModel(roles.SingleOrDefault(x => x.RoleEnum == Roles.FSETwineTechnician), Roles.FSETechnician, Roles.FSEAdvancedTechnician)); collection.Add(new RoleModel(roles.SingleOrDefault(x => x.RoleEnum == Roles.FSETwineAdministrator), Roles.FSETechnician, Roles.FSEAdvancedTechnician, Roles.FSEAdministrator, Roles.FSETwineTechnician)); - collection.Add(new RoleModel(roles.SingleOrDefault(x => x.RoleEnum == Roles.FSETwineProcedureDesigner), Roles.FSETechnician)); - collection.Add(new RoleModel(roles.SingleOrDefault(x => x.RoleEnum == Roles.FSETwineProcedurePublisher), Roles.FSETechnician, Roles.FSETwineProcedureDesigner)); - collection.Add(new RoleModel(roles.SingleOrDefault(x => x.RoleEnum == Roles.FSETwineDeveloper), Roles.FSETechnician) { IsVisible = CurrentUser.HasRole(Roles.FSETwineDeveloper) }); + collection.Add(new RoleModel(roles.SingleOrDefault(x => x.RoleEnum == Roles.FSETwineProcedureDesigner), Roles.FSETechnician, Roles.FSEAdvancedTechnician, Roles.FSETwineTechnician)); + collection.Add(new RoleModel(roles.SingleOrDefault(x => x.RoleEnum == Roles.FSETwineProcedurePublisher), Roles.FSETechnician, Roles.FSEAdvancedTechnician, Roles.FSETwineTechnician, Roles.FSETwineProcedureDesigner)); + collection.Add(new RoleModel(roles.SingleOrDefault(x => x.RoleEnum == Roles.FSETwineDataStoreDeveloper), Roles.FSETechnician, Roles.FSEAdvancedTechnician, Roles.FSETwineTechnician)); + collection.Add(new RoleModel(roles.SingleOrDefault(x => x.RoleEnum == Roles.FSETwineDeveloper), Roles.FSETechnician, Roles.FSEAdvancedTechnician, Roles.FSETwineTechnician) { IsVisible = CurrentUser.HasRole(Roles.FSETwineDeveloper) }); } collection.ToList().ForEach(x => x.IsSelected = user.FSERoles.Any(y => y.Code == x.Role.Code)); diff --git a/Software/Visual_Studio/FSE/Roles & Permissions/Administrator.csv b/Software/Visual_Studio/FSE/Roles & Permissions/Administrator.csv new file mode 100644 index 000000000..c889f448e --- /dev/null +++ b/Software/Visual_Studio/FSE/Roles & Permissions/Administrator.csv @@ -0,0 +1,2 @@ +Administrator +Manage Organization Users And Roles diff --git a/Software/Visual_Studio/FSE/Roles & Permissions/Advanced Technician.csv b/Software/Visual_Studio/FSE/Roles & Permissions/Advanced Technician.csv new file mode 100644 index 000000000..35ac5c8ae --- /dev/null +++ b/Software/Visual_Studio/FSE/Roles & Permissions/Advanced Technician.csv @@ -0,0 +1,5 @@ +Advanced Technician +Remote Desktop Control +PPC File System Read +Firmware File System Read +Remote Upgrade Online diff --git a/Software/Visual_Studio/FSE/Roles & Permissions/Roles & Permissions.eddx b/Software/Visual_Studio/FSE/Roles & Permissions/Roles & Permissions.eddx Binary files differnew file mode 100644 index 000000000..dcabc3bf9 --- /dev/null +++ b/Software/Visual_Studio/FSE/Roles & Permissions/Roles & Permissions.eddx diff --git a/Software/Visual_Studio/FSE/Roles & Permissions/Roles & Permissions.pdf b/Software/Visual_Studio/FSE/Roles & Permissions/Roles & Permissions.pdf Binary files differnew file mode 100644 index 000000000..f5bf232bd --- /dev/null +++ b/Software/Visual_Studio/FSE/Roles & Permissions/Roles & Permissions.pdf diff --git a/Software/Visual_Studio/FSE/Roles & Permissions/Technician.csv b/Software/Visual_Studio/FSE/Roles & Permissions/Technician.csv new file mode 100644 index 000000000..f4a50edef --- /dev/null +++ b/Software/Visual_Studio/FSE/Roles & Permissions/Technician.csv @@ -0,0 +1,5 @@ +Technician +Run FSE +Remote Desktop View +PPC File System Read +Remote Upgrade Offline diff --git a/Software/Visual_Studio/FSE/Roles & Permissions/Twine Administrator.csv b/Software/Visual_Studio/FSE/Roles & Permissions/Twine Administrator.csv new file mode 100644 index 000000000..42d217a67 --- /dev/null +++ b/Software/Visual_Studio/FSE/Roles & Permissions/Twine Administrator.csv @@ -0,0 +1,3 @@ +Twine Administrator +Manage All Organizations Users And Roles +Reset Machine Device Registration diff --git a/Software/Visual_Studio/FSE/Roles & Permissions/Twine Data Store Developer.csv b/Software/Visual_Studio/FSE/Roles & Permissions/Twine Data Store Developer.csv new file mode 100644 index 000000000..b1650e363 --- /dev/null +++ b/Software/Visual_Studio/FSE/Roles & Permissions/Twine Data Store Developer.csv @@ -0,0 +1,2 @@ +Twine Data Store Developer +DataStore Create diff --git a/Software/Visual_Studio/FSE/Roles & Permissions/Twine Developer.csv b/Software/Visual_Studio/FSE/Roles & Permissions/Twine Developer.csv new file mode 100644 index 000000000..93a5fae98 --- /dev/null +++ b/Software/Visual_Studio/FSE/Roles & Permissions/Twine Developer.csv @@ -0,0 +1,2 @@ +Twine Developer +DataStore Create Write Global diff --git a/Software/Visual_Studio/FSE/Roles & Permissions/Twine Procedure Designer.csv b/Software/Visual_Studio/FSE/Roles & Permissions/Twine Procedure Designer.csv new file mode 100644 index 000000000..e0bc0e9f3 --- /dev/null +++ b/Software/Visual_Studio/FSE/Roles & Permissions/Twine Procedure Designer.csv @@ -0,0 +1,2 @@ +Twine Procedure Designer +Run Procedure Designer diff --git a/Software/Visual_Studio/FSE/Roles & Permissions/Twine Procedure Publisher.csv b/Software/Visual_Studio/FSE/Roles & Permissions/Twine Procedure Publisher.csv new file mode 100644 index 000000000..42d81e75e --- /dev/null +++ b/Software/Visual_Studio/FSE/Roles & Permissions/Twine Procedure Publisher.csv @@ -0,0 +1,2 @@ +Twine Procedure Publisher +Publish Procedure Projects diff --git a/Software/Visual_Studio/FSE/Roles & Permissions/Twine Technician.csv b/Software/Visual_Studio/FSE/Roles & Permissions/Twine Technician.csv new file mode 100644 index 000000000..2b1ce91aa --- /dev/null +++ b/Software/Visual_Studio/FSE/Roles & Permissions/Twine Technician.csv @@ -0,0 +1,18 @@ +Twine Technician +Connect Any Machine +PPC File System Write +Firmware File System Write +Execute Remote Console Commands +Edit Diagnostics Project +View FSE Logs +Modify Bug Report +View Internal Published Procedures +Run Procedure Project File +Run Configuration Module +Modify Machine Provisioning +Modify Machine Update +Modify Machine Identity +Modify Machine Hardware +DataStore Read +DataStore Write +Reset Machine Counters diff --git a/Software/Visual_Studio/FSE/Tango.FSE.BL/FSEServicesContainer.cs b/Software/Visual_Studio/FSE/Tango.FSE.BL/FSEServicesContainer.cs index e5487bc1e..c8773eccd 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.BL/FSEServicesContainer.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.BL/FSEServicesContainer.cs @@ -63,6 +63,16 @@ namespace Tango.FSE.BL public OrganizationsService OrganizationsService { get; set; } /// <summary> + /// Gets or sets the machine configuration service. + /// </summary> + public MachineConfigurationService MachineConfigurationService { get; set; } + + /// <summary> + /// Gets or sets the data store service. + /// </summary> + public DataStoreService DataStoreService { get; set; } + + /// <summary> /// Initializes a new instance of the <see cref="FSEServicesContainer"/> class. /// </summary> /// <param name="authentication">The authentication.</param> @@ -78,6 +88,8 @@ namespace Tango.FSE.BL PublishedProcedureProjectsService = new PublishedProcedureProjectsService(); MachineEventsService = new MachineEventsService(); OrganizationsService = new OrganizationsService(); + MachineConfigurationService = new MachineConfigurationService(); + DataStoreService = new DataStoreService(); } } } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/DataStoreService.cs b/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/DataStoreService.cs new file mode 100644 index 000000000..2dd29fdc4 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/DataStoreService.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; +using Tango.DataStore; + +namespace Tango.FSE.BL.Services +{ + public class DataStoreService : FSEServiceBase + { + public Task<List<GlobalDataStoreItem>> GetGlobalDataStoreItems() + { + return Task.Factory.StartNew<List<GlobalDataStoreItem>>(() => + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + return db.GlobalDataStoreItems.ToList().OrderBy(x => x.CollectionName).OrderBy(x => x.Key).ToList(); + } + }); + } + + public Task<List<DataStoreItem>> GetMachinelDataStoreItems(String machineGuid) + { + return Task.Factory.StartNew<List<DataStoreItem>>(() => + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + return db.DataStoreItems.Where(x => x.MachineGuid == machineGuid && !x.IsDeleted).ToList().OrderBy(x => x.CollectionName).OrderBy(x => x.Key).ToList(); + } + }); + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/MachineConfigurationService.cs b/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/MachineConfigurationService.cs new file mode 100644 index 000000000..a30198ff2 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/MachineConfigurationService.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; +using System.Data.Entity; +using Tango.BL.Builders; + +namespace Tango.FSE.BL.Services +{ + public class MachineConfigurationService : FSEServiceBase + { + public class MachineEditingComposition : IDisposable + { + public Machine Machine { get; set; } + public List<Organization> Organizations { get; set; } + public List<HardwareVersion> HardwareVersions { get; set; } + public String TotalDyeTime { get; set; } + public String TotalDyeMeters { get; set; } + internal ObservablesContext Context { get; set; } + + public MachineEditingComposition() + { + Organizations = new List<Organization>(); + HardwareVersions = new List<HardwareVersion>(); + } + + public void Dispose() + { + Context?.Dispose(); + Context = null; + } + } + + public Task<MachineEditingComposition> GetMachineEditingComposition(String machineGuid) + { + return Task.Factory.StartNew<MachineEditingComposition>(() => + { + ObservablesContext db = ObservablesContext.CreateDefault(); + + MachineEditingComposition composition = new MachineEditingComposition(); + + //Organizations + bool allowAll = CurrentUser.HasPermission(Tango.BL.Enumerations.Permissions.FSE_ManageAllOrganizationsUsersAndRoles); + composition.Organizations = db.Organizations.Where(x => allowAll || x.Guid == CurrentUser.OrganizationGuid).Include(x => x.Sites).ToList(); + + //Machine + composition.Machine = new MachineBuilder(db).Set(machineGuid).WithConfiguration().Build(); + + //Hardware Versions + composition.HardwareVersions = db.HardwareVersions.OrderByDescending(x => x.Version).ToList(); + + //Counters + var jobRuns = db.JobRuns.Where(x => x.MachineGuid == machineGuid).Select(x => new { x.StartDate, x.EndDate, x.EndPosition }).ToList(); + composition.TotalDyeTime = TimeSpan.FromHours(jobRuns.Select(x => x.EndDate - x.StartDate).Sum(x => x.TotalHours)).ToStringUnlimitedHours(); + int meters = (int)jobRuns.Select(x => x.EndPosition).Sum(); + composition.TotalDyeMeters = $"{meters.ToString("N0")} meters"; + + composition.Context = db; + + return composition; + }); + } + + public Task<MachineEditingComposition> SaveMachineEditingComposition(MachineEditingComposition composition) + { + return Task.Factory.StartNew<MachineEditingComposition>(() => + { + composition.Machine.SetupFpga = composition.Machine.SetupFirmware; + + composition.Context.SaveChanges(); + composition.Context.Dispose(); + return GetMachineEditingComposition(composition.Machine.Guid).Result; + }); + } + + public Task<int> ResetCounters(String machineGuid) + { + return Task.Factory.StartNew<int>(() => + { + using (ObservablesContext db = new ObservablesContext()) + { + return db.JobRuns.Where(x => x.MachineGuid == machineGuid).DeleteFromQuery(); + } + }); + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/MachinesService.cs b/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/MachinesService.cs index 6f598a770..c03077a45 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/MachinesService.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/MachinesService.cs @@ -73,7 +73,6 @@ namespace Tango.FSE.BL.Services LogManager.Log("Machine retrieved successfully. Caching machine..."); var cachedMachine = CachedMachine.FromObservable<CachedMachine>(machine); - var m = cachedMachine.ToObservable(); //Store in memory cache. _machinesCache.Put(serialNumber, cachedMachine); @@ -271,12 +270,24 @@ namespace Tango.FSE.BL.Services List<CachedMachine> cachedMachines = new List<CachedMachine>(); - try + foreach (var machine in machines) { - foreach (var machine in machines) + try { var cachedMachine = CachedMachine.FromObservable<CachedMachine>(machine); - _machinesCache.Put(machine.SerialNumber, cachedMachine); + cachedMachines.Add(cachedMachine); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error creating cached machine (partial) '{machine.SerialNumber}'."); + } + } + + try + { + foreach (var cachedMachine in cachedMachines) + { + _machinesCache.Put(cachedMachine.SerialNumber, cachedMachine); } } catch (Exception ex) @@ -292,7 +303,14 @@ namespace Tango.FSE.BL.Services foreach (var cachedMachine in cachedMachines) { - collection.Upsert(cachedMachine); + try + { + collection.Upsert(cachedMachine); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error caching machine '{cachedMachine.SerialNumber}' (partial) to disk."); + } } } } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.BL/Tango.FSE.BL.csproj b/Software/Visual_Studio/FSE/Tango.FSE.BL/Tango.FSE.BL.csproj index 39257df86..c361f1d3f 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.BL/Tango.FSE.BL.csproj +++ b/Software/Visual_Studio/FSE/Tango.FSE.BL/Tango.FSE.BL.csproj @@ -119,6 +119,8 @@ <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="ReadOnlyEntityRepository.cs" /> <Compile Include="ServicesSettings.cs" /> + <Compile Include="Services\DataStoreService.cs" /> + <Compile Include="Services\MachineConfigurationService.cs" /> <Compile Include="WindowsRegistry\RegistryService.cs" /> <Compile Include="Services\AuthenticationService.cs" /> <Compile Include="Services\BugReportingService.cs" /> @@ -145,6 +147,14 @@ <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> <Name>Tango.Core</Name> </ProjectReference> + <ProjectReference Include="..\..\DataStore\Tango.DataStore.EF\Tango.DataStore.EF.csproj"> + <Project>{88d9906b-8fc4-4fe0-b7eb-127a0a8fcee4}</Project> + <Name>Tango.DataStore.EF</Name> + </ProjectReference> + <ProjectReference Include="..\..\DataStore\Tango.DataStore\Tango.DataStore.csproj"> + <Project>{e0364dfa-0721-4637-9d32-9d22aac109d6}</Project> + <Name>Tango.DataStore</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.Logging\Tango.Logging.csproj"> <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project> <Name>Tango.Logging</Name> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/IMachineProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/IMachineProvider.cs index 9a98477b8..8c4512c41 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/IMachineProvider.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Connection/IMachineProvider.cs @@ -41,7 +41,7 @@ namespace Tango.FSE.Common.Connection MachineConnectionTypes ConnectionType { get; } /// <summary> - /// Gets a value indicating whether the <see cref="ConnectionType"/> equals <see cref="MachineConnectionTypes.Wifi"/> or <see cref="MachineConnectionTypes.SignalR"/>. + /// Gets a value indicating whether the machine is connected and the <see cref="ConnectionType"/> equals <see cref="MachineConnectionTypes.Wifi"/> or <see cref="MachineConnectionTypes.SignalR"/>. /// </summary> bool IsPPCAvailable { get; } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/MachineView.xaml b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/MachineView.xaml index c37613e3e..8d375cc6d 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/MachineView.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/MachineView.xaml @@ -47,11 +47,11 @@ </Border> </Grid> - <TextBlock Canvas.Left="532" FontStyle="Italic" Foreground="Gray" Canvas.Top="-22">Hardware</TextBlock> + <!--<TextBlock Canvas.Left="532" FontStyle="Italic" Foreground="Gray" Canvas.Top="-22">Hardware</TextBlock> <Grid Width="97" Height="90" Canvas.Left="431" Canvas.Top="-13"> <Rectangle Stroke="Gray" VerticalAlignment="Top" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/> <Rectangle Stroke="Gray" HorizontalAlignment="Left" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/> - </Grid> + </Grid>--> <UniformGrid Width="310" Canvas.Top="295" Canvas.Left="420" TextElement.Foreground="#252525" Rows="1" Columns="8" TextElement.FontSize="9"> <TextBlock HorizontalAlignment="Center">1</TextBlock> @@ -217,17 +217,17 @@ <Rectangle Stroke="Gray" HorizontalAlignment="Left" StrokeThickness="2" StrokeDashArray="3" RenderTransformOrigin="0.5,0.5"/> </Grid> - <TextBlock Canvas.Top="395" Canvas.Left="331" FontStyle="Italic" Foreground="Gray">Mid Tanks</TextBlock> + <!--<TextBlock Canvas.Top="395" Canvas.Left="331" FontStyle="Italic" Foreground="Gray">Mid Tanks</TextBlock> <Grid Width="62" Height="29" Canvas.Top="418" Canvas.Left="357"> <Rectangle Stroke="Gray" VerticalAlignment="Bottom" StrokeThickness="2" StrokeDashArray="4" RenderTransformOrigin="0.5,0.5"/> <Rectangle Stroke="Gray" HorizontalAlignment="Left" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/> - </Grid> + </Grid>--> - <TextBlock Canvas.Top="469" Canvas.Left="304" FontStyle="Italic" Foreground="Gray">Cartridges</TextBlock> + <!--<TextBlock Canvas.Top="469" Canvas.Left="304" FontStyle="Italic" Foreground="Gray">Cartridges</TextBlock> <Grid Width="87" Height="10" Canvas.Top="487" Canvas.Left="332"> <Rectangle Stroke="Gray" VerticalAlignment="Bottom" StrokeThickness="2" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/> <Rectangle Stroke="Gray" HorizontalAlignment="Left" StrokeThickness="2" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/> - </Grid> + </Grid>--> <Grid x:Name="gridTablet" Width="67" IsHitTestVisible="True" SnapsToDevicePixels="True" ClipToBounds="True" Height="90" Canvas.Left="188" Canvas.Top="198"> <Grid.RowDefinitions> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/DataStore/IDataStoreProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/DataStore/IDataStoreProvider.cs new file mode 100644 index 000000000..a54766893 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/DataStore/IDataStoreProvider.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DataStore.Editing; + +namespace Tango.FSE.Common.DataStore +{ + public interface IDataStoreProvider + { + bool AcceptFirmwareChanges { get; set; } + Task<DataStoreModel> GetDataStoreModel(String machineGuid); + Task<DataStoreModel> UpdateDataStoreModel(DataStoreModel model, String machineGuid); + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/DataStore/IRemoteDataStoreManager.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/DataStore/IRemoteDataStoreManager.cs index 02cc3ac9d..162c109be 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/DataStore/IRemoteDataStoreManager.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/DataStore/IRemoteDataStoreManager.cs @@ -9,6 +9,6 @@ namespace Tango.FSE.Common.DataStore { public interface IRemoteDataStoreManager : IDataStoreManager { - + } } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/INotificationProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/INotificationProvider.cs index 3c7350be7..027555022 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/INotificationProvider.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/INotificationProvider.cs @@ -138,7 +138,7 @@ namespace Tango.FSE.Common.Notifications /// <param name="okText">The ok text.</param> /// <param name="cancelText">The cancel text.</param> /// <returns></returns> - Task<InputBoxResult> ShowInputBox(String title, String message, PackIconKind icon = PackIconKind.InfoOutline, String defaultInput = null, String inputHint = null, int? maxChars = null, String okText = null, String cancelText = null); + Task<InputBoxResult> ShowInputBox(String title, String message, PackIconKind icon = PackIconKind.InfoOutline, String defaultInput = null, String inputHint = null, int? maxChars = null, String okText = null, String cancelText = null, Func<String, String> validationFunc = null); /// <summary> /// Shows a question message box. diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/InputBoxVM.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/InputBoxVM.cs index 7744d04d0..415c6cfc5 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/InputBoxVM.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Notifications/InputBoxVM.cs @@ -14,11 +14,45 @@ namespace Tango.FSE.Common.Notifications public int MaxCharacters { get; set; } + internal Func<String,String> ValidationFunction { get; set; } + private String _input; public String Input { get { return _input; } - set { _input = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } + set + { + _input = value; + RaisePropertyChangedAuto(); + + if (_input.IsNotNullOrEmpty()) + { + if (ValidationFunction != null) + { + Error = ValidationFunction.Invoke(_input); + } + } + else + { + Error = null; + } + + RaisePropertyChanged(nameof(HasValidationError)); + + InvalidateRelayCommands(); + } + } + + public bool HasValidationError + { + get { return !String.IsNullOrWhiteSpace(Error); } + } + + private String _error; + public String Error + { + get { return _error; } + set { _error = value; RaisePropertyChangedAuto(); } } public InputBoxVM() : base() @@ -28,7 +62,7 @@ namespace Tango.FSE.Common.Notifications protected override bool CanOK() { - return base.CanOK() && Input.IsNotNullOrEmpty(); + return base.CanOK() && Input.IsNotNullOrEmpty() && !HasValidationError; } } } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Styles.xaml b/Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Styles.xaml index 24c4e91ec..4b5d8f8d2 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Styles.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Resources/Styles.xaml @@ -3,11 +3,14 @@ xmlns:editors="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete" xmlns:actions="clr-namespace:Tango.FSE.Common.EventTriggerActions" xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:wpf="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:local="clr-namespace:Tango.FSE.Common.Resources"> + + <Style x:Key="FSE_FlatButton_OpacityHover" TargetType="Button" BasedOn="{StaticResource MaterialDesignToolForegroundButton}"> <Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter> <Style.Triggers> @@ -821,4 +824,252 @@ </Setter> </Style> + <Style x:Key="FSE_Game_GroupBox" TargetType="GroupBox"> + <Setter Property="Foreground" Value="{StaticResource FSE_PrimaryForegroundBrush}"></Setter> + <Setter Property="Background" Value="{StaticResource FSE_PrimaryBackgroundMidBrush}"></Setter> + <Setter Property="BorderBrush" Value="{StaticResource FSE_PrimaryBackgroundLightBrush}"></Setter> + <Setter Property="FontSize" Value="{StaticResource FSE_SmallFontSize}"></Setter> + <Setter Property="Padding" Value="8"></Setter> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="GroupBox"> + <DockPanel> + <Grid DockPanel.Dock="Top"> + <Polygon HorizontalAlignment="Left" VerticalAlignment="Top" Width="{Binding ElementName=border,Path=ActualWidth}" Height="{Binding ElementName=border,Path=ActualHeight}" Fill="{StaticResource FSE_PrimaryBackgroundLighterBrush}" Stretch="Fill" Points="0,0 100,0 130,30 0,30"></Polygon> + + <Grid VerticalAlignment="Top"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="40*" /> + <ColumnDefinition Width="60*" /> + </Grid.ColumnDefinitions> + <Border VerticalAlignment="Top" Padding="0 0 50 0" x:Name="border"> + <Border Padding="{TemplateBinding Padding}" TextElement.FontSize="{StaticResource FSE_DefaultFontSize}"> + <ContentPresenter Content="{TemplateBinding Header}" /> + </Border> + </Border> + </Grid> + </Grid> + <Border TextElement.Foreground="{TemplateBinding Foreground}" TextElement.FontSize="{TemplateBinding FontSize}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" CornerRadius="0 3 3 3" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1"> + <ContentPresenter Content="{TemplateBinding Content}" /> + </Border> + </DockPanel> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <Style TargetType="{x:Type controls:SearchComboBox}" BasedOn="{StaticResource MaterialDesignComboBox}"> + <Setter Property="KeyboardNavigation.DirectionalNavigation" Value="Once"></Setter> + <Setter Property="ItemTemplate"> + <Setter.Value> + <DataTemplate> + <TextBlock Text="{Binding}"></TextBlock> + </DataTemplate> + </Setter.Value> + </Setter> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type controls:SearchComboBox}"> + <Border Background="{TemplateBinding Background}" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}"> + + <Grid Background="Transparent"> + <DockPanel> + <Grid VerticalAlignment="Center" Margin="15 10 0 10" DockPanel.Dock="Right" Width="8" Height="8"> + <Path Stretch="Uniform" Data="M7,10L12,15L17,10H7Z" Fill="{StaticResource FSE_GrayBrush}"> + + </Path> + </Grid> + <ContentControl Focusable="False" FocusVisualStyle="{x:Null}" VerticalAlignment="Bottom" Margin="0 0 0 5" Content="{TemplateBinding SelectedItem}" ContentTemplate="{TemplateBinding ItemTemplate}"> + + </ContentControl> + </DockPanel> + <ToggleButton x:Name="btnToggle" Focusable="False" FocusVisualStyle="{x:Null}" KeyboardNavigation.DirectionalNavigation="Once" Opacity="0" Style="{x:Null}" IsChecked="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=IsOpened,Mode=TwoWay}"> + + </ToggleButton> + + <Popup StaysOpen="False" MinWidth="{Binding ElementName=btnToggle,Path=ActualWidth}" PlacementTarget="{Binding ElementName=btnToggle}" Placement="Bottom" IsOpen="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=IsOpened,Mode=TwoWay}" MaxHeight="{TemplateBinding MaxDropDownHeight}" AllowsTransparency="True"> + <Border Margin="5" Background="{StaticResource WhiteBrush}" CornerRadius="3" Padding="5" MinWidth="{Binding ElementName=btnToggle,Path=ActualWidth}"> + <Border.Effect> + <DropShadowEffect ShadowDepth="0" /> + </Border.Effect> + <DockPanel> + <TextBox x:Name="txt" KeyboardNavigation.DirectionalNavigation="Once" DockPanel.Dock="Top" Margin="10" Padding="0 5" Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=SearchFilter,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBox> + <ListBox x:Name="list" FocusVisualStyle="{x:Null}" ItemsSource="{TemplateBinding ListItemsSource}" ItemTemplate="{TemplateBinding ItemTemplate}" DisplayMemberPath="{TemplateBinding DisplayMemberPath}"> + + </ListBox> + </DockPanel> + </Border> + </Popup> + </Grid> + + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <Style TargetType="{x:Type ToggleButton}"> + <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/> + <Setter Property="Foreground" Value="{DynamicResource PrimaryHueMidForegroundBrush}"/> + <Setter Property="Background" Value="{DynamicResource PrimaryHueMidBrush}"/> + <Setter Property="wpf:ToggleButtonAssist.SwitchTrackOnBackground" Value="Black"/> + <Setter Property="wpf:ToggleButtonAssist.SwitchTrackOffBackground" Value="Black"/> + <Setter Property="BorderThickness" Value="1"/> + <Setter Property="Padding" Value="0 1 0 0"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type ToggleButton}"> + <ControlTemplate.Resources> + <SineEase x:Key="RippleEasingFunction" EasingMode="EaseInOut"/> + <Storyboard x:Key="ShowRipple"> + <DoubleAnimation Storyboard.TargetName="RippleThumb" Storyboard.TargetProperty="Opacity" + EasingFunction="{StaticResource RippleEasingFunction}" + To="0.26" Duration="0"/> + <DoubleAnimation Storyboard.TargetName="RippleThumb" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" + EasingFunction="{StaticResource RippleEasingFunction}" + From="1" To="2.5" Duration="0:0:0.2"/> + <DoubleAnimation Storyboard.TargetName="RippleThumb" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" + EasingFunction="{StaticResource RippleEasingFunction}" + From="1" To="2.5" Duration="0:0:0.2"/> + </Storyboard> + <Storyboard x:Key="HideRipple"> + <DoubleAnimation Storyboard.TargetName="RippleThumb" Storyboard.TargetProperty="Opacity" + EasingFunction="{StaticResource RippleEasingFunction}" + To="0" Duration="0:0:0.3"/> + </Storyboard> + </ControlTemplate.Resources> + <Viewbox Width="34"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CheckStates"> + <VisualStateGroup.Transitions> + <VisualTransition From="*" To="Checked"> + <Storyboard> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="ThumbHolder"> + <EasingDoubleKeyFrame KeyTime="0" Value="0"/> + <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="23.5"> + <EasingDoubleKeyFrame.EasingFunction> + <QuadraticEase EasingMode="EaseOut"/> + </EasingDoubleKeyFrame.EasingFunction> + </EasingDoubleKeyFrame> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </VisualTransition> + <VisualTransition From="Checked" To="Unchecked"> + <Storyboard> + <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="ThumbHolder"> + <EasingDoubleKeyFrame KeyTime="0" Value="23.5"/> + <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0"> + <EasingDoubleKeyFrame.EasingFunction> + <QuadraticEase EasingMode="EaseOut"/> + </EasingDoubleKeyFrame.EasingFunction> + </EasingDoubleKeyFrame> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </VisualTransition> + </VisualStateGroup.Transitions> + <VisualState x:Name="Checked"> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="ThumbHolder" + Duration="0" To="23.5" /> + </Storyboard> + </VisualState> + <VisualState x:Name="Unchecked"> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)" Storyboard.TargetName="ThumbHolder" + Duration="0" To="0" /> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Grid> + <Rectangle x:Name="Track" + Fill= "{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:ToggleButtonAssist.SwitchTrackOffBackground)}" + Opacity="0.26" + HorizontalAlignment="Left" + Height="15" + Margin="4.211,5,4.211,0" + Stroke="{x:Null}" + VerticalAlignment="Top" + Width="40" + RadiusY="7.5" + RadiusX="7.5"/> + <Grid x:Name="ThumbHolder" + HorizontalAlignment="Left" VerticalAlignment="Top"> + <Ellipse x:Name="RippleThumb" + Fill="{DynamicResource PrimaryHueLightBrush}" + Height="25" Width="25" + IsHitTestVisible="False" + Opacity="0.26" + Margin="0" + HorizontalAlignment="Center" VerticalAlignment="Center" + RenderTransformOrigin="0.5,0.5"> + <Ellipse.RenderTransform> + <ScaleTransform ScaleX="1" ScaleY="1"/> + </Ellipse.RenderTransform> + </Ellipse> + <AdornerDecorator CacheMode="{Binding RelativeSource={RelativeSource Self}, Path=(wpf:ShadowAssist.CacheMode)}"> + <Ellipse x:Name="Thumb" + Fill="#707070" Stroke="{x:Null}" + HorizontalAlignment="Center" VerticalAlignment="Center" + Width="25" Height="25" + Margin="0,0,0,0" + RenderTransformOrigin="0.5,0.5" + Effect="{DynamicResource MaterialDesignShadowDepth1}"> + </Ellipse> + </AdornerDecorator> + <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" + Margin="{TemplateBinding Padding}" + x:Name="ContentPresenter" + HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" + FlowDirection="LeftToRight"/> + <Grid.RenderTransform> + <TranslateTransform X="0" Y="0"/> + </Grid.RenderTransform> + </Grid> + </Grid> + </Viewbox> + <ControlTemplate.Triggers> + <Trigger Property="IsChecked" Value="True"> + <Setter TargetName="Thumb" Property="Fill" Value="{StaticResource FSE_PrimaryAccentBrush}" /> + <Setter TargetName="Track" Property="Fill" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:ToggleButtonAssist.SwitchTrackOnBackground)}" /> + <Setter Property="Foreground" Value="{DynamicResource PrimaryHueMidForegroundBrush}"/> + </Trigger> + <MultiTrigger> + <MultiTrigger.Conditions> + <Condition Property="IsChecked" Value="True" /> + <Condition Property="wpf:ToggleButtonAssist.HasOnContent" Value="True" /> + </MultiTrigger.Conditions> + <Setter TargetName="ContentPresenter" Property="Content" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:ToggleButtonAssist.OnContent)}" /> + <Setter TargetName="ContentPresenter" Property="ContentTemplate" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:ToggleButtonAssist.OnContentTemplate)}" /> + </MultiTrigger> + <Trigger Property="IsChecked" Value="False"> + <Setter Property="Foreground" Value="{DynamicResource PrimaryHueMidBrush}"/> + <!-- Need to set Foreground to Background here instead of hardcoded PrimaryHueMidBrush --> + </Trigger> + <Trigger Property="Button.IsDefaulted" Value="true"/> + <Trigger Property="IsMouseOver" Value="true"/> + <Trigger Property="IsPressed" Value="true"> + <Trigger.EnterActions> + <BeginStoryboard Storyboard="{StaticResource ShowRipple}"/> + </Trigger.EnterActions> + <Trigger.ExitActions> + <BeginStoryboard Storyboard="{StaticResource HideRipple}"/> + </Trigger.ExitActions> + </Trigger> + <Trigger Property="IsEnabled" Value="false"> + <Setter TargetName="Thumb" Property="Fill" Value="{StaticResource FSE_PrimaryBackgroundLightBrush}" /> + <Setter TargetName="Track" Property="Fill" Value="{StaticResource FSE_PrimaryBackgroundLightBrush}" /> + </Trigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <Style TargetType="Separator"> + <Setter Property="Background" Value="{StaticResource FSE_PrimaryBackgroundLightBrush}"></Setter> + </Style> + </ResourceDictionary>
\ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj index 4f0cb622b..9a43bb5fb 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj @@ -188,6 +188,7 @@ <Compile Include="Converters\TimeSpanHumanizeConverter.cs" /> <Compile Include="Core\FSEProgress.cs" /> <Compile Include="DashboardTile.cs" /> + <Compile Include="DataStore\IDataStoreProvider.cs" /> <Compile Include="DataStore\IRemoteDataStoreManager.cs" /> <Compile Include="DemoMode\DemoModeCommand.cs" /> <Compile Include="DemoMode\IDemoModeManager.cs" /> @@ -505,7 +506,11 @@ <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> <Name>Tango.Core</Name> </ProjectReference> - <ProjectReference Include="..\..\Tango.DataStore\Tango.DataStore.csproj"> + <ProjectReference Include="..\..\DataStore\Tango.DataStore.Editing\Tango.DataStore.Editing.csproj"> + <Project>{ee088ff7-04d1-41fb-9d6a-cedeee7a7b9c}</Project> + <Name>Tango.DataStore.Editing</Name> + </ProjectReference> + <ProjectReference Include="..\..\DataStore\Tango.DataStore\Tango.DataStore.csproj"> <Project>{e0364dfa-0721-4637-9d32-9d22aac109d6}</Project> <Name>Tango.DataStore</Name> </ProjectReference> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/App.config b/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/App.config new file mode 100644 index 000000000..4ef5218a0 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/App.config @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <configSections> + <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> + <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> + </configSections> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> + </startup> + <entityFramework> + <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /> + <providers> + <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> + </providers> + </entityFramework> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-5.0.5.0" newVersion="5.0.5.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/Program.cs b/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/Program.cs new file mode 100644 index 000000000..9eb0fb7b6 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/Program.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.Entities; +using Tango.CSV; + +namespace Tango.FSE.DPGraphGenerator +{ + class Program + { + private class RolePermission + { + public String Name { get; set; } + + public override string ToString() + { + return Name; + } + } + + private class RoleModel + { + public String Name { get; set; } + public List<RolePermission> Permissions { get; set; } + + public RoleModel() + { + Permissions = new List<RolePermission>(); + } + } + + static void Main(string[] args) + { + String outputFolder = Path.GetFullPath(@"..\..\..\Roles & Permissions"); + + Console.WriteLine($"Generating roles and permissions csv files to '{outputFolder}'..."); + + List<RoleModel> models = new List<RoleModel>(); + + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var roles = db.Roles.ToList(); + var roles_permissions = db.RolesPermissions.ToList(); + var permissions = db.Permissions.ToList(); + + foreach (var role in roles.Where(x => x.Name.Contains("FSE")).ToList()) + { + RoleModel model = new RoleModel(); + model.Name = role.Description; + + List<Permission> role_permissions = role.RolesPermissions.Select(x => x.Permission).ToList(); + + foreach (var permission in role_permissions.OrderBy(x => x.Code)) + { + model.Permissions.Add(new RolePermission() { Name = permission.Name.Replace("FSE_", "") }); + } + + models.Add(model); + } + } + + Directory.CreateDirectory(outputFolder); + + foreach (var model in models) + { + Console.WriteLine($"Generating role '{model.Name}'..."); + + using (DynamicCsvFile csvFile = new DynamicCsvFile(Path.Combine(outputFolder, $"{model.Name}.csv"))) + { + csvFile.Columns.Add(new DynamicCsvFileColumn() { Name = model.Name }); + + foreach (var permission in model.Permissions) + { + csvFile.Append(permission); + } + } + } + + Console.WriteLine(); + Console.WriteLine("Done!, press return to exit..."); + Console.ReadLine(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/Properties/AssemblyInfo.cs b/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..4cec0e5fd --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tango.FSE.DPGraphGenerator")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Tango.FSE.DPGraphGenerator")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("c57d9d68-336c-4665-9ef4-ec1bdbb84885")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/Tango.FSE.DPGraphGenerator.csproj b/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/Tango.FSE.DPGraphGenerator.csproj new file mode 100644 index 000000000..ae2b84d7c --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/Tango.FSE.DPGraphGenerator.csproj @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" 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>{C57D9D68-336C-4665-9EF4-EC1BDBB84885}</ProjectGuid> + <OutputType>Exe</OutputType> + <RootNamespace>Tango.FSE.DPGraphGenerator</RootNamespace> + <AssemblyName>Tango.FSE.DPGraphGenerator</AssemblyName> + <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> + <Deterministic>true</Deterministic> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath> + </Reference> + <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <HintPath>..\..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.ComponentModel.DataAnnotations" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + <None Include="packages.config" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\Tango.BL\Tango.BL.csproj"> + <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> + <Name>Tango.BL</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.CSV\Tango.CSV.csproj"> + <Project>{58e8825f-0c96-449c-b320-1e82b0aa876b}</Project> + <Name>Tango.CSV</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/packages.config b/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/packages.config new file mode 100644 index 000000000..b3daf0d6c --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.DPGraphGenerator/packages.config @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="EntityFramework" version="6.2.0" targetFramework="net461" /> +</packages>
\ No newline at end of file diff --git a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Views/LogFileTabView.xaml b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Views/LogFileTabView.xaml index 8f06dac0d..92064f9fd 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Views/LogFileTabView.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Views/LogFileTabView.xaml @@ -16,7 +16,7 @@ Background="{StaticResource FSE_PrimaryBackgroundDarkBrush}" Foreground="{StaticResource FSE_PrimaryForegroundBrush}"> <Grid> - <DataGrid Visibility="{Binding IsEmbedded,Converter={StaticResource BooleanToVisibilityInverseConverter}}" Margin="0 5 0 0" Style="{StaticResource FSE_LogsGridStyle}" ItemsSource="{Binding Logs}" SelectedItem="{Binding SelectedLog}" CellStyle="{StaticResource FSE_LogsGridCellStyle}" CanUserSortColumns="True"> + <DataGrid Visibility="{Binding IsEmbedded,Converter={StaticResource BooleanToVisibilityInverseConverter}}" Margin="0 5 0 0" Style="{StaticResource FSE_LogsGridStyle}" ItemsSource="{Binding Logs}" SelectedItem="{Binding SelectedLog}" CellStyle="{StaticResource FSE_LogsGridCellStyle}" CanUserSortColumns="True" CanUserResizeColumns="True"> <DataGrid.Resources> <components:BindingProxy x:Key="proxy" Data="{Binding}" /> </DataGrid.Resources> @@ -24,6 +24,7 @@ <DataGridTemplateColumn Header="#" Width="40" CellTemplate="{StaticResource FSE_LogIcon_Cell}"/> <DataGridTextColumn Header="DATE TIME" Binding="{Binding TimeStamp,StringFormat='HH:mm:ss.ff'}" Width="100" /> <DataGridTextColumn Header="SERVICE" Binding="{Binding ClassName}" Width="200" /> + <DataGridTextColumn Header="LN" Binding="{Binding CallerLineNumber}" Width="60" /> <DataGridTemplateColumn Header="MESSAGE" Width="1*" > <DataGridTemplateColumn.CellTemplate> <DataTemplate> @@ -34,7 +35,7 @@ </DataGrid.Columns> </DataGrid> - <DataGrid Visibility="{Binding IsEmbedded,Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0 5 0 0" Style="{StaticResource FSE_LogsGridStyle}" ItemsSource="{Binding Logs}" SelectedItem="{Binding SelectedLog}" CellStyle="{StaticResource FSE_LogsGridCellStyle}" CanUserSortColumns="True"> + <DataGrid Visibility="{Binding IsEmbedded,Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0 5 0 0" Style="{StaticResource FSE_LogsGridStyle}" ItemsSource="{Binding Logs}" SelectedItem="{Binding SelectedLog}" CellStyle="{StaticResource FSE_LogsGridCellStyle}" CanUserSortColumns="True" CanUserResizeColumns="True"> <DataGrid.Resources> <components:BindingProxy x:Key="proxy" Data="{Binding}" /> </DataGrid.Resources> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Connection/DefaultMachineProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Connection/DefaultMachineProvider.cs index 94b035ab5..aad63fdf9 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Connection/DefaultMachineProvider.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Connection/DefaultMachineProvider.cs @@ -342,6 +342,7 @@ namespace Tango.FSE.UI.Connection { IsConnected = false; IsBusy = false; + Machine = null; OnMachineDisconnected(MachineOperator, null); } } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Controls/NotificationsControl.xaml b/Software/Visual_Studio/FSE/Tango.FSE.UI/Controls/NotificationsControl.xaml index 4e6ada6b5..4a2510552 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Controls/NotificationsControl.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Controls/NotificationsControl.xaml @@ -336,10 +336,14 @@ <commonControls:IconButton Icon="Close" Padding="5" Cursor="Hand" Margin="0 0 5 0" Command="{Binding CloseCommand}" CommandParameter="{Binding}" HorizontalAlignment="Right" Width="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}"/> </Grid> - <StackPanel Grid.Row="1" Margin="40" VerticalAlignment="Top"> - <TextBlock Foreground="{StaticResource FSE_PrimaryForegroundBrush}" Text="{Binding Message}" TextWrapping="Wrap"></TextBlock> - <TextBox x:Name="txtInput" KeyDown="TxtInput_KeyDown" Margin="0 20 0 0" Text="{Binding Input,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" MaxLength="{Binding MaxCharacters}" material:HintAssist.Hint="{Binding InputHint}" /> - </StackPanel> + <Grid Grid.Row="1" Margin="40" VerticalAlignment="Top"> + <StackPanel> + <TextBlock Foreground="{StaticResource FSE_PrimaryForegroundBrush}" Text="{Binding Message}" TextWrapping="Wrap"></TextBlock> + <TextBox x:Name="txtInput" KeyDown="TxtInput_KeyDown" Margin="0 20 0 0" Text="{Binding Input,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" MaxLength="{Binding MaxCharacters}" material:HintAssist.Hint="{Binding InputHint}" /> + </StackPanel> + + <TextBlock VerticalAlignment="Bottom" Margin="0 0 0 -20" TextWrapping="Wrap" Foreground="{StaticResource FSE_ErrorBrush}" FontSize="{StaticResource FSE_SmallFontSize}" Text="{Binding Error}" Visibility="{Binding HasValidationError,Converter={StaticResource BooleanToVisibilityConverter}}"></TextBlock> + </Grid> <StackPanel HorizontalAlignment="Right" Grid.Row="2" Margin="10" Orientation="Horizontal"> <Button MinWidth="150" x:Name="btnInputCancel" Height="Auto" Style="{StaticResource FSE_RaisedButton_Dark_Hover}" Margin="0 0 10 0" Command="{Binding CloseCommand}" Visibility="{Binding HasCancel,Converter={StaticResource BooleanToVisibilityConverter}}" Content="{Binding CancelText}"></Button> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/DataStore/DefaultDataStoreProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/DataStore/DefaultDataStoreProvider.cs new file mode 100644 index 000000000..7b8e6684d --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/DataStore/DefaultDataStoreProvider.cs @@ -0,0 +1,366 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL; +using Tango.BL.DTO; +using Tango.BL.Entities; +using Tango.Core; +using Tango.Core.DI; +using Tango.DataStore; +using Tango.DataStore.Editing; +using Tango.DataStore.EF; +using Tango.DataStore.Remote; +using Tango.FSE.BL; +using Tango.FSE.Common.Connection; +using Tango.FSE.Common.DataStore; + +namespace Tango.FSE.UI.DataStore +{ + public class DefaultDataStoreProvider : ExtendedObject, IDataStoreProvider + { + private DataStoreModel _lastModel; + private IMachineProvider MachineProvider { get; set; } + + [TangoInject] + private FSEServicesContainer Services { get; set; } + + private bool _acceptFirmwareChanges; + public bool AcceptFirmwareChanges + { + get { return _acceptFirmwareChanges; } + set { _acceptFirmwareChanges = value; RaisePropertyChangedAuto(); } + } + + public DefaultDataStoreProvider(IMachineProvider machineProvider) + { + MachineProvider = machineProvider; + MachineProvider.MachineConnected += MachineProvider_MachineConnected; + } + + private void MachineProvider_MachineConnected(object sender, MachineConnectedEventArgs e) + { + _lastModel = null; + + if (MachineProvider.IsPPCAvailable) + { + LogManager.Log("Starting listening for data store changes..."); + + MachineProvider.MachineOperator.SendGenericContinuousRequest<RemoteDataStoreStartListenRequest, RemoteDataStoreStartListenResponse>(new RemoteDataStoreStartListenRequest()).Subscribe((response) => + { + if (response.ChangeType != RemoteDataStoreChangeType.None) + { + LogManager.Log($"Data store change received for '{response.CollectionName}.{response.Item.Key}'..."); + OnDataStoreItemChanged(response); + } + }, (ex) => + { + if (!(ex is Transport.TransporterDisconnectedException)) + { + LogManager.Log(ex, "Error occurred on data store changes listener."); + } + }, () => + { + //Nothing. + }); + } + } + + private void OnDataStoreItemChanged(RemoteDataStoreStartListenResponse response) + { + try + { + if (_lastModel != null && AcceptFirmwareChanges) + { + DataStoreCollectionModel collectionModel = _lastModel.Collections.FirstOrDefault(x => x.Name == response.CollectionName); + + if (collectionModel == null) + { + collectionModel = new DataStoreCollectionModel(); + collectionModel.Name = response.CollectionName; + _lastModel.Collections.Add(collectionModel); + } + + var remoteItem = response.Item; + + var itemModel = collectionModel.Items.FirstOrDefault(x => x.Guid == remoteItem.Guid); + + if (itemModel == null) + { + itemModel = DataStoreItemModel.FromLocalDataStoreItem(remoteItem, null); + itemModel.ExistsOnMachine = true; + collectionModel.Items.Add(itemModel); + } + else + { + itemModel.Value = remoteItem.Value; + itemModel.Type = remoteItem.Type; + itemModel.Date = remoteItem.Date; + } + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error occurred while processing a data store item remote change."); + } + } + + public Task<DataStoreModel> GetDataStoreModel(String machineGuid) + { + return Task.Factory.StartNew<DataStoreModel>(() => + { + DataStoreModel model = new DataStoreModel(); + + List<GlobalDataStoreItem> globalItems = Services.DataStoreService.GetGlobalDataStoreItems().Result; + List<DataStoreItem> localItems = Services.DataStoreService.GetMachinelDataStoreItems(machineGuid).Result; + + List<DataStoreItemModel> itemsModels = new List<DataStoreItemModel>(); + + //Get machine items from db. + foreach (var collection in localItems.GroupBy(x => x.CollectionName)) + { + DataStoreCollectionModel collectionModel = new DataStoreCollectionModel(); + collectionModel.Name = collection.First().CollectionName; + + foreach (var item in collection) + { + GlobalDataStoreItem globalItem = globalItems.FirstOrDefault(x => x.CollectionName == item.CollectionName && x.Key == item.Key); + + if (globalItem != null) + { + globalItems.Remove(globalItem); + } + + DataStoreItemModel itemModel = DataStoreItemModel.FromLocalDataStoreItem(item.ToDataStoreItem(), globalItem?.ToDataStoreItem()); + collectionModel.Items.Add(itemModel); + } + + model.Collections.Add(collectionModel); + } + + //Get machine items from connected machine. + if (MachineProvider.IsPPCAvailable && machineGuid == MachineProvider.Machine.Guid) + { + var response = MachineProvider.MachineOperator.SendGenericRequest<RemoteDataStoreGetAllItemsRequest, RemoteDataStoreGetAllItemsResponse>(new RemoteDataStoreGetAllItemsRequest(), new Transport.TransportRequestConfig() { Timeout = TimeSpan.FromSeconds(30) }).Result; + + foreach (var collection in response.Collections) + { + DataStoreCollectionModel collectionModel = model.Collections.FirstOrDefault(x => x.Name == collection.Name); + + if (collectionModel == null) + { + collectionModel = new DataStoreCollectionModel(); + collectionModel.Name = collection.Name; + model.Collections.Add(collectionModel); + } + + foreach (var remoteItem in collection.Items) + { + var localItem = collectionModel.Items.FirstOrDefault(x => x.Key == remoteItem.Key); + + if (localItem != null) + { + localItem.ExistsOnMachine = true; + } + + if (localItem != null && remoteItem.Date > localItem.Date) + { + localItem.Value = remoteItem.Value; + localItem.OriginalValue = remoteItem.Value; + localItem.Type = remoteItem.Type; + localItem.Date = remoteItem.Date; + } + else if (localItem == null) + { + GlobalDataStoreItem globalItem = globalItems.FirstOrDefault(x => x.CollectionName == collection.Name && x.Key == remoteItem.Key); + + if (globalItem != null) + { + globalItems.Remove(globalItem); + } + + DataStoreItemModel itemModel = DataStoreItemModel.FromLocalDataStoreItem(remoteItem, globalItem?.ToDataStoreItem()); + itemModel.ExistsOnMachine = true; + collectionModel.Items.Add(itemModel); + } + + } + } + } + + //Get global items without overrides from db. + foreach (var collection in globalItems.GroupBy(x => x.CollectionName)) + { + DataStoreCollectionModel collectionModel = model.Collections.FirstOrDefault(x => x.Name == collection.First().CollectionName); + + if (collectionModel == null) + { + collectionModel = new DataStoreCollectionModel(); + collectionModel.Name = collection.First().CollectionName; + model.Collections.Add(collectionModel); + } + + foreach (var item in collection) + { + DataStoreItemModel itemModel = DataStoreItemModel.FromGlobalDataStoreItem(item.ToDataStoreItem()); + collectionModel.Items.Add(itemModel); + } + } + + + _lastModel = model; + return model; + }); + } + + private class SaveModel + { + public String CollectionName { get; set; } + public DataStoreItemModel Item { get; set; } + } + + public Task<DataStoreModel> UpdateDataStoreModel(DataStoreModel model, String machineGuid) + { + return Task.Factory.StartNew<DataStoreModel>(() => + { + List<SaveModel> globals = new List<SaveModel>(); + List<SaveModel> locals = new List<SaveModel>(); + List<SaveModel> deleted = new List<SaveModel>(); + UpdateDataStoreRequest updateRequest = new UpdateDataStoreRequest(); + + foreach (var collection in model.Collections.Where(x => !x.IsDeleted)) + { + foreach (var item in collection.Items) + { + if (item.IsGlobal) + { + globals.Add(new SaveModel() { CollectionName = collection.Name, Item = item }); + } + else if (item.IsDeleted) + { + deleted.Add(new SaveModel() { CollectionName = collection.Name, Item = item }); + } + else if (item.HasDifference || (MachineProvider.IsPPCAvailable && !item.ExistsOnMachine)) + { + locals.Add(new SaveModel() { CollectionName = collection.Name, Item = item }); + } + } + } + + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var allItems = db.DataStoreItems.Where(x => x.MachineGuid == machineGuid).ToList(); + + //Deleted collections + foreach (var deletedCollection in model.Collections.Where(x => x.IsDeleted)) + { + foreach (var itemDb in allItems.ToList()) + { + if (itemDb.CollectionName == deletedCollection.Name) + { + itemDb.IsDeleted = true; + itemDb.LastUpdated = DateTime.UtcNow; + itemDb.IsSynchronized = false; + updateRequest.ToDelete.Add(itemDb.Guid); + } + } + } + + //Deleted items + foreach (var item in deleted) + { + var itemDb = allItems.FirstOrDefault(x => x.CollectionName == item.CollectionName && x.Key == item.Item.Key); + if (itemDb != null) + { + itemDb.IsDeleted = true; + itemDb.LastUpdated = DateTime.UtcNow; + itemDb.IsSynchronized = false; + updateRequest.ToDelete.Add(itemDb.Guid); + } + } + + //locals + foreach (var item in locals) + { + DataStoreItem itemDb = allItems.FirstOrDefault(x => x.CollectionName == item.CollectionName && x.Key == item.Item.Key); + + if (itemDb == null) //new local item. + { + itemDb = new DataStoreItem(); + itemDb.MachineGuid = machineGuid; + itemDb.CollectionName = item.CollectionName; + itemDb.Key = item.Item.Key; + itemDb.LastUpdated = DateTime.UtcNow; + itemDb.DataType = (int)item.Item.Type; + itemDb.Value = EFDataStoreHelper.CreateBytes(item.Item.Type, item.Item.Value); + db.DataStoreItems.Add(itemDb); + updateRequest.ToUpsert.Add(DataStoreItemDTO.FromObservable(itemDb)); + } + else //update local item only if changed... + { + bool upsert = MachineProvider.IsPPCAvailable && !item.Item.ExistsOnMachine; + + if (itemDb.IsDeleted) //restore if item was deleted.. + { + itemDb.IsDeleted = false; + itemDb.LastUpdated = DateTime.UtcNow; + itemDb.IsSynchronized = false; + upsert = true; + } + + //update item only if it has difference although "locals" already contains only differences. + var bytes = EFDataStoreHelper.CreateBytes(item.Item.Type, item.Item.Value); + + if (itemDb.DataType != (int)item.Item.Type || !Enumerable.SequenceEqual(itemDb.Value, bytes)) + { + itemDb.DataType = (int)item.Item.Type; + itemDb.Value = bytes; + itemDb.LastUpdated = DateTime.UtcNow; + itemDb.IsSynchronized = false; + upsert = true; + } + + if (upsert) + { + updateRequest.ToUpsert.Add(DataStoreItemDTO.FromObservable(itemDb)); + } + } + } + + if (MachineProvider.IsPPCAvailable && machineGuid == MachineProvider.Machine.Guid) + { + //Direct Sync Here. + //Make all items "IsSynchronized = true" if success. + var response = MachineProvider.MachineOperator.SendGenericRequest<UpdateDataStoreRequest, UpdateDataStoreResponse>(updateRequest, new Transport.TransportRequestConfig() { Timeout = TimeSpan.FromSeconds(30) }).Result; + + allItems.ForEach(x => x.IsSynchronized = true); + } + + db.SaveChanges(); + } + + return GetDataStoreModel(machineGuid).Result; + }); + } + + private void ValidateCollectionAndKey(String collection = null, String key = null) + { + if (collection != null) + { + if (!DataStoreHelper.ValidateCollectionOrKeyName(collection)) + { + throw new ArgumentException("Collection name contains invalid characters."); + } + } + + if (key != null) + { + if (!DataStoreHelper.ValidateCollectionOrKeyName(key)) + { + throw new ArgumentException("Item key contains invalid characters."); + } + } + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/FileAssociation/DefaultFileAssociationProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/FileAssociation/DefaultFileAssociationProvider.cs index 0d582cb11..89364cbbd 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/FileAssociation/DefaultFileAssociationProvider.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/FileAssociation/DefaultFileAssociationProvider.cs @@ -19,6 +19,7 @@ namespace Tango.FSE.UI.FileAssociation { private Dictionary<String, Action<FileAssociationPackage>> _handlers; private IpcServer _ipcServer; + private bool _initialized; public const string FILE_ASSOCIATION_PREFIX = "-file"; public const int FILE_ASSOCIATION_ARGS_COUNT = 3; @@ -44,6 +45,10 @@ namespace Tango.FSE.UI.FileAssociation public async void OnApplicationReady(IFSEApplicationManager applicationManager) { + if (!_initialized) return; + + _initialized = true; + try { LogManager.Log("Starting file association IPC service..."); diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Notifications/DefaultNotificationProvider.cs index 4992953c2..7299a836d 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Notifications/DefaultNotificationProvider.cs @@ -340,7 +340,7 @@ namespace Tango.FSE.UI.Notifications return source.Task; } - public Task<InputBoxResult> ShowInputBox(string title, string message, PackIconKind icon = PackIconKind.InformationOutline, string defaultInput = null, string inputHint = null, int? maxChars = null, string okText = null, string cancelText = null) + public Task<InputBoxResult> ShowInputBox(string title, string message, PackIconKind icon = PackIconKind.InformationOutline, string defaultInput = null, string inputHint = null, int? maxChars = null, string okText = null, string cancelText = null, Func<String, String> validationFunc = null) { TaskCompletionSource<InputBoxResult> source = new TaskCompletionSource<InputBoxResult>(); @@ -350,6 +350,8 @@ namespace Tango.FSE.UI.Notifications vm.Icon = icon; vm.Input = defaultInput; vm.InputHint = inputHint; + vm.ValidationFunction = validationFunc; + if (maxChars != null) { vm.MaxCharacters = maxChars.Value; diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/AssemblyInfo.cs index fa70e630e..964eb990b 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Properties/AssemblyInfo.cs @@ -8,5 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango FSE")] -[assembly: AssemblyVersion("1.1.1.0")] - +[assembly: AssemblyVersion("1.1.1.0")] diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj index 6c5b993b5..4a1934404 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj @@ -261,6 +261,7 @@ <Compile Include="Converters\MidTankLevelToElementHeightConverter.cs" /> <Compile Include="Converters\StringToFirstLetterConverter.cs" /> <Compile Include="Cryptography\DefaultCryptographyProvider.cs" /> + <Compile Include="DataStore\DefaultDataStoreProvider.cs" /> <Compile Include="DataStore\DefaultRemoteDataStoreManager.cs" /> <Compile Include="DataStore\RemoteDataStoreCollection.cs" /> <Compile Include="DemoMode\DefaultDemoModeManager.cs" /> @@ -600,6 +601,10 @@ </None> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\..\DataStore\Tango.DataStore.CLI\Tango.DataStore.CLI.csproj"> + <Project>{6189b8c3-7af9-43dd-8a61-a8a05f526f62}</Project> + <Name>Tango.DataStore.CLI</Name> + </ProjectReference> <ProjectReference Include="..\..\PPC\Tango.PPC.Shared\Tango.PPC.Shared.csproj"> <Project>{208C8BD8-72C6-4E3C-ACAA-351091A2ACC7}</Project> <Name>Tango.PPC.Shared</Name> @@ -640,11 +645,19 @@ <Project>{38197109-8610-4d3f-92b9-16d48df94d7c}</Project> <Name>Tango.DAL.Remote</Name> </ProjectReference> - <ProjectReference Include="..\..\Tango.DataStore.Remote\Tango.DataStore.Remote.csproj"> + <ProjectReference Include="..\..\DataStore\Tango.DataStore.Editing\Tango.DataStore.Editing.csproj"> + <Project>{EE088FF7-04D1-41FB-9D6A-CEDEEE7A7B9C}</Project> + <Name>Tango.DataStore.Editing</Name> + </ProjectReference> + <ProjectReference Include="..\..\DataStore\Tango.DataStore.EF\Tango.DataStore.EF.csproj"> + <Project>{88d9906b-8fc4-4fe0-b7eb-127a0a8fcee4}</Project> + <Name>Tango.DataStore.EF</Name> + </ProjectReference> + <ProjectReference Include="..\..\DataStore\Tango.DataStore.Remote\Tango.DataStore.Remote.csproj"> <Project>{29448f3c-9b3e-4da6-8555-46a8b9a6b3aa}</Project> <Name>Tango.DataStore.Remote</Name> </ProjectReference> - <ProjectReference Include="..\..\Tango.DataStore\Tango.DataStore.csproj"> + <ProjectReference Include="..\..\DataStore\Tango.DataStore\Tango.DataStore.csproj"> <Project>{E0364DFA-0721-4637-9D32-9D22AAC109D6}</Project> <Name>Tango.DataStore</Name> </ProjectReference> @@ -716,6 +729,10 @@ <Project>{ac5b4be7-d607-4a38-98f8-b87aca468313}</Project> <Name>Tango.FSE.Insights</Name> </ProjectReference> + <ProjectReference Include="..\Modules\Tango.FSE.MachineConfiguration\Tango.FSE.MachineConfiguration.csproj"> + <Project>{15bcb5bb-731e-4e2d-aa28-75485050a8dc}</Project> + <Name>Tango.FSE.MachineConfiguration</Name> + </ProjectReference> <ProjectReference Include="..\Modules\Tango.FSE.PPCConsole\Tango.FSE.PPCConsole.csproj"> <Project>{866b916a-207c-43f0-b403-7c4a820c2e11}</Project> <Name>Tango.FSE.PPCConsole</Name> @@ -926,7 +943,9 @@ if $(ConfigurationName) == Release del *.pdb attrib -r Tango* if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)ProtoCompilers\" -if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)Roslyn\"</PostBuildEvent> +if $(ConfigurationName) == Release RD /S /Q "$(TargetDir)Roslyn\" + +if $(ConfigurationName) == Release del WebRtc.NET.pdb</PostBuildEvent> </PropertyGroup> <Import Project="..\..\packages\MaterialDesignThemes.3.0.1\build\MaterialDesignThemes.targets" Condition="Exists('..\..\packages\MaterialDesignThemes.3.0.1\build\MaterialDesignThemes.targets')" /> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tiles/Events/EventsTileView.xaml b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tiles/Events/EventsTileView.xaml index 7963cb733..508ebb6b7 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tiles/Events/EventsTileView.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tiles/Events/EventsTileView.xaml @@ -39,7 +39,7 @@ </Grid> </Grid> <StackPanel Margin="10 0 0 0"> - <TextBlock>active events summery:</TextBlock> + <TextBlock>active events summary:</TextBlock> <StackPanel TextElement.FontSize="{StaticResource FSE_SmallFontSize}" Margin="0 20 0 0"> <DockPanel Margin="0 5"> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs index fd514b7ac..e9d18d777 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModelLocator.cs @@ -117,6 +117,7 @@ namespace Tango.FSE.UI TangoIOC.Default.Unregister<IRemoteActionsProvider>(); TangoIOC.Default.Unregister<IActionLogManager>(); TangoIOC.Default.Unregister<IRemoteDataStoreManager>(); + TangoIOC.Default.Unregister<IDataStoreProvider>(); //TangoIOC.Default.Unregister<ExternalBridgeScanner>(); //TangoIOC.Default.Unregister<IDiagnosticsFrameProvider>(); //TangoIOC.Default.Unregister<IEventLogger>(); @@ -160,6 +161,7 @@ namespace Tango.FSE.UI TangoIOC.Default.Register<IInsightsProvider, DefaultInsightsProvider>(); TangoIOC.Default.Register<IRemoteActionsProvider, DefaultRemoteActionsProvider>(); TangoIOC.Default.Register<IRemoteDataStoreManager, DefaultRemoteDataStoreManager>(); + TangoIOC.Default.Register<IDataStoreProvider, DefaultDataStoreProvider>(); TangoIOC.Default.Register<MainWindowVM>(); diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/LoginViewVM.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/LoginViewVM.cs index 70a68918a..67b8a1145 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/ViewModels/LoginViewVM.cs @@ -69,6 +69,11 @@ namespace Tango.FSE.UI.ViewModels set { _email = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(DisplayEnvironment)); InvalidateRelayCommands(); } } + public String ProcessedEmail + { + get { return Email.ToStringOrEmpty().EndsWith("TEST") ? Email.Replace("TEST", "") : Email; } + } + private String _password; /// <summary> /// Gets or sets the user password. @@ -158,7 +163,7 @@ namespace Tango.FSE.UI.ViewModels /// </summary> public bool DisplayEnvironment { - get { return Email.IsNotNullOrEmpty() && Email.ToLower().EndsWith("@twine-s.com"); } + get { return Email.IsNotNullOrEmpty() && (Email.ToLower().EndsWith("@twine-s.com") || Email.EndsWith("TEST")); } } #endregion @@ -288,7 +293,7 @@ namespace Tango.FSE.UI.ViewModels { try { - LogManager.Log($"Logging in user '{Email}'..."); + LogManager.Log($"Logging in user '{ProcessedEmail}'..."); if (!Validate()) { @@ -303,7 +308,7 @@ namespace Tango.FSE.UI.ViewModels } SelectedView = LoginViews.Logging; - var result = await AuthenticationProvider.Login(Email, Password, SelectedEnvironment, (status) => Status = status); + var result = await AuthenticationProvider.Login(ProcessedEmail, Password, SelectedEnvironment, (status) => Status = status); if (result.Response.PasswordChangeRequired) { @@ -327,7 +332,7 @@ namespace Tango.FSE.UI.ViewModels } catch (Exception ex) { - LogManager.Log(ex, $"Error occurred while trying to login user '{Email}'."); + LogManager.Log(ex, $"Error occurred while trying to login user '{ProcessedEmail}'."); IsFree = true; SelectedView = LoginViews.Login; await NotificationProvider.ShowError(GetErrorMessage(ex)); @@ -379,7 +384,7 @@ namespace Tango.FSE.UI.ViewModels IsFree = false; SelectedView = LoginViews.ChangingPassword; await Task.Delay(1000); - await AuthenticationProvider.ChangePassword(Email, CurrentPassword, NewPassword); + await AuthenticationProvider.ChangePassword(ProcessedEmail, CurrentPassword, NewPassword); Password = null; SelectedView = LoginViews.Login; Status = "Password changed..."; @@ -387,7 +392,7 @@ namespace Tango.FSE.UI.ViewModels } catch (Exception ex) { - LogManager.Log(ex, $"Error updating password for user '{Email}'."); + LogManager.Log(ex, $"Error updating password for user '{ProcessedEmail}'."); await NotificationProvider.ShowError($"Error updating your password.\n{ex.FlattenMessage()}"); SelectedView = LoginViews.ChangePassword; } @@ -428,7 +433,7 @@ namespace Tango.FSE.UI.ViewModels { IsFree = false; SelectedView = LoginViews.SendingForgotPasswordEmail; - await Services.AuthenticationService.SendForgotPasswordEmail(Email, SelectedEnvironment); + await Services.AuthenticationService.SendForgotPasswordEmail(ProcessedEmail, SelectedEnvironment); SelectedView = LoginViews.Login; await NotificationProvider.ShowSuccess("The email was delivered successfully!\nPlease check your email account."); } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/EventsView.xaml b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/EventsView.xaml index 98f03a0f1..c3715700b 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/EventsView.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Views/EventsView.xaml @@ -176,7 +176,7 @@ </Grid> </Grid> <StackPanel Margin="10 0 0 0"> - <TextBlock>active events summery:</TextBlock> + <TextBlock>active events summary:</TextBlock> <StackPanel TextElement.FontSize="{StaticResource FSE_SmallFontSize}" Margin="0 20 0 0"> <DockPanel Margin="0 5"> |
