diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-06-18 17:17:54 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-06-18 17:17:54 +0300 |
| commit | abe3be77d04fe00d179da2eacee647b675fe9f9f (patch) | |
| tree | 806515c820cd70e36381edad48d7d08b75b4ab1f /Software/Visual_Studio | |
| parent | 253ef67316c94ea789d6fa8adf315a684a24f8fe (diff) | |
| parent | 70546e7e106b1d254a1f8069c07e8294d322065b (diff) | |
| download | Tango-abe3be77d04fe00d179da2eacee647b675fe9f9f.tar.gz Tango-abe3be77d04fe00d179da2eacee647b675fe9f9f.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio')
34 files changed, 693 insertions, 118 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj index baa6042f0..de82ff366 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj @@ -126,6 +126,7 @@ <Compile Include="ViewModels\ProcessParametersTablesGroupsViewVM.cs" /> <Compile Include="ViewModels\RmlsViewVM.cs" /> <Compile Include="ViewModels\RolesViewVM.cs" /> + <Compile Include="ViewModels\SpoolTypesViewVM.cs" /> <Compile Include="ViewModels\UsersViewVM.cs" /> <Compile Include="ViewModels\EntityViewModel.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> @@ -136,6 +137,12 @@ <Compile Include="Views\DBViews\ActionTypeView.xaml.cs"> <DependentUpon>ActionTypeView.xaml</DependentUpon> </Compile> + <Compile Include="Views\DBViews\SpoolTypesView.xaml.cs"> + <DependentUpon>SpoolTypesView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\DBViews\SpoolTypeView.xaml.cs"> + <DependentUpon>SpoolTypeView.xaml</DependentUpon> + </Compile> <Compile Include="Views\DBViews\EventTypesGroupsView.xaml.cs"> <DependentUpon>EventTypesGroupsView.xaml</DependentUpon> </Compile> @@ -402,6 +409,14 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> + <Page Include="Views\DBViews\SpoolTypesView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="Views\DBViews\SpoolTypeView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="Views\DBViews\EventTypesGroupsView.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs index d2506c362..7bf3c6717 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs @@ -65,6 +65,8 @@ namespace Tango.MachineStudio.DB TangoIOC.Default.Register<HardwarePidControlTypesViewVM>(); TangoIOC.Default.Register<EventTypesGroupsViewVM>(); + + TangoIOC.Default.Register<SpoolTypesViewVM>(); } public static MainViewVM MainViewVM @@ -402,5 +404,13 @@ namespace Tango.MachineStudio.DB return TangoIOC.Default.GetInstance<EventTypesGroupsViewVM>(); } } + + public static SpoolTypesViewVM SpoolTypesViewVM + { + get + { + return TangoIOC.Default.GetInstance<SpoolTypesViewVM>(); + } + } } }
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/SpoolTypesViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/SpoolTypesViewVM.cs new file mode 100644 index 000000000..cc52e6e95 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/SpoolTypesViewVM.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class SpoolTypesViewVM : DbTableViewModel<SpoolType> + { + public SpoolTypesViewVM(INotificationProvider notification) : base(notification) + { + + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlView.xaml index 43a17d8e4..9bddd3937 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlView.xaml @@ -41,7 +41,7 @@ <StackPanel Orientation="Horizontal"> <Rectangle Width="16" Height="16" VerticalAlignment="Center"> <Rectangle.Fill> - <SolidColorBrush Color="{Binding Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush> + <SolidColorBrush Color="{Binding Color}"></SolidColorBrush> </Rectangle.Fill> </Rectangle> </StackPanel> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsView.xaml index 86a61d400..8cd51ccac 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsView.xaml @@ -29,7 +29,7 @@ <DataTemplate> <Rectangle Width="50"> <Rectangle.Fill> - <SolidColorBrush Color="{Binding MediaColor.Color,Converter={StaticResource ColorToIntegerConverter},Mode=TwoWay}"></SolidColorBrush> + <SolidColorBrush Color="{Binding MediaColor.Color}"></SolidColorBrush> </Rectangle.Fill> </Rectangle> </DataTemplate> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/SpoolTypeView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/SpoolTypeView.xaml new file mode 100644 index 000000000..843b9c244 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/SpoolTypeView.xaml @@ -0,0 +1,53 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.SpoolTypeView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:vm="clr-namespace:Tango.MachineStudio.DB.ViewModels" + xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews" + mc:Ignorable="d" + d:DesignHeight="400" d:DesignWidth="300" d:DataContext="{d:DesignInstance Type=vm:SpoolTypesViewVM, IsDesignTimeCreatable=False}"> + + <Grid> + <controls:TableGrid> + <TextBlock Text="ID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox> + <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> + <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Code:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Code,Mode=TwoWay}"></mahapps:NumericUpDown> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + + <TextBlock Text="Length:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Length,Mode=TwoWay}"></mahapps:NumericUpDown> + + <TextBlock Text="Weight:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Weight,Mode=TwoWay}"></mahapps:NumericUpDown> + + <TextBlock Text="Diameter:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Diameter,Mode=TwoWay}"></mahapps:NumericUpDown> + + <TextBlock Text="Start Offset Pulses:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding EditEntity.StartOffsetPulses,Mode=TwoWay}"></mahapps:NumericUpDown> + + <TextBlock Text="Backing Rate:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding EditEntity.BackingRate,Mode=TwoWay}"></mahapps:NumericUpDown> + + <TextBlock Text="Segment Offset Pulses:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding EditEntity.SegmentOffsetPulses,Mode=TwoWay}"></mahapps:NumericUpDown> + + <TextBlock Text="Bottom Backing Rate:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding EditEntity.BottomBackingRate,Mode=TwoWay}"></mahapps:NumericUpDown> + + <TextBlock Text="Rotations Per Passage:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.RotationsPerPassage,Mode=TwoWay}"></mahapps:NumericUpDown> + </controls:TableGrid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/SpoolTypeView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/SpoolTypeView.xaml.cs new file mode 100644 index 000000000..51baf49bd --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/SpoolTypeView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class SpoolTypeView : UserControl + { + public SpoolTypeView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/SpoolTypesView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/SpoolTypesView.xaml new file mode 100644 index 000000000..4ed13cb11 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/SpoolTypesView.xaml @@ -0,0 +1,32 @@ +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.SpoolTypesView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:global="clr-namespace:Tango.MachineStudio.DB" + xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.SpoolTypesViewVM}"> + <Grid> + <controls:DbTableView> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.SpoolTypesViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True"> + <DataGrid.Columns> + <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> + <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Code" Binding="{Binding Code}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Length" Binding="{Binding Length}"></DataGridTextColumn> + <DataGridTextColumn Header="Weight" Binding="{Binding Weight}"></DataGridTextColumn> + <DataGridTextColumn Header="Diameter" Binding="{Binding Diameter}"></DataGridTextColumn> + <DataGridTextColumn Header="Start Offset Pulses" Binding="{Binding StartOffsetPulses}"></DataGridTextColumn> + <DataGridTextColumn Header="Backing Rate" Binding="{Binding BackingRate}"></DataGridTextColumn> + <DataGridTextColumn Header="Segment Offset Pulses" Binding="{Binding SegmentOffsetPulses}"></DataGridTextColumn> + <DataGridTextColumn Header="Bottom Backing Rate" Binding="{Binding BottomBackingRate}"></DataGridTextColumn> + <DataGridTextColumn Header="Rotations Per Passage" Binding="{Binding RotationsPerPassage}"></DataGridTextColumn> + </DataGrid.Columns> + </DataGrid> + </controls:DbTableView> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/SpoolTypesView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/SpoolTypesView.xaml.cs new file mode 100644 index 000000000..2f0864ee3 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/SpoolTypesView.xaml.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.MachineStudio.DB.CustomAttributes; +using Tango.MachineStudio.DB.Managers; +using Tango.SharedUI.Controls; + +namespace Tango.MachineStudio.DB.Views.DBViews +{ + /// <summary> + /// Interaction logic for MachinesView.xaml + /// </summary> + [DBView] + public partial class SpoolTypesView : UserControl + { + public SpoolTypesView() : base() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs index eb3572728..3dbee402b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs @@ -64,10 +64,13 @@ namespace Tango.MachineStudio.UI.TFS { try { - IStudioApplicationManager app = TangoIOC.Default.GetInstance<IStudioApplicationManager>(); - var items = await GetWorkItemsCreatedBy(Project, GetUserTeamMember()); - items.Where(x => x.StepsToReproduce != null).ToList().ForEach(x => x.StepsToReproduce = x.StepsToReproduce.Replace("<div style=\"white-space:pre;\">", "").Replace("</div>", "")); - ResolvedWorkItems = items.Where(x => x.State == State.Resolved && x.ResolvedReason == ResolvedReason.Fixed && x.IsBuildVersionValid && x.FoundInBuildVersion < Version.Parse(app.Version)).ToObservableCollection(); + if (Project != null) + { + IStudioApplicationManager app = TangoIOC.Default.GetInstance<IStudioApplicationManager>(); + var items = await GetWorkItemsCreatedBy(Project, GetUserTeamMember()); + items.Where(x => x.StepsToReproduce != null).ToList().ForEach(x => x.StepsToReproduce = x.StepsToReproduce.Replace("<div style=\"white-space:pre;\">", "").Replace("</div>", "")); + ResolvedWorkItems = items.Where(x => x.State == State.Resolved && x.ResolvedReason == ResolvedReason.Fixed && x.IsBuildVersionValid && x.FoundInBuildVersion < Version.Parse(app.Version)).ToObservableCollection(); + } } catch (Exception ex) { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs index 26fe06c5f..ecb37654d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/MainWindow.xaml.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; @@ -13,6 +15,7 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.Touch.Helpers; namespace Tango.PPC.UI { @@ -29,12 +32,12 @@ namespace Tango.PPC.UI InitializeComponent(); - //WindowStartupLocation = WindowStartupLocation.Manual; - //var lastMonitor = Screen.AllScreens.LastOrDefault(); - //Left = lastMonitor.Bounds.Left; - //Top = lastMonitor.Bounds.Top; - //Width = lastMonitor.Bounds.Width; - //Height = lastMonitor.Bounds.Height; + if (TouchHelper.IsTouchEnabled()) + { + WindowStyle = WindowStyle.None; + ResizeMode = ResizeMode.NoResize; + WindowState = WindowState.Maximized; + } } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/NotificationItems/EmptyCartridgesNotificationView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/NotificationItems/EmptyCartridgesNotificationView.xaml index 7ce525337..ccb6618e7 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/NotificationItems/EmptyCartridgesNotificationView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/NotificationItems/EmptyCartridgesNotificationView.xaml @@ -8,7 +8,7 @@ d:DesignHeight="60" d:DesignWidth="400" MinHeight="50" Background="Transparent" Foreground="#FF7777" d:DataContext="{d:DesignInstance Type=local:EmptyCartridgesNotification, IsDesignTimeCreatable=True}"> <Grid Margin="10"> <DockPanel> - <Image Source="/Images/warning-test.png" Width="24" /> + <Image Source="/Images/warning-test.png" Margin="5" /> <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" TextWrapping="Wrap" Text="{Binding Message}"></TextBlock> </DockPanel> </Grid> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index c74e76b50..a74d3a687 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -108,6 +108,7 @@ <Compile Include="ViewModelLocator.cs" /> <Compile Include="ViewModels\LayoutViewVM.cs" /> <Compile Include="ViewModels\LoadingViewVM.cs" /> + <Compile Include="ViewModels\LoginViewVM.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> <Compile Include="ViewsContracts\ILayoutView.cs" /> <Compile Include="Views\LayoutView.xaml.cs"> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs new file mode 100644 index 000000000..6962de59d --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common; + +namespace Tango.PPC.UI.ViewModels +{ + public class LoginViewVM : PPCViewModel + { + public override void OnApplicationStarted() + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml index 524550b94..a3f7d70e1 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml @@ -19,12 +19,12 @@ <localConverters:NotificationItemConverter x:Key="NotificationItemConverter" /> </UserControl.Resources> - <touch:TouchNotificationBar HasNotifications="{Binding NotificationProvider.HasNotificationItems}" Notifications="{Binding NotificationProvider.NotificationItems}"> + <touch:TouchNotificationBar MinNotificationHeight="60" HasNotifications="{Binding NotificationProvider.HasNotificationItems}" Notifications="{Binding NotificationProvider.NotificationItems}"> <touch:TouchNotificationBar.NotificationTemplate> <DataTemplate> <Grid> <ContentControl Content="{Binding Converter={StaticResource NotificationItemConverter}}" /> - <touch:TouchIconButton Background="Transparent" Padding="20" Style="{StaticResource TangoRoundTouchIconButton}" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.NotificationProvider.PopNotificationCommand}" CommandParameter="{Binding}" HorizontalAlignment="Right" Width="60" Icon="Close" Foreground="White" /> + <touch:TouchIconButton Background="Transparent" Padding="20" Style="{StaticResource TangoRoundTouchIconButton}" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.NotificationProvider.PopNotificationCommand}" CommandParameter="{Binding}" HorizontalAlignment="Right" MaxHeight="60" Width="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}" Icon="Close" Foreground="White" /> </Grid> </DataTemplate> </touch:TouchNotificationBar.NotificationTemplate> diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/MediaColor.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/MediaColor.cs index e4a312775..13fa567e2 100644 --- a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/MediaColor.cs +++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/MediaColor.cs @@ -1,6 +1,8 @@ using ColorMine.ColorSpaces; +using Newtonsoft.Json; using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -10,12 +12,16 @@ namespace Tango.BL.Entities { public partial class MediaColor { - private Color _color; - + [NotMapped] + [JsonIgnore] public Color Color { - get { return _color; } - set { _color = value; RaisePropertyChangedAuto(); } + get + { + Lab lab = new Lab(L, A, B); + var rgb = lab.To<Rgb>(); + return Color.FromRgb((byte)rgb.R, (byte)rgb.G, (byte)rgb.B); + } } protected override void RaisePropertyChanged(string propName) @@ -24,9 +30,7 @@ namespace Tango.BL.Entities if (propName == nameof(L) || propName == nameof(A) || propName == nameof(B)) { - Lab lab = new Lab(L, A, B); - var rgb = lab.To<Rgb>(); - Color = Color.FromRgb((byte)rgb.R, (byte)rgb.G, (byte)rgb.B); + RaisePropertyChanged(nameof(Color)); } } } diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/HardwarePidControlTypes.cs b/Software/Visual_Studio/Tango.BL/Enumerations/HardwarePidControlTypes.cs index 61d149a90..abe59390a 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/HardwarePidControlTypes.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/HardwarePidControlTypes.cs @@ -52,88 +52,94 @@ namespace Tango.BL.Enumerations HeadHeaterZ4 = 6, /// <summary> + /// (Head Heater Zone 5) + /// </summary> + [Description("Head Heater Zone 5")] + HeadHeaterZ5 = 7, + + /// <summary> /// (Mixer Heater) /// </summary> [Description("Mixer Heater")] - MixerHeater = 7, + MixerHeater = 8, /// <summary> /// (Waste Control) /// </summary> [Description("Waste Control")] - WasteControl = 8, + WasteControl = 9, /// <summary> /// (Dryer Motor) /// </summary> [Description("Dryer Motor")] - MotorDryer = 9, + MotorDryer = 10, /// <summary> /// (Feeder Motor) /// </summary> [Description("Feeder Motor")] - MotorFeeder = 10, + MotorFeeder = 11, /// <summary> /// (Pooler Motor) /// </summary> [Description("Pooler Motor")] - MotorPooler = 11, + MotorPooler = 12, /// <summary> /// (Winder Motor) /// </summary> [Description("Winder Motor")] - MotorWinder = 12, + MotorWinder = 13, /// <summary> /// (Dispenser 1) /// </summary> [Description("Dispenser 1")] - Dispenser1 = 13, + Dispenser1 = 14, /// <summary> /// (Dispenser 2) /// </summary> [Description("Dispenser 2")] - Dispenser2 = 14, + Dispenser2 = 15, /// <summary> /// (Dispenser 3) /// </summary> [Description("Dispenser 3")] - Dispenser3 = 15, + Dispenser3 = 16, /// <summary> /// (Dispenser 4) /// </summary> [Description("Dispenser 4")] - Dispenser4 = 16, + Dispenser4 = 17, /// <summary> /// (Dispenser 5) /// </summary> [Description("Dispenser 5")] - Dispenser5 = 17, + Dispenser5 = 18, /// <summary> /// (Dispenser 6) /// </summary> [Description("Dispenser 6")] - Dispenser6 = 18, + Dispenser6 = 19, /// <summary> /// (Dispenser 7) /// </summary> [Description("Dispenser 7")] - Dispenser7 = 19, + Dispenser7 = 20, /// <summary> /// (Dispenser 8) /// </summary> [Description("Dispenser 8")] - Dispenser8 = 20, + Dispenser8 = 21, } } diff --git a/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapter.cs b/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapter.cs index 966e1dad0..ad5e05adf 100644 --- a/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapter.cs +++ b/Software/Visual_Studio/Tango.BL/ObservablesEntitiesAdapter.cs @@ -220,6 +220,8 @@ namespace Tango.BL MidTankTypes = Context.MidTankTypes.ToObservableCollection(); + SpoolTypes = Context.SpoolTypes.ToObservableCollection(); + ActionTypes = Context.ActionTypes.ToObservableCollection(); EventTypesCategories = Context.EventTypesCategories.ToObservableCollection(); diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/StringNullOrEmptyToBooleanConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/StringNullOrEmptyToBooleanConverter.cs new file mode 100644 index 000000000..7c4a37635 --- /dev/null +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/StringNullOrEmptyToBooleanConverter.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.SharedUI.Converters +{ + public class StringNullOrEmptyToBooleanConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null) + { + return String.IsNullOrEmpty(value.ToString()); + } + + return true; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj index ec53f2c9e..b3634e969 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj +++ b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj @@ -103,6 +103,7 @@ <Compile Include="Converters\PathToShortPathConverter.cs" /> <Compile Include="Converters\StringEllipsisConverter.cs" /> <Compile Include="Converters\StringFormatConverter.cs" /> + <Compile Include="Converters\StringNullOrEmptyToBooleanConverter.cs" /> <Compile Include="Converters\StringToWordsConverter.cs" /> <Compile Include="Editors\IParameterItemEditor.cs" /> <Compile Include="Editors\ParameterItemEditor.cs" /> diff --git a/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs b/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs index 3b974d172..7d215cd06 100644 --- a/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs +++ b/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs @@ -9,6 +9,7 @@ using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; +using System.Windows.Controls; using Tango.Core; using Tango.Core.DI; @@ -75,8 +76,6 @@ namespace Tango.SharedUI /// <returns></returns> protected bool Validate() { - OnValidating(); - HasErrors = false; _currentErrors.Clear(); @@ -87,24 +86,37 @@ namespace Tango.SharedUI ValidationErrors.Clear(); + OnValidating(); + foreach (var prop in this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) { foreach (var validation in prop.GetCustomAttributes<ValidationAttribute>()) { if (!validation.IsValid(prop.GetValue(this))) { - HasErrors = true; _currentErrors.Add(new KeyValuePair<string, string>(prop.Name, validation.ErrorMessage)); ValidationErrors.Add(validation.ErrorMessage); - RaiseError(prop.Name); } } + + HasErrors = _currentErrors.Count > 0; + RaiseError(prop.Name); } return !HasErrors; } /// <summary> + /// Inserts the specified property error (Use inside OnValidating). + /// </summary> + /// <param name="propName">Name of the property.</param> + /// <param name="error">The error.</param> + protected void InsertError(String propName, String error) + { + _currentErrors.Add(new KeyValuePair<string, string>(propName, error)); + } + + /// <summary> /// Called before validating. /// </summary> protected virtual void OnValidating() diff --git a/Software/Visual_Studio/Tango.Touch/Components/Ripple.xaml b/Software/Visual_Studio/Tango.Touch/Components/Ripple.xaml index 6cdaa4d70..e64a10057 100644 --- a/Software/Visual_Studio/Tango.Touch/Components/Ripple.xaml +++ b/Software/Visual_Studio/Tango.Touch/Components/Ripple.xaml @@ -19,6 +19,8 @@ <Setter Property="HorizontalAlignment" Value="Stretch"></Setter> <Setter Property="VerticalAlignment" Value="Stretch"></Setter> <Setter Property="IsHitTestVisible" Value="True"></Setter> + <Setter Property="Focusable" Value="False"></Setter> + <Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:Ripple}"> diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs index d544af8c9..9a2ca465f 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.cs @@ -26,6 +26,7 @@ namespace Tango.Touch.Controls private bool _isMoving; private Point _downLocation; private TouchDevice _touchDevice; + private double _last_manipulation_delta; private Border border_notifications; private Grid grid_container; @@ -65,7 +66,7 @@ namespace Tango.Touch.Controls set { SetValue(HasNotificationsProperty, value); } } public static readonly DependencyProperty HasNotificationsProperty = - DependencyProperty.Register("HasNotifications", typeof(bool), typeof(TouchNotificationBar), new PropertyMetadata(false,(d,e) => (d as TouchNotificationBar).OnHasNotificationsChanged())); + DependencyProperty.Register("HasNotifications", typeof(bool), typeof(TouchNotificationBar), new PropertyMetadata(false, (d, e) => (d as TouchNotificationBar).OnHasNotificationsChanged())); public IList Notifications { @@ -83,23 +84,43 @@ namespace Tango.Touch.Controls public static readonly DependencyProperty NotificationTemplateProperty = DependencyProperty.Register("NotificationTemplate", typeof(DataTemplate), typeof(TouchNotificationBar), new PropertyMetadata(null)); + public double NotificationHeight + { + get { return (double)GetValue(NotificationHeightProperty); } + set { SetValue(NotificationHeightProperty, value); } + } + public static readonly DependencyProperty NotificationHeightProperty = + DependencyProperty.Register("NotificationHeight", typeof(double), typeof(TouchNotificationBar), new PropertyMetadata(0.0)); + + public override void OnApplyTemplate() { base.OnApplyTemplate(); border_notifications = GetTemplateChild("PART_BorderNotifications") as Border; grid_container = GetTemplateChild("PART_Grid_Container") as Grid; + border_notifications.IsManipulationEnabled = true; border_notifications.RegisterForPreviewMouseOrTouchDown(GridNotificationMouseDown); border_notifications.RegisterForMouseOrTouchMove(GridNotificationMouseMove); border_notifications.RegisterForPreviewMouseOrTouchUp(GridNotificationMouseUp); + border_notifications.ManipulationDelta += Border_notifications_ManipulationDelta; + border_notifications.SizeChanged += Border_notifications_SizeChanged; } + private void Border_notifications_ManipulationDelta(object sender, ManipulationDeltaEventArgs e) + { + if (e.DeltaManipulation.Translation.Y != 0) + { + _last_manipulation_delta = e.DeltaManipulation.Translation.Y; + } + } + private void Border_notifications_SizeChanged(object sender, SizeChangedEventArgs e) { - double maxPadding = 20; - NotificationPadding = new Thickness((border_notifications.ActualHeight / ActualHeight) * maxPadding); + double maxPadding = 150; + NotificationHeight = (border_notifications.ActualHeight / ActualHeight) * maxPadding; } private void OnHasNotificationsChanged() @@ -123,6 +144,7 @@ namespace Tango.Touch.Controls private void OpenNotifications() { DoubleAnimation ani = new DoubleAnimation(); + ani.DecelerationRatio = 1; ani.Duration = TimeSpan.FromSeconds(0.2); if (double.IsNaN(border_notifications.Height)) @@ -139,6 +161,7 @@ namespace Tango.Touch.Controls { DoubleAnimation ani = new DoubleAnimation(); ani.Duration = TimeSpan.FromSeconds(0.2); + ani.AccelerationRatio = 1; ani.From = border_notifications.ActualHeight; ani.To = MinNotificationHeight; @@ -180,11 +203,11 @@ namespace Tango.Touch.Controls DoubleAnimation ani = new DoubleAnimation(); ani.Duration = TimeSpan.FromSeconds(0.2); - if (e.GetPosition(this).Y > ActualHeight / 2) + if (e.GetPosition(this).Y > ActualHeight / 2 || _last_manipulation_delta > 20) { OpenNotifications(); } - else + else if (e.GetPosition(this).Y < ActualHeight / 2 || _last_manipulation_delta < 20) { CloseNotifications(); } diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.xaml index 40b0a2779..ac0d09e24 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNotificationBar.xaml @@ -24,11 +24,11 @@ <Grid x:Name="PART_Grid_Container" VerticalAlignment="Top" Background="Transparent" ClipToBounds="False"> <Canvas> - <Border x:Name="PART_BorderNotifications" BorderBrush="Silver" Background="#83000000" MaxHeight="{Binding RelativeSource={RelativeSource TemplatedParent},Path=MinNotificationHeight}" Width="{Binding RelativeSource={RelativeSource AncestorType=Canvas},Path=ActualWidth}"> + <Border x:Name="PART_BorderNotifications" BorderBrush="Silver" Background="#96000000" MaxHeight="{Binding RelativeSource={RelativeSource TemplatedParent},Path=MinNotificationHeight}" Width="{Binding RelativeSource={RelativeSource AncestorType=Canvas},Path=ActualWidth}"> <ItemsControl x:Name="notificationsItemsControl" ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent},Path=Notifications}"> <ItemsControl.ItemTemplate> <DataTemplate> - <Border BorderBrush="#595959" BorderThickness="0 0 0 5" Padding="{Binding RelativeSource={RelativeSource AncestorType=local:TouchNotificationBar},Path=NotificationPadding}" MinHeight="{Binding RelativeSource={RelativeSource AncestorType=local:TouchNotificationBar},Path=MinNotificationHeight}" MaxHeight="{Binding RelativeSource={RelativeSource AncestorType=local:TouchNotificationBar},Path=MaxNotificationHeight}"> + <Border BorderBrush="#757373" BorderThickness="0 0 0 5" Height="{Binding RelativeSource={RelativeSource AncestorType=local:TouchNotificationBar},Path=NotificationHeight}" MinHeight="{Binding RelativeSource={RelativeSource AncestorType=local:TouchNotificationBar},Path=MinNotificationHeight}" MaxHeight="{Binding RelativeSource={RelativeSource AncestorType=local:TouchNotificationBar},Path=MaxNotificationHeight}"> <Border.Background> <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> <GradientStop Color="#FF282828"/> diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs new file mode 100644 index 000000000..c69fd17ed --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs @@ -0,0 +1,54 @@ +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.Touch.Controls +{ + public class TouchTextBox : Control + { + public String Text + { + get { return (String)GetValue(TextProperty); } + set { SetValue(TextProperty, value); } + } + public static readonly DependencyProperty TextProperty = + DependencyProperty.Register("Text", typeof(String), typeof(TouchTextBox), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); + + public String Watermark + { + get { return (String)GetValue(WatermarkProperty); } + set { SetValue(WatermarkProperty, value); } + } + public static readonly DependencyProperty WatermarkProperty = + DependencyProperty.Register("Watermark", typeof(String), typeof(TouchTextBox), new PropertyMetadata(null)); + + public bool IsPassword + { + get { return (bool)GetValue(IsPasswordProperty); } + set { SetValue(IsPasswordProperty, value); } + } + public static readonly DependencyProperty IsPasswordProperty = + DependencyProperty.Register("IsPassword", typeof(bool), typeof(TouchTextBox), new PropertyMetadata(false)); + + static TouchTextBox() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(TouchTextBox), new FrameworkPropertyMetadata(typeof(TouchTextBox))); + } + + public TouchTextBox() + { + + } + } +} diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml new file mode 100644 index 000000000..fd197629d --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml @@ -0,0 +1,162 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:keyboard="clr-namespace:Tango.Touch.Keyboard" + xmlns:components="clr-namespace:Tango.Touch.Components" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:localConverters="clr-namespace:Tango.Touch.Converters" + xmlns:local="clr-namespace:Tango.Touch.Controls"> + + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="../Resources/Colors.xaml" /> + + <ResourceDictionary> + <converters:StringNullOrEmptyToBooleanConverter x:Key="StringNullOrEmptyToBooleanConverter" /> + <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> + <converters:MathOperatorConverter x:Key="MathOperatorConverter" /> + <localConverters:StringToPasswordConverter x:Key="StringToPasswordConverter" /> + </ResourceDictionary> + </ResourceDictionary.MergedDictionaries> + + <Style TargetType="{x:Type local:TouchTextBox}"> + <Setter Property="Focusable" Value="False"></Setter> + <Setter Property="keyboard:KeyboardView.Mode" Value="AlphaNumeric"></Setter> + <Setter Property="keyboard:KeyboardView.Action" Value="Tab"></Setter> + <Setter Property="Validation.ErrorTemplate" Value="{x:Null}"></Setter> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type local:TouchTextBox}"> + <Border Background="{TemplateBinding Background}" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}"> + <DockPanel> + <Border DockPanel.Dock="Bottom" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=(Validation.HasError),Converter={StaticResource BooleanToVisibilityConverter}}"> + <TextBlock FontSize="12" Foreground="{StaticResource TangoValidationErrorBrush}" Margin="0 5 0 0" TextWrapping="Wrap" Text="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=(Validation.Errors).CurrentItem.ErrorContent}"></TextBlock> + </Border> + <DockPanel> + <Grid DockPanel.Dock="Bottom" Height="2"> + <Rectangle Fill="{StaticResource TangoTextWatermarkBrush}" /> + <Rectangle RenderTransformOrigin="0.5,0.5" > + <Rectangle.Style> + <Style TargetType="Rectangle"> + <Setter Property="Fill" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> + <Setter Property="RenderTransform"> + <Setter.Value> + <ScaleTransform ScaleY="1" ScaleX="0" /> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=PART_TextBox,Path=IsFocused}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="00:00:0.4" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="0" Duration="00:00:0.4" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=(Validation.HasError)}" Value="True"> + <Setter Property="Fill" Value="{StaticResource TangoValidationErrorBrush}"></Setter> + <Setter Property="RenderTransform"> + <Setter.Value> + <ScaleTransform ScaleY="1" ScaleX="1" /> + </Setter.Value> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Rectangle.Style> + </Rectangle> + </Grid> + + <Grid> + <components:Ripple RippleBrush="{StaticResource TangoRippleDarkBrush}" RippleFactor="15"> + <Grid> + <TextBox Padding="0 0 0 4" CaretBrush="{StaticResource TangoPrimaryAccentBrush}" FocusVisualStyle="{x:Null}" x:Name="PART_TextBox" keyboard:KeyboardView.Mode="{TemplateBinding keyboard:KeyboardView.Mode}" keyboard:KeyboardView.Action="{TemplateBinding keyboard:KeyboardView.Action}" Text="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=Text,UpdateSourceTrigger=PropertyChanged}" BorderThickness="0" Background="Transparent"> + <TextBox.Style> + <Style TargetType="TextBox"> + <Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=Foreground}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=IsPassword}" Value="True"> + <Setter Property="Foreground" Value="Transparent"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBox.Style> + </TextBox> + <TextBlock IsHitTestVisible="False" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=IsPassword,Converter={StaticResource BooleanToVisibilityConverter}}" Padding="0 0 0 4" Text="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=Text,UpdateSourceTrigger=PropertyChanged,Converter={StaticResource StringToPasswordConverter}}"></TextBlock> + <TextBlock IsHitTestVisible="False" Text="{TemplateBinding Watermark}" Foreground="{StaticResource TangoTextWatermarkBrush}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Visibility" Value="Hidden"></Setter> + <Style.Triggers> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=Text,Converter={StaticResource StringNullOrEmptyToBooleanConverter},UpdateSourceTrigger=PropertyChanged}" Value="True"></Condition> + <Condition Binding="{Binding ElementName=PART_TextBox,Path=IsFocused}" Value="False"></Condition> + </MultiDataTrigger.Conditions> + <Setter Property="Visibility" Value="Visible"></Setter> + </MultiDataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </Grid> + </components:Ripple> + + <Canvas VerticalAlignment="Top" IsHitTestVisible="False" Margin="0 -4 0 0"> + <Canvas.Style> + <Style TargetType="Canvas"> + <Setter Property="Visibility" Value="Hidden"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=Text,UpdateSourceTrigger=PropertyChanged,Converter={StaticResource StringNullOrEmptyToBooleanConverter}}" Value="False"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding ElementName=PART_TextBox,Path=IsFocused}" Value="True"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Canvas.Style> + <TextBlock FontSize="11" Foreground="{StaticResource TangoPrimaryAccentBrush}" Canvas.Top="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,Converter={StaticResource MathOperatorConverter},ConverterParameter='*-1'}" Text="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=Watermark}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Opacity" Value="0"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Canvas},Path=Visibility}" Value="Visible"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="1" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="00:00:0.2" To="0" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </Canvas> + </Grid> + </DockPanel> + </DockPanel> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + +</ResourceDictionary>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Converters/StringToPasswordConverter.cs b/Software/Visual_Studio/Tango.Touch/Converters/StringToPasswordConverter.cs new file mode 100644 index 000000000..098ff25ff --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Converters/StringToPasswordConverter.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.Touch.Converters +{ + public class StringToPasswordConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value != null) + { + String str = String.Empty; + + for (int i = 0; i < value.ToString().Length; i++) + { + str += '●'; + } + + return str; + } + + return value; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/Tango.Touch/Helpers/TouchHelper.cs b/Software/Visual_Studio/Tango.Touch/Helpers/TouchHelper.cs new file mode 100644 index 000000000..4247f37e9 --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Helpers/TouchHelper.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Input; + +namespace Tango.Touch.Helpers +{ + public static class TouchHelper + { + [DllImport("user32.dll")] + private static extern int GetSystemMetrics(int nIndex); + + /// <summary> + /// Determines whether the current machine is touch enabled. + /// </summary> + public static bool IsTouchEnabled() + { + foreach (TabletDevice tabletDevice in Tablet.TabletDevices) + { + if (tabletDevice.Type == TabletDeviceType.Touch && !String.IsNullOrWhiteSpace(tabletDevice.Name)) + return true; + } + + return false; + } + } +} diff --git a/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml b/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml index 7a64b58c3..7d609d99a 100644 --- a/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml +++ b/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml @@ -27,6 +27,10 @@ <Color x:Key="TangoLightSelectedColor">#F1F1F1</Color> + <Color x:Key="TangoTextWatermarkColor">#B0B0B0</Color> + + <Color x:Key="TangoValidationErrorColor">Red</Color> + <!--Brushes--> <SolidColorBrush x:Key="TangoPrimaryBackgroundBrush" Color="{StaticResource TangoPrimaryBackgroundColor}"></SolidColorBrush> <SolidColorBrush x:Key="TangoMidBackgroundBrush" Color="{StaticResource TangoMidBackgroundColor}"></SolidColorBrush> @@ -51,4 +55,8 @@ <SolidColorBrush x:Key="TangoColumnDividerBrush" Color="{StaticResource TangoColumnDividerColor}"></SolidColorBrush> <SolidColorBrush x:Key="TangoLightSelectedBrush" Color="{StaticResource TangoLightSelectedColor}"></SolidColorBrush> + + <SolidColorBrush x:Key="TangoTextWatermarkBrush" Color="{StaticResource TangoTextWatermarkColor}"></SolidColorBrush> + + <SolidColorBrush x:Key="TangoValidationErrorBrush" Color="{StaticResource TangoValidationErrorColor}"></SolidColorBrush> </ResourceDictionary>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj index c950696d5..99bc1b19a 100644 --- a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj +++ b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj @@ -56,6 +56,9 @@ <Reference Include="PresentationFramework" /> </ItemGroup> <ItemGroup> + <Compile Include="Controls\TouchTextBox.cs" /> + <Compile Include="Converters\StringToPasswordConverter.cs" /> + <Compile Include="Helpers\TouchHelper.cs" /> <Page Include="Components\Ripple.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -112,6 +115,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Controls\TouchTextBox.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Controls\TouchToggleButton.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> diff --git a/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml b/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml index b18184c9a..75a1331f5 100644 --- a/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml +++ b/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml @@ -23,6 +23,7 @@ <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchHamburgerButton.xaml" /> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchLoadingPanel.xaml" /> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchNotificationBar.xaml" /> + <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchTextBox.xaml" /> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Styles/TouchToggleButton.xaml" /> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Styles/TouchButton.xaml" /> diff --git a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml index 1cf4479d7..f335cd8be 100644 --- a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml +++ b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml @@ -13,75 +13,15 @@ Title="MainWindow" Height="1000" Width="800" DataContext="{Binding RelativeSource={RelativeSource Self}}" Background="{StaticResource TangoMidBackgroundBrush}"> <Grid> + <keyboard:KeyboardView> + <Grid> + <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="300" DataContext="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=DataContext}"> + <touch:TouchTextBox FontSize="20" Watermark="Email" Text="{Binding Email,NotifyOnValidationError=True,ValidatesOnDataErrors=True}" /> + <touch:TouchTextBox IsPassword="True" Margin="0 30 0 0" FontSize="20" Watermark="Password" keyboard:KeyboardView.Action="Enter" Text="{Binding Password}" /> + <touch:TouchButton Height="50" Margin="0 60 0 0" IsDefault="True" Command="{Binding LoginCommand}">LOGIN</touch:TouchButton> + </StackPanel> + </Grid> + </keyboard:KeyboardView> - <Button HorizontalAlignment="Left" VerticalAlignment="Top" Click="Button_Click_1">ADD</Button> - - <touch:LightTouchDataGrid ItemsSource="{Binding Persons}" Margin="50" OnDragAndDropCommand="{Binding DropCommand}"> - <touch:LightTouchDataGrid.Columns> - <touch:LightTouchDataGridColumn SortMember="FirstName" Header="FIRST NAME"> - <touch:LightTouchDataGridColumn.CellTemplate> - <DataTemplate> - <TextBlock Text="{Binding FirstName}"></TextBlock> - </DataTemplate> - </touch:LightTouchDataGridColumn.CellTemplate> - </touch:LightTouchDataGridColumn> - - <touch:LightTouchDataGridColumn> - <touch:LightTouchDataGridColumn.HeaderTemplate> - <DataTemplate> - <TextBlock Text="LAST NAME"></TextBlock> - </DataTemplate> - </touch:LightTouchDataGridColumn.HeaderTemplate> - <touch:LightTouchDataGridColumn.CellTemplate> - <DataTemplate> - <TextBlock Text="{Binding LastName}"></TextBlock> - </DataTemplate> - </touch:LightTouchDataGridColumn.CellTemplate> - </touch:LightTouchDataGridColumn> - - <touch:LightTouchDataGridColumn> - <touch:LightTouchDataGridColumn.HeaderTemplate> - <DataTemplate> - <TextBlock Text="AGE"></TextBlock> - </DataTemplate> - </touch:LightTouchDataGridColumn.HeaderTemplate> - <touch:LightTouchDataGridColumn.CellTemplate> - <DataTemplate> - <TextBlock Text="{Binding Age}"></TextBlock> - </DataTemplate> - </touch:LightTouchDataGridColumn.CellTemplate> - </touch:LightTouchDataGridColumn> - - <touch:LightTouchDataGridColumn SortMember="Index" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" DisplayChevron="False"> - <touch:LightTouchDataGridColumn.HeaderTemplate> - <DataTemplate> - <Border CornerRadius="0 5 5 0"> - <Border.Style> - <Style TargetType="Border"> - <Setter Property="Opacity" Value="0.0"></Setter> - <Setter Property="Background" Value="Black"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding SortDirection}" Value="Ascending"> - <Setter Property="Opacity" Value="0.2"></Setter> - </DataTrigger> - <DataTrigger Binding="{Binding SortDirection}" Value="Descending"> - <Setter Property="Opacity" Value="0.5"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </Border.Style> - </Border> - </DataTemplate> - </touch:LightTouchDataGridColumn.HeaderTemplate> - <touch:LightTouchDataGridColumn.CellTemplate> - <DataTemplate> - <dragAndDrop:DragThumb Background="Transparent" components:Ripple.PreventRipple="True"> - <TextBlock IsHitTestVisible="False" Text="{Binding Index}"></TextBlock> - </dragAndDrop:DragThumb> - </DataTemplate> - </touch:LightTouchDataGridColumn.CellTemplate> - </touch:LightTouchDataGridColumn> - </touch:LightTouchDataGrid.Columns> - </touch:LightTouchDataGrid> </Grid> </Window> diff --git a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml.cs b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml.cs index b9cb9f2be..4137afefb 100644 --- a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml.cs +++ b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml.cs @@ -17,9 +17,50 @@ using System.Windows.Shapes; using Tango.Core; using Tango.Core.Commands; using Tango.DragAndDrop; +using Tango.SharedUI; namespace Tango.UITests { + public class VM : ViewModel + { + private String _email; + public String Email + { + get { return _email; } + set { _email = value; RaisePropertyChangedAuto(); } + } + + private String _password; + + public String Password + { + get { return _password; } + set { _password = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand LoginCommand { get; set; } + + public VM() + { + LoginCommand = new RelayCommand(Login); + } + + private void Login() + { + Validate(); + } + + protected override void OnValidating() + { + base.OnValidating(); + + if (Email == "1234") + { + InsertError(nameof(Email), "This email is not good"); + } + } + } + public class Person : ExtendedObject { public String FirstName { get; set; } @@ -71,6 +112,8 @@ namespace Tango.UITests DropCommand = new RelayCommand<DropEventArgs>(OnDrop); InitializeComponent(); + + DataContext = new VM(); } private void OnDrop(DropEventArgs e) @@ -100,5 +143,10 @@ namespace Tango.UITests Index = 0 }); } + + private void TouchButton_Click(object sender, RoutedEventArgs e) + { + MessageBox.Show("Clicked"); + } } } diff --git a/Software/Visual_Studio/Versioning/GlobalVersionInfo.cs b/Software/Visual_Studio/Versioning/GlobalVersionInfo.cs index e067918d5..9d96df6aa 100644 --- a/Software/Visual_Studio/Versioning/GlobalVersionInfo.cs +++ b/Software/Visual_Studio/Versioning/GlobalVersionInfo.cs @@ -9,5 +9,5 @@ using System.Runtime.InteropServices; [assembly: AssemblyCopyright("Copyright © Twine LTD 2017")] [assembly: AssemblyTrademark("Twine LTD")] -[assembly: AssemblyVersion("1.0.0.1")] -[assembly: AssemblyFileVersion("1.0.0.1")] +[assembly: AssemblyVersion("1.0.0.2")] +[assembly: AssemblyFileVersion("1.0.0.2")] |
