diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-10-25 11:10:35 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-10-25 11:10:35 +0300 |
| commit | 2eb5e880d44c358ef6a97232e90e77ea0ec582ae (patch) | |
| tree | 156599c15b3013d83a29e8e36fc6f94b7d9fb9c7 /Software/Visual_Studio/MachineStudio | |
| parent | b2ff9df011e1e710381683f8c50d66e9f34616a2 (diff) | |
| parent | f24af73628e5e7ddfa3590fe278c1623f6ede2df (diff) | |
| download | Tango-2eb5e880d44c358ef6a97232e90e77ea0ec582ae.tar.gz Tango-2eb5e880d44c358ef6a97232e90e77ea0ec582ae.zip | |
merge
Diffstat (limited to 'Software/Visual_Studio/MachineStudio')
16 files changed, 353 insertions, 119 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ColorLabModuleSettings.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ColorLabModuleSettings.cs new file mode 100644 index 000000000..e2413f22b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ColorLabModuleSettings.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Settings; + +namespace Tango.MachineStudio.ColorLab +{ + public class ColorLabModuleSettings : SettingsBase + { + public String LastMachineSerialNumber { get; set; } + public String LastRmlGuid { get; set; } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj index 64caa2a1d..080d35f5e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj @@ -72,6 +72,7 @@ <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs"> <Link>GlobalVersionInfo.cs</Link> </Compile> + <Compile Include="ColorLabModuleSettings.cs" /> <Compile Include="ViewModelLocator.cs" /> <Compile Include="ViewModels\CalibrationDataPointVM.cs" /> <Compile Include="ViewModels\CalibrationDataViewVM.cs" /> @@ -195,7 +196,7 @@ <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/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs index d264dd209..f3e153134 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs @@ -20,6 +20,7 @@ using Tango.MachineStudio.Common.Controls; using Tango.MachineStudio.Common.Notifications; using Tango.PMR; using Tango.PMR.ColorLab; +using Tango.Settings; using Tango.SharedUI; using Tango.SharedUI.Controls; @@ -283,9 +284,9 @@ namespace Tango.MachineStudio.ColorLab.ViewModels #region Application Ready - public override void OnApplicationReady() + public async override void OnApplicationReady() { - Task.Factory.StartNew(() => + await Task.Factory.StartNew(() => { _dbContext = ObservablesContext.CreateDefault(); @@ -293,6 +294,25 @@ namespace Tango.MachineStudio.ColorLab.ViewModels ColorSpaces = _dbContext.ColorSpaces.ToObservableCollection(); Rmls = _dbContext.Rmls.ToObservableCollection(); }); + + var settings = SettingsManager.Default.GetOrCreate<ColorLabModuleSettings>(); + + try + { + if (settings.LastMachineSerialNumber != null) + { + SelectedMachine = Machines.SingleOrDefault(x => x.SerialNumber == settings.LastMachineSerialNumber); + + if (settings.LastRmlGuid != null) + { + SelectedRML = Rmls.SingleOrDefault(x => x.Guid == settings.LastRmlGuid); + } + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error loading last selected machine or RML."); + } } #endregion @@ -303,48 +323,59 @@ namespace Tango.MachineStudio.ColorLab.ViewModels { Task.Factory.StartNew(() => { - if (LiquidsCalibrationData == null || CCT.ForwardData == null) return; + try + { + if (LiquidsCalibrationData == null || CCT.ForwardData == null) return; - ConversionInput input = new ConversionInput(); - input.ColorSpace = SourceColor.IsLab ? PMR.ColorLab.ColorSpace.Lab : PMR.ColorLab.ColorSpace.Rgb; - input.DeltaChroma = DeltaChroma; - input.DeltaL = DeltaL; - input.ForwardData = ByteString.CopyFrom(CCT.ForwardData); + ConversionInput input = new ConversionInput(); + input.ColorSpace = SourceColor.IsLab ? PMR.ColorLab.ColorSpace.Lab : PMR.ColorLab.ColorSpace.Rgb; + input.DeltaChroma = DeltaChroma; + input.DeltaL = DeltaL; + input.ForwardData = ByteString.CopyFrom(CCT.ForwardData); - input.InputCoordinates = new InputCoordinates(); - input.InputCoordinates.Red = (int)SourceColor.Red; - input.InputCoordinates.Green = (int)SourceColor.Green; - input.InputCoordinates.Blue = (int)SourceColor.Blue; - input.InputCoordinates.L = SourceColor.L; - input.InputCoordinates.A = SourceColor.A; - input.InputCoordinates.B = SourceColor.B; - input.ThreadL = 92.1815; //SelectedRML.MediaColor.L; - input.ThreadA = 2.2555; //SelectedRML.MediaColor.A; - input.ThreadB = -10.9325; //SelectedRML.MediaColor.B; + input.InputCoordinates = new InputCoordinates(); + input.InputCoordinates.Red = (int)SourceColor.Red; + input.InputCoordinates.Green = (int)SourceColor.Green; + input.InputCoordinates.Blue = (int)SourceColor.Blue; + input.InputCoordinates.L = SourceColor.L; + input.InputCoordinates.A = SourceColor.A; + input.InputCoordinates.B = SourceColor.B; + input.ThreadL = 92.1815; //SelectedRML.MediaColor.L; + input.ThreadA = 2.2555; //SelectedRML.MediaColor.A; + input.ThreadB = -10.9325; //SelectedRML.MediaColor.B; - foreach (var vm in LiquidsCalibrationData) - { - InputLiquid inputLiquid = new InputLiquid(); + foreach (var vm in LiquidsCalibrationData) + { + InputLiquid inputLiquid = new InputLiquid(); - //TODO: Use the real calibration data... - //CalibrationData calData = new CalibrationData(); - //calData.LiquidType = (PMR.ColorLab.LiquidType)vm.IdsPack.LiquidType.Code; - //calData.CalibrationPoints.AddRange(vm.CalibrationPoints.Select(x => new CalibrationPoint() { X = x.X, Y = x.Y })); + CalibrationData calData = new CalibrationData(); + calData.LiquidType = (PMR.ColorLab.LiquidType)vm.IdsPack.LiquidType.Code; + calData.CalibrationPoints.AddRange(vm.CalibrationPoints.Select(x => new CalibrationPoint() { X = x.X, Y = x.Y })); - inputLiquid.CalibrationData = Cat.CreateDemoCalibrationData((PMR.ColorLab.LiquidType)vm.LiquidType.Code); + inputLiquid.CalibrationData = calData; - inputLiquid.LiquidType = (PMR.ColorLab.LiquidType)vm.LiquidType.Code; - inputLiquid.MaxNanoliterPerCentimeter = LiquidTypesRmls.SingleOrDefault(x => x.LiquidType.Code == vm.LiquidType.Code).MaxNlPerCm; + inputLiquid.LiquidType = (PMR.ColorLab.LiquidType)vm.LiquidType.Code; + inputLiquid.MaxNanoliterPerCentimeter = LiquidTypesRmls.SingleOrDefault(x => x.LiquidType.Code == vm.LiquidType.Code).MaxNlPerCm; - input.InputCoordinates.InputLiquids.Add(inputLiquid); - } + input.InputCoordinates.InputLiquids.Add(inputLiquid); + } - var output = TangoColorConverter.GetSuggestions(input); + var output = TangoColorConverter.GetSuggestions(input); - IsOutOfGamut = output.OutOfGamut; + IsOutOfGamut = output.OutOfGamut; - HiveSuggestions = TangoColorConverter.CreateHiveSuggestions(output); + HiveSuggestions = TangoColorConverter.CreateHiveSuggestions(output); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error in color conversion."); + + InvokeUI(() => + { + _notification.ShowError($"An error occurred while trying to convert from source color to Volume.\n" + ex.Message); + }); + } }); } @@ -497,7 +528,7 @@ namespace Tango.MachineStudio.ColorLab.ViewModels if (LiquidsCalibrationData == null || _prevent_inverse_conversion) return; //TODO: This is temporary because of out of range volumes. - if (LiquidVolumes.Where(x => x.IdsPack.IdsPackFormula.Code == IdsPackFormulas.StandardColor.ToInt32()).Sum(x => x.Volume) > 200) + if (LiquidVolumes.Where(x => x.IdsPack.IdsPackFormula.Code == IdsPackFormulas.StandardColor.ToInt32()).Sum(x => x.Volume) > 100) { IsVolumesOutOfRange = true; return; @@ -522,13 +553,11 @@ namespace Tango.MachineStudio.ColorLab.ViewModels { InputLiquid inputLiquid = new InputLiquid(); - //TODO: Use the real calibration data... + CalibrationData calData = new CalibrationData(); + calData.LiquidType = (PMR.ColorLab.LiquidType)vm.IdsPack.LiquidType.Code; + calData.CalibrationPoints.AddRange(vm.CalibrationPoints.Select(x => new CalibrationPoint() { X = x.X, Y = x.Y })); - //CalibrationData calData = new CalibrationData(); - //calData.LiquidType = (PMR.ColorLab.LiquidType)vm.IdsPack.LiquidType.Code; - //calData.CalibrationPoints.AddRange(vm.CalibrationPoints.Select(x => new CalibrationPoint() { X = x.X, Y = x.Y })); - - inputLiquid.CalibrationData = Cat.CreateDemoCalibrationData((PMR.ColorLab.LiquidType)vm.LiquidType.Code); + inputLiquid.CalibrationData = calData; inputLiquid.LiquidType = (PMR.ColorLab.LiquidType)vm.LiquidType.Code; inputLiquid.MaxNanoliterPerCentimeter = LiquidTypesRmls.SingleOrDefault(x => x.LiquidType.Code == vm.LiquidType.Code).MaxNlPerCm; @@ -549,7 +578,7 @@ namespace Tango.MachineStudio.ColorLab.ViewModels catch (Exception ex) { LogManager.Log(ex, "Error in inversed color conversion!"); - _notification.ShowError("Error in inversed color conversion!"); + _notification.ShowError("An error occurred while trying to convert from Volume to RGB.\n" + ex.Message); } } @@ -563,6 +592,8 @@ namespace Tango.MachineStudio.ColorLab.ViewModels { IsFree = false; + List<IdsPack> default_calibration_to_notify = new List<IdsPack>(); + await Task.Factory.StartNew(() => { using (_notification.PushTaskItem("Loading RML data...")) @@ -590,6 +621,17 @@ namespace Tango.MachineStudio.ColorLab.ViewModels var calData = cat.GetCalibrationData(); vm.CalibrationPoints = calData.CalibrationPoints.Select(x => new CalibrationDataPointVM(x)).ToObservableCollection(); } + else + { + var liquidTypeRml = LiquidTypesRmls.SingleOrDefault(x => x.LiquidType == idsPack.LiquidType && x.Rml == SelectedRML); + + if (liquidTypeRml != null) + { + default_calibration_to_notify.Add(idsPack); + var calData = liquidTypeRml.GetCalibrationData(); + vm.CalibrationPoints = calData.CalibrationPoints.Select(x => new CalibrationDataPointVM(x)).ToObservableCollection(); + } + } InvokeUINow(() => { @@ -606,9 +648,31 @@ namespace Tango.MachineStudio.ColorLab.ViewModels CCT.Rml = SelectedRML; _isNewCCT = true; } + + var settings = SettingsManager.Default.GetOrCreate<ColorLabModuleSettings>(); + settings.LastMachineSerialNumber = SelectedMachine.SerialNumber; + settings.LastRmlGuid = SelectedRML.Guid; + settings.Save(); } }); + + //TODO: not sure is this is really needed.. + + //if (default_calibration_to_notify.Count > 0) + //{ + // String message = "The following calibration tables were loaded from the selected RML default calibration." + Environment.NewLine; + + // foreach (var pack in default_calibration_to_notify) + // { + // message += SelectedRML.Name + " >> " + pack.LiquidType.Name + "." + Environment.NewLine; + // } + + // _notification.ShowWarning(message); + //} + + + IsFree = true; } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 07686165b..f55ece6a1 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -45,6 +45,7 @@ using Tango.AutoComplete.Editors; using System.Data.Entity; using System.Runtime.ExceptionServices; using Tango.BL.Builders; +using Tango.MachineStudio.Common.Navigation; namespace Tango.MachineStudio.Developer.ViewModels { @@ -63,6 +64,7 @@ namespace Tango.MachineStudio.Developer.ViewModels private TimeSpan _runningJobEstimatedDuration; private JobHandler _jobHandler; private DeveloperNavigationManager _navigation; + private INavigationManager _msNavigation; private bool _blockInvalidateCommands; private IAuthenticationProvider _authentication; private ObservablesContext _machineDbContext; @@ -685,7 +687,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// </summary> /// <param name="applicationManager">The application manager.</param> /// <param name="notificationProvider">The notification provider.</param> - public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IVideoCaptureProvider videoCaptureProvider, DeveloperNavigationManager navigation, IAuthenticationProvider authentication, IEventLogger eventLogger, ISpeechProvider speech) + public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IVideoCaptureProvider videoCaptureProvider, DeveloperNavigationManager navigation, INavigationManager navigationManager, IAuthenticationProvider authentication, IEventLogger eventLogger, ISpeechProvider speech) { CanWork = true; EnableColorConversion = true; @@ -695,6 +697,7 @@ namespace Tango.MachineStudio.Developer.ViewModels _notification = notificationProvider; _speech = speech; _navigation = navigation; + _msNavigation = navigationManager; ApplicationManager = applicationManager; VideoCaptureProvider = videoCaptureProvider; _eventLogger = eventLogger; @@ -720,11 +723,11 @@ namespace Tango.MachineStudio.Developer.ViewModels RemoveBrushStopCommand = new RelayCommand(RemoveSelectedBrushStops, () => SelectedBrushStop != null && CanWork); SaveJobCommand = new RelayCommand(SaveActiveJob, () => SelectedMachine != null && CanWork); DiscardJobCommand = new RelayCommand(BackToJobs, () => SelectedMachine != null && CanWork); - StartJobCommand = new RelayCommand(StartJob, () => ActiveJob != null && CanWork && !IsJobRunning && MachineOperator != null && !MachineOperator.MachineEventsStateProvider.Events.ToList().Exists(x => x.ActionTypes.Contains(BL.Enumerations.ActionTypes.PreventJobExecution))); + StartJobCommand = new RelayCommand(() => StartJob(), () => ActiveJob != null && CanWork && !IsJobRunning && MachineOperator != null && !MachineOperator.MachineEventsStateProvider.Events.ToList().Exists(x => x.ActionTypes.Contains(BL.Enumerations.ActionTypes.PreventJobExecution))); StartJobAndRecordCommand = new RelayCommand(StartJobAndRecord, () => _dataCaptureVM != null && !_dataCaptureVM.Recorder.IsRecording && !_dataCaptureVM.Player.IsPlaying && ActiveJob != null && !IsJobRunning && MachineOperator != null && !MachineOperator.MachineEventsStateProvider.Events.ToList().Exists(x => x.ActionTypes.Contains(BL.Enumerations.ActionTypes.PreventJobExecution))); StopJobCommand = new RelayCommand(StopJob, () => IsJobRunning && CanWork); CloseJobCompletionStatusCommand = new RelayCommand(CloseJobCompletionStatusBar); - LoadJobCommand = new RelayCommand(LoadSelectedJob, () => SelectedMachineJob != null && CanWork); + LoadJobCommand = new RelayCommand(() => LoadSelectedJob(), () => SelectedMachineJob != null && CanWork); DuplicateJobCommand = new RelayCommand(DuplicateSelectedJobs, () => SelectedMachineJob != null && CanWork); DuplicateSegmentCommand = new RelayCommand(DuplicateSelectedSegments, () => SelectedSegment != null && CanWork); DuplicateBrushStopCommand = new RelayCommand(DuplicateSelectedBrushStops, () => SelectedBrushStop != null && CanWork); @@ -912,6 +915,33 @@ namespace Tango.MachineStudio.Developer.ViewModels MachineOperator.MachineEventsStateProvider.NewEvents -= MachineEventsStateProvider_NewEvents; MachineOperator.MachineEventsStateProvider.NewEvents += MachineEventsStateProvider_NewEvents; + + MachineOperator.ResumingJob -= MachineOperator_ResumingJob; + MachineOperator.ResumingJob += MachineOperator_ResumingJob; + } + } + + private void MachineOperator_ResumingJob(object sender, ResumingJobEventArgs e) + { + if (_notification.ShowQuestion("Machine studio has detected a job in progress. Would you like to try and continue from there you were?")) + { + var job = _machineDbContext.Jobs.SingleOrDefault(x => x.Guid == e.JobGuid); + + if (job != null) + { + _msNavigation.NavigateToModule<DeveloperModule>(); + SelectedMachine = _machineDbContext.Machines.SingleOrDefault(x => x.Guid == job.MachineGuid); + SelectedMachineJob = SelectedMachine.Jobs.SingleOrDefault(x => x.Guid == job.Guid); + LoadSelectedJob(() => + { + StartJob(e.Approve); + }); + } + else + { + LogManager.Log($"Could not resume job. The running job with guid '{e.JobGuid}' was not found."); + _notification.ShowError("Could not resume job. The running job was not found."); + } } } @@ -1010,7 +1040,11 @@ namespace Tango.MachineStudio.Developer.ViewModels SelectedProcessParametersTable.DyeingSpeedMinInkUptakeChanged -= SelectedProcessParametersTable_DyeingSpeedMinInkUptakeChanged; SelectedProcessParametersTable.DyeingSpeedMinInkUptakeChanged += SelectedProcessParametersTable_DyeingSpeedMinInkUptakeChanged; - SetSegmentBrushStopsLiquidVolumes(SelectedSegment); + foreach (var segment in ActiveJob.Segments) + { + SetSegmentBrushStopsLiquidVolumes(segment); + } + UpdateEstimatedDuration(); } } @@ -1205,7 +1239,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// <summary> /// Starts the job. /// </summary> - private void StartJob() + private void StartJob(Func<Job, JobHandler> resumeFunc = null) { LogManager.Log(String.Format("Starting job {0}...", ActiveJob.Name)); if (MachineOperator == null || MachineOperator.State != TransportComponentState.Connected) @@ -1242,7 +1276,14 @@ namespace Tango.MachineStudio.Developer.ViewModels { LogManager.Log("Sending job to machine operator..."); - _jobHandler = MachineOperator.Print(ActiveJob, SelectedProcessParametersTable); + if (resumeFunc == null) + { + _jobHandler = MachineOperator.Print(ActiveJob, SelectedProcessParametersTable); + } + else + { + _jobHandler = resumeFunc(ActiveJob); + } _eventLogger.Log(String.Format("Job '{0}' started...", ActiveJob.Name)); @@ -1377,9 +1418,9 @@ namespace Tango.MachineStudio.Developer.ViewModels await SelectedRML.SaveAsync(_activeJobDbContext); LiquidTypesRmls = ActiveJob.Machine.Configuration.NoneEmptyIdsPacks.Where(x => !x.IsEmpty).OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == SelectedRML.Guid).ToList(); - if (SelectedSegment != null) + foreach (var segment in ActiveJob.Segments) { - SetSegmentBrushStopsLiquidVolumes(SelectedSegment); + SetSegmentBrushStopsLiquidVolumes(segment); } } @@ -1406,7 +1447,7 @@ namespace Tango.MachineStudio.Developer.ViewModels _selectedRML = new RmlBuilder(_activeJobDbContext).Set(SelectedRML).WithAllParametersGroup().WithCAT(SelectedMachine.Guid).WithCCT().WithLiquidFactors().WithMediaProperties().Build(); - if (_selectedRML.Cats.Count == 0) + if (_selectedRML.Ccts.Count == 0) { InvokeUI(() => { @@ -1573,7 +1614,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// <summary> /// Loads the selected job. /// </summary> - private async void LoadSelectedJob() + private async void LoadSelectedJob(Action onCompleted = null) { if (SelectedMachineJob != null) { @@ -1662,6 +1703,8 @@ namespace Tango.MachineStudio.Developer.ViewModels } CanWork = true; + + onCompleted?.Invoke(); } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml index 1c0bc515b..884f60875 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -353,15 +353,8 @@ </Polygon> <Border Height="100" Padding="5" IsHitTestVisible="False"> <Grid> - <Rectangle VerticalAlignment="Bottom" Height="8"> - <Rectangle.Fill> - <MultiBinding Converter="{StaticResource SegmentToBrushConverterMulti}"> - <Binding Path="."></Binding> - <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.ActiveJob"></Binding> - <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.ActiveJob.Length"></Binding> - <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.SelectedBrushStop.Color"></Binding> - </MultiBinding> - </Rectangle.Fill> + <Rectangle VerticalAlignment="Bottom" Height="8" Fill="{Binding SegmentBrush}"> + </Rectangle> </Grid> </Border> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationManager.cs index e20940c8d..6bd4d8829 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationManager.cs @@ -101,6 +101,8 @@ namespace Tango.MachineStudio.Common.Navigation Task<bool> NavigateWithObject<TModule, TView, TPass>(TPass obj, bool pushToHistory = true) where TModule : IStudioModule; + void NavigateToModule<T>() where T : IStudioModule; + /// <summary> /// Clears the navigation back history. /// </summary> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs index 9989aa091..feb1e41b3 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs @@ -41,7 +41,14 @@ namespace Tango.MachineStudio.UI { InitializeComponent(); - _is_testing = TestHelper.IsRunningUnderTestStudio(); + try + { + _is_testing = TestHelper.IsRunningUnderTestStudio(); + } + catch (Exception ex) + { + LogManager.Log(ex, LogCategory.Warning, "An error occurred while trying to get the parent process of machine studio."); + } if (!_is_testing) { diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs index 0def3c943..28f56e521 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs @@ -44,7 +44,10 @@ namespace Tango.MachineStudio.UI.Modules /// <param name="e">The e.</param> private void _authenticationProvider_CurrentUserChanged(object sender, User e) { - LoadModules(); + if (e != null) + { + LoadModules(); + } } private SynchronizedObservableCollection<IStudioModule> _allModules; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs index 899ba846e..13ec6161d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using Tango.Core; using Tango.Core.Commands; +using Tango.Core.DI; using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Modules; using Tango.MachineStudio.Common.Navigation; @@ -384,5 +385,16 @@ namespace Tango.MachineStudio.UI.Navigation RaisePropertyChanged(nameof(CanNavigateBack)); } + + public void NavigateToModule<T>() where T : IStudioModule + { + var loader = TangoIOC.Default.GetInstance<IStudioModuleLoader>(); + var module = loader.UserModules.SingleOrDefault(x => x.GetType() == typeof(T)); + + if (module != null) + { + TangoIOC.Default.GetInstance<ViewModels.MainViewVM>().StartModule(module); + } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs index 6cff1ba17..80509e6c0 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs @@ -11,6 +11,7 @@ using System.Windows.Media; using Tango.Core; using System.Collections.ObjectModel; using Tango.SharedUI; +using System.Collections.Concurrent; namespace Tango.MachineStudio.UI.Notifications { @@ -21,6 +22,8 @@ namespace Tango.MachineStudio.UI.Notifications /// <seealso cref="Tango.MachineStudio.Common.Notifications.INotificationProvider" /> public class DefaultNotificationProvider : ExtendedObject, INotificationProvider { + private int _message_count = 0; + /// <summary> /// The view types /// </summary> @@ -79,6 +82,8 @@ namespace Tango.MachineStudio.UI.Notifications { MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; + _message_count++; + var result = new MessageBoxWindow() { Owner = Application.Current.MainWindow, @@ -89,7 +94,13 @@ namespace Tango.MachineStudio.UI.Notifications }.ShowDialog(); - MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + _message_count--; + + if (_message_count == 0) + { + MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + } + return result; } @@ -377,8 +388,11 @@ namespace Tango.MachineStudio.UI.Notifications /// <param name="taskItem">The task item.</param> public void PushTaskItem(TaskItem taskItem) { - TaskItems.Add(taskItem); - CurrentTaskItem = taskItem; + InvokeUI(() => + { + TaskItems.Add(taskItem); + CurrentTaskItem = taskItem; + }); } /// <summary> @@ -400,14 +414,20 @@ namespace Tango.MachineStudio.UI.Notifications /// <param name="taskItem">The task item.</param> public void PopTaskItem(TaskItem taskItem) { - TaskItems.Remove(taskItem); - - if (TaskItems.Count > 0) + Task.Delay(1000).ContinueWith((x) => { - CurrentTaskItem = TaskItems.Last(); - } + InvokeUI(() => + { + TaskItems.Remove(taskItem); - RaisePropertyChanged(nameof(HasTaskItems)); + if (TaskItems.Count > 0) + { + CurrentTaskItem = TaskItems.Last(); + } + + RaisePropertyChanged(nameof(HasTaskItems)); + }); + }); } /// <summary> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index 075832b06..01a7ac3da 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("3.5.51.18238")] +[assembly: AssemblyVersion("3.5.56.18238")] [assembly: ComVisible(false)]
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index 8be7f486a..3864708fc 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -25,6 +25,7 @@ using Tango.MachineStudio.UI.ViewModels; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.UI.Views; using Tango.Integration.Operation; +using Tango.MachineStudio.UI.Windows; namespace Tango.MachineStudio.UI.StudioApplication { @@ -39,6 +40,7 @@ namespace Tango.MachineStudio.UI.StudioApplication private IStudioModuleLoader _moduleLoader; private INotificationProvider _notification; private List<Window> _openedWindows; + private List<IStudioViewModel> _notified_view_models; /// <summary> /// Initializes a new instance of the <see cref="DefaultStudioApplicationManager" /> class. @@ -50,6 +52,7 @@ namespace Tango.MachineStudio.UI.StudioApplication _navigationManager = navigationManager; _notification = notification; _openedWindows = new List<Window>(); + _notified_view_models = new List<IStudioViewModel>(); Application.Current.MainWindow.ContentRendered += (_, __) => { @@ -286,6 +289,11 @@ namespace Tango.MachineStudio.UI.StudioApplication window.Closed += (x, y) => { _openedWindows.Remove(window); }; } + public bool IsModuleInNewWindow(IStudioModule module) + { + return _openedWindows.Exists(x => (x as ModuleWindow).ModuleContext.Module == module); + } + /// <summary> /// Gets the core libraries version. /// </summary> @@ -324,7 +332,14 @@ namespace Tango.MachineStudio.UI.StudioApplication /// </summary> public void NotifyApplicationReady() { - TangoIOC.Default.GetAllInstancesByBase<IStudioViewModel>().ToList().ForEach(x => x.OnApplicationReady()); + TangoIOC.Default.GetAllInstancesByBase<IStudioViewModel>().ToList().ForEach(x => + { + if (!_notified_view_models.Contains(x)) + { + x.OnApplicationReady(); + _notified_view_models.Add(x); + } + }); } /// <summary> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs index 51b7168ed..7737911e0 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs @@ -52,6 +52,8 @@ namespace Tango.MachineStudio.UI.ViewModels /// <param name="scanner">The scanner.</param> public MachineConnectionViewVM(ExternalBridgeScanner scanner) { + EnableDiagnostics = true; + UploadHardwareConfiguration = true; Scanner = scanner; ConnectCommand = new RelayCommand(Connect, (x) => SelectedMachine != null); } @@ -97,5 +99,36 @@ namespace Tango.MachineStudio.UI.ViewModels Scanner.AvailableMachines.Add(_emulator); Scanner.Start(); } + + private bool _enableDiagnostics; + /// <summary> + /// Gets or sets a value indicating whether to enable diagnostics after connection. + /// </summary> + public bool EnableDiagnostics + { + get { return _enableDiagnostics; } + set { _enableDiagnostics = value; RaisePropertyChangedAuto(); } + } + + private bool _uploadHardwareConfiguration; + /// <summary> + /// Gets or sets a value indicating whether to upload hardware configuration after connection. + /// </summary> + public bool UploadHardwareConfiguration + { + get { return _uploadHardwareConfiguration; } + set { _uploadHardwareConfiguration = value; RaisePropertyChangedAuto(); } + } + + private bool _enableKeepAlive; + /// <summary> + /// Gets or sets a value indicating whether to use the keep alive mechanism. + /// </summary> + public bool EnableKeepAlive + { + get { return _enableKeepAlive; } + set { _enableKeepAlive = value; RaisePropertyChangedAuto(); } + } + } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index 49a8ca807..31e297cd1 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -445,6 +445,11 @@ namespace Tango.MachineStudio.UI.ViewModels } } + x.SelectedMachine.EnableDiagnostics = x.EnableDiagnostics; + x.SelectedMachine.EnableEmbeddedDebugging = x.EnableDiagnostics; + x.SelectedMachine.EnableEventsNotification = x.EnableDiagnostics; + x.SelectedMachine.UseKeepAlive = x.EnableKeepAlive; + if (x.SelectedMachine.RequiresAuthentication) { _notificationProvider.ShowModalDialog<MachineLoginViewVM>(async (login) => @@ -453,11 +458,6 @@ namespace Tango.MachineStudio.UI.ViewModels { try { - if (x.SelectedMachine.EnableDiagnostics) - { - x.SelectedMachine.EnableEmbeddedDebugging = true; - } - await x.SelectedMachine.As<IExternalBridgeSecureClient>().Connect(new PMR.Integration.ExternalBridgeLoginRequest() { AppID = "Machine Studio", @@ -479,6 +479,11 @@ namespace Tango.MachineStudio.UI.ViewModels PostMessage(new MachineConnectionChangedMessage() { Machine = x.SelectedMachine }); _eventLogger.Log(String.Format("Successfully connected to machine {0} via TCP", x.SelectedMachine.SerialNumber)); + if (x.UploadHardwareConfiguration) + { + UploadHardwareConfiguration(); + } + } catch (ResponseErrorException ex) { @@ -507,11 +512,6 @@ namespace Tango.MachineStudio.UI.ViewModels { try { - if (x.SelectedMachine.EnableDiagnostics) - { - x.SelectedMachine.EnableEmbeddedDebugging = true; - } - await x.SelectedMachine.Connect(); x.SelectedMachine.SerialNumber = vm.SelectedMachine.SerialNumber; ApplicationManager.SetConnectedMachine(x.SelectedMachine); @@ -520,6 +520,11 @@ namespace Tango.MachineStudio.UI.ViewModels _eventLogger.Log(String.Format("Successfully connected to machine {0} via USB", x.SelectedMachine.SerialNumber)); _settings.LastVirtualMachineSerialNumber = vm.SelectedMachine.SerialNumber; _settings.Save(); + + if (x.UploadHardwareConfiguration) + { + UploadHardwareConfiguration(); + } } catch (Exception ex) { @@ -560,22 +565,7 @@ namespace Tango.MachineStudio.UI.ViewModels { using (NotificationProvider.PushTaskItem("Uploading hardware configuration...")) { - try - { - using (ObservablesContext db = ObservablesContext.CreateDefault()) - { - var config = db.Adapter.GetConfiguration(s => s.Guid == ApplicationManager.Machine.ConfigurationGuid); - var hw = db.Adapter.GetHardwareVersionByMachine(ApplicationManager.Machine.Guid); - - await ApplicationManager.ConnectedMachine.UploadHardwareConfiguration(hw, config); - } - NotificationProvider.ShowInfo("Hardware configuration uploaded successfully."); - } - catch (Exception ex) - { - LogManager.Log(ex, "Error uploading hardware configuration."); - NotificationProvider.ShowError("Error uploading hardware configuration." + Environment.NewLine + ex.Message); - } + UploadHardwareConfiguration(); } } } @@ -623,6 +613,26 @@ namespace Tango.MachineStudio.UI.ViewModels InvalidateRelayCommands(); } + private async void UploadHardwareConfiguration() + { + try + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var config = db.Adapter.GetConfiguration(s => s.Guid == ApplicationManager.Machine.ConfigurationGuid); + var hw = db.Adapter.GetHardwareVersionByMachine(ApplicationManager.Machine.Guid); + + await ApplicationManager.ConnectedMachine.UploadHardwareConfiguration(hw, config); + } + NotificationProvider.ShowInfo("Hardware configuration uploaded successfully."); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error uploading hardware configuration."); + NotificationProvider.ShowError("Error uploading hardware configuration." + Environment.NewLine + ex.Message); + } + } + /// <summary> /// Navigates to the home screen. /// </summary> @@ -639,6 +649,8 @@ namespace Tango.MachineStudio.UI.ViewModels { IsMenuOpened = false; + if ((_applicationManager as DefaultStudioApplicationManager).IsModuleInNewWindow(module)) return; + if (module != null) { LogManager.Log(String.Format("Starting module '{0}'...", module.Name)); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml index 180a2a8e0..9794404b9 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml @@ -10,7 +10,7 @@ xmlns:emulations="clr-namespace:Tango.Emulations.ExternalBridge;assembly=Tango.Emulations" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300" Width="600" Height="400" Background="White" DataContext="{Binding MachineConnectionViewVM, Source={StaticResource Locator}}"> + d:DesignHeight="300" d:DesignWidth="300" Width="630" Height="400" Background="White" DataContext="{Binding MachineConnectionViewVM, Source={StaticResource Locator}}"> <UserControl.Resources> <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"></converters:BooleanToVisibilityConverter> @@ -57,10 +57,6 @@ <ListBox.Resources> <DataTemplate DataType="{x:Type integration:ExternalBridgeTcpClient}"> <DockPanel> - <StackPanel Orientation="Vertical" VerticalAlignment="Center" DockPanel.Dock="Right" ToolTip="Allow incoming diagnostics data"> - <ToggleButton IsChecked="{Binding EnableDiagnostics}" VerticalAlignment="Center"></ToggleButton> - <TextBlock VerticalAlignment="Center" FontSize="10">Diagnostics/Debugging</TextBlock> - </StackPanel> <StackPanel Orientation="Horizontal"> <Image Source="/Images/external-bridge-tcp.png" Width="38" Height="38" RenderOptions.BitmapScalingMode="Fant"></Image> <StackPanel Margin="10 0 0 0"> @@ -79,10 +75,6 @@ </DataTemplate> <DataTemplate DataType="{x:Type integration:ExternalBridgeUsbClient}"> <DockPanel> - <StackPanel Orientation="Vertical" VerticalAlignment="Center" DockPanel.Dock="Right" ToolTip="Allow incoming diagnostics data"> - <ToggleButton IsChecked="{Binding EnableDiagnostics}" VerticalAlignment="Center"></ToggleButton> - <TextBlock VerticalAlignment="Center" FontSize="10">Diagnostics</TextBlock> - </StackPanel> <StackPanel Orientation="Horizontal"> <Image Source="/Images/external-bridge-usb.png" Width="38" Height="38" RenderOptions.BitmapScalingMode="Fant"></Image> <StackPanel Margin="10 0 0 0"> @@ -98,10 +90,6 @@ </DataTemplate> <DataTemplate DataType="{x:Type emulations:EmulatorExternalBridge}"> <DockPanel> - <StackPanel Orientation="Vertical" VerticalAlignment="Center" DockPanel.Dock="Right" ToolTip="Allow incoming diagnostics data"> - <ToggleButton IsChecked="{Binding EnableDiagnostics}" VerticalAlignment="Center"></ToggleButton> - <TextBlock VerticalAlignment="Center" FontSize="10">Diagnostics</TextBlock> - </StackPanel> <StackPanel Orientation="Horizontal"> <Image Source="/Images/external-bridge-emulator.png" Width="38" Height="38" RenderOptions.BitmapScalingMode="Fant"></Image> <StackPanel Margin="10 0 0 0"> @@ -123,6 +111,24 @@ </Grid> <Grid Grid.Row="1"> + + <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> + <ToggleButton IsChecked="{Binding EnableDiagnostics}" VerticalAlignment="Center" ToolTip="Allow incoming diagnostics data, debug logs and hardware events"></ToggleButton> + <TextBlock VerticalAlignment="Center" FontSize="10" Margin="5 0 0 0">Diagnostics, Debug & Events</TextBlock> + </StackPanel> + + <StackPanel Margin="20 0 0 0" Orientation="Horizontal" VerticalAlignment="Center"> + <ToggleButton IsChecked="{Binding UploadHardwareConfiguration}" VerticalAlignment="Center" ToolTip="Upload hardware configuration after connection is successful"></ToggleButton> + <TextBlock VerticalAlignment="Center" FontSize="10" Margin="5 0 0 0">Upload HW Configuration</TextBlock> + </StackPanel> + + <StackPanel Margin="20 0 0 0" Orientation="Horizontal" VerticalAlignment="Center"> + <ToggleButton IsChecked="{Binding EnableKeepAlive}" VerticalAlignment="Center" ToolTip="Upload hardware configuration after connection is successful"></ToggleButton> + <TextBlock VerticalAlignment="Center" FontSize="10" Margin="5 0 0 0">Keep Alive</TextBlock> + </StackPanel> + </StackPanel> + <Button HorizontalAlignment="Right" Width="140" Command="{Binding ConnectCommand}">CONNECT</Button> </Grid> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml index 7edfa50c6..f66e247a9 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -467,7 +467,7 @@ </Grid> </Grid> - <Border HorizontalAlignment="Right" Margin="0 -1 10 0" VerticalAlignment="Top" Width="300" Height="40" Padding="5" CornerRadius="0 0 30 30" BorderThickness="1 0 1 1" BorderBrush="DimGray"> + <Border HorizontalAlignment="Right" Margin="0 -1 10 0" VerticalAlignment="Top" Width="300" Height="Auto" CornerRadius="0 0 30 30" BorderThickness="1 0 1 1" BorderBrush="DimGray"> <Border.Style> <Style TargetType="Border"> <Setter Property="RenderTransform"> @@ -487,7 +487,7 @@ <DataTrigger.ExitActions> <BeginStoryboard HandoffBehavior="Compose"> <Storyboard> - <DoubleAnimation BeginTime="00:00:02" FillBehavior="HoldEnd" Storyboard.TargetProperty="RenderTransform.ScaleY" To="0" From="1" Duration="00:00:0.5"></DoubleAnimation> + <DoubleAnimation FillBehavior="HoldEnd" Storyboard.TargetProperty="RenderTransform.ScaleY" To="0" From="1" Duration="00:00:0.5"></DoubleAnimation> </Storyboard> </BeginStoryboard> </DataTrigger.ExitActions> @@ -502,10 +502,18 @@ </LinearGradientBrush> </Border.Background> - <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="20 0 0 0"> - <mahapps:ProgressRing Width="24" Height="24" Foreground="White"></mahapps:ProgressRing> - <TextBlock Text="{Binding NotificationProvider.CurrentTaskItem.Message,Converter={StaticResource StringEllipsisConverter},ConverterParameter=35}" Foreground="White" VerticalAlignment="Center" Margin="10 0 0 0" TextWrapping="Wrap"></TextBlock> - </StackPanel> + <ItemsControl ItemsSource="{Binding NotificationProvider.TaskItems}"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Border Margin="5"> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="20 0 0 0"> + <mahapps:ProgressRing Width="24" Height="24" Foreground="White"></mahapps:ProgressRing> + <TextBlock Text="{Binding Message,Converter={StaticResource StringEllipsisConverter},ConverterParameter=35}" Foreground="White" VerticalAlignment="Center" Margin="10 0 0 0" TextWrapping="Wrap"></TextBlock> + </StackPanel> + </Border> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> </Border> <Grid HorizontalAlignment="Right" VerticalAlignment="Top" Margin="10" Visibility="{Binding IsMachineErrorsOpened,Converter={StaticResource BooleanToVisibilityConverter}}"> |
