本文整理汇总了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);
}
示例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;
}
}
示例3: Initialize
public static void Initialize()
{
_window = CoreWindow.GetForCurrentThread();
_windowsBounds = _window.Bounds;
_windowState = WindowState.Full;
_window.SizeChanged += _window_SizeChanged;
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例7: OnKeyDown
private void OnKeyDown(CoreWindow sender, KeyEventArgs args)
{
if (!isInPage)
return;
if (args.VirtualKey == VirtualKey.Back && word.FocusState == FocusState.Unfocused)
OnDelClicked(del, null);
}
示例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);
}
示例9: CoreWindow_KeyDown
private void CoreWindow_KeyDown(CoreWindow sender, KeyEventArgs args)
{
if (args.VirtualKey == VirtualKey.Escape)
{
Reset();
}
}
示例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;
}
}
示例11: NotificationService
public NotificationService(IConvertService convertService,IUserDataRepository userDataRepository)
{
Current = ApplicationData.Current.LocalSettings;
_convertService = convertService;
_userDataRepository = userDataRepository;
_coreWindow = Window.Current.CoreWindow;
}
示例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;
}
示例13: SetWindow
public void SetWindow(CoreWindow window)
{
_window = window;
InitializeCompositor();
BuildVisualTree();
}
示例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;
}
示例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);
}