當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。