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


C# Window.VerifyAccess方法代码示例

本文整理汇总了C#中System.Windows.Window.VerifyAccess方法的典型用法代码示例。如果您正苦于以下问题:C# Window.VerifyAccess方法的具体用法?C# Window.VerifyAccess怎么用?C# Window.VerifyAccess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Window的用法示例。


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

示例1: ExtendGlassFrame

        /// <summary>
        /// Extends the glass frame of a window.  Only works on operating systems that support composition.
        /// </summary>
        /// <param name="window">The window to modify.</param>
        /// <param name="margin">The margins of the new frame.</param>
        /// <returns>Whether the frame was successfully extended.</returns>
        /// <remarks>
        /// This function adds hooks to the Window to respond to changes to whether composition is enabled.
        /// </remarks>
        public static bool ExtendGlassFrame(Window window, Thickness margin)
        {
            Verify.IsNotNull(window, "window");

            window.VerifyAccess();

            IntPtr hwnd = new WindowInteropHelper(window).Handle;

            if (_extendedWindows.ContainsKey(hwnd))
            {
                // The hook into the HWND's WndProc has the original margin cached.
                // Don't want to support dynamically adjusting that unless there's a need.
                throw new InvalidOperationException("Multiple calls to this function for the same Window are not supported.");
            }

            return _ExtendGlassFrameInternal(window, margin);
        }
开发者ID:krikelin,项目名称:torshify-client,代码行数:26,代码来源:GlassHelper.cs

示例2: RegisterHotKey

        public static void RegisterHotKey(Window window, Key key, ModifierKeys modifiers, int keyId)
        {
            window.VerifyAccess();

            int winMods = 0;
            if ((modifiers & ModifierKeys.Alt) == ModifierKeys.Alt)
                winMods = winMods | MOD_ALT;

            if ((modifiers & ModifierKeys.Control) == ModifierKeys.Control)
                winMods = winMods | MOD_CONTROL;

            if ((modifiers & ModifierKeys.Shift) == ModifierKeys.Shift)
                winMods = winMods | MOD_SHIFT;

            if ((modifiers & ModifierKeys.Windows) == ModifierKeys.Windows)
                winMods = winMods | MOD_WIN;

            var helper = new WindowInteropHelper(window);
            RegisterHotKey(helper.Handle, keyId, winMods, KeyInterop.VirtualKeyFromKey(key));
        }
开发者ID:x-skywalker,项目名称:Tasks.Show,代码行数:20,代码来源:HotKeyHelper.cs

示例3: SetWindowThemeAttribute

        public static bool SetWindowThemeAttribute(Window window, bool showCaption, bool showIcon)
        {
            Verify.IsNotNull(window, "window");

            window.VerifyAccess();

            IntPtr hwnd = new WindowInteropHelper(window).Handle;

            if (_attributedWindows.ContainsKey(hwnd))
            {
                // The hook into the HWND's WndProc has the original settings cached.
                // Don't want to support dynamically adjusting that unless there's a need.
                throw new InvalidOperationException("Multiple calls to this function for the same Window are not supported.");
            }

            return _SetWindowThemeAttribute(window, showCaption, showIcon);
        }
开发者ID:krikelin,项目名称:torshify-client,代码行数:17,代码来源:GlassHelper.cs

示例4: UnregisterHotKey

 public static void UnregisterHotKey(Window window, int keyId)
 {
     window.VerifyAccess();
     var helper = new WindowInteropHelper(window);
     UnregisterHotKey(helper.Handle, keyId);
 }
开发者ID:x-skywalker,项目名称:Tasks.Show,代码行数:6,代码来源:HotKeyHelper.cs


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