diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2020-07-05 14:20:32 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2020-07-05 14:20:32 +0300 |
| commit | f2f69df22abf814ac8060bf948cd72adeec08b4b (patch) | |
| tree | 4bf2635615faf3c128f6d6d70c906cf237f99e67 /Software | |
| parent | b79f7dfdb81f7f9ec838f79093858cf7077dd007 (diff) | |
| download | Tango-f2f69df22abf814ac8060bf948cd72adeec08b4b.tar.gz Tango-f2f69df22abf814ac8060bf948cd72adeec08b4b.zip | |
Dispenser Analyzer. Added settings wnd, changes in printing to pdf - set real height of document, removed printing graphs to png files.
Diffstat (limited to 'Software')
10 files changed, 357 insertions, 16 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index 2c605ec36..5586b5341 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -279,7 +279,7 @@ namespace Tango.PPC.Common HotSpotPassword = "Aa123456"; LockScreenTimeout = TimeSpan.FromMinutes(10); LockScreenPassword = "1111"; - DeploymentSlot = DeploymentSlot.TEST; + DeploymentSlot = DeploymentSlot.DEV; EnableWatchDog = true; EnableEmergencyNotifications = true; EmergencyComPort = "COM2"; diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IAnalyzerResult.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IAnalyzerResult.cs index 074d5ec86..6b404d2a5 100644 --- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IAnalyzerResult.cs +++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analysis/IAnalyzerResult.cs @@ -13,6 +13,8 @@ namespace Tango.DispenserAnalyzer.UI.Analysis { public ObservableCollection<DataPoint> Points { get; set; } + public string Title { get; set; } + private int _step; public int XStep { @@ -38,6 +40,7 @@ namespace Tango.DispenserAnalyzer.UI.Analysis { _to = Points.Max(x => x.Y) + 2; _from = Points.Min(x => x.Y)-1; + RaisePropertyChanged("Title"); RaisePropertyChanged("Points"); } diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/FlowAnalyser.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/FlowAnalyser.cs index 60ca14fa9..2d4775a37 100644 --- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/FlowAnalyser.cs +++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Analyzers/FlowAnalyser.cs @@ -22,10 +22,11 @@ namespace Tango.DispenserAnalyzer.UI.Analyzers { return Task.Factory.StartNew<List<IAnalyzerResult>>(() => { - List<IAnalyzerResult> results = new List<IAnalyzerResult>(); - List<DispenserSample> commands = csvRows.Where(x => x.Command != null && x.Command.ToLower().Contains("label")).ToList<DispenserSample>(); - var pairs = commands.Select((x, i) => new { Index = i, Value = x }).GroupBy(x => x.Index / 2).Select(x => x.Select(v => v.Value).ToList()).ToList(); - MovingAverageFilter filter = new MovingAverageFilter(); + List<IAnalyzerResult> results = new List<IAnalyzerResult>(); + List<DispenserSample> commands = csvRows.Where(x => x.Command != null && x.Command.ToLower().Contains("label")).ToList<DispenserSample>(); + var pairs = commands.Select((x, i) => new { Index = i, Value = x }).GroupBy(x => x.Index / 2).Select(x => x.Select(v => v.Value).ToList()).ToList(); + MovingAverageFilter filter = new MovingAverageFilter(); + int flowtestNumber = 0; for (int index = 0; index < pairs.Count(); index++) { var pair = pairs[index]; @@ -73,7 +74,7 @@ namespace Tango.DispenserAnalyzer.UI.Analyzers averageResult.Result = (averageResult.AverageValue <= 1850 && averageResult.AverageValue >= 1400) ? AnalyzerResultValue.Passed : AnalyzerResultValue.Failed; results.Add(averageResult); - FlowAnalyzerResult result = new FlowAnalyzerResult(); + FlowAnalyzerResult result = new FlowAnalyzerResult(++flowtestNumber); result.AverageValue = averageResult.AverageValue; result.SetLocalErrors(differenceMaxMin, differenceMaxMinToLocationArr); results.Add(result); @@ -114,13 +115,15 @@ namespace Tango.DispenserAnalyzer.UI.Analyzers public double AverageValue { get; set; } + public int TestNumber { get; set; } + #endregion Properties - public FlowAnalyzerResult():base() + public FlowAnalyzerResult(int testNumber) :base() { AverageValue = 0.0; Result = AnalyzerResultValue.Undetermined; - //this.Points = new ObservableCollection<DataPoint>(); + TestNumber = testNumber; } /// <summary> @@ -142,6 +145,7 @@ namespace Tango.DispenserAnalyzer.UI.Analyzers } } this.IsShowPlotResult = true; + RangeToCountChart.Title = $"Flow Range To Count {TestNumber}"; RangeToCountChart.UpdateData(); var rangeToTimePoints = RangeToTimeChart.Points; rangeToTimePoints.Clear(); @@ -149,6 +153,7 @@ namespace Tango.DispenserAnalyzer.UI.Analyzers { rangeToTimePoints.Add(new DataPoint(differenceMaxMinToLocationArr.ElementAt(y), differenceMaxMin.ElementAt(y))); } + RangeToTimeChart.Title = $"Flow Time Location To Range {TestNumber}"; RangeToTimeChart.UpdateData(); } diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/MainWindow.xaml b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/MainWindow.xaml index c73d67ba7..e56ae6639 100644 --- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/MainWindow.xaml +++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/MainWindow.xaml @@ -40,7 +40,12 @@ <TextBox x:Name="tbPath" BorderThickness="1" FontSize="16" VerticalContentAlignment="Center" IsReadOnly="False" Grid.Column="0" Margin="0 0 20 0" Text="{Binding OpenFilePath, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" AllowDrop="True" PreviewDrop="TextBlock_PreviewDrop" PreviewDragOver="TextBox_PreviewDragOver" BorderBrush="Silver" Padding="5 0 0 0 "></TextBox> <Button Grid.Column="1" Command="{Binding OpenCSVFileCommand}">Browse</Button> </Grid> - <Button Grid.Row="1" Margin="10 0 10 20" Command="{Binding GenerateCommand}" Content="{Binding ButtonName}"></Button> + <Grid Grid.Row="1" HorizontalAlignment="Stretch" Margin="10 0 20 20"> + <Button Command="{Binding GenerateCommand}" Content="{Binding ButtonName}" Margin="0 0 30 0"></Button> + <Button Command="{Binding OpenSettingWndCommand}" HorizontalAlignment="Right" VerticalAlignment="Center" Width="20" Height="20" Margin="0 0 0 0" Padding="0" Style="{StaticResource MaterialDesignFlatButton}" ToolTip="Open Setting Window"> + <materialDesign:PackIcon Kind="Settings" Width="16" Height="16" VerticalAlignment="Center"></materialDesign:PackIcon> + </Button> + </Grid> <Grid Grid.Row="2"> <Border BorderBrush="Silver" Padding="5" BorderThickness="1" CornerRadius="5" Margin="10"> <Expander Header="{Binding TestName}" IsExpanded="True"> @@ -106,7 +111,7 @@ </ItemsControl> <Border x:Name="PlotBorder" BorderBrush="Silver" Padding="2" BorderThickness="1" CornerRadius="5" Margin="10" Visibility="{Binding IsShowPlotResult, Converter={StaticResource BooleanToVisibilityConverter}}" MinHeight="300"> <StackPanel Orientation="Vertical" x:Name="PlotStackPanel"> - <oxy:Plot Title="Flow Range To Count" x:Name="RangeToCountPlot" LegendPlacement="Outside" LegendPosition="RightTop" LegendOrientation="Vertical" ClipToBounds="True" Loaded="RangeToCountPlot_Loaded" MinWidth="200" MinHeight="300"> + <oxy:Plot Title="{Binding RangeToCountChart.Title}" x:Name="RangeToCountPlot" LegendPlacement="Outside" LegendPosition="RightTop" LegendOrientation="Vertical" ClipToBounds="True" Loaded="RangeToCountPlot_Loaded" MinWidth="220" MinHeight="300"> <oxy:Plot.Series > <oxy:ColumnSeries ItemsSource="{Binding RangeToCountChart.Points}" Color="#73B6EC" StrokeThickness="1" FillColor="#73B6EC" ValueField="Y" LabelFormatString="{}{0}" LabelPlacement="Base" /> </oxy:Plot.Series> @@ -119,7 +124,7 @@ </Border> <Border x:Name="RangeToTimeBorder" BorderBrush="Silver" Padding="2" BorderThickness="1" CornerRadius="5" Margin="10" Visibility="{Binding IsShowPlotResult, Converter={StaticResource BooleanToVisibilityConverter}}" MinHeight="300"> <StackPanel Orientation="Vertical" x:Name="RangeToTimeStackPanel"> - <oxy:Plot Title="Flow Time Location To Range" x:Name="RangeToTimePlot" LegendPlacement="Outside" LegendPosition="RightTop" LegendOrientation="Vertical" ClipToBounds="True" MinWidth="200" MinHeight="300"> + <oxy:Plot Title="{Binding RangeToTimeChart.Title}" x:Name="RangeToTimePlot" LegendPlacement="Outside" LegendPosition="RightTop" LegendOrientation="Vertical" ClipToBounds="True" MinWidth="220" MinHeight="300"> <oxy:Plot.Series > <oxy:LineSeries ItemsSource="{Binding RangeToTimeChart.Points}" Color="#73B6EC" StrokeThickness="1" MarkerFill="SteelBlue" /> </oxy:Plot.Series> diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Models/SettingsModel.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Models/SettingsModel.cs new file mode 100644 index 000000000..0d9e20288 --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Models/SettingsModel.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; + +namespace Tango.DispenserAnalyzer.UI.Models +{ + public class SettingsModel: ExtendedObject + { + private string _propertyName; + + public string PropertyName + { + get { return _propertyName; } + set { _propertyName = value; RaisePropertyChangedAuto(); } + } + + private double _propertyvalue; + + public double PropertyValue + { + get { return _propertyvalue; } + set { _propertyvalue = value; RaisePropertyChangedAuto(); } + } + + private double _defaultValue; + + public double DefaultValue + { + get { return _defaultValue; } + set { _defaultValue = value; RaisePropertyChangedAuto(); } + } + + private string _defaultValueDisplay; + + public string DefaultValueDisplay + { + get { return _defaultValueDisplay; } + set { _defaultValueDisplay = value; } + } + + + public SettingsModel( string propertyName, string defaultValueDisplay, double defaultValue) + { + PropertyName = propertyName; + DefaultValueDisplay = defaultValueDisplay; + DefaultValue = defaultValue; + } + } +} diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Tango.DispenserAnalyzer.UI.csproj b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Tango.DispenserAnalyzer.UI.csproj index 373654985..7efcaa58d 100644 --- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Tango.DispenserAnalyzer.UI.csproj +++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/Tango.DispenserAnalyzer.UI.csproj @@ -143,7 +143,12 @@ <Compile Include="Models\DispenserCsvRow.cs" /> <Compile Include="Models\DispenserSample.cs" /> <Compile Include="Models\DispenserSampleCommand.cs" /> + <Compile Include="Models\SettingsModel.cs" /> <Compile Include="ViewModels\MainWindowVM.cs" /> + <Compile Include="ViewModels\SettingsVM.cs" /> + <Compile Include="View\SettingsWnd.xaml.cs"> + <DependentUpon>SettingsWnd.xaml</DependentUpon> + </Compile> <Page Include="MainWindow.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -156,6 +161,10 @@ <DependentUpon>MainWindow.xaml</DependentUpon> <SubType>Code</SubType> </Compile> + <Page Include="View\SettingsWnd.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs"> diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/View/SettingsWnd.xaml b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/View/SettingsWnd.xaml new file mode 100644 index 000000000..5c3cbb054 --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/View/SettingsWnd.xaml @@ -0,0 +1,155 @@ +<Window x:Class="Tango.DispenserAnalyzer.UI.View.SettingsWnd" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + 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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:local="clr-namespace:Tango.DispenserAnalyzer.UI.View" + mc:Ignorable="d" + Title="Settings" Height="760" Width="800" FontSize="22" ResizeMode="NoResize" WindowStyle="ToolWindow"> + <Window.Resources> + <Style TargetType="{x:Type TextBlock}" x:Key="WrapText"> + <Setter Property="TextWrapping" Value="Wrap"/> + </Style> + + <Style TargetType="DataGridColumnHeader" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}"> + <Setter Property="HorizontalAlignment" Value="Left"></Setter> + <Setter Property="HorizontalContentAlignment" Value="Left"></Setter> + <Setter Property="Padding" Value="0 0 0 0"></Setter> + <Setter Property="Margin" Value="8 0 0 0"></Setter> + <Setter Property="FontWeight" Value="SemiBold"/> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="Height" Value="Auto"/> + <Setter Property="FontSize" Value="14"/> + </Style> + <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> + <Setter Property="Padding" Value="1" /> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="FocusVisualStyle" Value="{x:Null}"/> + <Setter Property="VerticalContentAlignment" Value="Center"></Setter> + <Setter Property="VerticalAlignment" Value="Center"/> + <Setter Property="HorizontalAlignment" Value="Left"/> + <Setter Property="Margin" Value="8 0 8 0"/> + <Setter Property="Height" Value="Auto"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type DataGridCell}"> + <ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> + </ControlTemplate> + </Setter.Value> + </Setter> + <Style.Triggers> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" /> + </Trigger> + </Style.Triggers> + </Style> + <Style TargetType="DataGridRow" BasedOn="{StaticResource {x:Type DataGridRow}}"> + <Setter Property="BorderThickness" Value="0 0 0 1"/> + <Setter Property="BorderBrush" Value="LightGray"/> + <Setter Property="Height" Value="Auto"/> + <Style.Triggers> + <Trigger Property="IsMouseOver" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Foreground" Value="#4fc3f7" /> + <Setter Property="Cursor" Value="Hand"></Setter> + </Trigger> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + </Trigger> + <Trigger Property="IsFocused" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + </Trigger> + </Style.Triggers> + </Style> + + <Style TargetType="DataGrid" BasedOn="{StaticResource {x:Type DataGrid}}"> + <Setter Property="BorderBrush" Value="#FF688CAF"/> + <Setter Property="BorderThickness" Value="1"/> + <Setter Property="HorizontalScrollBarVisibility" Value="Disabled" /> + </Style> + + <DataGrid x:Key="PropertyDataGrid" AutoGenerateColumns="False" ItemsSource="{Binding .}" x:Shared="False" GridLinesVisibility="None" SelectionMode="Single" SelectionUnit="FullRow" RowHeight="80" + AlternatingRowBackground="#F6F6F6" CanUserReorderColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeColumns="False" CanUserResizeRows="False" VerticalScrollBarVisibility="Visible" + CanUserSortColumns="True" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" FontSize="14" > + <DataGrid.Columns> + <DataGridTextColumn Header="Property Name" Binding="{Binding PropertyName}" Width="150" ElementStyle="{StaticResource WrapText}"/> + <DataGridTextColumn Header="Property Value" Binding="{Binding PropertyValue}" Width="150" IsReadOnly="False"></DataGridTextColumn> + <DataGridTextColumn Header="Default Value" Binding="{Binding DefaultValueDisplay}" Width="150" ElementStyle="{StaticResource WrapText}" /> + <DataGridTemplateColumn Header="" Width="1*"> + <DataGridTemplateColumn.CellStyle> + <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="FocusVisualStyle" Value="{x:Null}"/> + <Setter Property="VerticalContentAlignment" Value="Center"></Setter> + <Setter Property="VerticalAlignment" Value="Center"/> + <Setter Property="HorizontalAlignment" Value="Stretch"/> + <Setter Property="Margin" Value="0 0 0 0"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type DataGridCell}"> + <ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> + </ControlTemplate> + </Setter.Value> + </Setter> + <Style.Triggers> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" /> + </Trigger> + </Style.Triggers> + </Style> + </DataGridTemplateColumn.CellStyle> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <Grid HorizontalAlignment="Stretch" VerticalAlignment="Center"> + <Button Width="100" Padding="2" >Set Default</Button> + </Grid> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + </DataGrid.Columns> + </DataGrid> + </Window.Resources> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + <RowDefinition Height="Auto"/> + </Grid.RowDefinitions> + <Grid.ColumnDefinitions> + + </Grid.ColumnDefinitions> + <DockPanel Grid.Row="0"> + <Grid DockPanel.Dock="Top" Height="Auto" VerticalAlignment="Top"> + <Border Margin="20" BorderBrush="LightGray" BorderThickness="0.6" CornerRadius="4" Height="36"> + <Border.Effect> + <DropShadowEffect/> + </Border.Effect> + </Border> + <Border Margin="20" BorderBrush="LightGray" BorderThickness="0.6" CornerRadius="4" Height="34" Background="#C4EEFC"> + <TextBlock FontSize="22" Padding="2">Pressure build up test</TextBlock> + </Border> + </Grid> + <ContentControl Margin="20 0 20 10" Content="{StaticResource PropertyDataGrid}" DataContext="{Binding Path=PBUTestSettings}"></ContentControl> + </DockPanel> + <DockPanel Grid.Row="1"> + <Grid DockPanel.Dock="Top" Height="Auto" VerticalAlignment="Top"> + <Border Margin="20" BorderBrush="LightGray" BorderThickness="0.6" CornerRadius="4" Height="36"> + <Border.Effect> + <DropShadowEffect/> + </Border.Effect> + </Border> + <Border Margin="20" BorderBrush="LightGray" BorderThickness="0.6" CornerRadius="4" Height="34" Background="#C4EEFC"> + <TextBlock FontSize="22" Padding="2">Flow test</TextBlock> + </Border> + </Grid> + <ContentControl Content="{StaticResource PropertyDataGrid}" DataContext="{Binding Path=FlowTestSettings}" Margin="20 0 20 10" ></ContentControl> + + </DockPanel> + <Grid Grid.Row="2" > + <Button Width="80" HorizontalAlignment="Right" Margin="20">Save</Button> + </Grid> + </Grid> +</Window> diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/View/SettingsWnd.xaml.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/View/SettingsWnd.xaml.cs new file mode 100644 index 000000000..f0e35726e --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/View/SettingsWnd.xaml.cs @@ -0,0 +1,38 @@ +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.Shapes; +using Tango.DispenserAnalyzer.UI.ViewModels; + +namespace Tango.DispenserAnalyzer.UI.View +{ + /// <summary> + /// Interaction logic for SettingsWnd.xaml + /// </summary> + public partial class SettingsWnd : Window + { + public SettingsWnd() + { + InitializeComponent(); + DataContext = new SettingsVM(); + Loaded += Window_loaded; + } + + private void Window_loaded(object sender, RoutedEventArgs e) + { + Application curApp = Application.Current; + Window mainWindow = curApp.MainWindow; + this.Left = mainWindow.Left + (mainWindow.Width - this.ActualWidth) / 2; + this.Top = mainWindow.Top + (mainWindow.Height - this.ActualHeight) / 2; + } + } +} diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/ViewModels/MainWindowVM.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/ViewModels/MainWindowVM.cs index 1182d5301..ab571ec43 100644 --- a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/ViewModels/MainWindowVM.cs +++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/ViewModels/MainWindowVM.cs @@ -27,6 +27,7 @@ using System.Windows.Media.Imaging; using PdfSharp; using OxyPlot.Reporting; using System.Threading; +using Tango.DispenserAnalyzer.UI.View; namespace Tango.DispenserAnalyzer.UI.ViewModels { @@ -144,12 +145,14 @@ namespace Tango.DispenserAnalyzer.UI.ViewModels public RelayCommand OpenCSVFileCommand { get; set; } public RelayCommand GenerateCommand { get; set; } + public RelayCommand OpenSettingWndCommand { get; set; } public MainWindowVM() { OpenCSVFileCommand = new RelayCommand(OpenCSVFile); GenerateCommand = new RelayCommand(Generate, CanGenerate); - + OpenSettingWndCommand = new RelayCommand(OpenSettingWnd); + YFormatter = value => value.ToString(); _from = 0; _to = 1; @@ -160,6 +163,18 @@ namespace Tango.DispenserAnalyzer.UI.ViewModels this.Points = new List<DataPoint>(); } + + #region Settings + + public void OpenSettingWnd() + { + SettingsWnd settings = new SettingsWnd(); + settings.Owner = System.Windows.Application.Current.MainWindow; + settings.ShowDialog(); + } + + #endregion + #region Read File private void OpenCSVFile() { @@ -209,6 +224,7 @@ namespace Tango.DispenserAnalyzer.UI.ViewModels } } #endregion + #region Generate public bool CanGenerate() { @@ -351,10 +367,11 @@ namespace Tango.DispenserAnalyzer.UI.ViewModels string pngPlotFileName = String.Format($"{fileNameWithoutExtension}_Plottest{index}.png"); File.Delete(pngPlotFileName); System.Windows.Controls.Image plotImage = new System.Windows.Controls.Image(); - using (var stream = File.Open(pngPlotFileName, FileMode.Create, FileAccess.ReadWrite)) + //print plot to png file - removed 2/07/2020 + //using (var stream = File.Open(pngPlotFileName, FileMode.Create, FileAccess.ReadWrite)) { PngExporter exporter = new PngExporter() { Width = (int)item.ActualWidth, Height = (int)item.ActualHeight, Background = OxyColors.White, Resolution = 96 }; - exporter.Export(item.ActualModel, stream); + //exporter.Export(item.ActualModel, stream); BitmapSource bitmap = exporter.ExportToBitmap(item.ActualModel); plotImage.Source = bitmap; @@ -400,7 +417,10 @@ namespace Tango.DispenserAnalyzer.UI.ViewModels FixedDocument fixedDoc = new FixedDocument(); PageContent pageContent = new PageContent(); FixedPage fixedPage = new FixedPage(); + fixedPage.Width = reportSize.Width; + fixedPage.Height = reportSize.Height; fixedPage.Children.Add(ResultsPanel); + fixedPage.UpdateLayout(); pageContent.BeginInit(); ((System.Windows.Markup.IAddChild)pageContent).AddChild(fixedPage); @@ -445,8 +465,8 @@ namespace Tango.DispenserAnalyzer.UI.ViewModels private static Size GetReportSize(ItemsControl reportContainer) { - double reportWidth = reportContainer.ActualWidth; - double reportHeight = reportContainer.ActualHeight;// (reportWidth / printDialog.PrintableAreaWidth) * printDialog.PrintableAreaHeight; + double reportWidth = reportContainer.ActualWidth + 10; + double reportHeight = reportContainer.ActualHeight + 10;// (reportWidth / printDialog.PrintableAreaWidth) * printDialog.PrintableAreaHeight; return new Size(reportWidth, reportHeight); } diff --git a/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/ViewModels/SettingsVM.cs b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/ViewModels/SettingsVM.cs new file mode 100644 index 000000000..99b6e948a --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/ViewModels/SettingsVM.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DispenserAnalyzer.UI.Models; +using Tango.SharedUI; + +namespace Tango.DispenserAnalyzer.UI.ViewModels +{ + public class SettingsVM : ViewModel + { + private ObservableCollection<SettingsModel> _PBUSettings; + + public ObservableCollection<SettingsModel> PBUTestSettings + { + get { return _PBUSettings; } + set { _PBUSettings = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<SettingsModel> _flowTestSettings; + + public ObservableCollection<SettingsModel> FlowTestSettings + { + get { return _flowTestSettings; } + set { _flowTestSettings = value; RaisePropertyChangedAuto(); } + } + + public SettingsVM() + { + _PBUSettings = new ObservableCollection<SettingsModel>(); + InitPBUTestSettings(); + _flowTestSettings = new ObservableCollection<SettingsModel>(); + InitFlowTestSettings(); + } + + private void InitPBUTestSettings() + { + _PBUSettings.Add(new SettingsModel("PBU Pass fail", "4.5 sec", 4.5)); + } + + private void InitFlowTestSettings() + { + _flowTestSettings.Add(new SettingsModel("PBU Pass fail", "4.5 sec", 4.5)); + _flowTestSettings.Add(new SettingsModel("Exclude from analysis", "1800 reads", 1800)); + _flowTestSettings.Add(new SettingsModel("Avg value", "1400-1850 [mbar]", 1400)); + _flowTestSettings.Add(new SettingsModel("Max-Min range", "500 reads", 500)); + _flowTestSettings.Add(new SettingsModel("Max Min intervals", "300 reads", 300)); + _flowTestSettings.Add(new SettingsModel("Max error", "1.5%", 1.5)); + _flowTestSettings.Add(new SettingsModel("Take off 'Max-min' values (out of highest results)", "3", 3)); + } + } +} |
