diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-06-24 18:39:34 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-06-24 18:39:34 +0300 |
| commit | 545f603c873cd026faf5560dae83da947f0a02a6 (patch) | |
| tree | 8022cfdbe21c6aefd68e0c7994d756e611183ef8 /Software | |
| parent | a34ee775bfe3001f562627963a4472e7df8e30b0 (diff) | |
| download | Tango-545f603c873cd026faf5560dae83da947f0a02a6.tar.gz Tango-545f603c873cd026faf5560dae83da947f0a02a6.zip | |
Working on PPC!!!!!!
Diffstat (limited to 'Software')
25 files changed, 380 insertions, 7 deletions
diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf Binary files differnew file mode 100644 index 000000000..73b7beea4 --- /dev/null +++ b/Software/DB/PPC/Tango.mdf diff --git a/Software/DB/Tango.db-journal b/Software/DB/Tango.db-journal Binary files differnew file mode 100644 index 000000000..6f9622257 --- /dev/null +++ b/Software/DB/Tango.db-journal diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf Binary files differindex 650455a02..73b7beea4 100644 --- a/Software/DB/Tango.mdf +++ b/Software/DB/Tango.mdf diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf Binary files differindex 31425db90..7e3784466 100644 --- a/Software/DB/Tango_log.ldf +++ b/Software/DB/Tango_log.ldf diff --git a/Software/Graphics/Mobile/large-cards-view.png b/Software/Graphics/Mobile/large-cards-view.png Binary files differnew file mode 100644 index 000000000..697ce228c --- /dev/null +++ b/Software/Graphics/Mobile/large-cards-view.png diff --git a/Software/Graphics/Mobile/large-cards-view@2x.png b/Software/Graphics/Mobile/large-cards-view@2x.png Binary files differnew file mode 100644 index 000000000..ee016ea09 --- /dev/null +++ b/Software/Graphics/Mobile/large-cards-view@2x.png diff --git a/Software/Graphics/Mobile/large-cards-view@3x.png b/Software/Graphics/Mobile/large-cards-view@3x.png Binary files differnew file mode 100644 index 000000000..ed65a5adf --- /dev/null +++ b/Software/Graphics/Mobile/large-cards-view@3x.png diff --git a/Software/Graphics/Mobile/small-cards-view.png b/Software/Graphics/Mobile/small-cards-view.png Binary files differnew file mode 100644 index 000000000..873b7513f --- /dev/null +++ b/Software/Graphics/Mobile/small-cards-view.png diff --git a/Software/Graphics/Mobile/small-cards-view@2x.png b/Software/Graphics/Mobile/small-cards-view@2x.png Binary files differnew file mode 100644 index 000000000..43ccd82aa --- /dev/null +++ b/Software/Graphics/Mobile/small-cards-view@2x.png diff --git a/Software/Graphics/Mobile/small-cards-view@3x.png b/Software/Graphics/Mobile/small-cards-view@3x.png Binary files differnew file mode 100644 index 000000000..a86e393af --- /dev/null +++ b/Software/Graphics/Mobile/small-cards-view@3x.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml index a7cc548dc..d66005016 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml @@ -9,6 +9,8 @@ xmlns:keyboard="clr-namespace:Tango.Touch.Keyboard;assembly=Tango.Touch" xmlns:global="clr-namespace:Tango.PPC.Jobs" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" xmlns:local="clr-namespace:Tango.PPC.Jobs.Views" mc:Ignorable="d" d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:JobViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.JobViewVM}"> @@ -20,6 +22,11 @@ <Style TargetType="FrameworkElement" x:Key="Level2Container"> <Setter Property="Margin" Value="80 30 60 0"></Setter> </Style> + <Style TargetType="FrameworkElement" x:Key="Level2ContainerExtraMargin"> + <Setter Property="Margin" Value="80 40 60 0"></Setter> + </Style> + + <converters:SegmentToBrushConverter x:Key="SegmentToBrushConverter" /> </UserControl.Resources> <Grid Background="{StaticResource TangoMidBackgroundBrush}"> @@ -108,6 +115,99 @@ <touch:TouchComboBox Margin="20 0 0 0" ItemsSource="{Binding ColorSpaces}" SelectedItem="{Binding Job.ColorSpace}" DisplayMemberPath="Name" Title="Select Color Catalog/Space" /> </DockPanel> + <DockPanel LastChildFill="False" Style="{StaticResource Level2ContainerExtraMargin}" Height="40"> + <StackPanel DockPanel.Dock="Left" Orientation="Horizontal"> + <touch:TouchToggleIconButton x:Name="toggle_small_list" IsChecked="{Binding ElementName=toggle_large_list,Path=IsChecked,Mode=OneWay,Converter={StaticResource BooleanInverseConverter}}" DockPanel.Dock="Right" Icon="List" CheckedIcon="List" Padding="8" CornerRadius="20" /> + <Rectangle HorizontalAlignment="Left" Stroke="{StaticResource TangoDividerBrush}" Margin="10 8" /> + <touch:TouchToggleIconButton x:Name="toggle_large_list" IsChecked="{Binding ElementName=toggle_small_list,Path=IsChecked,Mode=OneWay,Converter={StaticResource BooleanInverseConverter}}" DockPanel.Dock="Right" Icon="ThList" CheckedIcon="ThList" Padding="8" CornerRadius="20" /> + </StackPanel> + + <touch:TouchToggleIconButton DockPanel.Dock="Right" Icon="Pencil" CheckedIcon="Pencil" Padding="8" CornerRadius="20" /> + </DockPanel> + + <ItemsControl Style="{StaticResource Level2Container}" ItemsSource="{Binding Job.Segments}"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Border Margin="0 0 0 15" CornerRadius="8" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="1" BorderBrush="{StaticResource TangoGrayBrush}"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="Height" Value="163"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked}" Value="True"> + <Setter Property="Height" Value="74"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + <Border.Effect> + <DropShadowEffect Opacity="0.5" Color="{StaticResource TangoDropShadowColor}" BlurRadius="10" ShadowDepth="15" /> + </Border.Effect> + + <DockPanel> + <Border DockPanel.Dock="Left" CornerRadius="8 0 0 8" Background="{Binding SegmentBrush}"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked}" Value="True"> + <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,Converter={StaticResource MathOperatorConverter},ConverterParameter='*2'}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + </Border> + + <Grid> + <DockPanel Margin="30 0" VerticalAlignment="Center"> + <TextBlock DockPanel.Dock="Top" FontSize="{StaticResource TangoTitleFontSize}"> + <Run>Segment #</Run> + <Run Text="{Binding SegmentIndex,Mode=OneWay}"></Run> + </TextBlock> + + <StackPanel Margin="0 30 0 0" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="300" Visibility="{Binding ElementName=toggle_large_list,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter}}"> + <DockPanel LastChildFill="False"> + <TextBlock VerticalAlignment="Center" DockPanel.Dock="Left" Text="Color code:"></TextBlock> + + <Grid DockPanel.Dock="Right" DataContext="{Binding BrushStops[0]}"> + <ContentControl Focusable="False" FocusVisualStyle="{x:Null}" d:DataContext="{d:DesignInstance Type=entities:BrushStop, IsDesignTimeCreatable=False}" Content="{Binding}" Width="180"> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="ContentTemplate" Value="{x:Null}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.Job.ColorSpace.Name}" Value="RGB"> + <Setter Property="ContentTemplate"> + <Setter.Value> + <DataTemplate> + <UniformGrid Rows="1" Columns="3"> + <touch:TouchTextBox Margin="2 0" HorizontalContentAlignment="Center" Text="{Binding Red,UpdateSourceTrigger=PropertyChanged}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" /> + <touch:TouchTextBox Margin="2 0" HorizontalContentAlignment="Center" Text="{Binding Green,UpdateSourceTrigger=PropertyChanged}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" /> + <touch:TouchTextBox Margin="2 0" HorizontalContentAlignment="Center" Text="{Binding Blue,UpdateSourceTrigger=PropertyChanged}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" /> + </UniformGrid> + </DataTemplate> + </Setter.Value> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> + </Grid> + </DockPanel> + <DockPanel LastChildFill="False" Margin="0 20 0 0"> + <TextBlock VerticalAlignment="Center" DockPanel.Dock="Left" Text="Length (m):"></TextBlock> + <touch:TouchTextBox Width="180" DockPanel.Dock="Right" Text="{Binding Length,StringFormat=0.0}" /> + </DockPanel> + </StackPanel> + </DockPanel> + + <TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 0 50 0" Text="{Binding Length,StringFormat={}{0:N1} m}"></TextBlock> + </Grid> + </DockPanel> + </Border> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + <StackPanel HorizontalAlignment="Right" Style="{StaticResource Level2Container}" Orientation="Horizontal"> <touch:TouchButton Command="{Binding AddSolidSegmentCommand}" FontWeight="Normal" RippleBrush="{StaticResource TangoRippleDarkBrush}" FontSize="{StaticResource TangoDefaultFontSize}" EnableDropShadow="False" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="170" CornerRadius="20" Padding="0 10" Background="Transparent" BorderThickness="2" BorderBrush="{StaticResource TangoPrimaryAccentBrush}"> <StackPanel Orientation="Horizontal"> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml index 37e2d8074..2629c6a14 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml @@ -25,6 +25,7 @@ <converters:BooleanInverseConverter x:Key="BooleanInverseConverter" /> <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter" /> <converters:DateTimeUTCToShortDateConverter x:Key="DateTimeUTCToShortDateConverter" /> + <converters:MathOperatorConverter x:Key="MathOperatorConverter" /> </ResourceDictionary> </ResourceDictionary.MergedDictionaries> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs index 554bd704c..c8dc68291 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -118,12 +118,12 @@ namespace Tango.PPC.UI.PPCApplication // DataBaseSettings.DefaultDataSource = Path.Combine(PathHelper.GetUserTangoFolder(), "DB", "Tango.db"); //#endif - CoreSettings.DefaultDataBaseSource = Path.Combine(PathHelper.GetUserTangoFolder(), "DB", "Tango.db"); + CoreSettings.DefaultDataBaseSource = Path.Combine(PathHelper.GetUserTangoFolder(), "DB", "Tango.mdf"); if (!File.Exists(CoreSettings.DefaultDataBaseSource)) { Directory.CreateDirectory(Path.GetDirectoryName(CoreSettings.DefaultDataBaseSource)); - File.Copy(Path.Combine(PathHelper.GetStartupPath(), "DB", "Tango.db"), CoreSettings.DefaultDataBaseSource); + File.Copy(Path.Combine(PathHelper.GetStartupPath(), "DB", "Tango.mdf"), CoreSettings.DefaultDataBaseSource); } var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); ; 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 d4c2bb037..c42924d2d 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 @@ -15,6 +15,21 @@ <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <NuGetPackageImportStamp> </NuGetPackageImportStamp> + <PublishUrl>publish\</PublishUrl> + <Install>true</Install> + <InstallFrom>Disk</InstallFrom> + <UpdateEnabled>false</UpdateEnabled> + <UpdateMode>Foreground</UpdateMode> + <UpdateInterval>7</UpdateInterval> + <UpdateIntervalUnits>Days</UpdateIntervalUnits> + <UpdatePeriodically>false</UpdatePeriodically> + <UpdateRequired>false</UpdateRequired> + <MapFileExtensions>true</MapFileExtensions> + <ApplicationRevision>0</ApplicationRevision> + <ApplicationVersion>1.0.0.%2a</ApplicationVersion> + <IsWebBootstrapper>false</IsWebBootstrapper> + <UseApplicationTrust>false</UseApplicationTrust> + <BootstrapperEnabled>true</BootstrapperEnabled> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PlatformTarget>AnyCPU</PlatformTarget> @@ -189,8 +204,8 @@ <Generator>ResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> </EmbeddedResource> - <Content Include="..\..\..\DB\Tango.db"> - <Link>DB\Tango.db</Link> + <Content Include="..\..\..\DB\PPC\Tango.mdf"> + <Link>DB\Tango.mdf</Link> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> <None Include="packages.config" /> @@ -278,7 +293,18 @@ <ItemGroup> <Resource Include="Images\MessageBox Icons\information.png" /> </ItemGroup> - <ItemGroup /> + <ItemGroup> + <BootstrapperPackage Include=".NETFramework,Version=v4.6"> + <Visible>False</Visible> + <ProductName>Microsoft .NET Framework 4.6 %28x86 and x64%29</ProductName> + <Install>true</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5 SP1</ProductName> + <Install>false</Install> + </BootstrapperPackage> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="..\..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets')" /> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs index ad5781b7b..de887d8fe 100644 --- a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs +++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs @@ -204,6 +204,11 @@ namespace Tango.BL.Entities RaisePropertyChanged(prop.Name); } + if (Segment != null) + { + Segment.RaiseSegmentBrushChanged(); + } + _ignorePropChanged = false; } } diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Segment.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Segment.cs index 2c08cbf37..c4bbd0f65 100644 --- a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Segment.cs +++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Segment.cs @@ -61,6 +61,29 @@ namespace Tango.BL.Entities set { _completed = value; RaisePropertyChangedAuto(); } } + [NotMapped] + [JsonIgnore] + public Brush SegmentBrush + { + get + { + GradientStopCollection stops = new GradientStopCollection(); + + foreach (var stop in BrushStops.OrderBy(x => x.StopIndex)) + { + stops.Add(new GradientStop(stop.Color, stop.OffsetPercent / 100d)); + } + + LinearGradientBrush brush = new LinearGradientBrush(); + brush.StartPoint = new Point(0, 0); + brush.EndPoint = new Point(1, 0); + + brush.GradientStops = stops; + + return brush; + } + } + public override Segment Clone() { Segment cloned = base.Clone(); @@ -140,5 +163,10 @@ namespace Tango.BL.Entities return System.Drawing.Brushes.Black; } } + + public void RaiseSegmentBrushChanged() + { + RaisePropertyChanged(nameof(SegmentBrush)); + } } } diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/SegmentToBrushConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/SegmentToBrushConverter.cs new file mode 100644 index 000000000..60a79feb0 --- /dev/null +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/SegmentToBrushConverter.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; +using System.Windows.Media; +using Tango.BL.Entities; + +namespace Tango.SharedUI.Converters +{ + public class SegmentToBrushConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + try + { + Segment segment = value as Segment; + + GradientStopCollection stops = new GradientStopCollection(); + + foreach (var stop in segment.BrushStops.OrderBy(x => x.StopIndex)) + { + stops.Add(new GradientStop(stop.Color, stop.OffsetPercent / 100d)); + } + + LinearGradientBrush brush = new LinearGradientBrush(); + brush.StartPoint = new Point(0,0); + brush.EndPoint = new Point(1, 0); + + brush.GradientStops = stops; + + return brush; + } + catch + { + return null; + } + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/SegmentToBrushConverterMulti.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/SegmentToBrushConverterMulti.cs new file mode 100644 index 000000000..4b525b2d8 --- /dev/null +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/SegmentToBrushConverterMulti.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; +using System.Windows.Media; +using Tango.BL.Entities; + +namespace Tango.SharedUI.Converters +{ + public class SegmentToBrushConverterMulti : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + Segment segment = values[0] as Segment; + + if (segment != null) + { + GradientStopCollection stops = new GradientStopCollection(); + + foreach (var stop in segment.BrushStops.OrderBy(x => x.StopIndex)) + { + stops.Add(new GradientStop(stop.Color, stop.OffsetPercent / 100d)); + } + + LinearGradientBrush brush = new LinearGradientBrush(); + brush.StartPoint = new Point(0, 0); + brush.EndPoint = new Point(1, 0); + + brush.GradientStops = stops; + + return brush; + } + + return null; + } + catch + { + return null; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, 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 f877b327f..3795d9782 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj +++ b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj @@ -97,6 +97,8 @@ <Compile Include="Converters\LastItemInContainerToBooleanConverter.cs" /> <Compile Include="Converters\MathOperatorConverter.cs" /> <Compile Include="Converters\NumberToFileSizeConverter.cs" /> + <Compile Include="Converters\SegmentToBrushConverter.cs" /> + <Compile Include="Converters\SegmentToBrushConverterMulti.cs" /> <Compile Include="Converters\SmallerThanToBooleanConverter.cs" /> <Compile Include="Converters\GreaterThanToBooleanConverter.cs" /> <Compile Include="Converters\IsEnumConverter.cs" /> @@ -189,6 +191,10 @@ <Project>{6c55b776-26d4-4db3-a6ab-87e783b2f3d1}</Project> <Name>ICSharpCode.AvalonEdit</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> diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.cs index abe00a0a2..438d22272 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchComboBox.cs @@ -38,7 +38,7 @@ namespace Tango.Touch.Controls set { SetValue(SelectedItemProperty, value); } } public static readonly DependencyProperty SelectedItemProperty = - DependencyProperty.Register("SelectedItem", typeof(object), typeof(TouchComboBox), new PropertyMetadata(null)); + DependencyProperty.Register("SelectedItem", typeof(object), typeof(TouchComboBox), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); public IList ItemsSource { diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml index c463b5277..71624bb37 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml @@ -35,7 +35,9 @@ BorderThickness="{TemplateBinding BorderThickness}" keyboard:KeyboardView.Container="{TemplateBinding KeyboardContainer}"> <DockPanel> <Border DockPanel.Dock="Bottom" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=(Validation.HasError),Converter={StaticResource BooleanToVisibilityConverter}}"> + <Canvas> <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> + </Canvas> </Border> <DockPanel> <Grid DockPanel.Dock="Bottom" Height="2"> @@ -99,7 +101,7 @@ <Grid> <components:Ripple RippleBrush="{StaticResource TangoRippleDarkBrush}" RippleFactor="15"> <Grid> - <TextBox Foreground="{TemplateBinding Foreground}" Padding="0 0 0 4" CaretBrush="{StaticResource TangoPrimaryAccentBrush}" FocusVisualStyle="{x:Null}" x:Name="PART_TextBox" Text="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=Text,UpdateSourceTrigger=PropertyChanged}" BorderThickness="0" Background="Transparent" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=IsPassword,Converter={StaticResource BooleanToVisibilityInverseConverter}}"></TextBox> + <TextBox HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Foreground="{TemplateBinding Foreground}" Padding="0 0 0 4" CaretBrush="{StaticResource TangoPrimaryAccentBrush}" FocusVisualStyle="{x:Null}" x:Name="PART_TextBox" Text="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=Text,UpdateSourceTrigger=PropertyChanged}" BorderThickness="0" Background="Transparent" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=IsPassword,Converter={StaticResource BooleanToVisibilityInverseConverter}}"></TextBox> <PasswordBox Foreground="{TemplateBinding Foreground}" helpers:PasswordHelper.Attach="True" helpers:PasswordHelper.Password="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Padding="0 0 0 4" CaretBrush="{StaticResource TangoPrimaryAccentBrush}" FocusVisualStyle="{x:Null}" x:Name="PART_PasswordBox" BorderThickness="0" Background="Transparent" Visibility="{Binding RelativeSource={RelativeSource AncestorType=local:TouchTextBox},Path=IsPassword,Converter={StaticResource BooleanToVisibilityConverter}}"></PasswordBox> <TextBlock IsHitTestVisible="False" Text="{TemplateBinding Watermark}" Foreground="{StaticResource TangoTextWatermarkBrush}"> <TextBlock.Style> diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchToggleIconButton.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchToggleIconButton.cs new file mode 100644 index 000000000..8deb6b527 --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchToggleIconButton.cs @@ -0,0 +1,60 @@ +using FontAwesome.WPF; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +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 TouchToggleIconButton : ToggleButton + { + static TouchToggleIconButton() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(TouchToggleIconButton), new FrameworkPropertyMetadata(typeof(TouchToggleIconButton))); + } + + public FontAwesomeIcon Icon + { + get { return (FontAwesomeIcon)GetValue(IconProperty); } + set { SetValue(IconProperty, value); } + } + public static readonly DependencyProperty IconProperty = + DependencyProperty.Register("Icon", typeof(FontAwesomeIcon), typeof(TouchToggleIconButton), new PropertyMetadata(FontAwesomeIcon.Check)); + + public FontAwesomeIcon CheckedIcon + { + get { return (FontAwesomeIcon)GetValue(CheckedIconProperty); } + set { SetValue(CheckedIconProperty, value); } + } + public static readonly DependencyProperty CheckedIconProperty = + DependencyProperty.Register("CheckedIcon", typeof(FontAwesomeIcon), typeof(TouchToggleIconButton), new PropertyMetadata(FontAwesomeIcon.Close)); + + public Brush CheckedForeground + { + get { return (Brush)GetValue(CheckedForegroundProperty); } + set { SetValue(CheckedForegroundProperty, value); } + } + public static readonly DependencyProperty CheckedForegroundProperty = + DependencyProperty.Register("CheckedForeground", typeof(Brush), typeof(TouchToggleIconButton), new PropertyMetadata(null)); + + public CornerRadius CornerRadius + { + get { return (CornerRadius)GetValue(CornerRadiusProperty); } + set { SetValue(CornerRadiusProperty, value); } + } + public static readonly DependencyProperty CornerRadiusProperty = + DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(TouchToggleIconButton), new PropertyMetadata(default(CornerRadius))); + + } +} diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchToggleIconButton.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchToggleIconButton.xaml new file mode 100644 index 000000000..61d2f0ca7 --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchToggleIconButton.xaml @@ -0,0 +1,38 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:fa="http://schemas.fontawesome.io/icons/" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:components="clr-namespace:Tango.Touch.Components" + xmlns:local="clr-namespace:Tango.Touch.Controls"> + + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="../Resources/Colors.xaml" /> + </ResourceDictionary.MergedDictionaries> + + <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> + <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter" /> + + <Style TargetType="{x:Type local:TouchToggleIconButton}"> + <Setter Property="Foreground" Value="{StaticResource TangoDarkForegroundBrush}"></Setter> + <Setter Property="CheckedForeground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}"></Setter> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type local:TouchToggleIconButton}"> + <Border Background="{TemplateBinding Background}" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}"> + <components:Ripple CornerRadius="{TemplateBinding CornerRadius}" RippleBrush="{StaticResource TangoRippleDarkBrush}"> + <Grid Margin="{TemplateBinding Padding}"> + <fa:ImageAwesome Icon="{TemplateBinding Icon}" Foreground="{TemplateBinding Foreground}" Visibility="{TemplateBinding IsChecked,Converter={StaticResource BooleanToVisibilityInverseConverter}}" /> + <fa:ImageAwesome Icon="{TemplateBinding CheckedIcon}" Foreground="{TemplateBinding CheckedForeground}" Visibility="{TemplateBinding IsChecked,Converter={StaticResource BooleanToVisibilityConverter}}" /> + </Grid> + </components:Ripple> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + +</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 ebbcf650c..9f393898a 100644 --- a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj +++ b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj @@ -71,6 +71,7 @@ <Compile Include="Controls\TouchTable.cs" /> <Compile Include="Controls\TouchTextBox.cs" /> <Compile Include="Controls\TouchPanel.cs" /> + <Compile Include="Controls\TouchToggleIconButton.cs" /> <Compile Include="Controls\TouchToggleSlider.cs" /> <Compile Include="Converters\StringToPasswordConverter.cs" /> <Compile Include="Helpers\TouchHelper.cs" /> @@ -162,6 +163,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Controls\TouchToggleIconButton.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Controls\TouchToggleSlider.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 58b13bb8e..f987a0584 100644 --- a/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml +++ b/Software/Visual_Studio/Tango.Touch/Themes/Generic.xaml @@ -30,6 +30,7 @@ <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchExpander.xaml" /> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchToggleSlider.xaml" /> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchAutoComplete.xaml" /> + <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Controls/TouchToggleIconButton.xaml" /> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Styles/TouchToggleButton.xaml" /> <ResourceDictionary Source="pack://application:,,,/Tango.Touch;component/Styles/TouchButton.xaml" /> |
