From 94ae449d984f4bfaf5d14faa5dab25d9d4958955 Mon Sep 17 00:00:00 2001 From: tesar-tech Date: Fri, 10 Nov 2023 16:11:33 +0100 Subject: [PATCH 1/3] new association --- TremAn3/Package.appxmanifest | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TremAn3/Package.appxmanifest b/TremAn3/Package.appxmanifest index c8dd828..2e3f74f 100644 --- a/TremAn3/Package.appxmanifest +++ b/TremAn3/Package.appxmanifest @@ -9,10 +9,10 @@ + Publisher="CN=5981E6E6-8952-4365-82F4-62FDCB563115" + Version="1.3.4.0" /> - + TremAn3 From 40252253bb68eef24c561d8b27f6797f73871102 Mon Sep 17 00:00:00 2001 From: tesar-tech Date: Mon, 1 Jan 2024 17:58:56 +0100 Subject: [PATCH 2/3] New Settings for ROI Corners and Button Opacity Tracker Box Style; Average Coherence Value Fixing Freq Analysis Export CoM Values Export with Timestamped File Names Last Selected Tab in Spectral Analysis --- NoApp/LongTimeNoTouch.md | 7 + TremAn3.Core/Results.cs | 7 +- TremAn3/Helpers/StaticConverters.cs | 4 +- TremAn3/Services/ExportService.cs | 40 +-- .../Services/StoringMeasurementsService.cs | 10 +- TremAn3/TremAn3.csproj | 2 +- TremAn3/ViewModels/FreqCounterViewModel.cs | 21 +- .../ViewModels/PlotModelWithTypeViewModel.cs | 2 + .../PlotModelsContainerViewModel.cs | 128 +++++---- TremAn3/ViewModels/ResultsViewModel.cs | 71 +++-- .../SelectionRectangleComputationViewModel.cs | 3 +- TremAn3/ViewModels/SettingsViewModel.cs | 39 ++- TremAn3/Views/FreqCounterUc.xaml | 261 +++++++++++------- TremAn3/Views/FreqCounterUc.xaml.cs | 7 +- TremAn3/Views/SelectionRectangleUc.xaml | 16 +- TremAn3/Views/SelectionRectangleUc.xaml.cs | 4 +- TremAn3/Views/SettingsPage.xaml | 8 + 17 files changed, 405 insertions(+), 225 deletions(-) diff --git a/NoApp/LongTimeNoTouch.md b/NoApp/LongTimeNoTouch.md index 7a94c9f..7d93a4c 100644 --- a/NoApp/LongTimeNoTouch.md +++ b/NoApp/LongTimeNoTouch.md @@ -32,3 +32,10 @@ Usual issues when updating TremAn app after longer period of time. - Micorosoft Entra application - Click on the item, genereate new secret - Paste the secrete into Client Secret and password on Project settings-> Service connections -> NaWinDevCenter + +## The package "apppxbundle" is taking a long time to process. + +- In dashboard under submission, under packages with error. +- Dont understand it, but when I "refresh" the store association on the app it works: + https://stackoverflow.com/a/62310133/1154773 + diff --git a/TremAn3.Core/Results.cs b/TremAn3.Core/Results.cs index 3260322..7ca1cf6 100644 --- a/TremAn3.Core/Results.cs +++ b/TremAn3.Core/Results.cs @@ -11,12 +11,11 @@ namespace TremAn3.Core /// public class Results { - //public List FreqProgress { get; set; } = new List(); //public List FreqProgressTime { get; set; } public void SetComXAndFrameTimes(List comx, List frametimes) - { + { ComX = comx; FrameTimes = frametimes.Select(x => TimeSpan.FromSeconds(x)).ToList(); } @@ -36,7 +35,6 @@ public void SetComY(List comy) //public ResultsModel ResultsModel { get; set; } = new ResultsModel(); public Dictionary DataResultsDict { get; set; } = new Dictionary(); - } public class DataResult @@ -50,7 +48,6 @@ public class DataResult } public enum DataSeriesType { - Psd, ComX, ComY, AmpSpec, FreqProgress, Coherence,Welch + Psd = 0, ComX = 1, ComY = 2, AmpSpec = 3, FreqProgress = 4, Coherence = 5, Welch = 6 } - } diff --git a/TremAn3/Helpers/StaticConverters.cs b/TremAn3/Helpers/StaticConverters.cs index 87d4620..ead41ba 100644 --- a/TremAn3/Helpers/StaticConverters.cs +++ b/TremAn3/Helpers/StaticConverters.cs @@ -63,7 +63,9 @@ public static double SpectralAnalysisBiggerToggleToSizeOfPlot(bool? IsChecked) } public static string DoubleDoubleToStringPercent(double val) => $"{val:00.00} % "; - + + public static string DoubleFormatter(double val) => $"{val:0.00}"; + diff --git a/TremAn3/Services/ExportService.cs b/TremAn3/Services/ExportService.cs index 35ef5b7..7aeb9b4 100644 --- a/TremAn3/Services/ExportService.cs +++ b/TremAn3/Services/ExportService.cs @@ -7,9 +7,9 @@ using System.Threading.Tasks; using ViewModels; -public class ExportService +public class ExportService { - public async void ExportComValuesAsync() + public async void ExportComValuesAsync() { var rois = ViewModelLocator.Current.DrawingRectanglesViewModel.SelectionRectanglesViewModels.Where(x => x.IsShowInPlot && x.ComputationViewModel.HasResult).ToList(); if (rois.Count == 0) @@ -43,11 +43,12 @@ public async void ExportComValuesAsync() headers: yHeaders.Prepend("time[s]")); var mainViewModel = ViewModelLocator.Current.MainViewModel; - var name = $"{mainViewModel.MediaPlayerViewModel.VideoPropsViewModel.DisplayName}_CoM_Values"; + var name = $"{mainViewModel.MediaPlayerViewModel.VideoPropsViewModel.DisplayName}_" + + $"{ViewModelLocator.Current.PastMeasurementsViewModel.SelectedMeasurementVm.DateTime:yyyy-MM-dd_HH-mm-ss}_CoM_Values"; var (status, newName) = await CsvExport.ExportStringAsCsvAsync(str, name); mainViewModel.NotifyBasedOnStatus(status, newName); } - public async Task ExportFreqAnalysisToCsvAsync() + public async Task ExportFreqAnalysisToCsvAsync() { var rois = ViewModelLocator.Current.DrawingRectanglesViewModel.SelectionRectanglesViewModels.Where(x => x.IsShowInPlot && x.ComputationViewModel.HasResult).ToList(); @@ -57,29 +58,34 @@ public async Task ExportFreqAnalysisToCsvAsync() return; } - List> values = new(); - List headers = new(); + List> values = []; + List headers = []; - foreach (var dataSeriesType in new List - { - DataSeriesType.Psd, DataSeriesType.AmpSpec, DataSeriesType.Welch, DataSeriesType.FreqProgress - }) + List toExportDataSeries = [DataSeriesType.Psd, DataSeriesType.AmpSpec, DataSeriesType.Welch, DataSeriesType.FreqProgress]; + foreach (var dataSeriesType in toExportDataSeries) { - var xValues = rois[0].ComputationViewModel.Algorithm.Results.DataResultsDict[dataSeriesType].X; - values.Add(xValues); + var roi0DataResult = rois[0].ComputationViewModel.Algorithm.Results.DataResultsDict[dataSeriesType]; + if(!roi0DataResult.IsOk) continue; + values.Add(roi0DataResult.X); headers.Add($"freq[Hz]_{dataSeriesType}"); foreach (var roi in rois) { - var yValues = roi.ComputationViewModel.Algorithm.Results.DataResultsDict[dataSeriesType].Y; + List yValues = roi.ComputationViewModel.Algorithm.Results.DataResultsDict[dataSeriesType].Y; values.Add(yValues); headers.Add($"{dataSeriesType}__{roi}"); } } var roi1Roi2Coherence = ViewModelLocator.Current.MainViewModel.FreqCounterViewModel.CurrentGlobalScopedResultsViewModel.DataResultsDict[DataSeriesType.Coherence]; - values.Add(roi1Roi2Coherence.X); - headers.Add("freq[Hz]_coherence_roi1_roi2"); - values.Add(roi1Roi2Coherence.Y); - headers.Add("coherence_roi1_roi2"); + if (roi1Roi2Coherence.IsOk) + { + values.Add(roi1Roi2Coherence.X); + headers.Add("freq[Hz]_coherence_roi1_roi2"); + values.Add(roi1Roi2Coherence.Y); + headers.Add("coherence_roi1_roi2"); + values.Add([ViewModelLocator.Current.MainViewModel.FreqCounterViewModel.CurrentGlobalScopedResultsViewModel.CoherenceAverage]); + headers.Add("coherence_roi1_roi2_average"); + + } var str = CsvBuilder.GetCsvFromListOfLists(values: values, (ViewModelLocator.Current.SettingsViewModel.DecimalSeparator, ViewModelLocator.Current.SettingsViewModel.CsvElementSeparator), headers: headers); diff --git a/TremAn3/Services/StoringMeasurementsService.cs b/TremAn3/Services/StoringMeasurementsService.cs index 2e6caaa..558b41f 100644 --- a/TremAn3/Services/StoringMeasurementsService.cs +++ b/TremAn3/Services/StoringMeasurementsService.cs @@ -30,13 +30,13 @@ public async Task DisplayMeasurementByModelAsync(MeasurementModel measurementMod mainVm.MediaPlayerViewModel.MediaControllingViewModel.PositionSeconds = measurementModel.PositionSeconds; mainVm.MediaPlayerViewModel.FreqCounterViewModel.Maxrange = measurementModel.Maxrange; mainVm.MediaPlayerViewModel.FreqCounterViewModel.Minrange = measurementModel.Minrange; - + mainVm.MediaPlayerViewModel.FreqCounterViewModel.FreqProgressViewModel.SegmnetSize = measurementModel.FreqProgressSegmnetSize; ViewModelLocator.Current.DrawingRectanglesViewModel.RemoveRois(); foreach (var roiRes in measurementModel.VectorsDataModel.RoiResultModels) { - + //this creates roi on video var selvm = ViewModelLocator.Current.DrawingRectanglesViewModel.CreateROIFromModel(roiRes); @@ -47,17 +47,17 @@ public async Task DisplayMeasurementByModelAsync(MeasurementModel measurementMod foreach (var gsdm in measurementModel.VectorsDataModel.GlobalScopedDataResultsModels) { - DataResult dr = new DataResult + DataResult dr = new() { Y = gsdm.Y, X = gsdm.X, ErrorMessage = gsdm.ErrorMessage }; - rvm.DataResultsDict.Add(gsdm.DataSeriesType, dr); + rvm.DataResultsDict.Add(gsdm.DataSeriesType, dr); } mainVm.FreqCounterViewModel.CurrentGlobalScopedResultsViewModel = rvm; - + await mainVm.FreqCounterViewModel.CurrentGlobalScopedResultsViewModel.ComputeAdditionalResults(); await mainVm.FreqCounterViewModel.DisplayPlots(false); diff --git a/TremAn3/TremAn3.csproj b/TremAn3/TremAn3.csproj index 69d9077..0ee753c 100644 --- a/TremAn3/TremAn3.csproj +++ b/TremAn3/TremAn3.csproj @@ -2,7 +2,7 @@ - 11 + 12 Debug x86 {21E2606A-1739-4034-B6B1-043D8BA0DA61} diff --git a/TremAn3/ViewModels/FreqCounterViewModel.cs b/TremAn3/ViewModels/FreqCounterViewModel.cs index b332bd0..c0003b5 100644 --- a/TremAn3/ViewModels/FreqCounterViewModel.cs +++ b/TremAn3/ViewModels/FreqCounterViewModel.cs @@ -70,10 +70,7 @@ private void MediaControllingViewModel_PositionChanged(double value) } - public DrawingRectanglesViewModel DrawingRectanglesViewModel - { - get { return ViewModelLocator.Current.DrawingRectanglesViewModel; } - } + public DrawingRectanglesViewModel DrawingRectanglesViewModel => ViewModelLocator.Current.DrawingRectanglesViewModel; private double _ProgressPercentage; @@ -90,9 +87,17 @@ private void RefreshPlots() PlotModelsContainerViewModel.InvalidateAllPlots(true); } - public FreqProgressViewModel FreqProgressViewModel { get; set; } = new FreqProgressViewModel(); + public FreqProgressViewModel FreqProgressViewModel { get; set; } = new(); + + + private ResultsViewModel _CurrentGlobalScopedResultsViewModel = new(); + + public ResultsViewModel CurrentGlobalScopedResultsViewModel + { + get => _CurrentGlobalScopedResultsViewModel; + set => Set(ref _CurrentGlobalScopedResultsViewModel, value); + } - public ResultsViewModel CurrentGlobalScopedResultsViewModel { get; set; } = new ResultsViewModel(); public async Task DisplayPlots(bool doComputation, DataSeriesType? dataSeriesType = null) @@ -172,6 +177,8 @@ await CurrentGlobalScopedResultsViewModel.ComputeAllResults(ParentVm.MediaPlayer s.ItemsSource = (res.X.Zip(res.Y, (x, y) => new DataPoint(x, y))); pwmt.PlotModel.Series.Add(s); s.Color = OxyColors.Black; + s.TrackerFormatString = "{0}\n{1}: {2:0.000}\n{3}: {4:0.000}"; + } else { @@ -216,7 +223,7 @@ await CurrentGlobalScopedResultsViewModel.ComputeAllResults(ParentVm.MediaPlayer // } // freqProgressPlotModel.Series.Add(comp.LineSeriesDict[DataSeriesType.FreqProgress]); - // //get maximum to better view + // //get maximum to better view // //maxYOfFreqProgress = maxYOfFreqProgress < comp.Algorithm.Results.FreqProgress.Max() ? comp.Algorithm.Results.FreqProgress.Max() : maxYOfFreqProgress; // } diff --git a/TremAn3/ViewModels/PlotModelWithTypeViewModel.cs b/TremAn3/ViewModels/PlotModelWithTypeViewModel.cs index 72149f1..608465e 100644 --- a/TremAn3/ViewModels/PlotModelWithTypeViewModel.cs +++ b/TremAn3/ViewModels/PlotModelWithTypeViewModel.cs @@ -16,6 +16,8 @@ public class PlotModelWithTypeViewModel : ViewModelBase public PlotModel PlotModel { get; set; } public DataSeriesType DataSeriesType { get; set; } + + public DataPoint? CurrentDataPoint { get; set; } } //public static class PlotModelCollectionExtensions diff --git a/TremAn3/ViewModels/PlotModelsContainerViewModel.cs b/TremAn3/ViewModels/PlotModelsContainerViewModel.cs index fa06c30..a7c86b0 100644 --- a/TremAn3/ViewModels/PlotModelsContainerViewModel.cs +++ b/TremAn3/ViewModels/PlotModelsContainerViewModel.cs @@ -9,82 +9,98 @@ using System.Threading.Tasks; using TremAn3.Core; -namespace TremAn3.ViewModels +namespace TremAn3.ViewModels; + +public class PlotModelsContainerViewModel : ViewModelBase { - public class PlotModelsContainerViewModel : ViewModelBase - { - public void SetAllModelsToNoData() - { - PlotModels.ToList().ForEach(x => x.PlotModel = getPlotModelWithNoDataText()); - PlotModelsGlobalScope.ToList().ForEach(x => x.PlotModel = getPlotModelWithNoDataText()); - } - public void SetFreqProgressToNoData() - { - PlotModels.First(x => x.DataSeriesType == DataSeriesType.FreqProgress).PlotModel = getPlotModelWithNoDataText(); - } + public void SetAllModelsToNoData() + { + PlotModels.ToList().ForEach(x => x.PlotModel = getPlotModelWithNoDataText()); + PlotModelsGlobalScope.ToList().ForEach(x => x.PlotModel = getPlotModelWithNoDataText()); + } + public void SetFreqProgressToNoData() + { + PlotModels.First(x => x.DataSeriesType == DataSeriesType.FreqProgress).PlotModel = getPlotModelWithNoDataText(); + } - public void InvalidateTimePlots(bool updateData) - { - PlotModels.Where(x => - x.DataSeriesType == DataSeriesType.FreqProgress || - x.DataSeriesType == DataSeriesType.ComX || - x.DataSeriesType == DataSeriesType.ComY) + public void InvalidateTimePlots(bool updateData) + { + PlotModels.Where(x => + x.DataSeriesType == DataSeriesType.FreqProgress || + x.DataSeriesType == DataSeriesType.ComX || + x.DataSeriesType == DataSeriesType.ComY) .ToList().ForEach(x=>x.PlotModel.InvalidatePlot(updateData)); - } - public void InvalidateAllPlots(bool updateData) - { - PlotModels.ToList().ForEach(x => x.PlotModel.InvalidatePlot(updateData)); - PlotModelsGlobalScope.ToList().ForEach(x => x.PlotModel.InvalidatePlot(updateData)); - } + } + public void InvalidateAllPlots(bool updateData) + { + PlotModels.ToList().ForEach(x => x.PlotModel.InvalidatePlot(updateData)); + PlotModelsGlobalScope.ToList().ForEach(x => x.PlotModel.InvalidatePlot(updateData)); + } - //there is one line series for every roi. For example amp spectrum - public List PlotModels { get; set; } = - new List(); + //there is one line series for every roi. For example amp spectrum + public List PlotModels { get; set; } = []; - //there is only one series for all rois. For example coherence - public List PlotModelsGlobalScope { get; set; } = - new List(); + //there is only one series for all rois. For example coherence + public List PlotModelsGlobalScope { get; set; } = []; - private PlotModel getPlotModelWithNoDataText() - { - return new PlotModel { Title = "No Data" }; - } + private PlotModel getPlotModelWithNoDataText() + { + return new PlotModel { Title = "No Data" }; + } + private string currentDataPointString; + //when moving annotation on plot, all plots change this.. waiting for the future + public string CurrentDataPointString + { + get => currentDataPointString; + private set => Set(ref currentDataPointString, value); + } - /// - /// this needs to be done when new plotModel is presented. - /// - public PlotModel GetPlotModelByDsTypeOrCreateNew( DataSeriesType type) - { - var plotModel = PlotModels.SingleOrDefault(x => x.DataSeriesType == type); + private string GetCurrentDataPoint(PlotModelWithTypeViewModel plotModel) + { + return plotModel?.CurrentDataPoint == null + ? "no data point" + : $"X: {plotModel.CurrentDataPoint.Value.X:0.00}, Y: {plotModel.CurrentDataPoint.Value.Y:0.00} "; + } - if (plotModel == null)//adding new plot models, when xaml asks for them - { - plotModel = new PlotModelWithTypeViewModel() { DataSeriesType = type }; - PlotModels.Add(plotModel); - } - return plotModel.PlotModel; + /// + /// this needs to be done when new plotModel is presented. + /// - } + public PlotModel GetPlotModelByDsTypeOrCreateNew( DataSeriesType type) + { + var plotModel = PlotModels.SingleOrDefault(x => x.DataSeriesType == type); - public PlotModel GetGlobalScopedPlotModelByDsTypeOrCreateNew(DataSeriesType type) + if (plotModel == null)//adding new plot models, when xaml asks for them { - var plotModel = PlotModelsGlobalScope.SingleOrDefault(x => x.DataSeriesType == type); + plotModel = new PlotModelWithTypeViewModel() { DataSeriesType = type }; + PlotModels.Add(plotModel); + } + if(plotModel.PlotModel!=null ) + plotModel.PlotModel.TrackerChanged += (sender, args) => { + plotModel.CurrentDataPoint = args?.HitResult?.DataPoint; + CurrentDataPointString = GetCurrentDataPoint(plotModel); + }; + return plotModel.PlotModel; - if (plotModel == null)//adding new plot models, when xaml asks for them - { - plotModel = new PlotModelWithTypeViewModel() { DataSeriesType = type }; - PlotModelsGlobalScope.Add(plotModel); - } - return plotModel.PlotModel; + } - } + public PlotModel GetGlobalScopedPlotModelByDsTypeOrCreateNew(DataSeriesType type) + { + var plotModel = PlotModelsGlobalScope.SingleOrDefault(x => x.DataSeriesType == type); + if (plotModel == null)//adding new plot models, when xaml asks for them + { + plotModel = new PlotModelWithTypeViewModel() { DataSeriesType = type }; + PlotModelsGlobalScope.Add(plotModel); + } + return plotModel.PlotModel; } + } diff --git a/TremAn3/ViewModels/ResultsViewModel.cs b/TremAn3/ViewModels/ResultsViewModel.cs index 1e5a0a7..d160f5c 100644 --- a/TremAn3/ViewModels/ResultsViewModel.cs +++ b/TremAn3/ViewModels/ResultsViewModel.cs @@ -5,34 +5,63 @@ using System.Text; using System.Threading.Tasks; using TremAn3.Core; +using Windows.UI.Core; -namespace TremAn3.ViewModels +namespace TremAn3.ViewModels; + +using Services; +using Windows.ApplicationModel.Core; + +public class ResultsViewModel : ViewModelBase { - public class ResultsViewModel : ViewModelBase + /// + /// computes all the results and place it into the DataResutlsDict + /// + /// + /// + /// + public async Task ComputeAllResults(double frameRate, List> comXAllRois, List> comYAllRois) { - - - - /// - /// computes all the results and place it into the DataResutlsDict - /// - /// - /// - /// - public async Task ComputeAllResults(double frameRate, List> comXAllRois, List> comYAllRois) - { - await Task.Run(() => - { - Coherence coherence = new Coherence((int)frameRate, comXAllRois, comYAllRois); - DataResultsDict.Clear(); - DataResultsDict.Add(DataSeriesType.Coherence, coherence.Compute()); + await Task.Run(async () => { + Coherence coherence = new Coherence((int)frameRate, comXAllRois, comYAllRois); + DataResultsDict.Clear(); + var coh = coherence.Compute(); + DataResultsDict.Add(DataSeriesType.Coherence, coh); + await WindowManagerService.Current.MainDispatcher.RunAsync(CoreDispatcherPriority.Normal, async () => { + await ComputeAdditionalResults(); }); - } + }); + } - public Dictionary DataResultsDict { get; set; } = new Dictionary(); + public async Task ComputeAllResults(double frameRate, List> comXAllRois, List> comYAllRois, List freqProgress) + { + await Task.Run(async () => { + Coherence coherence = new((int)frameRate, comXAllRois, comYAllRois); + DataResultsDict.Clear(); + var coh = coherence.Compute(); + DataResultsDict.Add(DataSeriesType.Coherence, coh); + await ComputeAdditionalResults(); + }); + } - //public Guid Id { get; set; } = Guid.Empty; + public async Task ComputeAdditionalResults() + { + await WindowManagerService.Current.MainDispatcher.RunAsync(CoreDispatcherPriority.Normal, () => + { + CoherenceAverage = DataResultsDict[DataSeriesType.Coherence].Y.Average(); + }); + } + private double coherenceAverage; + public double CoherenceAverage + { + get => coherenceAverage; + set => Set(ref coherenceAverage, value); } + + + public Dictionary DataResultsDict { get; set; } = new(); + + //public Guid Id { get; set; } = Guid.Empty; } diff --git a/TremAn3/ViewModels/SelectionRectangleComputationViewModel.cs b/TremAn3/ViewModels/SelectionRectangleComputationViewModel.cs index 24192de..d30aa86 100644 --- a/TremAn3/ViewModels/SelectionRectangleComputationViewModel.cs +++ b/TremAn3/ViewModels/SelectionRectangleComputationViewModel.cs @@ -31,7 +31,7 @@ public SelectionRectangleComputationViewModel(Color color, SelectionRectangleVie private bool _IsRoiSameAsResult; //if roi is moved, result doesnt meet the roi, so result is deleted - //setting to false will delete plots + //setting to false will delete plots public bool IsRoiSameAsResult { get => _IsRoiSameAsResult; @@ -108,6 +108,7 @@ public async Task PrepareForDisplay(DataSeriesType dataSeriesType, int stepForFr { ItemsSource = itemSource, Color = color, + TrackerFormatString = "{0}\n{1}: {2:0.000}\n{3}: {4:0.000}", StrokeThickness = parent.IsShowInPlot ? defaultStrokeThickness : notShownStrokeThickness }; diff --git a/TremAn3/ViewModels/SettingsViewModel.cs b/TremAn3/ViewModels/SettingsViewModel.cs index 481812c..42cbec8 100644 --- a/TremAn3/ViewModels/SettingsViewModel.cs +++ b/TremAn3/ViewModels/SettingsViewModel.cs @@ -17,7 +17,7 @@ namespace TremAn3.ViewModels public class SettingsViewModel : ViewModelBase { - + private string _DecimalSeparator = LocalSettings.Read(".", nameof(DecimalSeparator)); @@ -32,7 +32,7 @@ public string DecimalSeparator _DecimalSeparator = value; LocalSettings.Write(value); } - + RaisePropertyChanged(); } } @@ -108,6 +108,41 @@ public bool IsLoadRecentVideoOnAppStart } } + private double _RoiButtonsOpacity = LocalSettings.Read(1.0, nameof(RoiButtonsOpacity)); + + public double RoiButtonsOpacity + { + get => _RoiButtonsOpacity; + set + { + if (!Set(ref _RoiButtonsOpacity, value)) return; + LocalSettings.Write(value); + } + } + + private int _SpectralAnalysisSelectedIndex = LocalSettings.Read(0, nameof(SpectralAnalysisSelectedIndex)); + + public int SpectralAnalysisSelectedIndex + { + get => _SpectralAnalysisSelectedIndex; + set + { + if (!Set(ref _SpectralAnalysisSelectedIndex, value)) return; + LocalSettings.Write(value, nameof(SpectralAnalysisSelectedIndex)); + } + } + private double _RoiCornersOpacity = LocalSettings.Read(1.0, nameof(RoiCornersOpacity)); + + public double RoiCornersOpacity + { + get => _RoiCornersOpacity; + set + { + if (!Set(ref _RoiCornersOpacity, value)) return; + LocalSettings.Write(value); + } + } + public SettingsViewModel() { } diff --git a/TremAn3/Views/FreqCounterUc.xaml b/TremAn3/Views/FreqCounterUc.xaml index 79429ea..df970bc 100644 --- a/TremAn3/Views/FreqCounterUc.xaml +++ b/TremAn3/Views/FreqCounterUc.xaml @@ -19,46 +19,60 @@ - + Target="{x:Bind FreqCounterButton}" + IsOpen="{x:Bind TeachingTipsViewModel.IsCountFreqTtipOpened, Mode=TwoWay}" + PreferredPlacement="Bottom" + CloseButtonClick="{x:Bind TeachingTipsViewModel.TtCountFreqClosed}" + CloseButtonContent="Next" + Title="Start computation here"> + + + + + + + + + + + - - - + + + - + - + - + @@ -66,10 +80,11 @@ - + - + @@ -77,10 +92,11 @@ - + - + @@ -88,10 +104,11 @@ - + - + @@ -120,34 +137,44 @@ - + - + - + - + - - - Video file is no longer available. It has probably been deleted or moved. + + Video file is no longer available. It has probably been deleted or moved. You can still review the measurement. - + - - + + @@ -161,27 +188,32 @@ - + - - + + - + + + - + - + - + - + + - - - + - + - + - + - - + - - + + - + - - + + - - + + + + + + + + + @@ -247,74 +293,93 @@ - + - + - - - + - - + + + - - - + + + - - + + - - - + + + - - - + + + + - + - - - + diff --git a/TremAn3/Views/SelectionRectangleUc.xaml.cs b/TremAn3/Views/SelectionRectangleUc.xaml.cs index 5196976..785f3fc 100644 --- a/TremAn3/Views/SelectionRectangleUc.xaml.cs +++ b/TremAn3/Views/SelectionRectangleUc.xaml.cs @@ -24,7 +24,9 @@ public sealed partial class SelectionRectangleUc : UserControl { public SelectionRectangleViewModel ViewModel { get; set; } - + + public SettingsViewModel SettingsViewModel => ViewModelLocator.Current.SettingsViewModel; + public SelectionRectangleUc() { this.InitializeComponent(); diff --git a/TremAn3/Views/SettingsPage.xaml b/TremAn3/Views/SettingsPage.xaml index d45a807..b589f28 100644 --- a/TremAn3/Views/SettingsPage.xaml +++ b/TremAn3/Views/SettingsPage.xaml @@ -44,6 +44,14 @@ + + + + + + + + From fd97aae09a984471a4f65407f6f7c0b8c8c666cd Mon Sep 17 00:00:00 2001 From: tesar-tech Date: Tue, 2 Jan 2024 10:45:02 +0100 Subject: [PATCH 3/3] No coherance avg when just 1 roi --- TremAn3/ViewModels/ResultsViewModel.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TremAn3/ViewModels/ResultsViewModel.cs b/TremAn3/ViewModels/ResultsViewModel.cs index d160f5c..ed52a1a 100644 --- a/TremAn3/ViewModels/ResultsViewModel.cs +++ b/TremAn3/ViewModels/ResultsViewModel.cs @@ -46,9 +46,9 @@ await Task.Run(async () => { public async Task ComputeAdditionalResults() { - await WindowManagerService.Current.MainDispatcher.RunAsync(CoreDispatcherPriority.Normal, () => - { - CoherenceAverage = DataResultsDict[DataSeriesType.Coherence].Y.Average(); + await WindowManagerService.Current.MainDispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { + if (DataResultsDict.ContainsKey(DataSeriesType.Coherence) && DataResultsDict[DataSeriesType.Coherence].Y != null) + CoherenceAverage = DataResultsDict[DataSeriesType.Coherence].Y.Average(); }); }