From 3705f1e19c88bed5acf95da615eb549cfed5f24e Mon Sep 17 00:00:00 2001 From: Phillip Smith Date: Sun, 22 Dec 2019 12:06:52 +1100 Subject: [PATCH] Update --- .../ViewModels/ExportChartViewModel.cs | 34 +++++++------------ .../Views/ExportChartView.xaml | 15 ++++---- 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/Project/EveryoneIsJohnTracker/ViewModels/ExportChartViewModel.cs b/Project/EveryoneIsJohnTracker/ViewModels/ExportChartViewModel.cs index 45d9b25..141f574 100644 --- a/Project/EveryoneIsJohnTracker/ViewModels/ExportChartViewModel.cs +++ b/Project/EveryoneIsJohnTracker/ViewModels/ExportChartViewModel.cs @@ -7,7 +7,7 @@ // File Name: ExportChartViewModel.cs // // Current Data: -// 2019-12-22 11:16 AM +// 2019-12-22 12:05 PM // // Creation Date: // 2019-12-22 11:05 AM @@ -38,8 +38,6 @@ internal class ExportChartViewModel : PropertyChangedBase { private BitmapImage _bitmapImage = new BitmapImage(); private ChartModel _chartModel = new ChartModel(); - private double _defaultHeight = 419; - private double _defaultWidth = 448; private string _hexColourValue = "#FFFFFF"; private double _imageZoom = 1; @@ -50,6 +48,8 @@ internal class ExportChartViewModel : PropertyChangedBase private int _renderWidth = 1080; private bool _saveEnabled; private double _windowHeight = 419; + private double _windowMinHeight = 419; + private double _windowMinWidth = 448; private double _windowWidth = 448; public bool SaveEnabled @@ -73,20 +73,20 @@ public double WindowWidth public double ImageZoom { get => _imageZoom; - set => SetValue(ref _imageZoom, value); + private set => SetValue(ref _imageZoom, value); } public BitmapImage BitmapImage { get => _bitmapImage; - set + private set { ImageZoom = 1; SetValue(ref _bitmapImage, value); } } - public ChartModel ChartModel + private ChartModel ChartModel { get => _chartModel; set => SetValue(ref _chartModel, value); @@ -123,16 +123,16 @@ public string OutputPath public ActionCommand CommandSaveImage { get; } public ActionCommand CommandMouseWheel { get; } - public double DefaultWidth + public double WindowMinWidth { - get => _defaultWidth; - set => SetValue(ref _defaultWidth, value); + get => _windowMinWidth; + set => SetValue(ref _windowMinWidth, value); } - public double DefaultHeight + public double WindowMinHeight { - get => _defaultHeight; - set => SetValue(ref _defaultHeight, value); + get => _windowMinHeight; + set => SetValue(ref _windowMinHeight, value); } public ExportChartViewModel() @@ -160,7 +160,7 @@ private void MouseWheel(object obj) ? Math.Min(_imageZoom + 0.1, 4) : Math.Max(_imageZoom - 0.1, 0.01); - ImageZoom = zoom.LimitToRange(0.01, 4); + ImageZoom = zoom.LimitToRange(0.1, 4); if (_imageZoom.IsInfinity()) { @@ -218,8 +218,6 @@ private Chart GenerateChart() // TODO: Make process run on own thread private void RenderImage() { - ResetWindowSize(); - // Creates a new chart var newChart = GenerateChart(); @@ -256,12 +254,6 @@ private void RenderImage() SaveEnabled = true; } - private void ResetWindowSize() - { - WindowWidth = DefaultWidth; - WindowHeight = DefaultHeight; - } - private void ChangeOutput() { if (BitmapImage is null) diff --git a/Project/EveryoneIsJohnTracker/Views/ExportChartView.xaml b/Project/EveryoneIsJohnTracker/Views/ExportChartView.xaml index 7fe5ce0..cc9490a 100644 --- a/Project/EveryoneIsJohnTracker/Views/ExportChartView.xaml +++ b/Project/EveryoneIsJohnTracker/Views/ExportChartView.xaml @@ -12,9 +12,13 @@ Icon="/EveryoneIsJohnTracker;component/Images/Icon.ico" Title="Export Chart" SizeToContent="WidthAndHeight" - ResizeMode="CanResize" - MinWidth="{Binding DefaultWidth}" - MinHeight="{Binding DefaultHeight}"> + ResizeMode="NoResize" + Width="{Binding WindowWidth}" + Height="{Binding WindowHeight}" + MinWidth="{Binding WindowMinWidth}" + MinHeight="{Binding WindowMinHeight}" + MaxWidth="1280" + MaxHeight="720"> @@ -173,14 +177,13 @@ - + - \ No newline at end of file