aboutsummaryrefslogtreecommitdiffstats
path: root/Software
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-07-02 16:27:32 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-07-02 16:27:32 +0300
commitd866652d38d2366c333a1ff5092aff1cc4b85dfa (patch)
tree0e004697f3971d03ecfb71dc7d0caf8aec6d01e3 /Software
parent58f612e03a9bb31c2ada4eb3c5989be458ec4ff5 (diff)
downloadTango-d866652d38d2366c333a1ff5092aff1cc4b85dfa.tar.gz
Tango-d866652d38d2366c333a1ff5092aff1cc4b85dfa.zip
Implemented Twine's catalog control, Twine's catalog viewer, Twines catalog color correction view.
Added INavigationResultProvider OnNavigationObjectReceived method.. Improved navigation system history.
Diffstat (limited to 'Software')
-rw-r--r--Software/DB/Tango.mdfbin75497472 -> 75497472 bytes
-rw-r--r--Software/DB/Tango_log.ldfbin1572864 -> 1572864 bytes
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/TwineCatalogViewer.xaml27
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/TwineCatalogViewer.xaml.cs45
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj15
-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.cs20
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/TwineCatalogColorCorrectionViewVM.cs85
-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/TwineCatalogColorCorrectionView.xaml54
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogColorCorrectionView.xaml.cs28
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml10
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationManager.cs2
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationResultProvider.cs4
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs33
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchStaticListBox.cs20
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchStaticListBox.xaml6
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/TouchStaticListBoxItem.cs26
-rw-r--r--Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj1
19 files changed, 355 insertions, 31 deletions
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf
index a75f9bedd..3d4079b03 100644
--- a/Software/DB/Tango.mdf
+++ b/Software/DB/Tango.mdf
Binary files differ
diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf
index 598d523a7..95484abb6 100644
--- a/Software/DB/Tango_log.ldf
+++ b/Software/DB/Tango_log.ldf
Binary files differ
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/TwineCatalogViewer.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/TwineCatalogViewer.xaml
new file mode 100644
index 000000000..0514ad98b
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/TwineCatalogViewer.xaml
@@ -0,0 +1,27 @@
+<UserControl x:Class="Tango.PPC.Jobs.Controls.TwineCatalogViewer"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:controls="clr-namespace:Tango.PPC.Common.Controls;assembly=Tango.PPC.Common"
+ xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch"
+ xmlns:sys="clr-namespace:System;assembly=mscorlib"
+ xmlns:local="clr-namespace:Tango.PPC.Jobs.Controls"
+ mc:Ignorable="d"
+ d:DesignHeight="500" d:DesignWidth="300">
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="80"/>
+ <RowDefinition Height="1*"/>
+ </Grid.RowDefinitions>
+
+ <Grid>
+ <touch:TouchNavigationLinks FontSize="{StaticResource TangoTitleFontSize}">
+ <sys:String>CATALOG</sys:String>
+ <sys:String>RECENT</sys:String>
+ </touch:TouchNavigationLinks>
+ </Grid>
+
+ <controls:TwineCatalogControl Grid.Row="1" DataContext="{Binding RelativeSource={RelativeSource AncestorType=local:TwineCatalogViewer},Path=Catalog}" SelectedItem="{Binding RelativeSource={RelativeSource AncestorType=local:TwineCatalogViewer},Path=SelectedItem,Mode=TwoWay}" />
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/TwineCatalogViewer.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/TwineCatalogViewer.xaml.cs
new file mode 100644
index 000000000..e8d06b820
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/TwineCatalogViewer.xaml.cs
@@ -0,0 +1,45 @@
+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.BL.Catalogs;
+
+namespace Tango.PPC.Jobs.Controls
+{
+ /// <summary>
+ /// Interaction logic for TwineCatalogViewer.xaml
+ /// </summary>
+ public partial class TwineCatalogViewer : UserControl
+ {
+ public Catalog Catalog
+ {
+ get { return (Catalog)GetValue(CatalogProperty); }
+ set { SetValue(CatalogProperty, value); }
+ }
+ public static readonly DependencyProperty CatalogProperty =
+ DependencyProperty.Register("Catalog", typeof(Catalog), typeof(TwineCatalogViewer), new PropertyMetadata(null));
+
+ public CatalogItem SelectedItem
+ {
+ get { return (CatalogItem)GetValue(SelectedItemProperty); }
+ set { SetValue(SelectedItemProperty, value); }
+ }
+ public static readonly DependencyProperty SelectedItemProperty =
+ DependencyProperty.Register("SelectedItem", typeof(CatalogItem), typeof(TwineCatalogViewer), new PropertyMetadata(null));
+
+ public TwineCatalogViewer()
+ {
+ InitializeComponent();
+ }
+ }
+}
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 f77a47d37..0603d47c9 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
@@ -72,6 +72,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Controls\TwineCatalogViewer.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Dialogs\AdvancedColorCorrectionView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -100,6 +104,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Views\TwineCatalogColorCorrectionView.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\Versioning\PPC.cs">
@@ -108,6 +116,9 @@
<Compile Include="Controls\JobSummeryViewer.xaml.cs">
<DependentUpon>JobSummeryViewer.xaml</DependentUpon>
</Compile>
+ <Compile Include="Controls\TwineCatalogViewer.xaml.cs">
+ <DependentUpon>TwineCatalogViewer.xaml</DependentUpon>
+ </Compile>
<Compile Include="Converters\JobCollectionToCategoryCountConverter.cs" />
<Compile Include="Converters\JobToPieImageConverter.cs" />
<Compile Include="Dialogs\AdvancedColorCorrectionView.xaml.cs">
@@ -141,6 +152,7 @@
<Compile Include="ViewModels\JobsViewVM.cs" />
<Compile Include="ViewModels\JobViewVM.cs" />
<Compile Include="ViewModels\MainViewVM.cs" />
+ <Compile Include="ViewModels\TwineCatalogColorCorrectionViewVM.cs" />
<Compile Include="Views\JobsView.xaml.cs">
<DependentUpon>JobsView.xaml</DependentUpon>
</Compile>
@@ -153,6 +165,9 @@
<Compile Include="Views\MainView.xaml.cs">
<DependentUpon>MainView.xaml</DependentUpon>
</Compile>
+ <Compile Include="Views\TwineCatalogColorCorrectionView.xaml.cs">
+ <DependentUpon>TwineCatalogColorCorrectionView.xaml</DependentUpon>
+ </Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
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 0597b7f3e..17a14192e 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<TwineCatalogColorCorrectionViewVM>();
}
/// <summary>
@@ -64,5 +65,13 @@ namespace Tango.PPC.Jobs
return TangoIOC.Default.GetInstance<JobViewVM>();
}
}
+
+ public static TwineCatalogColorCorrectionViewVM TwineCatalogColorCorrectionViewVM
+ {
+ get
+ {
+ return TangoIOC.Default.GetInstance<TwineCatalogColorCorrectionViewVM>();
+ }
+ }
}
}
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 b23530582..aea7e0c71 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
@@ -16,6 +16,8 @@ using Tango.DragAndDrop;
using System.ComponentModel;
using System.Windows.Data;
using Tango.PPC.Jobs.Dialogs;
+using Tango.PPC.Jobs.Views;
+using Tango.BL.Catalogs;
namespace Tango.PPC.Jobs.ViewModels
{
@@ -315,7 +317,7 @@ namespace Tango.PPC.Jobs.ViewModels
{
var basicVM = await NotificationProvider.ShowDialog<BasicColorCorrectionViewVM>(new BasicColorCorrectionViewVM()
{
- InvalidBrushStop = brushStop,
+ InvalidBrushStop = brushStop,
});
if (basicVM.Result == BasicColorCorrectionViewVM.BasicColorCorrectionResult.Confirmed)
@@ -328,6 +330,22 @@ namespace Tango.PPC.Jobs.ViewModels
{
InvalidBrushStop = brushStop,
});
+
+ if (advancedVM.Result == BasicColorCorrectionViewVM.BasicColorCorrectionResult.Confirmed)
+ {
+
+ }
+ else if (advancedVM.Result == BasicColorCorrectionViewVM.BasicColorCorrectionResult.MoreOptions)
+ {
+ _can_navigate_back = true;
+ var catalogItem = await NavigationManager.NavigateForResult<JobsModule, TwineCatalogColorCorrectionView, CatalogItem, BrushStop>(brushStop);
+ _can_navigate_back = false;
+
+ if (catalogItem != null)
+ {
+
+ }
+ }
}
}
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
new file mode 100644
index 000000000..a329174d8
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/TwineCatalogColorCorrectionViewVM.cs
@@ -0,0 +1,85 @@
+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;
+
+namespace Tango.PPC.Jobs.ViewModels
+{
+ public class TwineCatalogColorCorrectionViewVM : PPCViewModel, INavigationResultProvider<CatalogItem, BrushStop>
+ {
+ private bool _confirmed;
+
+ private Catalog _catalog;
+ public Catalog Catalog
+ {
+ get { return _catalog; }
+ set { _catalog = value; RaisePropertyChangedAuto(); }
+ }
+
+ private CatalogItem _selectedItem;
+ public CatalogItem SelectedItem
+ {
+ get { return _selectedItem; }
+ set
+ {
+ _selectedItem = value; RaisePropertyChangedAuto();
+ }
+ }
+
+ private BrushStop _invalidBrushStop;
+ public BrushStop InvalidBrushStop
+ {
+ get { return _invalidBrushStop; }
+ 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);
+ }
+
+ public override void OnNavigatedTo()
+ {
+ SelectedItem = null;
+ base.OnNavigatedTo();
+ _confirmed = false;
+ }
+
+ private void Confirm()
+ {
+ _confirmed = true;
+ NavigationManager.NavigateBack();
+ }
+
+ public CatalogItem GetNavigationResult()
+ {
+ if (_confirmed)
+ {
+ return SelectedItem;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public void OnNavigationObjectReceived(BrushStop brushStop)
+ {
+ InvalidBrushStop = brushStop;
+ }
+ }
+}
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 e5f641fd6..e2ab2c26f 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:TwineCatalogColorCorrectionView />
</controls:NavigationControl>
</Grid>
</UserControl>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogColorCorrectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogColorCorrectionView.xaml
new file mode 100644
index 000000000..17fba6b7e
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogColorCorrectionView.xaml
@@ -0,0 +1,54 @@
+<UserControl x:Class="Tango.PPC.Jobs.Views.TwineCatalogColorCorrectionView"
+ 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:TwineCatalogColorCorrectionViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.TwineCatalogColorCorrectionViewVM}">
+ <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="Top" Style="{StaticResource TangoTouchBorder}" Padding="20">
+ <StackPanel>
+ <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}" Foreground="{StaticResource TangoErrorBrush}">Color is out of range</TextBlock>
+ <StackPanel Orientation="Horizontal" Margin="0 10 0 0" VerticalAlignment="Center">
+ <Image Source="../Images/JobView/error.png" Stretch="None" />
+ <Ellipse Width="60" Height="60" Margin="20 0 0 0" Fill="{Binding InvalidBrushStop.Brush}" />
+ <TextBlock VerticalAlignment="Center" Foreground="{StaticResource TangoGrayTextBrush}" Margin="20 0 0 0">
+ <Run Text="{Binding InvalidBrushStop.Red}"></Run><Run>,</Run>
+ <Run Text="{Binding InvalidBrushStop.Green}"></Run><Run>,</Run>
+ <Run Text="{Binding InvalidBrushStop.Blue}"></Run>
+ </TextBlock>
+ </StackPanel>
+
+ <TextBlock DockPanel.Dock="Top" Margin="0 30 0 0">Please select an alternative from Twine's catalog</TextBlock>
+ </StackPanel>
+ </Border>
+
+ <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}" SelectedItem="{Binding SelectedItem,Mode=TwoWay}" />
+ </Border>
+ </DockPanel>
+ </Grid>
+ </Grid>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogColorCorrectionView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogColorCorrectionView.xaml.cs
new file mode 100644
index 000000000..c6023c62e
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogColorCorrectionView.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 TwineCatalogColorCorrectionView : UserControl
+ {
+ public TwineCatalogColorCorrectionView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml
index cc28bfddb..66db7bc10 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/TwineCatalogControl.xaml
@@ -7,7 +7,7 @@
xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch"
xmlns:catalog="clr-namespace:Tango.BL.Catalogs;assembly=Tango.BL"
mc:Ignorable="d"
- d:DesignHeight="300" Background="White" d:DesignWidth="300" d:DataContext="{d:DesignInstance Type=catalog:Catalog, IsDesignTimeCreatable=False}">
+ d:DesignHeight="300" d:DesignWidth="300" d:DataContext="{d:DesignInstance Type=catalog:Catalog, IsDesignTimeCreatable=False}">
<Grid>
<Grid>
@@ -19,16 +19,16 @@
<touch:TouchListBox ItemsSource="{Binding Groups}" x:Name="list" DisableRipple="True" ScrollBarVisibility="Collapsed" SelectionMode="None">
<touch:TouchListBox.ItemTemplate>
<DataTemplate>
- <StackPanel>
+ <StackPanel Margin="0 0 10 0">
<TextBlock HorizontalAlignment="Center" Text="{Binding Name}"></TextBlock>
- <touch:TouchStaticListBox ItemsSource="{Binding Items}" SelectedItem="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=SelectedItem}" Margin="0 20 0 40">
+ <touch:TouchStaticListBox ItemsSource="{Binding Items}" SelectedItem="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=SelectedItem,Mode=TwoWay}" Margin="0 20 0 40">
<touch:TouchStaticListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</touch:TouchStaticListBox.ItemsPanel>
<touch:TouchStaticListBox.ItemContainerStyle>
- <Style TargetType="{x:Type touch:TouchListBoxItem}">
+ <Style TargetType="{x:Type touch:TouchStaticListBoxItem}">
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"></Setter>
<Setter Property="RenderTransform">
<Setter.Value>
@@ -79,7 +79,7 @@
</touch:TouchListBox>
<Grid Grid.Column="1">
- <Rectangle Stroke="{StaticResource TangoDividerBrush}" HorizontalAlignment="Left" />
+ <!--<Rectangle Stroke="{StaticResource TangoDividerBrush}" HorizontalAlignment="Left" />-->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationManager.cs
index fd5ee8e31..dd2872fd5 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationManager.cs
@@ -72,7 +72,7 @@ namespace Tango.PPC.Common.Navigation
/// The view must be of type INavigationResultProvider<TResult>.
/// </summary>
/// <param name="fullPath">The full path.</param>
- Task<TResult> NavigateForResult<TModule,TView, TResult>(bool pushToHistory = true)
+ Task<TResult> NavigateForResult<TModule, TView, TResult, TObject>(TObject obj, bool pushToHistory = true)
where TModule : IPPCModule;
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationResultProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationResultProvider.cs
index 9d9c7ac35..71bdc01e0 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationResultProvider.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/INavigationResultProvider.cs
@@ -6,8 +6,10 @@ using System.Threading.Tasks;
namespace Tango.PPC.Common.Navigation
{
- public interface INavigationResultProvider<TResult>
+ public interface INavigationResultProvider<TResult, TObject>
{
TResult GetNavigationResult();
+
+ void OnNavigationObjectReceived(TObject obj);
}
}
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 c56e0f000..d26f4d396 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs
@@ -26,6 +26,8 @@ namespace Tango.PPC.UI.Navigation
private IPPCModuleLoader _moduleLoader;
private Object _currentVM;
+ private String _lastFullPath;
+ private bool _preventHistory;
private Stack<String> _navigationHistory;
@@ -71,6 +73,7 @@ namespace Tango.PPC.UI.Navigation
if (view == NavigationView.HomeModule)
{
_navigationHistory.Clear();
+ _lastFullPath = null;
var firstModule = _moduleLoader.UserModules.FirstOrDefault();
var moduleAtt = firstModule.GetType().GetCustomAttribute<PPCModuleAttribute>();
@@ -142,12 +145,14 @@ namespace Tango.PPC.UI.Navigation
}
}
- if (pushToHistory)
+ if (pushToHistory && _lastFullPath != null && !_preventHistory)
{
- _navigationHistory.Push(fullPath);
+ _navigationHistory.Push(_lastFullPath);
RaisePropertyChanged(nameof(CanNavigateBack));
}
+ _lastFullPath = fullPath;
+
MainView.Instance.NavigationControl.NavigateTo(NavigationView.LayoutView.ToString());
var navigationControl = LayoutView.Instance.NavigationControl;
CurrentModule = module;
@@ -193,7 +198,7 @@ namespace Tango.PPC.UI.Navigation
}
}
- public Task<TResult> NavigateForResult<TModule, TView, TResult>(bool pushToHistory = true)
+ public Task<TResult> NavigateForResult<TModule, TView, TResult, TObject>(TObject obj, bool pushToHistory = true)
where TModule : IPPCModule
{
TaskCompletionSource<TResult> source = new TaskCompletionSource<TResult>();
@@ -204,19 +209,23 @@ namespace Tango.PPC.UI.Navigation
Action<Object, Object> handler = null;
- handler = (from, to) =>
+ handler = (from, to) =>
{
if (toVM == null)
{
toVM = to;
+ if (toVM is INavigationResultProvider<TResult, TObject>)
+ {
+ (toVM as INavigationResultProvider<TResult, TObject>).OnNavigationObjectReceived(obj);
+ }
}
else
{
if (to == fromVM && from == toVM)
{
- if (from is INavigationResultProvider<TResult>)
+ if (from is INavigationResultProvider<TResult, TObject>)
{
- source.SetResult((from as INavigationResultProvider<TResult>).GetNavigationResult());
+ source.SetResult((from as INavigationResultProvider<TResult, TObject>).GetNavigationResult());
}
}
@@ -236,7 +245,7 @@ namespace Tango.PPC.UI.Navigation
/// </summary>
public bool CanNavigateBack
{
- get { return _navigationHistory.Count > 1; }
+ get { return _navigationHistory.Count > 0; }
}
/// <summary>
@@ -245,16 +254,20 @@ namespace Tango.PPC.UI.Navigation
public async Task<bool> NavigateBack()
{
String first = _navigationHistory.Pop();
- String second = _navigationHistory.Pop();
+ _preventHistory = true;
- if (await NavigateTo(second))
+
+ if (await NavigateTo(first))
{
+ RaisePropertyChanged(nameof(CanNavigateBack));
+ _preventHistory = false;
return true;
}
else
{
- _navigationHistory.Push(second);
_navigationHistory.Push(first);
+ _preventHistory = false;
+ RaisePropertyChanged(nameof(CanNavigateBack));
return false;
}
}
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchStaticListBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchStaticListBox.cs
index febd09309..de363bac5 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/TouchStaticListBox.cs
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchStaticListBox.cs
@@ -50,15 +50,15 @@ namespace Tango.Touch.Controls
set { SetValue(SelectedItemProperty, value); }
}
public static readonly DependencyProperty SelectedItemProperty =
- DependencyProperty.Register("SelectedItem", typeof(Object), typeof(TouchStaticListBox), new PropertyMetadata(null, (d, e) => (d as TouchStaticListBox).OnSelectdItemChanged()));
+ DependencyProperty.Register("SelectedItem", typeof(Object), typeof(TouchStaticListBox), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, (d, e) => (d as TouchStaticListBox).OnSelectdItemChanged()));
- public RelayCommand<TouchListBoxItem> ListBoxItemLoadedCommand
+ public RelayCommand<TouchStaticListBoxItem> ListBoxItemLoadedCommand
{
- get { return (RelayCommand<TouchListBoxItem>)GetValue(ListBoxItemLoadedCommandProperty); }
+ get { return (RelayCommand<TouchStaticListBoxItem>)GetValue(ListBoxItemLoadedCommandProperty); }
set { SetValue(ListBoxItemLoadedCommandProperty, value); }
}
public static readonly DependencyProperty ListBoxItemLoadedCommandProperty =
- DependencyProperty.Register("ListBoxItemLoadedCommand", typeof(RelayCommand<TouchListBoxItem>), typeof(TouchStaticListBox), new PropertyMetadata(null));
+ DependencyProperty.Register("ListBoxItemLoadedCommand", typeof(RelayCommand<TouchStaticListBoxItem>), typeof(TouchStaticListBox), new PropertyMetadata(null));
public ItemsPanelTemplate ItemsPanel
{
@@ -77,10 +77,10 @@ namespace Tango.Touch.Controls
public TouchStaticListBox()
{
- ListBoxItemLoadedCommand = new RelayCommand<TouchListBoxItem>(RegisterListBoxItemEvents);
+ ListBoxItemLoadedCommand = new RelayCommand<TouchStaticListBoxItem>(RegisterListBoxItemEvents);
}
- private void RegisterListBoxItemEvents(TouchListBoxItem item)
+ private void RegisterListBoxItemEvents(TouchStaticListBoxItem item)
{
if (item.Tag == null)
{
@@ -94,7 +94,7 @@ namespace Tango.Touch.Controls
var scrollViewer = this.FindAncestor<LightTouchScrollViewer>();
if (scrollViewer != null && scrollViewer.IsAfterScrolling) return;
- var item = (e.Source is TouchListBoxItem) ? e.Source as TouchListBoxItem : (e.Source as DependencyObject).FindAncestor<TouchListBoxItem>();
+ var item = (e.Source is TouchStaticListBoxItem) ? e.Source as TouchStaticListBoxItem : (e.Source as DependencyObject).FindAncestor<TouchStaticListBoxItem>();
SelectedItem = item.DataContext;
}
@@ -102,7 +102,7 @@ namespace Tango.Touch.Controls
{
var items = GetItems();
items.ForEach(x => x.IsSelected = false);
-
+
if (SelectedItem != null)
{
var selected_item = items.FirstOrDefault(x => x.DataContext == SelectedItem);
@@ -114,9 +114,9 @@ namespace Tango.Touch.Controls
}
}
- private List<TouchListBoxItem> GetItems()
+ private List<TouchStaticListBoxItem> GetItems()
{
- return this.FindVisualChildren<TouchListBoxItem>().ToList();
+ return this.FindVisualChildren<TouchStaticListBoxItem>().ToList();
}
}
}
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchStaticListBox.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchStaticListBox.xaml
index 6789a0e21..62e9b215f 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/TouchStaticListBox.xaml
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchStaticListBox.xaml
@@ -18,14 +18,14 @@
<ItemsControl ItemsSource="{TemplateBinding ItemsSource}" ItemsPanel="{TemplateBinding ItemsPanel}">
<ItemsControl.ItemTemplate>
<DataTemplate>
- <local:TouchListBoxItem Style="{Binding RelativeSource={RelativeSource AncestorType=local:TouchStaticListBox},Path=ItemContainerStyle}">
+ <local:TouchStaticListBoxItem Style="{Binding RelativeSource={RelativeSource AncestorType=local:TouchStaticListBox},Path=ItemContainerStyle}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
- <i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource AncestorType=local:TouchStaticListBox},Path=ListBoxItemLoadedCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=local:TouchListBoxItem}}" />
+ <i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource AncestorType=local:TouchStaticListBox},Path=ListBoxItemLoadedCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=local:TouchStaticListBoxItem}}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<ContentControl Content="{Binding}" ContentTemplate="{Binding RelativeSource={RelativeSource AncestorType=local:TouchStaticListBox},Path=ItemTemplate}"></ContentControl>
- </local:TouchListBoxItem>
+ </local:TouchStaticListBoxItem>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchStaticListBoxItem.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchStaticListBoxItem.cs
new file mode 100644
index 000000000..ff956ab6f
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchStaticListBoxItem.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace Tango.Touch.Controls
+{
+ public class TouchStaticListBoxItem : Border
+ {
+ public bool IsSelected
+ {
+ get { return (bool)GetValue(IsSelectedProperty); }
+ set { SetValue(IsSelectedProperty, value); }
+ }
+ public static readonly DependencyProperty IsSelectedProperty =
+ DependencyProperty.Register("IsSelected", typeof(bool), typeof(TouchStaticListBoxItem), new PropertyMetadata(false));
+
+ static TouchStaticListBoxItem()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(TouchStaticListBoxItem), new FrameworkPropertyMetadata(typeof(TouchStaticListBoxItem)));
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj
index b6242dfa2..84565c08b 100644
--- a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj
+++ b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj
@@ -77,6 +77,7 @@
<Compile Include="Controls\TouchNumericTextBox.cs" />
<Compile Include="Controls\TouchSlider.cs" />
<Compile Include="Controls\TouchStaticListBox.cs" />
+ <Compile Include="Controls\TouchStaticListBoxItem.cs" />
<Compile Include="Controls\TouchTable.cs" />
<Compile Include="Controls\TouchTextBox.cs" />
<Compile Include="Controls\TouchPanel.cs" />