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


C# Windows类代码示例

本文整理汇总了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
 }
开发者ID:C-C-D-I,项目名称:Windows-universal-samples,代码行数:32,代码来源:Scenario2_DragUICustomization.xaml.cs

示例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;
 }
开发者ID:ChinaRAUnion,项目名称:RedAlertPlus,代码行数:7,代码来源:App.xaml.cs

示例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);
     }
 }
开发者ID:vapps,项目名称:-Hadows,代码行数:7,代码来源:WebBrowser.xaml.cs

示例4: CompleteAllCheckBox_Click

 private void CompleteAllCheckBox_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
 {
     App.Store.Dispatch(new CompleteAllTodosAction
     {
         IsCompleted = CompleteAllCheckBox.IsChecked.Value
     });
 }
开发者ID:win-wo,项目名称:redux.NET,代码行数:7,代码来源:Header.xaml.cs

示例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;
                }
            }
        }
开发者ID:hirokuma3,项目名称:Windows-universal-samples,代码行数:32,代码来源:Scenario3_AspectRatio.xaml.cs

示例6: AppBarBackButton_Click

 private void AppBarBackButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
 {
     if (Frame.CanGoBack)
     {
         Frame.GoBack();
     }
 }
开发者ID:diagonalwalnut,项目名称:GodTools,代码行数:7,代码来源:Settings.xaml.cs

示例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);
         }
     }
 }
开发者ID:mateerladnam,项目名称:DJNanoSampleApp,代码行数:33,代码来源:OrientationStateTrigger.cs

示例8: HardwareButtons_BackPressed

 void HardwareButtons_BackPressed(object sender, Windows.Phone.UI.Input.BackPressedEventArgs e) 
 { 
     if (Frame.CanGoBack) 
     {
            e.Handled = true; Frame.GoBack();
     }
 }
开发者ID:haoas,项目名称:Wp8.1WeiXinAssistant,代码行数:7,代码来源:MainPage.xaml.cs

示例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");
            }

        }
开发者ID:InZernetTechnologies,项目名称:PicLoc-Windows,代码行数:26,代码来源:send_snap.xaml.cs

示例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();
        }
开发者ID:liquidboy,项目名称:X,代码行数:31,代码来源:MainLayout.xaml.Tabs.cs

示例11: CoreApplication_Suspending

 private void CoreApplication_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e)
 {
     if (OnSuspending != null)
     {
         this.OnSuspending(this, null);
     }
 }
开发者ID:bitstadium,项目名称:HockeySDK-Windows,代码行数:7,代码来源:ApplicationService.cs

示例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();
     //}
 }
开发者ID:XPOWERLM,项目名称:More-Personal-Computing,代码行数:13,代码来源:TripListView.xaml.cs

示例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;
        }
开发者ID:psotirov,项目名称:TelerikAcademyProjects,代码行数:7,代码来源:ResizeImageManager.cs

示例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
     }
 }
开发者ID:C-C-D-I,项目名称:Windows-universal-samples,代码行数:32,代码来源:Scenario2_DragUICustomization.xaml.cs

示例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
            }
        }
开发者ID:chihchi,项目名称:facebook-windows8-sample,代码行数:31,代码来源:FuntownLoginPage.xaml.cs


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