当前位置: 首页>>代码示例>>C#>>正文


C# UltravioletContext类代码示例

本文整理汇总了C#中UltravioletContext的典型用法代码示例。如果您正苦于以下问题:C# UltravioletContext类的具体用法?C# UltravioletContext怎么用?C# UltravioletContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UltravioletContext类属于命名空间,在下文中一共展示了UltravioletContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateCullNone

 /// <summary>
 /// Creates the CullNone rasterizer state.
 /// </summary>
 /// <param name="uv">The Ultraviolet context.</param>
 /// <returns>The rasterizer state that was created.</returns>
 public static OpenGLRasterizerState CreateCullNone(UltravioletContext uv)
 {
     var state = new OpenGLRasterizerState(uv);
     state.CullMode = CullMode.None;
     state.MakeImmutable();
     return state;
 }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:12,代码来源:OpenGLRasterizerState.cs

示例2: AdornerLayer

 /// <summary>
 /// Initializes a new instance of the <see cref="AdornerLayer"/> class.
 /// </summary>
 /// <param name="uv">The Ultraviolet context.</param>
 /// <param name="name">The element's identifying name within its namescope.</param>
 public AdornerLayer(UltravioletContext uv, String name)
     : base(uv, name)
 {
     adorners = new VisualCollection(this);
     adornersStates = new List<AdornerState>();
     adornersTemp = new List<Adorner>();
 }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:12,代码来源:AdornerLayer.cs

示例3: Apply

 /// <summary>
 /// Applies the specified settings.
 /// </summary>
 /// <param name="uv">The Ultraviolet context.</param>
 public void Apply(UltravioletContext uv)
 {
     if (Window != null)
     {
         Window.Apply(uv);
     }
 }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:11,代码来源:UltravioletApplicationSettings.cs

示例4: OpenGLUltravioletPlatform

 /// <summary>
 /// Initializes a new instance of the OpenGLUltravioletPlatform class.
 /// </summary>
 /// <param name="uv">The Ultraviolet context.</param>
 /// <param name="configuration">The Ultraviolet Framework configuration settings for the current context.</param>
 public OpenGLUltravioletPlatform(UltravioletContext uv, OpenGLUltravioletConfiguration configuration)
     : base(uv)
 {
     this.clipboard = new OpenGLUltravioletClipboardInfo();
     this.windows   = new OpenGLUltravioletWindowInfo(uv, configuration);
     this.displays  = new OpenGLUltravioletDisplayInfo();
 }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:12,代码来源:OpenGLUltravioletPlatform.cs

示例5: Initialize

        /// <inheritdoc/>
        public override void Initialize(UltravioletContext uv, Object configuration)
        {
            var config = (PresentationFoundationConfiguration)configuration ?? new PresentationFoundationConfiguration();

            var upf = uv.GetUI().GetPresentationFoundation();
            upf.BindingExpressionCompilerAssemblyName = config.BindingExpressionCompilerAssembly;
        }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:8,代码来源:PresentationFoundationInitializer.cs

示例6: CompileSingleView

        /// <inheritdoc/>
        public BindingExpressionCompilationResult CompileSingleView(UltravioletContext uv, BindingExpressionCompilerOptions options)
        {
            Contract.Require(options, "options");

            if (String.IsNullOrEmpty(options.Input))
                throw new ArgumentException(PresentationStrings.InvalidCompilerOptions);

            var definition = CreateDataSourceDefinitionFromXml(options.RequestedViewModelNamespace, options.RequestedViewModelName, options.Input);
            if (definition == null)
                return BindingExpressionCompilationResult.CreateSucceeded();

            var state = CreateCompilerState(uv, options);
            var dataSourceWrapperInfo = GetDataSourceWrapperInfo(state, definition.Value);
            var dataSourceWrapperInfos = new[] { dataSourceWrapperInfo };
            
            var result = CompileViewModels(state, dataSourceWrapperInfos, null);
            if (result.Succeeded)
            {
                options.Output = dataSourceWrapperInfos[0].DataSourceWrapperSourceCode;
            }
            else
            {
                DeleteWorkingDirectory(state);
            }

            return result;
        }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:28,代码来源:ExpressionCompiler.cs

示例7: OpenGLCursor

        /// <summary>
        /// Initializes a new instance of the OpenGLCursor class.
        /// </summary>
        /// <param name="uv">The UltravioletContext class.</param>
        /// <param name="surface">The surface that contains the cursor image.</param>
        /// <param name="hx">The x-coordinate of the cursor's hotspot.</param>
        /// <param name="hy">The y-coordinate of the cursor's hotspot.</param>
        public OpenGLCursor(UltravioletContext uv, Surface2D surface, Int32 hx, Int32 hy)
            : base(uv)
        {
            Contract.Require(surface, "surface");

            uv.ValidateResource(surface);

            if (AreCursorsSupported(uv))
            {
                this.cursor = SDL.CreateColorCursor(((OpenGLSurface2D)surface).Native, hx, hy);
                this.width  = surface.Width;
                this.height = surface.Height;

                if (this.cursor == null)
                {
                    this.width  = 0;
                    this.height = 0;
                }
            }
            else
            {
                this.cursor = null;
                this.width  = 0;
                this.height = 0;
            }
        }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:33,代码来源:OpenGLCursor.cs

示例8: InitWindows8_1

        /// <summary>
        /// Retrieves DPI information when running on Windows 8.1 and higher.
        /// </summary>
        private Boolean InitWindows8_1(UltravioletContext uv, IUltravioletDisplay display)
        {
            if (uv.Platform != UltravioletPlatform.Windows || Environment.OSVersion.Version < new Version(6, 3))
                return false;

            var rect = new Win32.RECT
            {
                left   = display.Bounds.Left,
                top    = display.Bounds.Top,
                right  = display.Bounds.Right,
                bottom = display.Bounds.Bottom 
            };

            var hmonitor = IntPtr.Zero;

            Win32.EnumDisplayMonitors(IntPtr.Zero, &rect, (hdc, lprcClip, lprcMonitor, dwData) =>
            {
                hmonitor = hdc;
                return false;
            }, IntPtr.Zero);

            if (hmonitor == IntPtr.Zero)
                return false;

            UInt32 x, y;
            Win32.GetDpiForMonitor(hmonitor, 0, out x, out y);

            this.densityX      = x;
            this.densityY      = y;
            this.densityScale  = x / 96f;
            this.densityBucket = GuessBucketFromDensityScale(densityScale);

            return true;
        }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:37,代码来源:DesktopScreenDensityService.cs

示例9: Deactivate

        /// <inheritdoc/>
        public override void Deactivate(UltravioletContext uv, DependencyObject dobj)
        {
            var element = dobj as UIElement;
            if (element == null || element.View == null)
                return;

            if (selector == null)
            {
                var storyboard = element.View.FindStoryboard(storyboardName);
                if (storyboard == null)
                    return;

                storyboard.Stop(element);
            }
            else
            {
                var rooted = selector.PartCount == 0 ? false :
                    String.Equals(selector[0].PseudoClass, "trigger-root", StringComparison.InvariantCultureIgnoreCase);
                var target = rooted ? dobj as UIElement : null;

                element.View.Select(target, selector, this, (e, s) =>
                {
                    var action = (PlayStoryboardTriggerAction)s;

                    var storyboard = e.View.FindStoryboard(action.storyboardName);
                    if (storyboard != null)
                    {
                        storyboard.Stop(e);
                    }
                });
            }
            base.Deactivate(uv, dobj);
        }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:34,代码来源:PlayStoryboardTriggerAction.cs

示例10: CustomCompositor

        /// <summary>
        /// Initializes a new instance of the <see cref="CustomCompositor"/> class.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        /// <param name="window">The window with which this compositor is associated.</param>
        public CustomCompositor(UltravioletContext uv, IUltravioletWindow window)
            : base(uv, window)
        {
            rtScene = RenderTarget2D.Create(BufferWidth, BufferHeight);

            rtSceneColor = RenderBuffer2D.Create(RenderBufferFormat.Color, BufferWidth, BufferHeight);
            rtScene.Attach(rtSceneColor);

            rtSceneDepthStencil = RenderBuffer2D.Create(RenderBufferFormat.Depth24Stencil8, BufferWidth, BufferHeight);
            rtScene.Attach(rtSceneDepthStencil);

            rtInterface = RenderTarget2D.Create(BufferWidth, BufferHeight);

            rtInterfaceColor = RenderBuffer2D.Create(RenderBufferFormat.Color, BufferWidth, BufferHeight);
            rtInterface.Attach(rtInterfaceColor);

            rtInterfaceDepthStencil = RenderBuffer2D.Create(RenderBufferFormat.Depth24Stencil8, BufferWidth, BufferHeight);
            rtInterface.Attach(rtInterfaceDepthStencil);

            rtComposition = RenderTarget2D.Create(BufferWidth, BufferHeight, RenderTargetUsage.PreserveContents);

            rtCompositionColor = RenderBuffer2D.Create(RenderBufferFormat.Color, BufferWidth, BufferHeight);
            rtComposition.Attach(rtCompositionColor);

            rtCompositionDepthStencil = RenderBuffer2D.Create(RenderBufferFormat.Depth24Stencil8, BufferWidth, BufferHeight);
            rtComposition.Attach(rtCompositionDepthStencil);

            spriteBatch = SpriteBatch.Create();
        }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:34,代码来源:CustomCompositor.cs

示例11: Compositor

        /// <summary>
        /// Initializes a new instance of the <see cref="Compositor"/> class.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        /// <param name="window">The window with which this compositor is associated.</param>
        public Compositor(UltravioletContext uv, IUltravioletWindow window)
            : base(uv)
        {
            Contract.Require(window, nameof(window));

            this.window = window;
        }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:12,代码来源:Compositor.cs

示例12: Activate

 /// <summary>
 /// Activates the actions in the collection, with the specified dependency object as their implicit target.
 /// </summary>
 /// <param name="uv">The Ultraviolet context.</param>
 /// <param name="dobj">The dependency object which is the implicit target of the activated actions.</param>
 internal void Activate(UltravioletContext uv, DependencyObject dobj)
 {
     foreach (var action in actions)
     {
         action.Activate(uv, dobj);
     }
 }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:12,代码来源:TriggerActionCollection.cs

示例13: DummyUltravioletPlatform

 /// <summary>
 /// Initializes a new instance of the <see cref="DummyUltravioletPlatform"/> class.
 /// </summary>
 /// <param name="uv">The Ultraviolet context.</param>
 public DummyUltravioletPlatform(UltravioletContext uv)
     : base(uv)
 {
     this.clipboard = new DummyUltravioletClipboardInfo();
     this.windows = new DummyUltravioletWindowInfo();
     this.displays = new DummyUltravioletDisplayInfo();
 }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:11,代码来源:DummyUltravioletPlatform.cs

示例14: Compile

        /// <inheritdoc/>
        public BindingExpressionCompilationResult Compile(UltravioletContext uv, BindingExpressionCompilerOptions options)
        {
            Contract.Require(uv, "uv");
            Contract.Require(options, "options");

            if (String.IsNullOrEmpty(options.Input) || String.IsNullOrEmpty(options.Output))
                throw new ArgumentException(PresentationStrings.InvalidCompilerOptions);

            var state = CreateCompilerState(uv, options);
            var dataSourceWrapperInfos = GetDataSourceWrapperInfos(state, uv, options.Input);
            
            var cacheFile = Path.ChangeExtension(options.Output, "cache");
            var cacheNew = CompilerCache.FromDataSourceWrappers(dataSourceWrapperInfos);
            if (File.Exists(options.Output))
            {
                var cacheOld = CompilerCache.TryFromFile(cacheFile);
                if (cacheOld != null && !options.IgnoreCache && !cacheOld.IsDifferentFrom(cacheNew))
                    return BindingExpressionCompilationResult.CreateSucceeded();
            }

            var result = CompileViewModels(state, dataSourceWrapperInfos, options.Output);
            if (result.Succeeded)
            {
                cacheNew.Save(cacheFile);

                if (!options.WriteCompiledFilesToWorkingDirectory && !options.WorkInTemporaryDirectory)
                    DeleteWorkingDirectory(state);
            }

            if (options.WriteCompiledFilesToWorkingDirectory && !options.WorkInTemporaryDirectory)
                WriteCompiledFilesToWorkingDirectory(state, dataSourceWrapperInfos);

            return result;
        }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:35,代码来源:ExpressionCompiler.cs

示例15: OpenGLRenderTarget2D

        /// <summary>
        /// Initializes a new instance of the OpenGLRenderTarget2D class.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        /// <param name="width">The render target's width in pixels.</param>
        /// <param name="height">The render target's height in pixels.</param>
        /// <param name="usage">A <see cref="RenderTargetUsage"/> value specifying whether the 
        /// render target's data is discarded or preserved when it is bound to the graphics device.</param>
        /// <param name="buffers">The collection of render buffers to attach to the target.</param>
        public OpenGLRenderTarget2D(UltravioletContext uv, Int32 width, Int32 height, RenderTargetUsage usage, IEnumerable<RenderBuffer2D> buffers = null)
            : base(uv)
        {
            Contract.EnsureRange(width > 0, nameof(width));
            Contract.EnsureRange(height > 0, nameof(height));

            // NOTE: If we're in an older version of GLES, we need to use glFramebufferTexture2D()
            glFramebufferTextureIsSupported = !gl.IsGLES || gl.IsVersionAtLeast(3, 2);

            glDrawBuffersIsSupported = !gl.IsGLES2 || gl.IsExtensionSupported("GL_ARB_draw_buffers");
            glDrawBufferIsSupported = !gl.IsGLES;

            var framebuffer = 0u;

            uv.QueueWorkItemAndWait(() =>
            {
                using (OpenGLState.ScopedCreateFramebuffer(out framebuffer))
                {
                    if (buffers != null)
                    {
                        foreach (OpenGLRenderBuffer2D buffer in buffers)
                        {
                            AttachRenderBuffer(buffer);
                        }
                    }
                }
            });

            this.width = width;
            this.height = height;
            this.framebuffer = framebuffer;
            this.renderTargetUsage = usage;
        }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:42,代码来源:OpenGLRenderTarget2D.cs


注:本文中的UltravioletContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。