Esempio n. 1
0
 protected virtual void OnCheckedCharacterChanging(OnChangingArg <NDPConfiguration, char> arg)
 {
     if (arg.Property.IsObjectValueChanging)
     {
         InvalidateRender();
     }
 }
Esempio n. 2
0
 protected virtual void OnIsThreeStateChanging(OnChangingArg <NDPConfiguration, bool> arg)
 {
     if (arg.Property.IsObjectValueChanging)
     {
         InvalidateRender();
     }
 }
Esempio n. 3
0
 protected virtual void OnRootWindowChanging(OnChangingArg <NDPConfiguration, RootWindow> arg)
 {
     if (this is RootWindow && arg.Provider.NewValue == null)
     {
         arg.Provider.MutatedValue = this as RootWindow;
     }
 }
Esempio n. 4
0
 protected virtual void OnPaddingChanging(OnChangingArg <NDPConfiguration, Thickness> arg)
 {
     arg.ExecuteAfterChange += (oldValue, newValue) =>
     {
         if (oldValue != newValue)
         {
             InvalidateMeasure();
         }
     };
 }
Esempio n. 5
0
 protected virtual void OnSecondaryColorDisabledChanging(OnChangingArg <NDPConfiguration, ConsoleColor> arg)
 {
     arg.ExecuteAfterChange += (oldValue, newValue) =>
     {
         if (oldValue != newValue)
         {
             InvalidateRender();
         }
     };
 }
Esempio n. 6
0
 protected virtual void OnIsCheckedChanging(OnChangingArg <NDPConfiguration, bool?> arg)
 {
     if (arg.Provider.HasNewValue && !arg.Provider.NewValue.HasValue && !IsThreeState)
     {
         arg.Provider.Reject = true;
     }
     else if (arg.Property.IsObjectValueChanging)
     {
         InvalidateRender();
     }
 }
Esempio n. 7
0
 private void OnStrChanged(OnChangingArg <Configuration, string> arg)
 {
     if (Reject)
     {
         arg.Provider.Reject = Reject;
     }
     if (Mutate != null)
     {
         arg.Provider.MutatedValue = Mutate;
     }
 }
Esempio n. 8
0
 protected void OnContentChanging(OnChangingArg <NDPConfiguration, object> arg)
 {
     if (arg.Property.IsObjectValueChanging)
     {
         arg.ExecuteAfterChange += (sender, e) =>
         {
             DisplayContent = Template.InstanciateFromDefaultDataTemplate(e.Property.NewValue);
         }
     }
     ;
 }
Esempio n. 9
0
 protected virtual void OnCloseParenthiseChanging(OnChangingArg <NDPConfiguration, char?> arg)
 {
     if (arg.Property.IsObjectValueChanging)
     {
         if (arg.Property.NewValue == null || arg.Property.OldValue == null)
         {
             InvalidateMeasure();
         }
         else
         {
             InvalidateRender();
         }
     }
 }
Esempio n. 10
0
 protected void OnDisplayContentChanging(OnChangingArg <NDPConfiguration, UIElement> arg)
 {
     if (arg.Property.IsObjectValueChanging)
     {
         arg.ExecuteAfterChange += (sender, e) =>
         {
             if (e.Property.OldValue != null)
             {
                 e.Property.OldValue.VisualParent = null;
             }
             if (e.Property.NewValue != null)
             {
                 e.Property.NewValue.VisualParent = this;
             }
             InvalidateMeasure();
         }
     }
     ;
 }
Esempio n. 11
0
        protected override void OnRootWindowChanging(OnChangingArg <NDPConfiguration, RootWindow> arg)
        {
            if (arg.Property.IsObjectValueChanging)
            {
                arg.ExecuteAfterChange += (sender, args) =>
                {
                    if (SupportSelection && !IsDisabled)
                    {
                        if ((args.Property.OldValue?.ActiveControl ?? null) == this)
                        {
                            args.Property.OldValue.ActiveControl = null;
                        }
                        args.Property.OldValue?.tabList.Remove(this);
                        args.Property.NewValue?.tabList.Add(this);
                    }

                    base.OnRootWindowChanging(arg);
                }
            }
            ;
        }
Esempio n. 12
0
 private static void OnColumnSpanChanging(OnChangingArg <NDPConfiguration, UIElement, int> arg)
 {
 }
Esempio n. 13
0
 protected virtual void OnMinWidthChanging(OnChangingArg <NDPConfiguration, IntEx> arg)
 {
 }
Esempio n. 14
0
 protected virtual void OnNameChanging(OnChangingArg <NDPConfiguration, string> arg)
 {
 }
Esempio n. 15
0
 private void OnNotifyTestChanging(OnChangingArg <Configuration, string> arg)
 {
 }
Esempio n. 16
0
 private static void OnAttachChanged(OnChangingArg <Configuration, string, object> arg)
 {
 }
Esempio n. 17
0
 protected virtual void OnActualWidthChanging(OnChangingArg <NDPConfiguration, int> arg)
 {
 }
Esempio n. 18
0
 protected virtual void OnTagChanging(OnChangingArg <NDPConfiguration, object> arg)
 {
 }
Esempio n. 19
0
 private void OnMyBlaChanging(OnChangingArg <Configuration, string> arg)
 {
     var test = TestAttributeProperty.ToString();
 }
Esempio n. 20
0
 protected virtual void OnHorizontalAlignmentChanging(OnChangingArg <NDPConfiguration, HorizontalAlignment> arg)
 {
     InvalidateArrange();
 }
Esempio n. 21
0
        //protected bool Update<TType, TValue>(object sender, TType targetObject, NDBasePropertyKey<TKey, TType, TValue> property, TValue newValue, bool hasNewValue, TValue oldValue, bool hasOldValue, ValueProvider<TKey> currentProvider, TValue currentValue)
        //    where TType : class
        //{
        //    return Update(sender, targetObject, property, newValue, hasNewValue, () => true, oldValue, hasOldValue, currentProvider, currentValue);
        //}

        internal bool Update <TType, TValue>(object sender, TType targetObject, NDBasePropertyKey <TKey, TType, TValue> property, TValue newProviderValue, bool hasNewValue, Func <TValue, bool> updateCode, TValue oldProviderValue, bool hasOldValue, ValueProvider <TKey> oldActualProvider, TValue oldActualValue)
            where TType : class
        {
            var otherProviderIndex = PropertyRegistar <TKey> .ProviderOrder[oldActualProvider];
            var thisIndex          = PropertyRegistar <TKey> .ProviderOrder[this];

            if (!property.Settigns.HasFlag(NDPropertySettings.CallOnChangedHandlerOnEquals) && Object.Equals(oldProviderValue, newProviderValue) && hasOldValue == hasNewValue)
            {
                return(true);
            }

            TValue newActualValue = default;
            ValueProvider <TKey> newActualProvider = null;

            if (this == oldActualProvider && !hasNewValue)
            {
                // the current value was provided by the changing provider but now it will no longer have a value
                // we need to find out what the new value will be.
                bool found = false;
                foreach (var item in PropertyRegistar <TKey> .ValueProviders)
                {
                    if (item == this)
                    {
                        continue;
                    }
                    var(providerValue, hasValue) = item.GetValue(targetObject, property);
                    if (hasValue)
                    {
                        found             = true;
                        newActualProvider = item;
                        newActualValue    = providerValue;
                        break;
                    }
                }
                if (!found)
                {
                    throw new InvalidOperationException("No Value Found");
                }
            }
            else if (otherProviderIndex >= thisIndex)
            {
                newActualProvider = this;
                newActualValue    = newProviderValue;
            }
            else
            {
                newActualProvider = oldActualProvider;
                newActualValue    = oldActualValue;
            }


            // We need to call the actial update after we recived the current old value. Otherwise we could already read the
            OnChangingArg <TKey, TValue> onChangingArg;

            if (property as object is NDAttachedPropertyKey <TKey, TType, TValue> attach)
            {
                var attachArg = OnChangingArg.Create(targetObject, oldProviderValue, hasOldValue, newProviderValue, hasNewValue, this, oldActualProvider, newActualProvider, oldActualValue, newActualValue, hasNewValue || !this.canDeletionBePrevented);
                onChangingArg = attachArg;
                attach.changedMethod(attachArg);
            }
            else if (property as object is NDPropertyKey <TKey, TType, TValue> p)
            {
                onChangingArg = OnChangingArg.Create(oldProviderValue, hasOldValue, newProviderValue, hasNewValue, this, oldActualProvider, newActualProvider, oldActualValue, newActualValue, hasNewValue || !this.canDeletionBePrevented);
                p.changedMethod(targetObject)(onChangingArg);
            }
            else
            {
                throw new NotSupportedException();
            }
            var result = PropertyRegistar <TKey> .ChangeValue(sender, property, targetObject, onChangingArg, updateCode);

            FireEventHandler(property, targetObject, sender, ChangedEventArgs.Create(targetObject, property, oldProviderValue, newProviderValue));
            return(result);
        }
Esempio n. 22
0
 protected virtual void OnMarginChanging(OnChangingArg <NDPConfiguration, Thickness> arg)
 {
     InvalidateMeasure();
 }
Esempio n. 23
0
 protected virtual void OnIsPressedChanging(OnChangingArg <NDPConfiguration, bool> arg)
 {
 }
Esempio n. 24
0
 protected virtual void OnMaxHeightChanging(OnChangingArg <NDPConfiguration, IntEx> arg)
 {
 }
Esempio n. 25
0
 //[System.ComponentModel.DefaultValue("asdf")]
 private void OnTestAttributeChanging(OnChangingArg <Configuration, MyStruct> arg)
 {
     var test = TestAttributeProperty.ToString();
 }