private void sliderOuterDiskRadius_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { if (TheMainWindow == null) { return; } Config.OuterRadius = sliderOuterDiskRadius.Value; labelOuterDiskRadiusValue.Content = Config.OuterRadius.ToString("0"); TheMainWindow.OuterDisk.Width = 2 * Config.OuterRadius; TheMainWindow.OuterDisk.Height = 2 * Config.OuterRadius; TheMainWindow.ResizeWindow(); }
private void sliderInnerDiskRadius_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { // This is VERY NECESSARY because apparently this method CAN and WILL get called before // the value of TheMainWindow is assigned in the constructor. // Even if we do the obvious and only call InitializeComponent() and everything else after // it has been assigned. Spooky. if (TheMainWindow == null) { return; } Config.InnerRadius = sliderInnerDiskRadius.Value; labelInnerDiskRadiusValue.Content = Config.InnerRadius.ToString("0"); TheMainWindow.InnerDisk.Width = 2 * Config.InnerRadius; TheMainWindow.InnerDisk.Height = 2 * Config.InnerRadius; // TODO: Fix resizing the window being jittery if the window dimensions actually end up changing. TheMainWindow.ResizeWindow(); }