aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/ViewModels/MainWindowVM.cs
diff options
context:
space:
mode:
authorVictoria Plitt <Victoria.Plitt@twine-s.com>2020-07-05 14:20:32 +0300
committerVictoria Plitt <Victoria.Plitt@twine-s.com>2020-07-05 14:20:32 +0300
commitf2f69df22abf814ac8060bf948cd72adeec08b4b (patch)
tree4bf2635615faf3c128f6d6d70c906cf237f99e67 /Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/ViewModels/MainWindowVM.cs
parentb79f7dfdb81f7f9ec838f79093858cf7077dd007 (diff)
downloadTango-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/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/ViewModels/MainWindowVM.cs')
-rw-r--r--Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/ViewModels/MainWindowVM.cs30
1 files changed, 25 insertions, 5 deletions
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);
}