aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2018-06-15 23:18:51 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2018-06-15 23:18:51 +0300
commitf0bcdcdbfa78ba705b8fa44591fa594a425352a9 (patch)
treed5476a7259fc5d6061d819ae5f1df5b78c904856 /Software/Visual_Studio/PPC
parent84700eb44cffe4b503a9ad22b1dfa8c703f356d2 (diff)
downloadTango-f0bcdcdbfa78ba705b8fa44591fa594a425352a9.tar.gz
Tango-f0bcdcdbfa78ba705b8fa44591fa594a425352a9.zip
Implemented TouchLoadingPanel
Diffstat (limited to 'Software/Visual_Studio/PPC')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs15
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml186
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs6
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs5
4 files changed, 111 insertions, 101 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs
index fabb57d10..3cbb44bbe 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs
@@ -53,6 +53,17 @@ namespace Tango.PPC.Jobs.ViewModels
}
}
+ private bool _isLoadingJobs;
+ /// <summary>
+ /// Gets or sets a value indicating whether this instance is loading jobs.
+ /// </summary>
+ public bool IsLoadingJobs
+ {
+ get { return _isLoadingJobs; }
+ set { _isLoadingJobs = value; RaisePropertyChangedAuto(); }
+ }
+
+
#endregion
#region Commands
@@ -139,6 +150,8 @@ namespace Tango.PPC.Jobs.ViewModels
{
Task.Factory.StartNew(() =>
{
+ IsLoadingJobs = true;
+
Thread.Sleep(500);
if (_jobsContext != null)
@@ -151,6 +164,8 @@ namespace Tango.PPC.Jobs.ViewModels
Jobs = _jobsContext.Jobs.Where(x => x.Machine.SerialNumber == Settings.MachineSerialNumber).ToObservableCollection();
JobsCollectionView = CollectionViewSource.GetDefaultView(Jobs);
JobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Descending));
+
+ IsLoadingJobs = false;
});
}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml
index 1686aef84..63e65f777 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml
@@ -23,7 +23,7 @@
<converters:JobToPieImageConverter x:Key="JobToPieImageConverter" />
<sharedConverters:DateTimeUTCToShortDateConverter x:Key="DateTimeUTCToShortDateConverter" />
<sharedConverters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" />
-
+
</UserControl.Resources>
<Grid Background="{StaticResource TangoMidBackgroundBrush}">
@@ -58,98 +58,100 @@
</touch:TouchNavigationLinks>
<Grid Grid.Row="1">
- <touch:LightTouchDataGrid x:Name="dataGridJobs" OnDragAndDropCommand="{Binding JobDragedDroppedCommand}" ItemsSource="{Binding JobsCollectionView}" ItemSelectedCommand="{Binding JobSelectedCommand}" Margin="10">
- <touch:LightTouchDataGrid.Columns>
- <touch:LightTouchDataGridColumn Width="50">
- <touch:LightTouchDataGridColumn.Header>
- <Image Source="../Images/warning.png" Width="24" />
- </touch:LightTouchDataGridColumn.Header>
- <touch:LightTouchDataGridColumn.CellTemplate>
- <DataTemplate>
- <Image Source="../Images/Job Issues/cyan.png" Width="38" />
- </DataTemplate>
- </touch:LightTouchDataGridColumn.CellTemplate>
- </touch:LightTouchDataGridColumn>
- <touch:LightTouchDataGridColumn Width="100" Header="Status" SortMember="JobStatus">
- <touch:LightTouchDataGridColumn.CellTemplate>
- <DataTemplate>
- <TextBlock IsHitTestVisible="False" Text="{Binding JobStatus,Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock>
- </DataTemplate>
- </touch:LightTouchDataGridColumn.CellTemplate>
- </touch:LightTouchDataGridColumn>
- <touch:LightTouchDataGridColumn Width="1*" Header="Name" SortMember="Name" HorizontalContentAlignment="Left">
- <touch:LightTouchDataGridColumn.CellTemplate>
- <DataTemplate>
- <TextBlock IsHitTestVisible="False" Text="{Binding Name}"></TextBlock>
- </DataTemplate>
- </touch:LightTouchDataGridColumn.CellTemplate>
- </touch:LightTouchDataGridColumn>
- <touch:LightTouchDataGridColumn Width="117" Header="Length (m)" SortMember="Length">
- <touch:LightTouchDataGridColumn.CellTemplate>
- <DataTemplate>
- <TextBlock IsHitTestVisible="False" Text="{Binding Length,StringFormat=0.0}"></TextBlock>
- </DataTemplate>
- </touch:LightTouchDataGridColumn.CellTemplate>
- </touch:LightTouchDataGridColumn>
- <touch:LightTouchDataGridColumn Header="Colors" SortMember="Segments.Count" Width="85">
- <touch:LightTouchDataGridColumn.CellTemplate>
- <DataTemplate>
- <Image Stretch="Fill" IsHitTestVisible="False" Source="{Binding Converter={StaticResource JobToPieImageConverter},ConverterParameter='25,25'}" Width="25" Height="25" HorizontalAlignment="Left"></Image>
- </DataTemplate>
- </touch:LightTouchDataGridColumn.CellTemplate>
- </touch:LightTouchDataGridColumn>
- <touch:LightTouchDataGridColumn Width="100" Header="Updated" SortMember="LastUpdated">
- <touch:LightTouchDataGridColumn.CellTemplate>
- <DataTemplate>
- <TextBlock IsHitTestVisible="False" Text="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateConverter}}"></TextBlock>
- </DataTemplate>
- </touch:LightTouchDataGridColumn.CellTemplate>
- </touch:LightTouchDataGridColumn>
- <touch:LightTouchDataGridColumn x:Name="userSortColumn" SortMember="JobIndex" SortDirection="{x:Null}" Width="78" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" DisplayChevron="False" ForcedSortDirection="Ascending">
- <touch:LightTouchDataGridColumn.HeaderTemplate>
- <DataTemplate>
- <Border CornerRadius="0 5 5 0" x:Name="userSortColumnBorder">
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="Background" Value="{StaticResource TangoMidAccentBrush}"></Setter>
- <Style.Triggers>
- <DataTrigger Binding="{Binding SortDirection}" Value="Ascending">
- <Setter Property="Background" Value="{StaticResource TangoLowAccentBrush}"></Setter>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
- <Grid>
- <Rectangle HorizontalAlignment="Left" StrokeThickness="2" Stroke="{StaticResource TangoColumnDividerBrush}" />
- <Image Source="/Images/arrows.png" Width="28" />
- </Grid>
- </Border>
- </DataTemplate>
- </touch:LightTouchDataGridColumn.HeaderTemplate>
- <touch:LightTouchDataGridColumn.CellTemplate>
- <DataTemplate>
- <dragAndDrop:DragThumb Background="Transparent" touchComponents:Ripple.PreventRipple="True" touchComponents:TransformationHelper.PreventTransform="True">
- <dragAndDrop:DragThumb.Style>
- <Style TargetType="dragAndDrop:DragThumb">
- <Setter Property="Visibility" Value="Collapsed"></Setter>
- <Style.Triggers>
- <DataTrigger Binding="{Binding Source={x:Reference userSortColumn},Path=SortDirection}" Value="Ascending">
- <Setter Property="Visibility" Value="Visible"></Setter>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </dragAndDrop:DragThumb.Style>
- <StackPanel Width="30" IsHitTestVisible="False" VerticalAlignment="Center">
- <Rectangle StrokeThickness="2" Stroke="{StaticResource TangoDarkForegroundBrush}" />
- <Rectangle StrokeThickness="2" Stroke="{StaticResource TangoDarkForegroundBrush}" Margin="0 5 0 0" />
- </StackPanel>
- </dragAndDrop:DragThumb>
- </DataTemplate>
- </touch:LightTouchDataGridColumn.CellTemplate>
- </touch:LightTouchDataGridColumn>
- </touch:LightTouchDataGrid.Columns>
- </touch:LightTouchDataGrid>
+ <touch:TouchLoadingPanel IsLoading="{Binding IsLoadingJobs}">
+ <touch:LightTouchDataGrid x:Name="dataGridJobs" OnDragAndDropCommand="{Binding JobDragedDroppedCommand}" ItemsSource="{Binding JobsCollectionView}" ItemSelectedCommand="{Binding JobSelectedCommand}" Margin="10">
+ <touch:LightTouchDataGrid.Columns>
+ <touch:LightTouchDataGridColumn Width="50">
+ <touch:LightTouchDataGridColumn.Header>
+ <Image Source="../Images/warning.png" Width="24" />
+ </touch:LightTouchDataGridColumn.Header>
+ <touch:LightTouchDataGridColumn.CellTemplate>
+ <DataTemplate>
+ <Image Source="../Images/Job Issues/cyan.png" Width="38" />
+ </DataTemplate>
+ </touch:LightTouchDataGridColumn.CellTemplate>
+ </touch:LightTouchDataGridColumn>
+ <touch:LightTouchDataGridColumn Width="100" Header="Status" SortMember="JobStatus">
+ <touch:LightTouchDataGridColumn.CellTemplate>
+ <DataTemplate>
+ <TextBlock IsHitTestVisible="False" Text="{Binding JobStatus,Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock>
+ </DataTemplate>
+ </touch:LightTouchDataGridColumn.CellTemplate>
+ </touch:LightTouchDataGridColumn>
+ <touch:LightTouchDataGridColumn Width="1*" Header="Name" SortMember="Name" HorizontalContentAlignment="Left">
+ <touch:LightTouchDataGridColumn.CellTemplate>
+ <DataTemplate>
+ <TextBlock IsHitTestVisible="False" Text="{Binding Name}"></TextBlock>
+ </DataTemplate>
+ </touch:LightTouchDataGridColumn.CellTemplate>
+ </touch:LightTouchDataGridColumn>
+ <touch:LightTouchDataGridColumn Width="117" Header="Length (m)" SortMember="Length">
+ <touch:LightTouchDataGridColumn.CellTemplate>
+ <DataTemplate>
+ <TextBlock IsHitTestVisible="False" Text="{Binding Length,StringFormat=0.0}"></TextBlock>
+ </DataTemplate>
+ </touch:LightTouchDataGridColumn.CellTemplate>
+ </touch:LightTouchDataGridColumn>
+ <touch:LightTouchDataGridColumn Header="Colors" SortMember="Segments.Count" Width="85">
+ <touch:LightTouchDataGridColumn.CellTemplate>
+ <DataTemplate>
+ <Image Stretch="Fill" IsHitTestVisible="False" Source="{Binding Converter={StaticResource JobToPieImageConverter},ConverterParameter='25,25'}" Width="25" Height="25" HorizontalAlignment="Left"></Image>
+ </DataTemplate>
+ </touch:LightTouchDataGridColumn.CellTemplate>
+ </touch:LightTouchDataGridColumn>
+ <touch:LightTouchDataGridColumn Width="100" Header="Updated" SortMember="LastUpdated">
+ <touch:LightTouchDataGridColumn.CellTemplate>
+ <DataTemplate>
+ <TextBlock IsHitTestVisible="False" Text="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateConverter}}"></TextBlock>
+ </DataTemplate>
+ </touch:LightTouchDataGridColumn.CellTemplate>
+ </touch:LightTouchDataGridColumn>
+ <touch:LightTouchDataGridColumn x:Name="userSortColumn" SortMember="JobIndex" SortDirection="{x:Null}" Width="78" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" DisplayChevron="False" ForcedSortDirection="Ascending">
+ <touch:LightTouchDataGridColumn.HeaderTemplate>
+ <DataTemplate>
+ <Border CornerRadius="0 5 5 0" x:Name="userSortColumnBorder">
+ <Border.Style>
+ <Style TargetType="Border">
+ <Setter Property="Background" Value="{StaticResource TangoMidAccentBrush}"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding SortDirection}" Value="Ascending">
+ <Setter Property="Background" Value="{StaticResource TangoLowAccentBrush}"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <Grid>
+ <Rectangle HorizontalAlignment="Left" StrokeThickness="2" Stroke="{StaticResource TangoColumnDividerBrush}" />
+ <Image Source="/Images/arrows.png" Width="28" />
+ </Grid>
+ </Border>
+ </DataTemplate>
+ </touch:LightTouchDataGridColumn.HeaderTemplate>
+ <touch:LightTouchDataGridColumn.CellTemplate>
+ <DataTemplate>
+ <dragAndDrop:DragThumb Background="Transparent" touchComponents:Ripple.PreventRipple="True" touchComponents:TransformationHelper.PreventTransform="True">
+ <dragAndDrop:DragThumb.Style>
+ <Style TargetType="dragAndDrop:DragThumb">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Source={x:Reference userSortColumn},Path=SortDirection}" Value="Ascending">
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </dragAndDrop:DragThumb.Style>
+ <StackPanel Width="30" IsHitTestVisible="False" VerticalAlignment="Center">
+ <Rectangle StrokeThickness="2" Stroke="{StaticResource TangoDarkForegroundBrush}" />
+ <Rectangle StrokeThickness="2" Stroke="{StaticResource TangoDarkForegroundBrush}" Margin="0 5 0 0" />
+ </StackPanel>
+ </dragAndDrop:DragThumb>
+ </DataTemplate>
+ </touch:LightTouchDataGridColumn.CellTemplate>
+ </touch:LightTouchDataGridColumn>
+ </touch:LightTouchDataGrid.Columns>
+ </touch:LightTouchDataGrid>
+ </touch:TouchLoadingPanel>
<TextBox VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="100" Width="200" keyboard:KeyboardView.Mode="Alpha"></TextBox>
</Grid>
</Grid>
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 233751ddb..554bd704c 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs
@@ -128,10 +128,8 @@ namespace Tango.PPC.UI.PPCApplication
var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); ;
- using (ObservablesContext db = ObservablesContext.CreateDefault())
- {
- Machine = db.Machines.SingleOrDefault(x => x.SerialNumber == settings.MachineSerialNumber);
- }
+ ObservablesEntitiesAdapter.Instance.Initialize();
+ Machine = ObservablesEntitiesAdapter.Instance.Machines.FirstOrDefault();
});
ApplicationStarted?.Invoke(this, new EventArgs());
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs
index f6b06ca61..5bc02f829 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs
@@ -36,11 +36,6 @@ namespace Tango.PPC.UI.ViewModels
/// </summary>
public async override void OnApplicationStarted()
{
- await Task.Factory.StartNew(() =>
- {
- ObservablesEntitiesAdapter.Instance.Initialize();
- });
-
ApplicationManager.ModulesInitialized += (_, __) =>
{
NavigationManager.NavigateTo(NavigationView.HomeModule);