Commit dbb9f267 authored by Francesco Carraro's avatar Francesco Carraro
Browse files

added num of points for alignment

parent 872c3bf2
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -19,12 +19,12 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts
            if (!tryReadAreSeparatorsVisible())
                AreSeparatorsVisible = true;

            tryReadNumOfPointsForAlignment();

            tryReadWavelengthModel(0);
            tryReadWavelengthModel(1);
            tryReadWavelengthModel(2);
            tryReadWavelengthModel(3);

            NumOfPointsForAlignment = 3;
        }

        #region properties
@@ -39,7 +39,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts
        public int NumOfPointsForAlignment
        {
            get { return numOfPointsForAlignment; }
            set { numOfPointsForAlignment = value; saveNumOfPointsForAlignment(value); RaisePropertyChanged(nameof(AreSeparatorsVisible)); }
            set { numOfPointsForAlignment = value; System.Diagnostics.Debug.WriteLine($"numOfPointsForAlignment: {numOfPointsForAlignment}"); saveNumOfPointsForAlignment(value); RaisePropertyChanged(nameof(AreSeparatorsVisible)); }
        }

        private WavelengthModel separatorWavelength0;
@@ -76,6 +76,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts
        {
            settingsHelper.save(Constants.Constants.ARE_SEPARATORS_VISIBLE, areVisible.ToString());
        }

        private void saveNumOfPointsForAlignment(int numOfPoints)
        {
            settingsHelper.save(Constants.Constants.NUM_OF_POINTS_FOR_ALIGNMENT, numOfPoints.ToString());
@@ -93,12 +94,13 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts
            string value = settingsHelper.get(Constants.Constants.ARE_SEPARATORS_VISIBLE);
            if (!string.IsNullOrEmpty(value))
            {
                AreSeparatorsVisible = value.ToBool();
                areSeparatorsVisible = value.ToBool();
                isFound = true;
            }

            return isFound;
        }

        public bool tryReadNumOfPointsForAlignment()
        {
            bool isFound = false;
@@ -106,7 +108,7 @@ namespace INAF.Apps.Uwp.SLabDataManager.Charts
            string value = settingsHelper.get(Constants.Constants.NUM_OF_POINTS_FOR_ALIGNMENT);
            if (!string.IsNullOrEmpty(value))
            {
                NumOfPointsForAlignment = value.ToIntInvariant();
                numOfPointsForAlignment = value.ToIntInvariant();
                isFound = true;
            }

+13 −0
Original line number Diff line number Diff line
@@ -63,6 +63,19 @@ namespace INAF.Apps.Uwp.SLabDataManager.Converters
        }
    }

    public sealed class DoubleToIntConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            return System.Convert.ToDouble(value);
        }

        public object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            return System.Convert.ToInt32(value);
        }
    }

    public sealed class ShortFilepathConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, string language)
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
    <extconverters:BoolToVisibilityInverseConverter x:Key="BoolToVisibilityInverseConverter" />
    <converters:ChartDataPointConverter x:Key="ChartDataPointConverter" />
    <converters:ChartGridItemsVisibilityConverter x:Key="ChartGridItemsVisibilityConverter" />
    <converters:DoubleToIntConverter x:Key="DoubleToIntConverter" />
    <converters:ShortFilepathConverter x:Key="ShortFilepathConverter" />
    <converters:StatusToImageConverter x:Key="StatusToImageConverter" />
    <converters:StatusToSolidColorBrushConverter x:Key="StatusToSolidColorBrushConverter" />
+23 −4
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:telerikInput="using:Telerik.UI.Xaml.Controls.Input"
    xmlns:telerikChart="using:Telerik.UI.Xaml.Controls.Chart"
    xmlns:telerikPrimitives="using:Telerik.UI.Xaml.Controls.Primitives"
    xmlns:ui="using:INAF.Apps.Uwp.SLabDataManager.Helpers.UI"
@@ -159,6 +160,7 @@
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <!-- CHECKBOX SEPARATORS VISIBILITY -->
                <CheckBox x:Name="checkboxSeparatorsVisibility"
@@ -187,6 +189,21 @@
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                </Grid>
                <!-- NUM OF POINTS FOR ALIGNMENT -->
                <telerikInput:RadNumericBox x:Name="inputNumOfPoints"
                                            AllowNullValue="False"
                                            Value="{x:Bind ViewModel.WorkingItems.AlignmentConfig.NumOfPointsForAlignment, Converter={StaticResource DoubleToIntConverter}, Mode=TwoWay}"
                                            Minimum="3"
                                            Maximum="100"
                                            SmallChange="1"
                                            LargeChange="5"
                                            ValueFormat="{}{0,0:N0}"
                                            IsEditable="True"
                                            Width="60"
                                            Margin="24,8,8,8"
                                            HorizontalAlignment="Left"
                                            Background="{StaticResource myBackground}"
                                            Grid.Row="2" />
                <!-- BUTTON ALIGN SPECTRUM -->
                <Button x:Name="buttonVisualizationOptions"
                    FontFamily="Segoe MDL2 Assets"
@@ -194,8 +211,8 @@
                    HorizontalAlignment="Left"
                    Width="48"
                    Height="36"
                    Margin="8"
                    Grid.Row="2">
                    Margin="24,8,8,8"
                    Grid.Row="3">
                    <ToolTipService.ToolTip>
                        <TextBlock x:Uid="RawSpectrumDoAlignment" />
                    </ToolTipService.ToolTip>
@@ -206,8 +223,8 @@
                    </Interactivity:Interaction.Behaviors>
                </Button>
                <TextBlock x:Uid="RawSpectrumDoAlignment"
                           Margin="64,16,0,0"
                           Grid.Row="2"/>
                           Margin="80,16,0,0"
                           Grid.Row="3"/>
            </Grid>
        </Flyout>

@@ -248,6 +265,7 @@
                    Width="48"
                    Height="36"
                    Margin="8"
                    Background="{StaticResource myBackground}"
                    Grid.Column="1"
                    DataContext="{Binding ElementName=Self, Mode=OneWay}"
                    Flyout="{StaticResource AlignmentOptionsFlyout}">
@@ -263,6 +281,7 @@
                    Width="48"
                    Height="36"
                    Margin="8"
                    Background="{StaticResource myBackground}"
                    Grid.Column="2"
                    DataContext="{Binding ElementName=Self, Mode=OneWay}"
                    Flyout="{StaticResource VisualizationOptionsFlyout}">
+4 −0
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@
                        Width="48"
                        Height="36"
                        Margin="8"
                        Background="{StaticResource myBackground}"
                        Grid.Row="1"
                        Grid.Column="0">
                    <SymbolIcon Symbol="OpenFile"/>
@@ -110,6 +111,7 @@
                        Width="48"
                        Height="36"
                        Margin="8"
                        Background="{StaticResource myBackground}"
                        Grid.Row="1"
                        Grid.Column="2"
                        DataContext="{Binding ElementName=Self, Path=DataContext.RecentFilesRawContainer, Mode=OneWay}"
@@ -204,6 +206,7 @@
                        Width="48"
                        Height="36"
                        Margin="8"
                        Background="{StaticResource myBackground}"
                        Grid.Row="1"
                        Grid.Column="0">
                    <SymbolIcon Symbol="Flag"/>
@@ -225,6 +228,7 @@
                        Width="48"
                        Height="36"
                        Margin="8"
                        Background="{StaticResource myBackground}"
                        Grid.Row="1"
                        Grid.Column="2"
                        DataContext="{Binding ElementName=Self, Path=DataContext.RecentFilesRefContainer, Mode=OneWay}"