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(); }
/// <summary> /// Returns true if the given AnimationTrigger mode is a key-related trigger (OnKeyPress or OnKeyRelease) /// </summary> public static bool IsTriggerKeyBased(AnimationTriggerMode m) { return(new[] { AnimationTriggerMode.OnKeyPress, AnimationTriggerMode.OnKeyRelease, AnimationTriggerMode.WhileKeyHeld }.Contains(m)); }
/// <summary> /// Returns true if the given AnimationTrigger mode is a boolean gamestate value-related trigger (OnTrue, OnFalse or WhileTrue) /// </summary> public static bool IsTriggerBooleanValueBased(AnimationTriggerMode m) { return(new[] { AnimationTriggerMode.OnTrue, AnimationTriggerMode.OnFalse, AnimationTriggerMode.WhileTrue }.Contains(m)); }
/// <summary> /// Returns true if the given AnimationTrigger mode is a numeric gamestate value-related trigger (OnHigh, OnLow or OnChange) /// </summary> public static bool IsTriggerNumericValueBased(AnimationTriggerMode m) { return(new[] { AnimationTriggerMode.OnHigh, AnimationTriggerMode.OnLow, AnimationTriggerMode.OnChange }.Contains(m)); }
/// <summary> /// Returns true if the given AnimationTrigger mode is an IEvaluatable boolean value-related trigger (OnEvaluatableTrue, OnEvaluatableFalse or WhileEvaluatableTrue) /// </summary> public static bool IsTriggerEvaluatableBooleanValueBased(AnimationTriggerMode m) => new[] { AnimationTriggerMode.OnEvaluatableTrue, AnimationTriggerMode.OnEvaluatableFalse, AnimationTriggerMode.WhileEvaluatableTrue }.Contains(m);
/// <summary> /// Returns true if the given AnimationTrigger mode is an IEvaluatable numeric value-related trigger (OnEvaluatableHigh, OnEvaluatableLow or OnEvaluatableChange) /// </summary> public static bool IsTriggerEvaluatableNumericValueBased(AnimationTriggerMode m) => new[] { AnimationTriggerMode.OnEvaluatableHigh, AnimationTriggerMode.OnEvaluatableLow, AnimationTriggerMode.OnEvaluatableChange }.Contains(m);