Example #1
0
        /// <inheritdoc/>
        protected override UltravioletContext OnCreatingUltravioletContext()
        {
            var configuration = new OpenGLUltravioletConfiguration();

            configuration.Headless                = headless;
            configuration.EnableServiceMode       = serviceMode;
            configuration.IsHardwareInputDisabled = true;
            configuration.Debug         = true;
            configuration.DebugLevels   = DebugLevels.Error | DebugLevels.Warning;
            configuration.DebugCallback = (uv, level, message) =>
            {
                System.Diagnostics.Debug.WriteLine(message);
            };

            if (!String.IsNullOrEmpty(audioSubsystem))
            {
                configuration.AudioSubsystemAssembly = audioSubsystem;
            }

            if (configureUPF)
            {
                PresentationFoundation.Configure(configuration);
            }

            return(new OpenGLUltravioletContext(this, configuration));
        }
Example #2
0
        protected override UltravioletContext OnCreatingUltravioletContext()
        {
            var configuration = new OpenGLUltravioletConfiguration();

            PresentationFoundation.Configure(configuration);

            return(new OpenGLUltravioletContext(this, configuration));
        }
Example #3
0
        /// <summary>
        /// Gets the underlying bound value.
        /// </summary>
        /// <returns>The underlying bound value.</returns>
        protected T GetUnderlyingValue()
        {
            if (!IsReadable)
            {
                throw new InvalidOperationException(PresentationStrings.BindingIsWriteOnly);
            }

            return(getter(PresentationFoundation.GetDataSourceWrapper(dependencyValue.Owner.DependencyDataSource)));
        }
Example #4
0
        /// <inheritdoc/>
        internal override void OnPreApplyTemplate()
        {
            if (TemplatedParent is Slider parent)
            {
                var templateWrapperType = PresentationFoundation.GetDataSourceWrapper(parent).GetType();

                if (HasDefaultValue(ValueProperty))
                {
                    BindValue(ValueProperty, templateWrapperType, "{{Value}}");
                }
                if (HasDefaultValue(MinimumProperty))
                {
                    BindValue(MinimumProperty, templateWrapperType, "{{Minimum}}");
                }
                if (HasDefaultValue(MaximumProperty))
                {
                    BindValue(MaximumProperty, templateWrapperType, "{{Maximum}}");
                }
                if (HasDefaultValue(SmallChangeProperty))
                {
                    BindValue(SmallChangeProperty, templateWrapperType, "{{SmallChange}}");
                }
                if (HasDefaultValue(LargeChangeProperty))
                {
                    BindValue(LargeChangeProperty, templateWrapperType, "{{LargeChange}}");
                }
                if (HasDefaultValue(TickPlacementProperty))
                {
                    BindValue(TickPlacementProperty, templateWrapperType, "{{TickPlacement}}");
                }
                if (HasDefaultValue(TickFrequencyProperty))
                {
                    BindValue(TickFrequencyProperty, templateWrapperType, "{{TickFrequency}}");
                }
                if (HasDefaultValue(IsDirectionReversedProperty))
                {
                    BindValue(IsDirectionReversedProperty, templateWrapperType, "{{IsDirectionReversed}}");
                }
                if (HasDefaultValue(IsSnapToTickEnabledProperty))
                {
                    BindValue(IsSnapToTickEnabledProperty, templateWrapperType, "{{IsSnapToTickEnabled}}");
                }
            }
            base.OnPreApplyTemplate();
        }
Example #5
0
        /// <summary>
        /// Sets the underlying bound value.
        /// </summary>
        /// <param name="value">The value to set.</param>
        protected void SetUnderlyingValue(T value)
        {
            if (!IsWritable)
            {
                throw new InvalidOperationException(PresentationStrings.BindingIsReadOnly);
            }

            var owner    = dependencyValue.Owner;
            var metadata = dependencyValue.Property.GetMetadataForOwner(owner.GetType());

            if (metadata.CoerceValueCallback != null)
            {
                value = metadata.CoerceValue <T>(owner, value);
            }

            setter(PresentationFoundation.GetDataSourceWrapper(dependencyValue.Owner.DependencyDataSource), value);
            dependencyValue.DigestImmediately();
        }
Example #6
0
        /// <summary>
        /// Called when the application is creating its Ultraviolet context.
        /// </summary>
        /// <returns>The Ultraviolet context.</returns>
        protected override UltravioletContext OnCreatingUltravioletContext()
        {
            var configuration = new OpenGLUltravioletConfiguration();

            configuration.EnableServiceMode = ShouldRunInServiceMode();
            PopulateConfiguration(configuration);

            PresentationFoundation.Configure(configuration);

#if DEBUG
            configuration.Debug         = true;
            configuration.DebugLevels   = DebugLevels.Error | DebugLevels.Warning;
            configuration.DebugCallback = (uv, level, message) =>
            {
                System.Diagnostics.Debug.WriteLine(message);
            };
#endif
            return(new OpenGLUltravioletContext(this, configuration));
        }
Example #7
0
        /// <summary>
        /// Called when the application is creating its Ultraviolet context.
        /// </summary>
        /// <returns>The Ultraviolet context.</returns>
        protected override UltravioletContext OnCreatingUltravioletContext()
        {
            var configuration = new OpenGLUltravioletConfiguration();

            configuration.SupportsHighDensityDisplayModes = true;
            configuration.EnableServiceMode        = ShouldRunInServiceMode();
            configuration.WatchViewFilesForChanges = ShouldDynamicallyReloadContent();
            PopulateConfiguration(configuration);

            PresentationFoundation.Configure(configuration);

#if DEBUG
            configuration.Debug         = true;
            configuration.DebugLevels   = DebugLevels.Error | DebugLevels.Warning;
            configuration.DebugCallback = (uv, level, message) =>
            {
                System.Diagnostics.Debug.WriteLine(message);
            };
            configuration.WatchViewFilesForChanges = true;
#endif
            return(new OpenGLUltravioletContext(this, configuration));
        }
        /// <inheritdoc/>
        internal override void OnPreApplyTemplate()
        {
            if (TemplatedParent is OrientedSlider parent)
            {
                var templateWrapperType = PresentationFoundation.GetDataSourceWrapper(parent).GetType();

                if (HasDefaultValue(MinimumProperty))
                {
                    BindValue(MinimumProperty, templateWrapperType, "{{Minimum}}");
                }
                if (HasDefaultValue(MaximumProperty))
                {
                    BindValue(MaximumProperty, templateWrapperType, "{{Maximum}}");
                }
                if (HasDefaultValue(TickFrequencyProperty))
                {
                    BindValue(TickFrequencyProperty, templateWrapperType, "{{TickFrequency}}");
                }
                if (HasDefaultValue(IsDirectionReversedProperty))
                {
                    BindValue(IsDirectionReversedProperty, templateWrapperType, "{{IsDirectionReversed}}");
                }
                if (HasDefaultValue(ReservedSpaceProperty))
                {
                    if (TemplatedParent is HSlider)
                    {
                        BindValue(ReservedSpaceProperty, templateWrapperType, "{{Track.Thumb.ActualWidth}}");
                    }
                    else
                    {
                        BindValue(ReservedSpaceProperty, templateWrapperType, "{{Track.Thumb.ActualHeight}}");
                    }
                }
            }
            base.OnPreApplyTemplate();
        }
Example #9
0
        /// <summary>
        /// Creates an instantiation context for the specified view.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        /// <param name="control">The control for which to create an instantiation context.</param>
        /// <returns>The instantiation context which was created.</returns>
        internal static UvmlInstantiationContext ForControl(UltravioletContext uv, Control control)
        {
            var wrapper = PresentationFoundation.GetDataSourceWrapper(control);

            return(new UvmlInstantiationContext(uv, control, control, wrapper.GetType(), control.ComponentTemplateNamescope));
        }
Example #10
0
 /// <inheritdoc/>
 public override void Register(UltravioletConfiguration configuration) =>
 PresentationFoundation.Configure(configuration, presentationConfig);