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


C# Core.CoreWindow类代码示例

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


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

示例1: SetWindow

            /// <inheritdoc/>
            public void SetWindow(CoreWindow window)
            {
                this.window = window;

                // Safely dispose any previous instance
                RemoveAndDispose(ref deviceManager);
                RemoveAndDispose(ref target);
                RemoveAndDispose(ref cubeRenderer);

                // Creates a new DeviceManager (Direct3D, Direct2D, DirectWrite, WIC)
                deviceManager = ToDispose(new DeviceManager());

                // Use CoreWindowTarget as the rendering target (Initialize SwapChain, RenderTargetView, DepthStencilView, BitmapTarget)
                target = ToDispose(new CoreWindowTarget(window));

                // New CubeRenderer
                cubeRenderer = ToDispose(new CubeRenderer());
                var fpsRenderer = new FpsRenderer();

                // Add Initializer to device manager
                deviceManager.OnInitialize += target.Initialize;
                deviceManager.OnInitialize += cubeRenderer.Initialize;
                deviceManager.OnInitialize += fpsRenderer.Initialize;

                // Render the cube within the CoreWindow
                target.OnRender += cubeRenderer.Render;
                target.OnRender += fpsRenderer.Render;

                // Initialize the device manager and all registered deviceManager.OnInitialize 
                deviceManager.Initialize(DisplayProperties.LogicalDpi);
            }
开发者ID:Nezz,项目名称:SharpDX,代码行数:32,代码来源:Program.cs

示例2: InputEvents

        public InputEvents(CoreWindow window, UIElement inputElement, TouchQueue touchQueue)
        {
            _touchQueue = touchQueue;

            // The key events are always tied to the window as those will
            // only arrive here if some other control hasn't gotten it.
            window.KeyDown += CoreWindow_KeyDown;
            window.KeyUp += CoreWindow_KeyUp;
            window.VisibilityChanged += CoreWindow_VisibilityChanged;

            if (inputElement != null)
            {
                // If we have an input UIElement then we bind input events
                // to it else we'll get events for overlapping XAML controls.
                inputElement.PointerPressed += UIElement_PointerPressed;
                inputElement.PointerReleased += UIElement_PointerReleased;
                inputElement.PointerCanceled += UIElement_PointerReleased;
                inputElement.PointerMoved += UIElement_PointerMoved;
                inputElement.PointerWheelChanged += UIElement_PointerWheelChanged;
            }
            else
            {
                // If we only have a CoreWindow then use it for input events.
                window.PointerPressed += CoreWindow_PointerPressed;
                window.PointerReleased += CoreWindow_PointerReleased;
                window.PointerMoved += CoreWindow_PointerMoved;
                window.PointerWheelChanged += CoreWindow_PointerWheelChanged;
            }
        }
开发者ID:BrainSlugs83,项目名称:MonoGame,代码行数:29,代码来源:InputEvents.cs

示例3: Initialize

 public static void Initialize()
 {
     _window = CoreWindow.GetForCurrentThread();
     _windowsBounds = _window.Bounds;
     _windowState = WindowState.Full;
     _window.SizeChanged += _window_SizeChanged;
 }
开发者ID:sinmaplewing,项目名称:Hare-TortoiseGame,代码行数:7,代码来源:GameState.cs

示例4: CoreWindowOnKeyDown

        private void CoreWindowOnKeyDown(CoreWindow Sender, KeyEventArgs Args)
        {
            MoveDirection? direction = null;
            if (Args.VirtualKey == VirtualKey.Up)
            {
                direction = MoveDirection.Up;
            }
            else if (Args.VirtualKey == VirtualKey.Down)
            {
                direction = MoveDirection.Down;
            }
            else if (Args.VirtualKey == VirtualKey.Left)
            {
                direction = MoveDirection.Left;
            }
            else if (Args.VirtualKey == VirtualKey.Right)
            {
                direction = MoveDirection.Right;
            }

            if (direction != null)
            {
                _gameGrid.HandleMove(direction.Value);
            }
        }
开发者ID:andrecurvello,项目名称:2048,代码行数:25,代码来源:MainPage.xaml.cs

示例5: Scenario4

        public Scenario4()
        {
            this.InitializeComponent();

            try
            {
                formatterShortDateLongTime = new DateTimeFormatter("{month.integer}/{day.integer}/{year.full} {hour.integer}:{minute.integer(2)}:{second.integer(2)}", new[] { "en-US" }, "US", Windows.Globalization.CalendarIdentifiers.Gregorian, Windows.Globalization.ClockIdentifiers.TwentyFourHour);
                formatterLongTime = new DateTimeFormatter("{hour.integer}:{minute.integer(2)}:{second.integer(2)}", new[] { "en-US" }, "US", Windows.Globalization.CalendarIdentifiers.Gregorian, Windows.Globalization.ClockIdentifiers.TwentyFourHour);
                calendar = new Calendar();
                decimalFormatter = new DecimalFormatter();
                geofenceCollection = new  ObservableCollection<GeofenceItem>();
                eventCollection = new ObservableCollection<string>();

                // Geofencing setup
                InitializeGeolocation();

                // using data binding to the root page collection of GeofenceItems
                RegisteredGeofenceListBox.DataContext = geofenceCollection;

                // using data binding to the root page collection of GeofenceItems associated with events
                GeofenceEventsListBox.DataContext = eventCollection;

                coreWindow = CoreWindow.GetForCurrentThread(); // this needs to be set before InitializeComponent sets up event registration for app visibility
                coreWindow.VisibilityChanged += OnVisibilityChanged;
            }
            catch (Exception ex)
            {
                // GeofenceMonitor failed in adding a geofence
                // exceptions could be from out of memory, lat/long out of range,
                // too long a name, not a unique name, specifying an activation
                // time + duration that is still in the past
                _rootPage.NotifyUser(ex.ToString(), NotifyType.ErrorMessage);
            }
        }
开发者ID:RasmusTG,项目名称:Windows-universal-samples,代码行数:34,代码来源:Scenario4_ForegroundGeofence.xaml.cs

示例6: InputManager

        /// <summary>
        /// Initialise the input system. Note that accelerometer input defaults to off.
        /// </summary>
        /// <param name="game"></param>
        public InputManager(Project2Game game) : base(game)
        {

            // initialisation
            useMouseDelta = false;
            accelerometerEnabled = false;
            mouseDelta = new Vector2();

            keyboardManager = new KeyboardManager(game);
            mouseManager = new MouseManager(game);
            pointerManager = new PointerManager(game);
            keyMapping = new KeyMapping();

            // get the accelerometer. Returns null if no accelerometer found
            accelerometer = Accelerometer.GetDefault();
            window = Window.Current.CoreWindow;

            // Set up the gesture recognizer.  In this game, it only responds to TranslateX, TranslateY and Tap events
            gestureRecognizer = new Windows.UI.Input.GestureRecognizer();
            gestureRecognizer.GestureSettings = GestureSettings.ManipulationTranslateX | 
                GestureSettings.ManipulationTranslateY | GestureSettings.Tap;
            
            // Register event handlers for pointer events
            window.PointerPressed += OnPointerPressed;
            window.PointerMoved += OnPointerMoved;
            window.PointerReleased += OnPointerReleased;
            
            // automatically enable accelerometer if we have one
            this.AccelerometerEnabled(true);
            this.MouseDeltaEnabled(true);
            
        }
开发者ID:nuclearpidgeon,项目名称:graphicsproj2,代码行数:36,代码来源:InputManager.cs

示例7: OnKeyDown

 private void OnKeyDown(CoreWindow sender, KeyEventArgs args)
 {
     if (!isInPage)
         return;
     if (args.VirtualKey == VirtualKey.Back && word.FocusState == FocusState.Unfocused)
         OnDelClicked(del, null);
 }
开发者ID:XZiar,项目名称:WordsLinks,代码行数:7,代码来源:WritePage.xaml.cs

示例8: pointerMoved

		private void pointerMoved(CoreWindow sender, PointerEventArgs e)
		{
			theEvent.Type = ApplicationEventTypes.MouseMove;
			var loc = e.CurrentPoint.RawPosition;
			theEvent.CursorPosition = new Point2((int)loc.X, (int)loc.Y);
			handleEvent(theEvent);
		}
开发者ID:reignstudios,项目名称:ReignSDK,代码行数:7,代码来源:CoreMetroWindow.cs

示例9: CoreWindow_KeyDown

 private void CoreWindow_KeyDown(CoreWindow sender, KeyEventArgs args)
 {
     if (args.VirtualKey == VirtualKey.Escape)
     {
         Reset();
     }
 }
开发者ID:kfwls,项目名称:GTRhacktastic,代码行数:7,代码来源:MainPage.xaml.cs

示例10: MainPage_KeyDown

        private void MainPage_KeyDown(CoreWindow sender, KeyEventArgs args)
        {
            if (args.VirtualKey.Equals(VirtualKey.P) || args.VirtualKey.Equals(VirtualKey.Pause))
            {
                if (pause)
                    pause = true;
                else
                    pause = false;
            }
            if (args.VirtualKey.Equals(VirtualKey.Left)) //Bewegt die Bilder nach Links
            {
                CoverFlowControl.PreviousItem();
            }
            if (args.VirtualKey.Equals(VirtualKey.Right)) //Bewegt die Bilder nach Rechts
            {
                CoverFlowControl.NextItem();
            }

            if (args.VirtualKey.Equals(VirtualKey.R)) //Rotiert nach Rechts
            {
                
                CoverFlowControl.SelectedCoverItem.ZRotation -= 90;
            }
            if (args.VirtualKey.Equals(VirtualKey.L)) //Rotiert nach Rechts
            {

                CoverFlowControl.SelectedCoverItem.ZRotation += 90;
            }


        }
开发者ID:Deadkraut,项目名称:chris2013,代码行数:31,代码来源:MainPage.xaml.cs

示例11: NotificationService

 public NotificationService(IConvertService convertService,IUserDataRepository userDataRepository)
 {
     Current = ApplicationData.Current.LocalSettings;
     _convertService = convertService;
     _userDataRepository = userDataRepository;
     _coreWindow = Window.Current.CoreWindow;
 }
开发者ID:Mainmatsu,项目名称:App,代码行数:7,代码来源:NotificationService.cs

示例12: OnNavigatedTo

        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            ButtonInitialize.Click += new RoutedEventHandler(initDevice);
            ButtonIncomingCall.Click += new RoutedEventHandler(newIncomingCall);
            ButtonHangUp.Click += new RoutedEventHandler(hangUp);

            _cw = Window.Current.CoreWindow;
        }
开发者ID:oldnewthing,项目名称:old-Windows8-samples,代码行数:13,代码来源:phonecall.xaml.cs

示例13: SetWindow

        public void SetWindow(CoreWindow window)
        {
            _window = window;

            InitializeCompositor();

            BuildVisualTree();
        }
开发者ID:clarkezone,项目名称:BUILD2015-Talk-2-672,代码行数:8,代码来源:CompositionApp.cs

示例14: InitNewComposition

        //------------------------------------------------------------------------------
        //
        // VisualProperties.SetWindow
        //
        // This method is called when the CoreApplication has created a new CoreWindow,
        // allowing the application to configure the window and start producing content
        // to display.
        //
        //------------------------------------------------------------------------------

        void IFrameworkView.SetWindow(CoreWindow window)
        {
            _window = window;
            InitNewComposition();
            _window.PointerPressed += OnPointerPressed;
            _window.PointerMoved += OnPointerMoved;
            _window.PointerReleased += OnPointerReleased;
        }
开发者ID:RudyChen,项目名称:composition,代码行数:18,代码来源:VisualProperties.cs

示例15: SetWindow

		public void SetWindow(CoreWindow window)
		{
			if (CoreWindow != window) window.VisibilityChanged += visibilityChanged;

			CoreWindow = window;
			if (coreMetroWindow != null) coreMetroWindow.Dispose();
			coreMetroWindow = new CoreMetroWindow(this, window, theEvent, true);
		}
开发者ID:reignstudios,项目名称:ReignSDK,代码行数:8,代码来源:CoreWindowApplication.cs


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