/// <summary> /// This event is generated every time the user clicks a Radio Button in the Geometry Scaling section /// The method just get the Radio Button clicked and saves the ScaleValue selected /// This are the values used for the scales: /// - 2 - Small /// 0 - Medium (Default) /// 2 - Large /// 4 - Extra Large /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Geometry_Scaling_Checked(object sender, RoutedEventArgs e) { RadioButton selectedScaling = sender as RadioButton; var radioButtons = GeometryScalingRadiosPanel.Children.OfType <RadioButton>(); int index = 0; //We need to loop all the radiobuttons in the GeometryScaling section in order to find the index of the selected one foreach (var radio in radioButtons) { if (radio == selectedScaling) { scaleValue = GeometryScalingOptions.ConvertUIToScaleFactor(index); break; } index++; } }
/// <summary> /// This event is generated every time the user clicks a Radio Button in the Geometry Scaling section /// This are the values used for the scales: /// - 2 - Small /// 0 - Medium (Default) /// 2 - Large /// 4 - Extra Large /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Geometry_Scaling_Checked(object sender, RoutedEventArgs e) { RadioButton selectedScaling = sender as RadioButton; var radioButtons = GeometryScalingRadiosPanel.Children.OfType <RadioButton>(); int index = 0; int scaleValue = 0; //We need to loop all the radiobuttons in the GeometryScaling section in order to find the index of the selected one foreach (var radio in radioButtons) { if (radio == selectedScaling) { scaleValue = GeometryScalingOptions.ConvertUIToScaleFactor(index); break; } index++; } //If the new radio button selected (ScaleValue) is different than the current one in Dynamo, we update the current one if (dynViewModel.ScaleFactorLog != scaleValue) { dynViewModel.ScaleFactorLog = scaleValue; dynViewModel.CurrentSpace.HasUnsavedChanges = true; //Due that binding are done before the contructor of this class we need to execute the Log only if the viewModel was assigned previously if (viewModel != null) { Log(String.Format("Geometry working range changed to {0} ({1}, {2})", viewModel.ScaleRange.Item1, viewModel.ScaleRange.Item2, viewModel.ScaleRange.Item3)); viewModel.UpdateSavedChangesLabel(); Dynamo.Logging.Analytics.TrackEvent( Actions.Switch, Categories.Preferences, Res.PreferencesViewVisualSettingsGeoScaling); } var allNodes = dynViewModel.HomeSpace.Nodes; dynViewModel.HomeSpace.MarkNodesAsModifiedAndRequestRun(allNodes, forceExecute: true); } }