本文整理汇总了C#中Windows类的典型用法代码示例。如果您正苦于以下问题:C# Windows类的具体用法?C# Windows怎么用?C# Windows使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Windows类属于命名空间,在下文中一共展示了Windows类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SourceGrid_DragStarting
/// <summary>
/// Start of the Drag and Drop operation: we set some content and change the DragUI
/// depending on the selected options
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
private async void SourceGrid_DragStarting(Windows.UI.Xaml.UIElement sender, Windows.UI.Xaml.DragStartingEventArgs args)
{
args.Data.SetText(SourceTextBox.Text);
if ((bool)DataPackageRB.IsChecked)
{
// Standard icon will be used as the DragUIContent
args.DragUI.SetContentFromDataPackage();
}
else if ((bool)CustomContentRB.IsChecked)
{
// Generate a bitmap with only the TextBox
// We need to take the deferral as the rendering won't be completed synchronously
var deferral = args.GetDeferral();
var rtb = new RenderTargetBitmap();
await rtb.RenderAsync(SourceTextBox);
var buffer = await rtb.GetPixelsAsync();
var bitmap = SoftwareBitmap.CreateCopyFromBuffer(buffer,
BitmapPixelFormat.Bgra8,
rtb.PixelWidth,
rtb.PixelHeight,
BitmapAlphaMode.Premultiplied);
args.DragUI.SetContentFromSoftwareBitmap(bitmap);
deferral.Complete();
}
// else just show the dragged UIElement
}
示例2: App_UnhandledException
private void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
{
//var client = new Microsoft.ApplicationInsights.TelemetryClient();
//client.TrackException(e.Exception);
_logger.Error(e.Exception);
e.Handled = true;
}
示例3: UrlTextBox_KeyUp
void UrlTextBox_KeyUp(object sender, Windows.UI.Xaml.Input.KeyRoutedEventArgs e)
{
if (e.Key == Windows.System.VirtualKey.Enter)
{
webView.Source = new Uri(UrlTextBox.Text);
}
}
示例4: CompleteAllCheckBox_Click
private void CompleteAllCheckBox_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
App.Store.Dispatch(new CompleteAllTodosAction
{
IsCompleted = CompleteAllCheckBox.IsChecked.Value
});
}
示例5: InitializeCameraButton_Tapped
/// <summary>
/// Initializes the camera and populates the UI
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async void InitializeCameraButton_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
{
var button = sender as Button;
// Clear any previous message.
rootPage.NotifyUser("", NotifyType.StatusMessage);
button.IsEnabled = false;
await _previewer.InitializeCameraAsync();
button.IsEnabled = true;
if (_previewer.IsPreviewing)
{
if (string.IsNullOrEmpty(_previewer.MediaCapture.MediaCaptureSettings.AudioDeviceId))
{
rootPage.NotifyUser("No audio device available. Cannot capture.", NotifyType.ErrorMessage);
}
else
{
button.Visibility = Visibility.Collapsed;
PreviewControl.Visibility = Visibility.Visible;
CheckIfStreamsAreIdentical();
PopulateComboBoxes();
VideoButton.IsEnabled = true;
}
}
}
示例6: AppBarBackButton_Click
private void AppBarBackButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
if (Frame.CanGoBack)
{
Frame.GoBack();
}
}
示例7: UpdateTrigger
private void UpdateTrigger(Windows.Graphics.Display.DisplayOrientations orientation)
{
var qualifiers = Windows.ApplicationModel.Resources.Core.ResourceContext.GetForCurrentView().QualifierValues;
var isOnMobile = qualifiers.ContainsKey("DeviceFamily") && qualifiers["DeviceFamily"].ToLowerInvariant() == "Mobile".ToLowerInvariant();
if (orientation == Windows.Graphics.Display.DisplayOrientations.None)
{
SetActive(false);
}
else if (orientation == Windows.Graphics.Display.DisplayOrientations.Landscape ||
orientation == Windows.Graphics.Display.DisplayOrientations.LandscapeFlipped)
{
if (isOnMobile)
{
SetActive(Orientation == Orientations.LandscapeMobile);
}
else
{
SetActive(Orientation == Orientations.Landscape);
}
}
else if (orientation == Windows.Graphics.Display.DisplayOrientations.Portrait ||
orientation == Windows.Graphics.Display.DisplayOrientations.PortraitFlipped)
{
if (isOnMobile)
{
SetActive(Orientation == Orientations.PortraitMobile);
}
else
{
SetActive(Orientation == Orientations.Portrait);
}
}
}
示例8: HardwareButtons_BackPressed
void HardwareButtons_BackPressed(object sender, Windows.Phone.UI.Input.BackPressedEventArgs e)
{
if (Frame.CanGoBack)
{
e.Handled = true; Frame.GoBack();
}
}
示例9: button_send_Tapped
private async void button_send_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
{
JArray ja = new JArray();
foreach (var a in ((ListView)listView_friends).SelectedItems)
{
classes.Friend friendToSendSnapTo = (classes.Friend)(a);
ja.Add(friendToSendSnapTo.username);
}
String JSON = await a.sendSnap(main.static_user, main.static_pass, pb, ja.ToString(), snap_file, int.Parse(slider_time.Value.ToString()));
//Frame.Navigate(typeof(snap_screen));
JObject jo = JObject.Parse(JSON);
if (jo["status"].ToString() == "True")
{
h.showSingleButtonDialog("Snap uploaded", "Snap uploaded successfully!", "Dismiss");
}
else
{
h.showSingleButtonDialog("Server error [" + jo["code"] + "]", ((jo["message"] != null) ? jo["message"].ToString() : "No server message was provided"), "Dismiss");
}
}
示例10: tlMainTabs_TabPointerEntered
private void tlMainTabs_TabPointerEntered(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
{
TabViewModel tvm = null;
if (sender is FrameworkElement)
{
var fe = (FrameworkElement)sender;
if (fe.DataContext is TabViewModel) tvm = (TabViewModel)fe.DataContext;
else return;
var visual = fe.TransformToVisual(layoutRoot);
var point1 = visual.TransformPoint(new Point(0, 40));
var point2 = new Point(point1.X + fe.ActualWidth + 180, point1.Y + fe.ActualHeight + 140);
//hide all the current tabs in the canvas
_spriteBatch.Elements.ToList().ForEach(delegate (IVisualTreeElement element) { element.IsVisible = false; });
//now delete all the relevant elements in the spritebatch
_spriteBatch.DeleteAll();
//create the new thumbnail sprite for current button
_spriteBatch.Add(new TabThumbnailSprite() { Layout = new Rect(point1, point2), ID = const_TabPreview, TextureBackgroundUri = tvm.ThumbUri, IsVisible = true });
_spriteBatch.IsVisible = true;
}
CanvasInvalidate();
}
示例11: CoreApplication_Suspending
private void CoreApplication_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
{
if (OnSuspending != null)
{
this.OnSuspending(this, null);
}
}
示例12: CoreWindow_VisibilityChanged
/// <summary>
/// If we've lost focus and returned to this app, reload the store, as the on-disk content might have
/// been changed by the background task.
/// </summary>
/// <param name="sender">Ignored</param>
/// <param name="args">Ignored</param>
private async void CoreWindow_VisibilityChanged(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.VisibilityChangedEventArgs args)
{
//if (args.Visible == true)
//{
// await DefaultViewModel.LoadTrips();
//}
}
示例13: image_Tapped
static void image_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
{
var image = sender as Image;
image.Height += 10;
image.Width += 10;
}
示例14: TargetTextBox_DragEnter
/// <summary>
/// Entering the Target, we'll change its background and optionally change the DragUI as well
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void TargetTextBox_DragEnter(object sender, Windows.UI.Xaml.DragEventArgs e)
{
/// Change the background of the target
VisualStateManager.GoToState(this, "Inside", true);
bool hasText = e.DataView.Contains(StandardDataFormats.Text);
e.AcceptedOperation = hasText ? DataPackageOperation.Copy : DataPackageOperation.None;
if (hasText)
{
e.DragUIOverride.Caption = "Drop here to insert text";
// Now customize the content
if ((bool)HideRB.IsChecked)
{
e.DragUIOverride.IsGlyphVisible = false;
e.DragUIOverride.IsContentVisible = false;
}
else if ((bool)CustomRB.IsChecked)
{
var bitmap = new BitmapImage(new Uri("ms-appx:///Assets/dropcursor.png", UriKind.RelativeOrAbsolute));
// Anchor will define how to position the image relative to the pointer
Point anchor = new Point(0,52); // lower left corner of the image
e.DragUIOverride.SetContentFromBitmapImage(bitmap, anchor);
e.DragUIOverride.IsGlyphVisible = false;
e.DragUIOverride.IsCaptionVisible = false;
}
// else keep the DragUI Content set by the source
}
}
示例15: WebView1_LoadCompleted
private void WebView1_LoadCompleted(object sender, Windows.UI.Xaml.Navigation.NavigationEventArgs e)
{
FuntownOAuthResult oauthResult;
if (!_ft.TryParseOAuthCallbackUrl(e.Uri, out oauthResult))
{
return;
}
if (oauthResult.IsSuccess)
{
var error_code = oauthResult.ErrorCode;
var code = oauthResult.Code;
var accessToken = oauthResult.AccessToken;
if (error_code == 100 && !string.IsNullOrEmpty(code))
{
RequestToken(code);
return;
}
if (error_code == 100 && !string.IsNullOrEmpty(accessToken))
{
LoginSucceded(accessToken);
return;
}
}
else
{
// user cancelled
}
}