Exemplo n.º 1
0
        /// <summary>
        /// Changes the UI value.
        /// </summary>
        /// <param name="newValue">New value.</param>
        /// <param name="doChaningValue">Do changing the UI value.</param>
        /// <param name="onValueChanging">Trigger value changing event.</param>
        /// <param name="onValueChanged">Trigger value changed event.</param>
        public void ChangeValue(
            T newValue,
            Action doChaningValue,
            ValueChangingEventHandler onValueChanging,
            ValueChangedEventHandler onValueChanged)
        {
            Precondition.ArgumentNotNull(doChaningValue, nameof(doChaningValue));

            var oldValue = _editor.Value;

            if (onValueChanging != null)
            {
                var args = new ValueChangingEventArgs(oldValue, newValue);
                onValueChanging.Invoke(_editor, args);
                if (args.Cancel)
                {
                    return;
                }
            }

            doChaningValue();

            onValueChanged?.Invoke(_editor, new ValueChangedEventArgs(oldValue, newValue));
        }
Exemplo n.º 2
0
 ////////////////////////////////////////////////////////////////////////////////////////////////
 /*--------------------------------------------------------------------------------------------*/
 protected HoverItemDataSelectableFloat()
 {
     OnValueChanged += (x => { OnValueChangedEvent.Invoke(x); });
 }