aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2020-05-26 17:03:25 +0300
committerAvi Levkovich <avi@twine-s.com>2020-05-26 17:03:25 +0300
commitfd326204404ee0932ea465efcdd41e21fd7f2b49 (patch)
treeffb38ac74dc86490a8581539cba7094452cb6ed6 /Software/Visual_Studio/PPC
parentf0fc1abe6628c903d2e58dcd1b1a88ef43d45057 (diff)
parent7102ed21905bc52c6aee506e919992ce1f98f641 (diff)
downloadTango-fd326204404ee0932ea465efcdd41e21fd7f2b49.tar.gz
Tango-fd326204404ee0932ea465efcdd41e21fd7f2b49.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportJobView.xaml2
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs17
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs111
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/cone-empty.pngbin2174 -> 4125 bytes
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/cone-full.pngbin1752 -> 3018 bytes
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj8
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs16
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml14
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Models/StorageNavigationIntent.cs4
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs41
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml67
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs3
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs2
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarItem.cs10
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarPriority.cs15
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs10
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Storage/DefaultStorageProvider.cs23
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Storage/IStorageProvider.cs6
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj3
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItem.cs31
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItemView.xaml30
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItemView.xaml.cs28
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs38
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj10
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs12
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs42
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml17
27 files changed, 449 insertions, 111 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportJobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportJobView.xaml
index ac27cc00d..da51bba27 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportJobView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportJobView.xaml
@@ -18,7 +18,7 @@
<TextBlock HorizontalAlignment="Center" Margin="0 20 0 0" FontSize="{StaticResource TangoHeaderFontSize}">IMPORT JOB</TextBlock>
<TextBlock Margin="20 10" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center">A job file has been selected from the storage device. press 'IMPORT' to add the job to your job list.</TextBlock>
- <touch:TouchCheckBox IsChecked="{Binding ImportAndEdit}" Margin="40 50 0 0">Edit this job after import</touch:TouchCheckBox>
+ <touch:TouchCheckBox IsChecked="{Binding ImportAndEdit}" Margin="40 50 0 0" Visibility="Collapsed">Edit this job after import</touch:TouchCheckBox>
</StackPanel>
</DockPanel>
</Grid>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs
index 03cd5bfff..b4a30cb39 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs
@@ -9,6 +9,7 @@ using Tango.Integration.Operation;
using Tango.PMR.Printing;
using Tango.PPC.Common;
using Tango.PPC.Common.Navigation;
+using Tango.PPC.Common.Notifications;
using Tango.PPC.Jobs.AppBarItems;
using Tango.PPC.Jobs.AppButtons;
using Tango.PPC.Jobs.Dialogs;
@@ -25,6 +26,7 @@ namespace Tango.PPC.Jobs.ViewModels
{
private StopPrintingButton _stop_job_btn;
private JobHandler _handler;
+ private JobProgressAppBarItem _appBarItem;
#region Properties
@@ -142,9 +144,10 @@ namespace Tango.PPC.Jobs.ViewModels
if (MachineProvider.MachineOperator.IsPrinting && _handler != null && !_handler.IsCanceled)
{
- NotificationProvider.PushAppBarItem<JobProgressAppBarItem>().Pressed += (_, __) =>
+ _appBarItem = NotificationProvider.PushAppBarItem<JobProgressAppBarItem>();
+ _appBarItem.Pressed += (_, __) =>
{
- NotificationProvider.CurrentAppBarItem.Close();
+ _appBarItem?.Close();
NavigationManager.NavigateTo<JobsModule>(nameof(JobProgressView));
};
}
@@ -159,10 +162,7 @@ namespace Tango.PPC.Jobs.ViewModels
IsDisplayJobOutline = false;
- if (NotificationProvider.HasAppBarItem && NotificationProvider.CurrentAppBarItem is JobProgressAppBarItem)
- {
- NotificationProvider.CurrentAppBarItem.Close();
- }
+ _appBarItem?.Close();
if (_handler != null && !_handler.Status.IsFailed)
{
@@ -232,10 +232,7 @@ namespace Tango.PPC.Jobs.ViewModels
_stop_job_btn.Pop();
}
- if (NotificationProvider.HasAppBarItem && NotificationProvider.CurrentAppBarItem is JobProgressAppBarItem)
- {
- NotificationProvider.CurrentAppBarItem.Close();
- }
+ _appBarItem?.Close();
if (_handler != null)
{
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 f9029ed8c..c41a9ef5d 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
@@ -38,6 +38,7 @@ using Tango.PPC.Jobs.ViewContracts;
using Tango.Core.ExtensionMethods;
using Tango.PPC.Common.Synchronization;
using Tango.PPC.Jobs.NotificationItems;
+using Tango.PPC.Storage.Models;
namespace Tango.PPC.Jobs.ViewModels
{
@@ -763,37 +764,64 @@ namespace Tango.PPC.Jobs.ViewModels
var selected_job = SelectedJobs.FirstOrDefault();
if (selected_job == null) return;
+ var selectedJobs = SelectedJobs.ToList();
+
ClearSelection();
var result = await NavigationManager.
NavigateForResult<StorageModule,
Storage.Views.MainView, ExplorerFileItem,
- Storage.Models.StorageNavigationRequest>(
- new Storage.Models.StorageNavigationRequest()
+ StorageNavigationRequest>(
+ new StorageNavigationRequest()
{
- Intent = Storage.Models.StorageNavigationIntent.SaveFile,
+ Intent = selectedJobs.Count == 1 ? StorageNavigationIntent.SaveFile : StorageNavigationIntent.SaveFiles,
DefaultFileName = selected_job.Name,
Filter = ExplorerFileDefinition.Job.Extension,
- Title = "Save Job File",
+ Title = selectedJobs.Count == 1 ? "Save Job File" : "Save Job Files",
});
if (result != null)
{
- try
+ if (selectedJobs.Count == 1)
{
- var jobFile = await selected_job.ToJobFile();
+ try
+ {
+ var jobFile = await selected_job.ToJobFile();
- using (FileStream fs = new FileStream(result.Path + ExplorerFileDefinition.Job.Extension, FileMode.Create))
+ using (FileStream fs = new FileStream(result.Path + ExplorerFileDefinition.Job.Extension, FileMode.Create))
+ {
+ jobFile.WriteTo(fs);
+ }
+
+ await NotificationProvider.ShowSuccess("Job saved successfully.");
+ }
+ catch (Exception ex)
{
- jobFile.WriteTo(fs);
+ LogManager.Log(ex, $"Error saving job {selected_job.Name} to file.");
+ await NotificationProvider.ShowError($"An error occurred while trying to save the job.\n{ex.Message}");
}
-
- await NotificationProvider.ShowSuccess("Job saved successfully.");
}
- catch (Exception ex)
+ else
{
- LogManager.Log(ex, $"Error saving job {selected_job.Name} to file.");
- await NotificationProvider.ShowError($"An error occurred while trying to save the job.\n{ex.Message}");
+ foreach (var job in selectedJobs)
+ {
+ try
+ {
+ var jobFile = await job.ToJobFile();
+
+ using (FileStream fs = new FileStream(Path.Combine(result.Path, jobFile.Name) + ExplorerFileDefinition.Job.Extension, FileMode.Create))
+ {
+ jobFile.WriteTo(fs);
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, $"Error saving job {job.Name} to file.");
+ await NotificationProvider.ShowError($"An error occurred while trying to save the job.\n{ex.Message}");
+ }
+ }
+
+ await NotificationProvider.ShowSuccess("Jobs saved successfully.");
}
}
}
@@ -802,7 +830,7 @@ namespace Tango.PPC.Jobs.ViewModels
#region Handle Job File Loading From Storage
- private async void HandleJobFileLoaded(ExplorerFileItem jobFile)
+ private async void HandleJobFileLoaded(List<ExplorerFileItem> jobFiles)
{
var vm = await NotificationProvider.ShowDialog<ImportJobViewVM>();
@@ -810,30 +838,35 @@ namespace Tango.PPC.Jobs.ViewModels
{
using (ObservablesContext jobContext = ObservablesContext.CreateDefault())
{
- try
+ foreach (var jobFile in jobFiles)
{
- JobFile jFile = JobFile.Parser.ParseFrom(File.ReadAllBytes(jobFile.Path));
- var job = await Job.FromJobFile(jFile, MachineProvider.Machine.Guid, AuthenticationProvider.CurrentUser.Guid);
- job.JobSource = JobSource.Local;
- jobContext.Jobs.Add(job);
- await jobContext.SaveChangesAsync();
- LoadJobs(() =>
+ try
{
- if (vm.ImportAndEdit)
- {
- var postJob = Jobs.SingleOrDefault(x => x.Guid == job.Guid);
- if (postJob != null)
- {
- SelectJob(postJob, true);
- }
- }
- });
+ JobFile jFile = JobFile.Parser.ParseFrom(File.ReadAllBytes(jobFile.Path));
+ var job = await Job.FromJobFile(jFile, MachineProvider.Machine.Guid, AuthenticationProvider.CurrentUser.Guid);
+ job.JobSource = JobSource.Local;
+ jobContext.Jobs.Add(job);
+ await jobContext.SaveChangesAsync();
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, $"Error occurred while trying to import job from file {jobFile.Path}.");
+ await NotificationProvider.ShowError($"An error occurred while trying to import the selected job file.\n{ex.Message}");
+ }
}
- catch (Exception ex)
+
+ LoadJobs(() =>
{
- LogManager.Log(ex, $"Error occurred while trying to import job from file {jobFile.Path}.");
- await NotificationProvider.ShowError($"An error occurred while trying to import the selected job file.\n{ex.Message}");
- }
+ //Editing of a job is currently deprecated due to enabling multiple job imports.
+ //if (vm.ImportAndEdit)
+ //{
+ // var postJob = Jobs.SingleOrDefault(x => x.Guid == job.Guid);
+ // if (postJob != null)
+ // {
+ // SelectJob(postJob, true);
+ // }
+ //}
+ });
}
}
}
@@ -842,8 +875,10 @@ namespace Tango.PPC.Jobs.ViewModels
#region Handle TCC File Loading From Storage
- private async void HandleColorProfileFileLoaded(ExplorerFileItem tccFile)
+ private async void HandleColorProfileFileLoaded(List<ExplorerFileItem> tccFiles)
{
+ var tccFile = tccFiles.FirstOrDefault();
+
try
{
DetectionColorFile tcc = DetectionColorFile.Parser.ParseFrom(File.ReadAllBytes(tccFile.Path));
@@ -872,8 +907,10 @@ namespace Tango.PPC.Jobs.ViewModels
#region Handle Pulse TWN Loading From Storage
- private async void HandlePulseFileLoaded(ExplorerFileItem twnFile)
+ private async void HandlePulseFileLoaded(List<ExplorerFileItem> twnFiles)
{
+ var twnFile = twnFiles.FirstOrDefault();
+
TwnFile twn = TwnFile.FromFile(twnFile.Path);
BitmapSource preview = twn.Thumbnail.ToBitmapSource();
@@ -907,7 +944,7 @@ namespace Tango.PPC.Jobs.ViewModels
NotificationProvider.ShowSuccess("Your job list is now synchronized.");
});
};
- item.Closed += (_, __) =>
+ item.Closed += (_, __) =>
{
_isJobsSynchronizationNotificationActive = false;
};
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/cone-empty.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/cone-empty.png
index d65b8f793..17c3225ed 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/cone-empty.png
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/cone-empty.png
Binary files differ
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/cone-full.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/cone-full.png
index c42abf56e..b4ed45d1e 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/cone-full.png
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Images/cone-full.png
Binary files differ
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj
index 94dcf8247..7e5c52725 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj
@@ -281,17 +281,19 @@
</ItemGroup>
<ItemGroup>
<Resource Include="Images\cl-full.png" />
- <Resource Include="Images\cone-empty.png" />
- <Resource Include="Images\cone-full.png" />
<Resource Include="Images\l-full.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\head_cleaning.png" />
</ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\cone-empty.png" />
+ <Resource Include="Images\cone-full.png" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
+ <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs
index 4bd63e9a6..f613d6f43 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs
@@ -56,6 +56,21 @@ namespace Tango.PPC.Maintenance.ViewModels
set { _totalDyeMeters = value; RaisePropertyChangedAuto(); }
}
+ private SpoolState _spoolState;
+ public SpoolState SpoolState
+ {
+ get { return _spoolState; }
+ set
+ {
+ if (_spoolState != value)
+ {
+ _spoolState = value;
+ RaisePropertyChangedAuto();
+ }
+ }
+ }
+
+
public RelayCommand ExportLogsCommand { get; set; }
public OpenCloseDyeingHeadCommand OpenCloseDyeingHeadCommand { get; set; }
@@ -105,6 +120,7 @@ namespace Tango.PPC.Maintenance.ViewModels
{
UpdateMidTankLevels(status);
OverallTemperature.Temperature = status.OverallTemperature;
+ SpoolState = status.SpoolState;
InvalidateRelayCommands();
}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml
index f49bdebe4..acbda9daa 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml
@@ -155,10 +155,22 @@
</ItemsControl>
</Grid>
- <!--<Image Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center" Source="../Images/cone-full.png" Margin="30"></Image>-->
+ <Image Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="15" RenderOptions.BitmapScalingMode="Fant">
+ <Image.Style>
+ <Style TargetType="Image">
+ <Setter Property="Source" Value="../Images/cone-empty.png"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding SpoolState}" Value="Present">
+ <Setter Property="Source" Value="../Images/cone-full.png"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Image.Style>
+ </Image>
<TextBlock Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Temperature</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Inks</TextBlock>
+ <TextBlock Grid.Column="2" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Cone</TextBlock>
</Grid>
</StackPanel>
</StackPanel>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Models/StorageNavigationIntent.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Models/StorageNavigationIntent.cs
index 2c2a7f10d..3ec14cc6f 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Models/StorageNavigationIntent.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Models/StorageNavigationIntent.cs
@@ -9,6 +9,8 @@ namespace Tango.PPC.Storage.Models
public enum StorageNavigationIntent
{
LoadFile,
- SaveFile
+ LoadFiles,
+ SaveFile,
+ SaveFiles
}
}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs
index 8c166379e..b9d59334c 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -70,16 +71,21 @@ namespace Tango.PPC.Storage.ViewModels
set { _displayItems = value; RaisePropertyChangedAuto(); }
}
-
public RelayCommand<ExplorerFileItem> FileSelectedCommand { get; set; }
+ public ObservableCollection<ExplorerFileItem> SelectedItems { get; set; }
+
public RelayCommand SaveCommand { get; set; }
+ public RelayCommand OpenCommand { get; set; }
+
public MainViewVM()
{
+ SelectedItems = new ObservableCollection<ExplorerFileItem>();
FileSelectedCommand = new RelayCommand<ExplorerFileItem>(OnFileSelected);
- SaveCommand = new RelayCommand(OnSaveCommand, (x) => !String.IsNullOrWhiteSpace(FileName));
- Request = new StorageNavigationRequest();
+ SaveCommand = new RelayCommand(OnSaveCommand, (x) => !String.IsNullOrWhiteSpace(FileName) || Request.Intent == StorageNavigationIntent.SaveFiles);
+ Request = new StorageNavigationRequest() { Intent = StorageNavigationIntent.LoadFiles };
+ OpenCommand = new RelayCommand(OnOpenCommand, () => Request.Intent == StorageNavigationIntent.LoadFiles);
}
public override void OnApplicationStarted()
@@ -128,7 +134,7 @@ namespace Tango.PPC.Storage.ViewModels
base.OnNavigatedFrom();
DisplayItems = false;
Request = null;
- Request = new StorageNavigationRequest();
+ Request = new StorageNavigationRequest() { Intent = StorageNavigationIntent.LoadFiles };
}
/// <summary>
@@ -184,7 +190,14 @@ namespace Tango.PPC.Storage.ViewModels
_selectedItem = fileItem;
_allow_exit = true;
await NavigationManager.NavigateBack();
- StorageProvider.SubmitFileSelection(fileItem);
+ StorageProvider.SubmitFileSelection(new List<ExplorerFileItem>() { fileItem });
+ }
+
+ private async void OnOpenCommand()
+ {
+ _allow_exit = true;
+ await NavigationManager.NavigateBack();
+ StorageProvider.SubmitFileSelection(SelectedItems.ToList());
}
public ExplorerFileItem GetNavigationResult()
@@ -200,10 +213,22 @@ namespace Tango.PPC.Storage.ViewModels
private void OnSaveCommand()
{
_allow_exit = true;
- _selectedItem = new ExplorerFileItem()
+
+ if (Request.Intent == StorageNavigationIntent.SaveFile)
+ {
+ _selectedItem = new ExplorerFileItem()
+ {
+ Path = CurrentPath + "\\" + FileName,
+ };
+ }
+ else if (Request.Intent == StorageNavigationIntent.SaveFiles)
{
- Path = CurrentPath + "\\" + FileName,
- };
+ _selectedItem = new ExplorerFileItem()
+ {
+ Path = CurrentPath,
+ };
+ }
+
NavigationManager.NavigateBack();
}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml
index 25538a525..e8d402d89 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml
@@ -16,7 +16,7 @@
<UserControl.InputBindings>
<KeyBinding Key="Return" Command="{Binding SaveCommand}"></KeyBinding>
</UserControl.InputBindings>
-
+
<Grid>
<Grid Background="{StaticResource TangoMidBackgroundBrush}">
<Grid.RowDefinitions>
@@ -32,8 +32,54 @@
</Border>
<Grid Margin="10" Grid.Row="1">
<DockPanel>
-
- <Grid DockPanel.Dock="Top" Visibility="{Binding Request.Intent,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter=SaveFile}">
+ <Grid DockPanel.Dock="Top">
+ <Grid.Style>
+ <Style TargetType="Grid">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <MultiDataTrigger>
+ <MultiDataTrigger.Conditions>
+ <Condition Binding="{Binding Request.Intent}" Value="LoadFiles" />
+ <Condition Binding="{Binding ElementName=explorer,Path=IsMultiSelecting}" Value="True" />
+ </MultiDataTrigger.Conditions>
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </MultiDataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Grid.Style>
+ <Border BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}" Padding="20">
+ <StackPanel>
+ <DockPanel Margin="0 0 0 0">
+ <touch:TouchButton Command="{Binding OpenCommand}" Margin="20 0 0 0" Height="55" Width="200" Style="{StaticResource TangoHollowButton}" CornerRadius="25" DockPanel.Dock="Right">
+ <touch:TouchButton.Content>
+ OPEN
+ </touch:TouchButton.Content>
+ </touch:TouchButton>
+ <Grid>
+ <TextBlock VerticalAlignment="Center" Foreground="{StaticResource TangoGrayTextBrush}">
+ <Run Text="{Binding SelectedItems.Count,Mode=OneWay}"></Run>
+ <Run>files selected</Run>
+ </TextBlock>
+ </Grid>
+ </DockPanel>
+ </StackPanel>
+ </Border>
+ </Grid>
+
+ <Grid DockPanel.Dock="Top">
+ <Grid.Style>
+ <Style TargetType="Grid">
+ <Setter Property="Visibility" Value="Collapsed"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Request.Intent}" Value="SaveFile">
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Request.Intent}" Value="SaveFiles">
+ <Setter Property="Visibility" Value="Visible"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Grid.Style>
<Border BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}" Padding="20">
<StackPanel>
<TextBlock Text="{Binding Request.Title}" FontSize="{StaticResource TangoHeaderFontSize}"></TextBlock>
@@ -43,20 +89,31 @@
SAVE
</touch:TouchButton.Content>
</touch:TouchButton>
- <touch:TouchTextBox x:Name="txtFileName" KeyboardAction="Go" FocusSelectionMode="SelectAll" VerticalAlignment="Bottom" Text="{Binding FileName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
+ <Grid>
+ <touch:TouchTextBox x:Name="txtFileName" Visibility="{Binding Request.Intent,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter=SaveFile}" KeyboardAction="Go" FocusSelectionMode="SelectAll" VerticalAlignment="Bottom" Text="{Binding FileName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" />
+ <TextBlock VerticalAlignment="Center" Foreground="{StaticResource TangoGrayTextBrush}" Visibility="{Binding Request.Intent,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter=SaveFiles}">Select destination folder</TextBlock>
+ </Grid>
</DockPanel>
</StackPanel>
</Border>
</Grid>
- <explorer:ExplorerControl x:Name="explorer" CurrentPath="{Binding CurrentPath,Mode=TwoWay}" FileSelectedCommand="{Binding FileSelectedCommand}" Filter="{Binding Request.Filter}" Visibility="{Binding DisplayItems,Converter={StaticResource BooleanToVisibilityConverter}}">
+ <explorer:ExplorerControl x:Name="explorer" CurrentPath="{Binding CurrentPath,Mode=TwoWay}" SelectedItems="{Binding SelectedItems}" FileSelectedCommand="{Binding FileSelectedCommand}" Filter="{Binding Request.Filter}" Visibility="{Binding DisplayItems,Converter={StaticResource BooleanToVisibilityConverter}}">
<explorer:ExplorerControl.Style>
<Style TargetType="explorer:ExplorerControl" BasedOn="{StaticResource {x:Type explorer:ExplorerControl}}">
<Setter Property="EnableFileSelection" Value="True"></Setter>
+ <Setter Property="EnableMultiSelect" Value="False"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding Request.Intent}" Value="SaveFile">
<Setter Property="EnableFileSelection" Value="False"></Setter>
</DataTrigger>
+ <DataTrigger Binding="{Binding Request.Intent}" Value="LoadFiles">
+ <Setter Property="EnableFileSelection" Value="True"></Setter>
+ <Setter Property="EnableMultiSelect" Value="True"></Setter>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Request.Intent}" Value="LoadFile">
+ <Setter Property="EnableFileSelection" Value="False"></Setter>
+ </DataTrigger>
</Style.Triggers>
</Style>
</explorer:ExplorerControl.Style>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs
index 9fe6d24bd..84190d373 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs
@@ -100,10 +100,11 @@ namespace Tango.PPC.Common.Connection
MachineOperator = new MachineOperator();
MachineOperator.StatusChanged += MachineOperator_StatusChanged;
MachineOperator.EnableEventsNotification = true;
- MachineOperator.EnableJobResume = true;
+ MachineOperator.EnableJobResume = false;
MachineOperator.UseKeepAlive = true;
MachineOperator.EnableMachineStatusUpdates = true;
MachineOperator.EnableDiagnostics = true;
+ MachineOperator.EnablePowerUpSequence = true;
MachineOperator.EnableEmbeddedDebugging = settings.EnableEmbeddedDebugLogs;
MachineOperator.EnableAutomaticThreadLoading = settings.EnableAutomaticThreadLoading;
MachineOperator.JobRunsLogger.JobSource = BL.Enumerations.JobSource.Local;
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
index ae77c26d0..29bffb945 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs
@@ -973,7 +973,7 @@ namespace Tango.PPC.Common.MachineUpdate
if (!_machineProvider.MachineOperator.CanPrint)
{
- throw LogManager.Log(new InvalidOperationException($"Could not perform an update while the machine is in {_machineProvider.MachineOperator} status."));
+ throw LogManager.Log(new InvalidOperationException($"Could not perform an update while the machine is in {_machineProvider.MachineOperator.Status} status."));
}
UpdateProgress("Updating Database", "Initializing...");
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarItem.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarItem.cs
index 1c47d2a97..fdd66a56b 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarItem.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarItem.cs
@@ -13,6 +13,16 @@ namespace Tango.PPC.Common.Notifications
/// </summary>
public abstract class AppBarItem : ItemBase
{
+ private AppBarPriority _priority;
+ public AppBarPriority Priority
+ {
+ get { return _priority; }
+ set { _priority = value; RaisePropertyChangedAuto(); }
+ }
+ public AppBarItem()
+ {
+ Priority = AppBarPriority.Normal;
+ }
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarPriority.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarPriority.cs
new file mode 100644
index 000000000..bd8547f5d
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarPriority.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.PPC.Common.Notifications
+{
+ public enum AppBarPriority
+ {
+ Low,
+ Normal,
+ High
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs
index 4a0627d70..950b8d23f 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs
@@ -34,14 +34,14 @@ namespace Tango.PPC.Common.Notifications
ObservableCollection<TaskBarItem> TaskBarItems { get; }
/// <summary>
- /// Gets the current application bar item.
+ /// Gets the application bar items.
/// </summary>
- AppBarItem CurrentAppBarItem { get; }
+ ObservableCollection<AppBarItem> AppBarItems { get; }
/// <summary>
- /// Gets a value indicating whether this instance has application bar item.
+ /// Gets a value indicating whether this instance has any application bar items.
/// </summary>
- bool HasAppBarItem { get; }
+ bool HasAppBarItems { get; }
/// <summary>
/// Gets a value indicating whether this instance has notification items.
@@ -182,7 +182,7 @@ namespace Tango.PPC.Common.Notifications
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
- AppBarItem PushAppBarItem<T>() where T : AppBarItem;
+ T PushAppBarItem<T>() where T : AppBarItem;
/// <summary>
/// Pops the application bar item.
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Storage/DefaultStorageProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Storage/DefaultStorageProvider.cs
index 46315e4b8..5f097d303 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Storage/DefaultStorageProvider.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Storage/DefaultStorageProvider.cs
@@ -21,7 +21,7 @@ namespace Tango.PPC.Common.Storage
public class DefaultStorageProvider : ExtendedObject, IStorageProvider
{
private Thread _scanThread;
- private Dictionary<String, Action<ExplorerFileItem>> _fileHandlers;
+ private Dictionary<String, Action<List<ExplorerFileItem>>> _fileHandlers;
/// <summary>
/// Occurs when a new storage drive has been inserted.
@@ -58,7 +58,7 @@ namespace Tango.PPC.Common.Storage
/// </summary>
public DefaultStorageProvider(IPPCApplicationManager applicationManager)
{
- _fileHandlers = new Dictionary<string, Action<ExplorerFileItem>>();
+ _fileHandlers = new Dictionary<string, Action<List<ExplorerFileItem>>>();
var drives = DriveInfo.GetDrives().Where(x => x.DriveType == DriveType.Removable).ToList();
if (drives.Count > 0)
@@ -86,7 +86,7 @@ namespace Tango.PPC.Common.Storage
/// <param name="extension">The file extension.</param>
/// <param name="handler">The handler.</param>
/// <exception cref="System.InvalidOperationException">Cannot register multiple file handlers for the same extension.</exception>
- public void RegisterFileHandler(string extension, Action<ExplorerFileItem> handler)
+ public void RegisterFileHandler(string extension, Action<List<ExplorerFileItem>> handler)
{
if (_fileHandlers.ContainsKey(extension))
{
@@ -99,7 +99,7 @@ namespace Tango.PPC.Common.Storage
/// Unregisters the file handler.
/// </summary>
/// <param name="handler">The handler.</param>
- public void UnregisterFileHandler(Action<ExplorerFileItem> handler)
+ public void UnregisterFileHandler(Action<List<ExplorerFileItem>> handler)
{
var h = _fileHandlers.SingleOrDefault(x => x.Value == handler);
@@ -112,14 +112,17 @@ namespace Tango.PPC.Common.Storage
/// <summary>
/// Submits a file selection.
/// </summary>
- /// <param name="fileItem">The file item.</param>
- public void SubmitFileSelection(ExplorerFileItem fileItem)
+ /// <param name="fileItems">The file item.</param>
+ public void SubmitFileSelection(List<ExplorerFileItem> fileItems)
{
- String extension = Path.GetExtension(fileItem.Path);
-
- if (_fileHandlers.ContainsKey(extension))
+ if (fileItems != null && fileItems.Count > 0)
{
- _fileHandlers[extension].Invoke(fileItem);
+ String extension = Path.GetExtension(fileItems.First().Path);
+
+ if (_fileHandlers.ContainsKey(extension))
+ {
+ _fileHandlers[extension].Invoke(fileItems);
+ }
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Storage/IStorageProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Storage/IStorageProvider.cs
index 902021002..2a9cf4e90 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Storage/IStorageProvider.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Storage/IStorageProvider.cs
@@ -38,18 +38,18 @@ namespace Tango.PPC.Common.Storage
/// </summary>
/// <param name="extension">The file extension.</param>
/// <param name="handler">The handler.</param>
- void RegisterFileHandler(String extension, Action<ExplorerFileItem> handler);
+ void RegisterFileHandler(String extension, Action<List<ExplorerFileItem>> handler);
/// <summary>
/// Unregisters the file handler.
/// </summary>
/// <param name="handler">The handler.</param>
- void UnregisterFileHandler(Action<ExplorerFileItem> handler);
+ void UnregisterFileHandler(Action<List<ExplorerFileItem>> handler);
/// <summary>
/// Submits a file selection.
/// </summary>
/// <param name="fileItem">The file item.</param>
- void SubmitFileSelection(ExplorerFileItem fileItem);
+ void SubmitFileSelection(List<ExplorerFileItem> fileItems);
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj
index 9bdba2c63..14c1a54ff 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj
@@ -168,6 +168,7 @@
<Compile Include="MachineSetup\MachineSetupManager.cs" />
<Compile Include="MachineSetup\MachineSetupProgress.cs" />
<Compile Include="MachineSetup\MachineSetupResult.cs" />
+ <Compile Include="Notifications\AppBarPriority.cs" />
<Compile Include="Performance\DefaultPerformanceService.cs" />
<Compile Include="Performance\IPerformanceService.cs" />
<Compile Include="RemoteDesktop\DefaultRemoteDesktopService.cs" />
@@ -462,7 +463,7 @@
</Target>
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItem.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItem.cs
new file mode 100644
index 000000000..966e78769
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItem.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.PMR.Power;
+using Tango.PPC.Common.Notifications;
+
+namespace Tango.PPC.UI.AppBarItems
+{
+ public class PowerUpAppBarItem : AppBarItem
+ {
+ private StartPowerUpResponse _status;
+ public StartPowerUpResponse Status
+ {
+ get { return _status; }
+ set { _status = value; RaisePropertyChangedAuto(); }
+ }
+
+ /// <summary>
+ /// Gets or sets the view type.
+ /// </summary>
+ public override Type ViewType
+ {
+ get
+ {
+ return typeof(PowerUpAppBarItemView);
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItemView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItemView.xaml
new file mode 100644
index 000000000..b6b769c69
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItemView.xaml
@@ -0,0 +1,30 @@
+<UserControl x:Class="Tango.PPC.UI.AppBarItems.PowerUpAppBarItemView"
+ 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch"
+ xmlns:local="clr-namespace:Tango.PPC.UI.AppBarItems"
+ mc:Ignorable="d"
+ d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=local:PowerUpAppBarItem, IsDesignTimeCreatable=False}">
+ <Grid>
+ <touch:TouchButton Style="{StaticResource TangoFlatButton}" Command="{Binding PressedCommand}" Padding="0">
+ <StackPanel VerticalAlignment="Center">
+ <TextBlock Text="{Binding Status.Message}" FontSize="{StaticResource TangoDefaultFontSize}" TextTrimming="CharacterEllipsis"></TextBlock>
+ <ProgressBar Maximum="100" Value="{Binding Status.ProgressPercentage}" Margin="0 10 0 5" Background="{StaticResource TangoGrayBrush}" Height="5" Foreground="{StaticResource TangoPrimaryAccentBrush}" BorderThickness="0" />
+ <DockPanel LastChildFill="False">
+ <TextBlock DockPanel.Dock="Left">
+
+ <Run Text="{Binding Status.ProgressPercentage}"></Run><Run>%</Run>
+ <Run>Completed</Run>
+ </TextBlock>
+
+ <!--<TextBlock DockPanel.Dock="Right">
+ <Run Text="{Binding MachineProvider.MachineOperator.RunningJobStatus.RemainingTime,Converter={StaticResource TimeSpanToTwoDigitsTimeConverter},FallbackValue=5}"></Run>
+ <Run FontSize="16" Text="{Binding MachineProvider.MachineOperator.RunningJobStatus.RemainingTime,Converter={StaticResource TimeSpanToLabelConverter},FallbackValue=min}"></Run>
+ </TextBlock>-->
+ </DockPanel>
+ </StackPanel>
+ </touch:TouchButton>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItemView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItemView.xaml.cs
new file mode 100644
index 000000000..599f24d3b
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItemView.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.UI.AppBarItems
+{
+ /// <summary>
+ /// Interaction logic for PowerOffAppBarItemView.xaml
+ /// </summary>
+ public partial class PowerUpAppBarItemView : UserControl
+ {
+ public PowerUpAppBarItemView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs
index 3b1e1e2f5..e9de2538e 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs
@@ -49,6 +49,11 @@ namespace Tango.PPC.UI.Notifications
public ObservableCollection<NotificationItem> NotificationItems { get; private set; }
/// <summary>
+ /// Gets the application bar items.
+ /// </summary>
+ public ObservableCollection<AppBarItem> AppBarItems { get; private set; }
+
+ /// <summary>
/// Gets the notification items view.
/// </summary>
public ICollectionView NotificationItemsView { get; private set; }
@@ -65,6 +70,10 @@ namespace Tango.PPC.UI.Notifications
{
NotificationsVisible = true;
NotificationItems = new ObservableCollection<NotificationItem>();
+
+ AppBarItems = new ObservableCollection<AppBarItem>();
+ CollectionViewSource.GetDefaultView(AppBarItems).SortDescriptions.Add(new SortDescription(nameof(AppBarItem.Priority), ListSortDirection.Ascending));
+
TaskBarItems = new ObservableCollection<TaskBarItem>();
_pendingMessageBoxes = new ConcurrentQueue<PendingNotification<MessageBoxVM, bool>>();
_pendingDialogs = new ConcurrentQueue<PendingNotification<DialogAndView, DialogViewVM>>();
@@ -472,22 +481,12 @@ namespace Tango.PPC.UI.Notifications
/// </summary>
public bool IsInGlobalBusyState { get; private set; }
- private AppBarItem _currentAppBarItem;
- /// <summary>
- /// Gets the current application bar item.
- /// </summary>
- public AppBarItem CurrentAppBarItem
- {
- get { return _currentAppBarItem; }
- set { _currentAppBarItem = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(HasAppBarItem)); }
- }
-
/// <summary>
/// Gets a value indicating whether this instance has application bar item.
/// </summary>
- public bool HasAppBarItem
+ public bool HasAppBarItems
{
- get { return CurrentAppBarItem != null; }
+ get { return AppBarItems.Count > 0; }
}
/// <summary>
@@ -498,8 +497,9 @@ namespace Tango.PPC.UI.Notifications
public AppBarItem PushAppBarItem(AppBarItem appBarItem)
{
LogManager.Log($"Pushing AppBarItem '{appBarItem.GetType().Name}'.");
- CurrentAppBarItem = appBarItem;
+ AppBarItems.Add(appBarItem);
appBarItem.RemoveAction = () => PopAppBarItem(appBarItem);
+ RaisePropertyChanged(nameof(HasAppBarItems));
return appBarItem;
}
@@ -508,9 +508,9 @@ namespace Tango.PPC.UI.Notifications
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
- public AppBarItem PushAppBarItem<T>() where T : AppBarItem
+ public T PushAppBarItem<T>() where T : AppBarItem
{
- return PushAppBarItem(Activator.CreateInstance<T>());
+ return PushAppBarItem(Activator.CreateInstance<T>()) as T;
}
/// <summary>
@@ -519,8 +519,12 @@ namespace Tango.PPC.UI.Notifications
/// <param name="appBarItem">The application bar item.</param>
public void PopAppBarItem(AppBarItem appBarItem)
{
- LogManager.Log($"Popping out AppBarItem '{appBarItem.GetType().Name}'.");
- CurrentAppBarItem = null;
+ InvokeUI(() =>
+ {
+ LogManager.Log($"Popping out AppBarItem '{appBarItem.GetType().Name}'.");
+ AppBarItems.Remove(appBarItem);
+ RaisePropertyChanged(nameof(HasAppBarItems));
+ });
}
/// <summary>
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 10d3a82a5..0cdf78614 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
@@ -114,7 +114,11 @@
<Compile Include="..\..\Versioning\GlobalVersionInfo.cs">
<Link>GlobalVersionInfo.cs</Link>
</Compile>
+ <Compile Include="AppBarItems\PowerUpAppBarItem.cs" />
<Compile Include="AppBarItems\PowerOffAppBarItem.cs" />
+ <Compile Include="AppBarItems\PowerUpAppBarItemView.xaml.cs">
+ <DependentUpon>PowerUpAppBarItemView.xaml</DependentUpon>
+ </Compile>
<Compile Include="AppBarItems\PowerOffAppBarItemView.xaml.cs">
<DependentUpon>PowerOffAppBarItemView.xaml</DependentUpon>
</Compile>
@@ -238,6 +242,10 @@
<Compile Include="Views\RestartingSystemView.xaml.cs">
<DependentUpon>RestartingSystemView.xaml</DependentUpon>
</Compile>
+ <Page Include="AppBarItems\PowerUpAppBarItemView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="AppBarItems\PowerOffAppBarItemView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -705,7 +713,7 @@ if $(ConfigurationName) == Debug copy /Y "$(TargetDir)Packages" "$(TargetDir)"</
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
+ <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs
index 965584767..54a92aa5c 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs
@@ -408,8 +408,12 @@ namespace Tango.PPC.UI.ViewModels
#region Handle USB Update
- private async void HandleSoftwareUpdatePackageLoaded(ExplorerFileItem fileItem)
+ private async void HandleSoftwareUpdatePackageLoaded(List<ExplorerFileItem> fileItems)
{
+ var fileItem = fileItems.FirstOrDefault();
+
+ if (fileItem == null) return;
+
PublishInfo packageFile = null;
LogManager.Log("TUP file loaded from storage...");
@@ -456,8 +460,12 @@ namespace Tango.PPC.UI.ViewModels
}
}
- private async void HandleFirmwareUpgradeLoaded(ExplorerFileItem fileItem)
+ private async void HandleFirmwareUpgradeLoaded(List<ExplorerFileItem> fileItems)
{
+ var fileItem = fileItems.FirstOrDefault();
+
+ if (fileItem == null) return;
+
LogManager.Log("TFP file loaded from storage...");
VersionPackageDescriptor packageInfo;
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs
index b53a54682..e84fd81a1 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs
@@ -21,6 +21,7 @@ using Tango.PPC.Common.WatchDog;
using Tango.PPC.UI.Dialogs;
using Tango.SharedUI;
using System.Data.Entity;
+using Tango.PPC.UI.AppBarItems;
namespace Tango.PPC.UI.ViewModels
{
@@ -33,6 +34,7 @@ namespace Tango.PPC.UI.ViewModels
private DispatcherTimer _date_timer;
private bool _isPowerUpDialogShown;
private bool _isThreadLoadingShown;
+ private PowerUpAppBarItem _powerUpAppBar;
private DateTime _currentDateTime;
/// <summary>
@@ -64,11 +66,47 @@ namespace Tango.PPC.UI.ViewModels
{
base.OnApplicationReady();
MachineProvider.MachineOperator.CartridgeValidationRequestReceived += MachineOperator_CartridgeValidationRequestReceived;
- MachineProvider.MachineOperator.PowerUpStarted += MachineOperator_PowerUpStarted;
+ MachineProvider.MachineOperator.FirmwareStarted += MachineOperator_FirmwareStarted;
MachineProvider.MachineOperator.ThreadLoadingStatusChanged += MachineOperator_ThreadLoadingStatusChanged;
MachineProvider.MachineOperator.ThreadLoadingConfirmationRequired += MachineOperator_ThreadLoadingConfirmationRequired;
+
+ MachineProvider.MachineOperator.PowerUpStarted += MachineOperator_PowerUpStarted;
+ MachineProvider.MachineOperator.PowerUpProgress += MachineOperator_PowerUpProgress;
+ MachineProvider.MachineOperator.PowerUpEnded += MachineOperator_PowerUpEnded;
+ }
+
+ #region Power Up
+
+ private void MachineOperator_PowerUpEnded(object sender, EventArgs e)
+ {
+ _powerUpAppBar?.Close();
+ _powerUpAppBar = null;
+ }
+
+ private void MachineOperator_PowerUpProgress(object sender, PMR.Power.StartPowerUpResponse status)
+ {
+ if (_powerUpAppBar != null)
+ {
+ _powerUpAppBar.Status = status;
+ }
}
+ private void MachineOperator_PowerUpStarted(object sender, PMR.Power.StartPowerUpResponse e)
+ {
+ InvokeUI(() =>
+ {
+ if (_powerUpAppBar != null)
+ {
+ _powerUpAppBar.Close();
+ }
+
+ _powerUpAppBar = NotificationProvider.PushAppBarItem<PowerUpAppBarItem>();
+ _powerUpAppBar.Priority = AppBarPriority.Low;
+ });
+ }
+
+ #endregion
+
#region Event Handlers
/// <summary>
@@ -101,7 +139,7 @@ namespace Tango.PPC.UI.ViewModels
});
}
- private async void MachineOperator_PowerUpStarted(object sender, EventArgs e)
+ private async void MachineOperator_FirmwareStarted(object sender, EventArgs e)
{
if (_isPowerUpDialogShown)
{
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml
index 1700749c2..21cc90f2d 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml
@@ -284,8 +284,21 @@
</Grid>
<Grid>
- <Grid Margin="20 0 60 0" Height="80" Visibility="{Binding NotificationProvider.HasAppBarItem,Converter={StaticResource BooleanToVisibilityConverter}}">
- <ContentControl Content="{Binding NotificationProvider.CurrentAppBarItem,Converter={StaticResource AppBarItemConverter}}"></ContentControl>
+ <Grid Margin="20 0 60 0" Height="80" Visibility="{Binding NotificationProvider.HasAppBarItems,Converter={StaticResource BooleanToVisibilityConverter}}">
+ <ItemsControl ItemsSource="{Binding NotificationProvider.AppBarItems}">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <Grid IsItemsHost="True" />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Grid Background="{StaticResource TangoPrimaryBackgroundBrush}">
+ <ContentControl Content="{Binding Converter={StaticResource AppBarItemConverter}}"></ContentControl>
+ </Grid>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
</Grid>
<!--External Header Content Here-->