private void UpdatePathCombobox() { bool isTriggerBoolean = AnimationLayerHandler.IsTriggerBooleanValueBased(Context.Properties.TriggerMode); // If the trigger items are currently all booleans, and the trigger is now boolean, don't re-populate the list (it will clear the user's selection). // Same goes for if it already contains numeric items and we are now in a numeric mode. if (triggerPathItemsAreBoolean.HasValue && triggerPathItemsAreBoolean == isTriggerBoolean) { return; } triggerPathItemsAreBoolean = isTriggerBoolean; // Get a list of the parameters. If trigger is boolean mode, filters to only boolean values, else does numeric values var parameters = profile.ParameterLookup?.Where(kvp => isTriggerBoolean ? kvp.Value.Item1 == typeof(bool) : TypeUtils.IsNumericType(kvp.Value.Item1) ); // Add the items to the trigger path combobox triggerPath.Items.Clear(); foreach (var item in parameters) { triggerPath.Items.Add(item.Key); } }
private void UpdatePathCombobox() { bool isTriggerBoolean = AnimationLayerHandler.IsTriggerBooleanValueBased(Context.Properties.TriggerMode); // If the trigger items are currently all booleans, and the trigger is now boolean, don't re-populate the list (it will clear the user's selection). // Same goes for if it already contains numeric items and we are now in a numeric mode. //if (triggerPathItemsAreBoolean.HasValue && triggerPathItemsAreBoolean == isTriggerBoolean) // return; triggerPathItemsAreBoolean = isTriggerBoolean; // Get a list of the parameters. If trigger is boolean mode, filters to only boolean values, else does numeric values /*triggerPath.ItemsSource = profile?.ParameterLookup? * .Where(kvp => isTriggerBoolean * ? kvp.Value.Item1 == typeof(bool) * : TypeUtils.IsNumericType(kvp.Value.Item1) * ) * .Select(kvp => kvp.Key) * .ToList();*/ }
private void triggerMode_SelectionChanged(object sender, SelectionChangedEventArgs e) { AnimationTriggerMode selectedItem = ((KeyValuePair <string, AnimationTriggerMode>)(sender as ComboBox).SelectedItem).Value; if (CanSet) { Context.Properties._TriggerMode = selectedItem; } // Only show trigger path when one of the path-like modes is set triggerGridLayout.RowDefinitions[1].Height = new GridLength(AnimationLayerHandler.IsTriggerNumericValueBased(selectedItem) || AnimationLayerHandler.IsTriggerBooleanValueBased(selectedItem) ? 28 : 0); // Only show tigger keys when one of the key-like modes is set triggerGridLayout.RowDefinitions[2].Height = new GridLength(AnimationLayerHandler.IsTriggerKeyBased(selectedItem) ? 160 : 0); triggerGridLayout.RowDefinitions[3].Height = new GridLength(AnimationLayerHandler.IsTriggerKeyBased(selectedItem) ? 28 : 0); // Only show the stack mode setting if the trigger mode is NOT "AlwaysOn" triggerGridLayout.RowDefinitions[4].Height = new GridLength(selectedItem == AnimationTriggerMode.AlwaysOn ? 0 : 28); // Only show the force terminate setting if the trigger mode is key press or when key held (not released) triggerGridLayout.RowDefinitions[5].Height = new GridLength(selectedItem == AnimationTriggerMode.OnKeyPress || selectedItem == AnimationTriggerMode.WhileKeyHeld ? 28 : 0); // Update the combobox UpdatePathCombobox(); }
private void UpdateUI() { // Shortcut to the trigger mode var trigMode = Context.Properties.TriggerMode; // Only show trigger path when one of the path-like modes is set triggerGridLayout.RowDefinitions[1].Height = new GridLength(AnimationLayerHandler.IsTriggerNumericValueBased(trigMode) || AnimationLayerHandler.IsTriggerBooleanValueBased(trigMode) ? 28 : 0); // Only show IEvaluatable<object>when one of the evaluatable modes is set triggerGridLayout.RowDefinitions[2].Height = new GridLength(0, AnimationLayerHandler.IsTriggerEvaluatableNumericValueBased(trigMode) || AnimationLayerHandler.IsTriggerEvaluatableBooleanValueBased(trigMode) ? GridUnitType.Auto : GridUnitType.Pixel); // Only show tigger keys when one of the key-like modes is set triggerGridLayout.RowDefinitions[3].Height = new GridLength(AnimationLayerHandler.IsTriggerKeyBased(trigMode) ? 160 : 0); triggerGridLayout.RowDefinitions[4].Height = new GridLength(AnimationLayerHandler.IsTriggerKeyBased(trigMode) ? 28 : 0); // Only show the stack mode setting if the trigger mode is NOT "AlwaysOn" triggerGridLayout.RowDefinitions[5].Height = new GridLength(trigMode == AnimationTriggerMode.AlwaysOn ? 0 : 28); // Only show the force terminate setting if the trigger mode is key press or when key held (not released) triggerGridLayout.RowDefinitions[6].Height = new GridLength(trigMode == AnimationTriggerMode.OnKeyPress || trigMode == AnimationTriggerMode.WhileKeyHeld ? 28 : 0); // Use all available space when in an evaluatable mode (since these controls use a lot of space) triggerGroupbox.Width = AnimationLayerHandler.IsTriggerEvaluatableBooleanValueBased(trigMode) || AnimationLayerHandler.IsTriggerEvaluatableNumericValueBased(trigMode) ? double.NaN : 333; triggerGroupbox.HorizontalAlignment = AnimationLayerHandler.IsTriggerEvaluatableBooleanValueBased(trigMode) || AnimationLayerHandler.IsTriggerEvaluatableNumericValueBased(trigMode) ? HorizontalAlignment.Stretch : HorizontalAlignment.Left; // Update the combobox UpdatePathCombobox(); }