示例#1
0
 private static void onEventNameChanged(RippleMouseTrackerOLD e, DPChangedEventArgs <string> args)
 {
     if (e.SourceObject != null && !e.EventName.IsNullOrWhiteSpace())
     {
         e.registerEventHandler(e.SourceObject, e.EventName);
     }
 }
示例#2
0
文件: MDH.cs 项目: jack-bowen/Ccr
        private static void onSwatchChanged(
            DependencyObject @this,
            DPChangedEventArgs <SwatchClassifier> args)
        {
            var swatch = GlobalResources
                         .Palette
                         .GetSwatch(
                args.NewValue);

            SetTheme(@this, swatch);
        }
 private static void onAnimationTemplateChanged(IterativeReaction i, DPChangedEventArgs <AnimationTemplate> e)
 {
     if (e.OldValue != null)
     {
         e.OldValue.Detach();
     }
     if (e.NewValue != null)
     {
         i.attachAssociatedChildElement();
     }
 }
示例#4
0
文件: Designer.cs 项目: forki/Ccr
        private static void onCompensateForWindowsToolbarChanged(
            DependencyObject @this,
            DPChangedEventArgs <bool> args)
        {
            var _pageOrientation             = GetOrientation(@this);
            var _compensateForWindowsToolbar = GetCompensateForWindowsToolbar(@this);
            var _viewport = GetViewport(@this);

            onPageLayoutCompute(
                @this,
                _viewport,
                _pageOrientation,
                _compensateForWindowsToolbar);
        }
示例#5
0
        private static void onPlacementChanged(
            DependencyObject @this,
            DPChangedEventArgs <Point> args)
        {
            var translateTransform = @this as TranslateTransform;

            if (translateTransform == null)
            {
                return;
            }

            translateTransform.X = args.NewValue.X;
            translateTransform.Y = args.NewValue.Y;
        }
示例#6
0
文件: MDH.cs 项目: jack-bowen/Ccr
 private static void onIdentityChanged(
     DependencyObject @this,
     DPChangedEventArgs <MaterialIdentity> args)
 {
     if (args.NewValue != null)
     {
         if (!_registeredIdentities.ContainsKey(args.NewValue))
         {
             _registeredIdentities.Add(
                 args.NewValue,
                 @this.As <SolidColorBrush>());
         }
     }
 }
 private static void ZoomOffsetChanged(FlexDocumentViewport i, DPChangedEventArgs <double> e)
 {
     FlexDocumentViewportSettings.Instance.Zoom = i.ZoomOffset;
     if (i.PART_scroll == null || i.PART_root == null)
     {
         i.applyZoomOffsetOnTemplate = true;
     }
     else
     {
         i.applyZoomOffsetOnTemplate = false;
         var centerOfViewport = new Point(i.PART_scroll.ViewportWidth / 2,
                                          i.PART_scroll.ViewportHeight / 2);
         i.lastCenterPositionOnTarget = i.PART_scroll.TranslatePoint(centerOfViewport, i.PART_root);
     }
 }
示例#8
0
        private static void onAttachPropertyChanged(
            DependencyObject @this,
            DPChangedEventArgs <bool> args)
        {
            var window = @this.AsOrDefault <Window>();

            if (window == null)
            {
                throw new NotSupportedException(
                          $"The {nameof(AttachProperty).SQuote()} attached property can only be used on the " +
                          $"type {nameof(Window).SQuote()}.");
            }

            if (args.NewValue)
            {
                window
                .CommandBindings
                .Add(
                    new CommandBinding(
                        SystemCommands.CloseWindowCommand,
                        OnCloseWindow));

                window
                .CommandBindings
                .Add(
                    new CommandBinding(
                        SystemCommands.MaximizeWindowCommand,
                        OnMaximizeWindow,
                        OnCanResizeWindow));

                window
                .CommandBindings
                .Add(
                    new CommandBinding(
                        SystemCommands.MinimizeWindowCommand,
                        OnMinimizeWindow,
                        OnCanMinimizeWindow));

                window
                .CommandBindings
                .Add(
                    new CommandBinding(
                        SystemCommands.RestoreWindowCommand,
                        OnRestoreWindow,
                        OnCanResizeWindow));
            }
        }
示例#9
0
        private static void onValidatorChanged(
            DependencyObject @this,
            DPChangedEventArgs <IStringValidator> args)
        {
            var frameworkElement = @this.AsOrDefault <FrameworkElement>();

            if (frameworkElement == null)
            {
                throw new ArgumentException(
                          $"The service \'HintAssist.Validator\' can only be used with elements that inherit " +
                          $"from the \'FrameworkElement\' type.");
            }

            var managerService = frameworkElement.GetTextFieldInputVisualStateService();

            managerService?.EvaluateValidationState(frameworkElement);
        }
示例#10
0
        //private static bool shadowLevelPropertyValidator(
        //  double? value)
        //{
        //  if (!value.HasValue)
        //    return true;

        //  return value.Value >= 0;
        //}

        private static void onShadowLevelChanged(
            DependencyObject @this,
            DPChangedEventArgs <double?> args)
        {
            if (@this is UIElement uiElement)
            {
                if (args.NewValue >= 0)
                {
                    var shadow = getDropShadowEffect(args.NewValue.Value);//ShadowInterpolator.Interpolate(args.NewValue.Value);
                    uiElement.Effect = shadow;
                }
                else
                {
                    uiElement.Effect = null;
                }
            }
        }
示例#11
0
        // TODO find a better way to ensure render() call corresponds with animation and bar rendering states, defaults, etc.
        // TODO if bars are shoinwg -> first collapse, then render pass, then reveal animation
        public override void OnDataChanged(DPChangedEventArgs <DoubleSeries> e)
        {
            var oldValueValid = IsValidGraphData(e.OldValue);
            var newValueValid = IsValidGraphData(e.NewValue);

            if (oldValueValid)
            {
                // good -> good
                if (newValueValid)
                {
                    //TODO check new and old datasets to see if number of columbns is different. if so, may...
                    // TODO ...require background visuals for bars to animate to correct number.
                    BeginCollapseAnimation();
                    var dispatcherTimer = new DispatcherTimer()
                    {
                        Interval = TimeSpan.FromMilliseconds(1000)
                    };
                    dispatcherTimer.Tick += (s, a) =>
                    {
                        s.RequireType <DispatcherTimer>().Stop();
                        //pc.animationState = AnimationState.Final;
                        InvalidateMeasure();
                        InvalidateVisual();
                        BeginRevealAnimation();
                    };
                    dispatcherTimer.Start();
                    //TODO fadeout first
                }
                else
                {
                    BeginCollapseAnimation();
                }
            }
            else
            {
                if (newValueValid)
                {
                    animationState = AnimationState.Final;
                    InvalidateVisual();
                    BeginRevealAnimation();
                }
            }

            base.OnDataChanged(e);
        }
示例#12
0
        private static void OnProviderServiceChanged(
            DependencyObject @this,
            DPChangedEventArgs <UserInputNuanceProviderService> args)
        {
            if (!(@this is FrameworkElement frameworkElement))
            {
                throw new NotSupportedException(
                          $"The \'UserInputNuanceInjector.NuanceProviderService\' property cannot be set on the " +
                          $"element type \'{@this.GetType().Name}\' because \'HostedElement<TElement>\'-based " +
                          $"services require the host element to derive from \'FrameworkElement\'.");
            }

            var newService = args.NewValue;
            var oldService = args.OldValue;

            newService?.DetachHost();
            oldService?.AttachHost(frameworkElement);
        }
示例#13
0
        private static void onTextFieldInputVisualStateServiceChanged(
            DependencyObject @this,
            DPChangedEventArgs <TextFieldInputVisualStateService> args)
        {
            var visualStateManagerService = args.NewValue;

            var frameworkInputElement = @this.AsOrDefault <IFrameworkInputElement>();

            if (frameworkInputElement == null)
            {
                throw new ArgumentException(
                          $"The service \'HintAssist.TextFieldInputVisualStateService\' can only be used " +
                          $"with elements that implement the \'IFrameworkInputElement\' interface.");
            }

            visualStateManagerService
            .AttachElement(
                frameworkInputElement);
        }
示例#14
0
        private static void onTrackingServiceChanged(
            DependencyObject @this,
            DPChangedEventArgs <RippleMouseTracker> args)
        {
            var frameworkElement = @this as FrameworkElement;

            if (frameworkElement == null)
            {
                throw new NotSupportedException(
                          $"The \'RippleAssist.InputTrackingService\' property cannot be set on the " +
                          $"element type \'{@this.GetType().Name}\' because \'HostedElement<TElement>\'-based" +
                          $"services require the host element to derive from \'FrameworkElement\'.");
            }

            var newTrackingService = args.NewValue;
            var oldTrackingService = args.OldValue;

            oldTrackingService?.DetachHost();
            newTrackingService?.AttachHost(frameworkElement);
        }
示例#15
0
        //protected override void OnDetaching()
        //{
        //	base.OnDetaching();
        //	if (Emitter != null)
        //	{
        //		Emitter.Detach();
        //	}
        //}

        private static void onEmittersChanged(AnimationTemplate i, DPChangedEventArgs <AnimationEmitterCollection> e)
        {
            if (e.OldValue == e.NewValue)
            {
                return;
            }
            if (e.OldValue != null && e.OldValue.IsAssociated)
            {
                e.OldValue.Detach();
            }

            if (e.NewValue == null || i == null)
            {
                return;
            }

            if (e.NewValue.IsAssociated)
            {
                throw new InvalidOperationException("ExceptionStringTable.CannotHostBehaviorCollectionMultipleTimesExceptionMessage");
            }

            e.NewValue.Attach(i);
        }
示例#16
0
		private static void IsDimmedChanged(MaterialDimmer i, DPChangedEventArgs<bool> e)
		{
			if (e.NewValue)
			{
				i.IsHitTestVisible = true;
				i._rectangle.BeginAnimation(OpacityProperty,
					new DoubleAnimation(i.DimPercent, new Duration(TimeSpan.FromMilliseconds(200)))
					{
						AccelerationRatio = AnimationParameters.AccelerationRatio,
						DecelerationRatio = AnimationParameters.DecelerationRatio
					});
			}
			else
			{
				i.IsHitTestVisible = false;
				i._rectangle.BeginAnimation(OpacityProperty,
					new DoubleAnimation(0, new Duration(TimeSpan.FromMilliseconds(200)))
					{
						AccelerationRatio = AnimationParameters.AccelerationRatio,
						DecelerationRatio = AnimationParameters.DecelerationRatio
					});
			}
		}
示例#17
0
 private static void IsDimmedChanged(MaterialDimmer i, DPChangedEventArgs <bool> e)
 {
     if (e.NewValue)
     {
         i.IsHitTestVisible = true;
         i._rectangle.BeginAnimation(OpacityProperty,
                                     new DoubleAnimation(i.DimPercent, new Duration(TimeSpan.FromMilliseconds(200)))
         {
             AccelerationRatio = AnimationParameters.AccelerationRatio,
             DecelerationRatio = AnimationParameters.DecelerationRatio
         });
     }
     else
     {
         i.IsHitTestVisible = false;
         i._rectangle.BeginAnimation(OpacityProperty,
                                     new DoubleAnimation(0, new Duration(TimeSpan.FromMilliseconds(200)))
         {
             AccelerationRatio = AnimationParameters.AccelerationRatio,
             DecelerationRatio = AnimationParameters.DecelerationRatio
         });
     }
 }
		private static void DocumentChanged(FlexDocumentViewport i, DPChangedEventArgs<FlexDocument> e)
		{
			i.ZoomOffset = FlexDocumentViewportSettings.Instance.Zoom;
			i.RaiseEvent(new RoutedEventArgs(DocumentAddedEvent));
		}
示例#19
0
 public virtual void OnDataFiltered(DPChangedEventArgs <T> e)
 {
 }
示例#20
0
        private static void onForceCapitalizeTextChanged(
            DependencyObject @this,
            DPChangedEventArgs <bool> args)
        {
            if (args.NewValue)
            {
                switch (@this)
                {
                case TextBlock textBlock:
                    textBlock.TextInput += onTextInput;
                    break;

                case TextBox textbox:
                    textbox.TextInput   += onTextInput;
                    textbox.TextChanged += onTextChanged;
                    break;

                case Button button:
                {
                    var descriptor = DependencyPropertyDescriptor
                                     .FromProperty(
                        Button.ContentProperty,
                        typeof(Button));

                    descriptor?.AddValueChanged(
                        button, onButtonContentChanged);
                    break;
                }

                case Label label:
                {
                    var descriptor = DependencyPropertyDescriptor
                                     .FromProperty(
                        Label.ContentProperty,
                        typeof(Label));

                    descriptor?.AddValueChanged(
                        label, onLabelContentChanged);
                    break;
                }
                }
            }
            else
            {
                switch (@this)
                {
                case TextBlock textBlock:
                    textBlock.TextInput -= onTextInput;
                    break;

                case TextBox textbox:
                    textbox.TextInput   -= onTextInput;
                    textbox.TextChanged -= onTextChanged;
                    break;

                case Button button:
                {
                    var descriptor = DependencyPropertyDescriptor
                                     .FromProperty(
                        Button.ContentProperty,
                        typeof(Button));

                    descriptor?.RemoveValueChanged(
                        button, onButtonContentChanged);
                    break;
                }

                case Label label:
                {
                    var descriptor = DependencyPropertyDescriptor
                                     .FromProperty(
                        Label.ContentProperty,
                        typeof(Label));

                    descriptor?.RemoveValueChanged(
                        label, onLabelContentChanged);
                    break;
                }
                }
            }
        }
示例#21
0
 private static void DataChangedCallback(AbstractFlexChart <T> i, DPChangedEventArgs <T> e)
 {
     i.FilteredData = i.DataFilter.Filter(i.DataSorter.Sort(e.NewValue));
     i.OnDataChanged(e);
 }
示例#22
0
 private static void DataFilteredCallback(AbstractFlexChart <T> i, DPChangedEventArgs <T> e)
 {
     i.OnDataFiltered(e);
 }
示例#23
0
 private static void onTargetObjectChanged(MethodCallReaction i, DPChangedEventArgs <DependencyObject> e)
 {
     i.ResolveMethodTarget();
 }
示例#24
0
文件: MDH.cs 项目: jack-bowen/Ccr
 private static void onThemeChanged(
     DependencyObject @this,
     DPChangedEventArgs <Swatch> args)
 {
 }
示例#25
0
 private static void SourceFileChanged(XMLTextEditor i, DPChangedEventArgs <FileInfo> e)
 {
     i.colorize();
 }
		private static void DocumentFileChanged(FlexDocumentViewport i, DPChangedEventArgs<FileInfo> e)
		{
			i.loadDocument(e.NewValue);
		}
示例#27
0
 //private static void onSourceObjectChanged(NewRippleTracker i, DPChangedEventArgs<object> e)
 //{
 //	i.updateTarget();
 //}
 private static void onEventNameChanged(NewRippleTracker i, DPChangedEventArgs <string> e)
 {
     i.updateTarget();
 }
示例#28
0
		private static void ActiveDirectoryChanged(FileManager i, DPChangedEventArgs<DirectoryInfo> e)
		{
			i.RaiseEvent(new RoutedEventArgs(DirectoryChangedEvent, e.NewValue));
			FileManagerSettings.Instance.LastDirectory = e.NewValue.FullName;
			i.refresh();
		}
示例#29
0
		private static void SourceFileChanged(XMLTextEditor i, DPChangedEventArgs<FileInfo> e)
		{
			i.colorize();
		}
示例#30
0
 private static void DocumentFileChanged(FlexDocumentViewport i, DPChangedEventArgs <FileInfo> e)
 {
     i.loadDocument(e.NewValue);
 }
示例#31
0
 private static void DocumentChanged(FlexDocumentViewport i, DPChangedEventArgs <FlexDocument> e)
 {
     i.ZoomOffset = FlexDocumentViewportSettings.Instance.Zoom;
     i.RaiseEvent(new RoutedEventArgs(DocumentAddedEvent));
 }
		private static void ZoomOffsetChanged(FlexDocumentViewport i, DPChangedEventArgs<double> e)
		{
			FlexDocumentViewportSettings.Instance.Zoom = i.ZoomOffset;
			if (i.PART_scroll == null || i.PART_root == null)
			{
				i.applyZoomOffsetOnTemplate = true;
			}
			else
			{
				i.applyZoomOffsetOnTemplate = false;
				var centerOfViewport = new Point(i.PART_scroll.ViewportWidth / 2,
																			 i.PART_scroll.ViewportHeight / 2);
				i.lastCenterPositionOnTarget = i.PART_scroll.TranslatePoint(centerOfViewport, i.PART_root);
			}
		}
示例#33
0
 private static void onTargetObjectChanged(ReactiveSetter i, DPChangedEventArgs <DependencyObject> e)
 {
     //i.resolveEffectiveTarget();
 }
示例#34
0
        private static void onMethodNameChanged(MethodCallReaction i, DPChangedEventArgs <string> e)
        {
            i.ResolveMethodTarget();

            //i._methodInfo = resolveMethodInfo(i.Target, i.MethodName);
        }
示例#35
0
 private static void DataSorterChanged(AbstractFlexChart <T> i, DPChangedEventArgs <DataSorter <T> > e)
 {
     i.FilteredData = i.DataFilter.Filter(i.DataSorter.Sort(i.Data));
 }
示例#36
0
 private static void onTargetNameChanged(MethodCallReaction i, DPChangedEventArgs <string> e)
 {
     i._targetNameResolver.Name = e.NewValue;
 }
示例#37
0
		private static void OnTabsChanged(FlexDocument i, DPChangedEventArgs<ObservableCollection<FlexDocumentTab>> e)
		{
			i.resetDocument();
		}