Пример #1
0
            /// <summary>
            /// Internals the property change.
            /// </summary>
            /// <param name="modelInstance">The model instance.</param>
            /// <param name="newValue">The new value.</param>

            /// <param name="message">The message.</param>
            private async void InternalPropertyChange(BindableBase modelInstance, TProperty newValue, string message)
            {
                //find out there will be a changing by makesure they are not equal
                var changing = (this.EqualityComparer != null) ?
                               !this.EqualityComparer(newValue, _value) :
                               !Object.Equals(newValue, _value);

                if (!changing)
                {
                    return;
                }
                //fire changing event ask if anyone against changing

                var changingArg = new ValueChangingEventArgs <TProperty>(message, _value, newValue);

                modelInstance.RaisePropertyChanging(changingArg);
                var oldvalue = _value;

                _value = newValue;

                await Task.Yield();

                if (changingArg.Cancellation.IsCancellationRequested)
                {
                    _value = oldvalue;
                    return;
                }

                if (ValueChanging != null)
                {
                    ValueChanging.Invoke(this, changingArg);
                    await Task.Yield();

                    if (changingArg.Cancellation.IsCancellationRequested)
                    {
                        _value = oldvalue;
                        return;
                    }
                }

                if (NonGenericValueChanging != null)
                {
                    NonGenericValueChanging.Invoke(this, changingArg);
                    await Task.Yield();

                    if (changingArg.Cancellation.IsCancellationRequested)
                    {
                        _value = oldvalue;
                        return;
                    }
                }



                ValueChangedEventArgs <TProperty> changedArg = new ValueChangedEventArgs <TProperty>(message, oldvalue, newValue);

                modelInstance.RaisePropertyChanged(changedArg);
                ValueChanged?.Invoke(this, changedArg);
                NonGenericValueChanged?.Invoke(this, changedArg);
            }
Пример #2
0
        /// <summary>
        /// Handles the Tick event of the m_timer control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void m_timer_Tick(object sender, EventArgs e)
        {
            m_timer.Stop();

            if (!Enabled)
            {
                return;
            }

            // Actions according to mouse clicks
            switch (m_mouseEvent.Clicks)
            {
            case 1:
            {
                base.OnMouseClick(m_mouseEvent);

                int newValue = GetValueAt(m_mouseEvent.Location);

                if (newValue == -1)
                {
                    return;
                }

                if (newValue < m_baseValue)
                {
                    newValue = m_baseValue;
                }

                DeltaValue = newValue - m_value;

                if (DeltaValue == 0)
                {
                    return;
                }

                // Fires the value changing event
                ValueChanging?.ThreadSafeInvoke(this, new AttributeValueChangingEventArgs(DeltaValue));

                if (DeltaValue == 0)
                {
                    return;
                }

                Value += DeltaValue;
            }
            break;

            case 2:
            {
                base.OnMouseDoubleClick(m_mouseEvent);

                Value = m_baseValue;
            }
            break;
            }

            // Fires the value changed event
            ValueChanged?.ThreadSafeInvoke(this, new AttributeValueChangedEventArgs());
        }
Пример #3
0
 /// <summary>
 /// Raises the <see cref="ValueChanging"/> event with the given parameters.
 /// </summary>
 /// <param name="args">The arguments of the event.</param>
 protected void NotifyContentChanging(MemberNodeChangeEventArgs args)
 {
     PrepareChange?.Invoke(this, args);
     ValueChanging?.Invoke(this, args);
 }
Пример #4
0
 protected void TransI(ref uint a, uint b, uint c, uint d, uint k, ushort s, uint i)
 {
     a = b + MD5Helper.RotateLeft(a + (c ^ (b | ~d)) + X[k] + T[i - 1], s);
 }
Пример #5
0
 protected void TransF(ref uint a, uint b, uint c, uint d, uint k, ushort s, uint i)
 {
     a = b + MD5Helper.RotateLeft(a + ((b & c) | (~b & d)) + X[k] + T[i - 1], s);
 }
Пример #6
0
 private void OnValueChanging(object sender, MemberNodeChangeEventArgs e)
 {
     ValueChanging?.Invoke(sender, e);
 }
Пример #7
0
 /// <summary>
 /// Raises the ValueChanging event
 /// </summary>
 /// <param name="oldValue">The old property value</param>
 /// <param name="newValue">The expected new property value</param>
 /// <param name="cancel">Set to True to cancel the property change</param>
 protected virtual void RaisePropertyValueChanging(TValue oldValue, TValue newValue, ref bool cancel)
 {
     ValueChanging?.Invoke(Owner, oldValue, newValue, ref cancel);
 }
Пример #8
0
 /// <summary>
 /// 値変更前イベントを発生させる。
 /// </summary>
 /// <param name="e">ValueChangingEventArgs</param>
 protected virtual void InvokeValueChanging(ValueChangingEventArgs e)
 {
     ValueChanging?.Invoke(this, e);
 }
Пример #9
0
 protected void RaiseValueChanging(object newValue)
 {
     ValueChanging?.Invoke(this, new ValueChangingEventArgs(newValue));
 }
Пример #10
0
 protected virtual void OnValueChanging(object sender)
 {
     ValueChanging?.Invoke(sender);
 }