aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-07-02 19:03:59 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-07-02 19:03:59 +0300
commit2d340ef8bbbb5a1c7f3415da704a0b83c28c07b4 (patch)
treee051087540ca37ab98c253075adf90b16fe6c665 /Software/Visual_Studio
parent327fe90a471c74a5723258ccbda7d9ade064b50c (diff)
downloadTango-2d340ef8bbbb5a1c7f3415da704a0b83c28c07b4.tar.gz
Tango-2d340ef8bbbb5a1c7f3415da704a0b83c28c07b4.zip
WOrking on PPC.
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj8
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModelLocator.cs9
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs19
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/TwineCatalogColorCorrectionViewVM.cs73
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/TwineCatalogViewVM.cs97
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml10
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/MainView.xaml1
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogView.xaml37
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogView.xaml.cs28
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs13
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs7
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchLoadingPanel.xaml2
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs36
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml2
14 files changed, 264 insertions, 78 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj
index 100b7dcbd..935fdb77d 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj
@@ -104,6 +104,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Views\TwineCatalogView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="Views\TwineCatalogColorCorrectionView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -154,6 +158,7 @@
<Compile Include="ViewModels\JobViewVM.cs" />
<Compile Include="ViewModels\MainViewVM.cs" />
<Compile Include="ViewModels\TwineCatalogColorCorrectionViewVM.cs" />
+ <Compile Include="ViewModels\TwineCatalogViewVM.cs" />
<Compile Include="Views\JobsView.xaml.cs">
<DependentUpon>JobsView.xaml</DependentUpon>
</Compile>
@@ -166,6 +171,9 @@
<Compile Include="Views\MainView.xaml.cs">
<DependentUpon>MainView.xaml</DependentUpon>
</Compile>
+ <Compile Include="Views\TwineCatalogView.xaml.cs">
+ <DependentUpon>TwineCatalogView.xaml</DependentUpon>
+ </Compile>
<Compile Include="Views\TwineCatalogColorCorrectionView.xaml.cs">
<DependentUpon>TwineCatalogColorCorrectionView.xaml</DependentUpon>
</Compile>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModelLocator.cs
index 17a14192e..2a0692350 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModelLocator.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModelLocator.cs
@@ -19,6 +19,7 @@ namespace Tango.PPC.Jobs
TangoIOC.Default.Register<JobsViewVM>();
TangoIOC.Default.Register<JobSummeryViewVM>();
TangoIOC.Default.Register<JobViewVM>();
+ TangoIOC.Default.Register<TwineCatalogViewVM>();
TangoIOC.Default.Register<TwineCatalogColorCorrectionViewVM>();
}
@@ -66,6 +67,14 @@ namespace Tango.PPC.Jobs
}
}
+ public static TwineCatalogViewVM TwineCatalogViewVM
+ {
+ get
+ {
+ return TangoIOC.Default.GetInstance<TwineCatalogViewVM>();
+ }
+ }
+
public static TwineCatalogColorCorrectionViewVM TwineCatalogColorCorrectionViewVM
{
get
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs
index 8663686c6..1c4fec382 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs
@@ -160,6 +160,11 @@ namespace Tango.PPC.Jobs.ViewModels
/// </summary>
public RelayCommand<BrushStop> ReplaceBrushStopCommand { get; set; }
+ /// <summary>
+ /// Gets or sets the twine catalog field tap command.
+ /// </summary>
+ public RelayCommand<BrushStop> TwineCatalogFieldTapCommand { get; set; }
+
#endregion
#region Constructors
@@ -192,6 +197,7 @@ namespace Tango.PPC.Jobs.ViewModels
RemoveJobCommand = new RelayCommand(RemoveJob);
SaveJobCommand = new RelayCommand(SaveJob);
ReplaceBrushStopCommand = new RelayCommand<BrushStop>(InvokeColorAdjustmentForBrushStop);
+ TwineCatalogFieldTapCommand = new RelayCommand<BrushStop>(InvokeTwineCatalogForBrushStop);
}
#endregion
@@ -349,6 +355,19 @@ namespace Tango.PPC.Jobs.ViewModels
}
}
+ private async void InvokeTwineCatalogForBrushStop(BrushStop brushStop)
+ {
+ _can_navigate_back = true;
+ var catalogItem = await NavigationManager.NavigateForResult<JobsModule, TwineCatalogView, CatalogItem, BrushStop>(brushStop);
+ _can_navigate_back = false;
+
+ if (catalogItem != null)
+ {
+ brushStop.ColorCatalog = _db.ColorCatalogs.Single(x => x.Guid == catalogItem.Entity.Guid);
+ brushStop.Color = catalogItem.Color;
+ }
+ }
+
#endregion
#region Job Selection Message
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/TwineCatalogColorCorrectionViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/TwineCatalogColorCorrectionViewVM.cs
index 9cae25dd2..7217bd174 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/TwineCatalogColorCorrectionViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/TwineCatalogColorCorrectionViewVM.cs
@@ -13,35 +13,8 @@ using Tango.Settings;
namespace Tango.PPC.Jobs.ViewModels
{
- public class TwineCatalogColorCorrectionViewVM : PPCViewModel, INavigationResultProvider<CatalogItem, BrushStop>
+ public class TwineCatalogColorCorrectionViewVM : TwineCatalogViewVM
{
- private bool _confirmed;
-
- private Catalog _catalog;
- public Catalog Catalog
- {
- get { return _catalog; }
- set { _catalog = value; RaisePropertyChangedAuto(); }
- }
-
- private Catalog _recent;
- public Catalog Recent
- {
- get { return _recent; }
- set { _recent = value; RaisePropertyChangedAuto(); }
- }
-
-
- private CatalogItem _selectedItem;
- public CatalogItem SelectedItem
- {
- get { return _selectedItem; }
- set
- {
- _selectedItem = value; RaisePropertyChangedAuto();
- }
- }
-
private BrushStop _invalidBrushStop;
public BrushStop InvalidBrushStop
{
@@ -49,49 +22,7 @@ namespace Tango.PPC.Jobs.ViewModels
set { _invalidBrushStop = value; RaisePropertyChangedAuto(); }
}
- public RelayCommand OKCommand { get; set; }
-
- public TwineCatalogColorCorrectionViewVM()
- {
- OKCommand = new RelayCommand(Confirm);
- }
-
- public override void OnApplicationStarted()
- {
- Catalog = CatalogLoader.LoadCatalog(BL.Enumerations.ColorSpaces.Twine, ObservablesEntitiesAdapter.Instance.Context);
- Recent = CatalogLoader.GetRecent(Catalog, SettingsManager.Default.GetOrCreate<JobsModuleSettings>().RecentTwineCatalogColors);
- }
-
- public override void OnNavigatedTo()
- {
- SelectedItem = null;
- base.OnNavigatedTo();
- _confirmed = false;
- }
-
- private void Confirm()
- {
- SettingsManager.Default.GetOrCreate<JobsModuleSettings>().RecentTwineCatalogColors.Add(SelectedItem.Entity.Guid);
- SettingsManager.Default.Save();
- Recent = CatalogLoader.GetRecent(Catalog, SettingsManager.Default.GetOrCreate<JobsModuleSettings>().RecentTwineCatalogColors);
-
- _confirmed = true;
- NavigationManager.NavigateBack();
- }
-
- public CatalogItem GetNavigationResult()
- {
- if (_confirmed)
- {
- return SelectedItem;
- }
- else
- {
- return null;
- }
- }
-
- public void OnNavigationObjectReceived(BrushStop brushStop)
+ public override void OnNavigationObjectReceived(BrushStop brushStop)
{
InvalidBrushStop = brushStop;
}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/TwineCatalogViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/TwineCatalogViewVM.cs
new file mode 100644
index 000000000..2b7a24ab8
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/TwineCatalogViewVM.cs
@@ -0,0 +1,97 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL;
+using Tango.BL.Catalogs;
+using Tango.BL.Entities;
+using Tango.Core.Commands;
+using Tango.PPC.Common;
+using Tango.PPC.Common.Navigation;
+using Tango.Settings;
+
+namespace Tango.PPC.Jobs.ViewModels
+{
+ public class TwineCatalogViewVM : PPCViewModel, INavigationResultProvider<CatalogItem, BrushStop>
+ {
+ private bool _confirmed;
+
+ private Catalog _catalog;
+ public Catalog Catalog
+ {
+ get { return _catalog; }
+ set { _catalog = value; RaisePropertyChangedAuto(); }
+ }
+
+ private Catalog _recent;
+ public Catalog Recent
+ {
+ get { return _recent; }
+ set { _recent = value; RaisePropertyChangedAuto(); }
+ }
+
+ private CatalogItem _selectedItem;
+ public CatalogItem SelectedItem
+ {
+ get { return _selectedItem; }
+ set
+ {
+ _selectedItem = value; RaisePropertyChangedAuto();
+ }
+ }
+
+ public RelayCommand OKCommand { get; set; }
+
+ public TwineCatalogViewVM()
+ {
+ OKCommand = new RelayCommand(Confirm);
+ }
+
+ public override void OnApplicationStarted()
+ {
+ Catalog = CatalogLoader.LoadCatalog(BL.Enumerations.ColorSpaces.Twine, ObservablesEntitiesAdapter.Instance.Context);
+ Recent = CatalogLoader.GetRecent(Catalog, SettingsManager.Default.GetOrCreate<JobsModuleSettings>().RecentTwineCatalogColors);
+ }
+
+ public override void OnNavigatedTo()
+ {
+ base.OnNavigatedTo();
+ _confirmed = false;
+ }
+
+ private void Confirm()
+ {
+ SettingsManager.Default.GetOrCreate<JobsModuleSettings>().RecentTwineCatalogColors.Add(SelectedItem.Entity.Guid);
+ SettingsManager.Default.Save();
+ Recent = CatalogLoader.GetRecent(Catalog, SettingsManager.Default.GetOrCreate<JobsModuleSettings>().RecentTwineCatalogColors);
+
+ _confirmed = true;
+ NavigationManager.NavigateBack();
+ }
+
+ public CatalogItem GetNavigationResult()
+ {
+ if (_confirmed)
+ {
+ return SelectedItem;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public virtual void OnNavigationObjectReceived(BrushStop brushStop)
+ {
+ if (brushStop.ColorCatalog != null)
+ {
+ SelectedItem = Catalog.Groups.SelectMany(x => x.Items).SingleOrDefault(x => x.Entity.Guid == brushStop.ColorCatalog.Guid);
+ }
+ else
+ {
+ SelectedItem = null;
+ }
+ }
+ }
+}
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 610d3f61f..a55e5a7d3 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
@@ -52,6 +52,10 @@
<touch:TouchNumericTextBox Margin="2 0" HorizontalContentAlignment="Center" Value="{Binding B}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="-128" Maximum="128" StringFormat="0.00" />
</UniformGrid>
</DataTemplate>
+
+ <DataTemplate x:Key="TWINE_Template" DataType="{x:Type entities:BrushStop}">
+ <touch:TouchTextBox TapCommand="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.TwineCatalogFieldTapCommand}" TapCommandParameter="{Binding}" IsReadOnly="True" keyboard:KeyboardView.Mode="{x:Null}" Margin="2 0" Text="{Binding ColorCatalog.Name}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" />
+ </DataTemplate>
</UserControl.Resources>
<Grid Background="{StaticResource TangoMidBackgroundBrush}">
@@ -248,6 +252,9 @@
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.Job.ColorSpace.Name}" Value="LAB">
<Setter Property="ContentTemplate" Value="{StaticResource LAB_Template}" />
</DataTrigger>
+ <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.Job.ColorSpace.Name}" Value="Twine">
+ <Setter Property="ContentTemplate" Value="{StaticResource TWINE_Template}" />
+ </DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
@@ -375,6 +382,9 @@
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.Job.ColorSpace.Name}" Value="LAB">
<Setter Property="ContentTemplate" Value="{StaticResource LAB_Template}" />
</DataTrigger>
+ <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.Job.ColorSpace.Name}" Value="Twine">
+ <Setter Property="ContentTemplate" Value="{StaticResource TWINE_Template}" />
+ </DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/MainView.xaml
index e2ab2c26f..6de05b01b 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/MainView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/MainView.xaml
@@ -15,6 +15,7 @@
<views:JobsView />
<views:JobSummeryView />
<views:JobView />
+ <views:TwineCatalogView />
<views:TwineCatalogColorCorrectionView />
</controls:NavigationControl>
</Grid>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogView.xaml
new file mode 100644
index 000000000..3a29c3dd2
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogView.xaml
@@ -0,0 +1,37 @@
+<UserControl x:Class="Tango.PPC.Jobs.Views.TwineCatalogView"
+ 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:vm="clr-namespace:Tango.PPC.Jobs.ViewModels"
+ xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch"
+ xmlns:controls="clr-namespace:Tango.PPC.Jobs.Controls"
+ xmlns:global="clr-namespace:Tango.PPC.Jobs"
+ xmlns:local="clr-namespace:Tango.PPC.Jobs.Views"
+ mc:Ignorable="d"
+ d:DesignHeight="1280" d:DesignWidth="800" Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DataContext="{d:DesignInstance Type=vm:TwineCatalogViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.TwineCatalogViewVM}">
+ <Grid>
+ <Grid Background="{StaticResource TangoMidBackgroundBrush}">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto"/>
+ <RowDefinition Height="1*"/>
+ </Grid.RowDefinitions>
+
+ <Border Padding="20" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}">
+ <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold">Twine Catalog</TextBlock>
+ </Border>
+
+ <Grid Grid.Row="1">
+ <DockPanel Margin="10">
+ <Border DockPanel.Dock="Bottom" Height="100">
+ <touch:TouchButton Command="{Binding OKCommand}" HorizontalAlignment="Right" VerticalAlignment="Center" Content="OK" Height="50" Width="150" Style="{StaticResource TangoHollowButton}" Margin="0 0 20 0" />
+ </Border>
+
+ <Border Style="{StaticResource TangoTouchBorder}" Padding="20 20 20 100" Margin="0 10 0 0">
+ <controls:TwineCatalogViewer Catalog="{Binding Catalog}" Recent="{Binding Recent}" SelectedItem="{Binding SelectedItem,Mode=TwoWay}" />
+ </Border>
+ </DockPanel>
+ </Grid>
+ </Grid>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogView.xaml.cs
new file mode 100644
index 000000000..57600322f
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogView.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.PPC.Jobs.Views
+{
+ /// <summary>
+ /// Interaction logic for TwineCatalogColorCorrectionView.xaml
+ /// </summary>
+ public partial class TwineCatalogView : UserControl
+ {
+ public TwineCatalogView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs
index d26f4d396..448fc0edc 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs
@@ -171,11 +171,18 @@ namespace Tango.PPC.UI.Navigation
await Task.Delay(100);
var v = moduleNavigation.NavigateTo(view);
- _currentVM = v.DataContext;
+ if (v != null)
+ {
+ _currentVM = v.DataContext;
- if (view != path.Last())
+ if (view != path.Last())
+ {
+ moduleNavigation = v.FindChildOffline<NavigationControl>();
+ }
+ }
+ else
{
- moduleNavigation = v.FindChildOffline<NavigationControl>();
+ throw new ArgumentNullException("Could not navigate to " + fullPath);
}
}
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs
index 9840a6fd8..eb60565a5 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs
+++ b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs
@@ -33,7 +33,7 @@ namespace Tango.Touch.Controls
private DateTime _current_move_time;
private double _current_move_delta;
private double _last_move_delta;
- private const double _min_move_delta = 5;
+ private const double _min_move_delta = 10;
private const double _delta_measure_interval_milli = 10;
private const double _friction_factor_per_second = 0.9;
private DispatcherTimer _move_timer;
@@ -559,6 +559,9 @@ namespace Tango.Touch.Controls
if (IsScrolling)
{
+ double max_move_delta = 120;
+ double strengh = Math.Abs(_current_move_delta) / max_move_delta;
+
Debug.WriteLine((DateTime.Now - _current_move_time).TotalMilliseconds);
Debug.WriteLine("MOVE DELTA: " + _current_move_delta);
//Emulate inertia
@@ -579,7 +582,7 @@ namespace Tango.Touch.Controls
double to = _grid_content.Margin.Top + (pixels_per_second) / 100;
_grid_content.Margin = new Thickness(0, to, 0, 0);
- if (DateTime.Now > cur_time.AddMilliseconds(300))
+ if (DateTime.Now > cur_time.AddMilliseconds(500 * strengh))
{
pixels_per_second *= _friction_factor_per_second;
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchLoadingPanel.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchLoadingPanel.xaml
index d4c0c3d80..4a4cdbba2 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/TouchLoadingPanel.xaml
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchLoadingPanel.xaml
@@ -45,7 +45,7 @@
</Grid.Style>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
- <local:TouchBusyIndicator Foreground="{TemplateBinding Foreground}" IsIndeterminate="True" Width="100" Height="100" HorizontalAlignment="Center" />
+ <local:TouchBusyIndicator Foreground="{TemplateBinding Foreground}" IsIndeterminate="{TemplateBinding IsLoading}" Width="100" Height="100" HorizontalAlignment="Center" />
<TextBlock Margin="20" Text="{TemplateBinding LoadingMessage}" HorizontalAlignment="Center" />
</StackPanel>
</Grid>
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs
index b70750286..d5ecdfdeb 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.cs
@@ -12,6 +12,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
+using Tango.Core.EventArguments;
using Tango.Touch.Keyboard;
namespace Tango.Touch.Controls
@@ -44,6 +45,31 @@ namespace Tango.Touch.Controls
public static readonly DependencyProperty IsPasswordProperty =
DependencyProperty.Register("IsPassword", typeof(bool), typeof(TouchTextBox), new PropertyMetadata(false));
+ public bool IsReadOnly
+ {
+ get { return (bool)GetValue(IsReadOnlyProperty); }
+ set { SetValue(IsReadOnlyProperty, value); }
+ }
+ public static readonly DependencyProperty IsReadOnlyProperty =
+ DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(TouchTextBox), new PropertyMetadata(false));
+
+ public ICommand TapCommand
+ {
+ get { return (ICommand)GetValue(TapCommandProperty); }
+ set { SetValue(TapCommandProperty, value); }
+ }
+ public static readonly DependencyProperty TapCommandProperty =
+ DependencyProperty.Register("TapCommand", typeof(ICommand), typeof(TouchTextBox), new PropertyMetadata(null));
+
+ public Object TapCommandParameter
+ {
+ get { return (Object)GetValue(TapCommandParameterProperty); }
+ set { SetValue(TapCommandParameterProperty, value); }
+ }
+ public static readonly DependencyProperty TapCommandParameterProperty =
+ DependencyProperty.Register("TapCommandParameter", typeof(Object), typeof(TouchTextBox), new PropertyMetadata(null));
+
+
static TouchTextBox()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(TouchTextBox), new FrameworkPropertyMetadata(typeof(TouchTextBox)));
@@ -56,6 +82,16 @@ namespace Tango.Touch.Controls
_text_box = GetTemplateChild("PART_TextBox") as TextBox;
_text_box.GotFocus += _text_box_GotFocus;
+
+ this.RegisterForPreviewMouseOrTouchUp(OnMouseOrTouchUp);
+ }
+
+ private void OnMouseOrTouchUp(object sender, MouseOrTouchEventArgs e)
+ {
+ if (TapCommand != null)
+ {
+ TapCommand.Execute(TapCommandParameter);
+ }
}
private async void _text_box_GotFocus(object sender, RoutedEventArgs e)
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml
index 715705a87..da999385f 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchTextBox.xaml
@@ -102,7 +102,7 @@
<Grid>
<components:Ripple RippleBrush="{StaticResource TangoRippleDarkBrush}" RippleFactor="15">
<Grid>
- <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>
+ <TextBox IsReadOnly="{TemplateBinding IsReadOnly}" 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>