Skip to content

Commit

Permalink
avoid AppConfig.Save() on loading
Browse files Browse the repository at this point in the history
  • Loading branch information
TransposonY committed Jun 17, 2017
1 parent 6fbf514 commit 8efa310
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions GestureSign.ControlPanel/MainWindowControls/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ private void VisualFeedbackWidthSlider_ValueChanged(object sender, RoutedPropert
{
UpdateVisualFeedbackExample();

AppConfig.VisualFeedbackWidth = (int)Math.Round(VisualFeedbackWidthSlider.Value);
var newValue = (int)Math.Round(e.NewValue);
if (newValue == AppConfig.VisualFeedbackWidth) return;

AppConfig.VisualFeedbackWidth = newValue;

AppConfig.Save();
}
Expand All @@ -110,15 +113,18 @@ private void OpacitySlider_ValueChanged(object sender, RoutedPropertyChangedEven
{
// Change opacity display text with new value
OpacityText.Text = LocalizationProvider.Instance.GetTextValue("Options.Opacity") + GetAlphaPercentage(OpacitySlider.Value) + "%";
if (Math.Abs(e.NewValue - AppConfig.Opacity) < 0.001) return;

AppConfig.Opacity = OpacitySlider.Value;

AppConfig.Save();
}

private void MinimumPointDistanceSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
if (e.OldValue == 0) return;
AppConfig.MinimumPointDistance = (int)Math.Round(e.NewValue);
var newValue = (int)Math.Round(e.NewValue);
if (newValue == AppConfig.MinimumPointDistance || (int)e.OldValue == 0) return;
AppConfig.MinimumPointDistance = newValue;

AppConfig.Save();
}
Expand Down

0 comments on commit 8efa310

Please sign in to comment.