• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Windows类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Windows类属于命名空间,在下文中一共展示了Windows类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: Current_Activated

 void Current_Activated(object sender, Windows.UI.Core.WindowActivatedEventArgs e)
 {
     if (e.WindowActivationState == Windows.UI.Core.CoreWindowActivationState.Deactivated)
     {
         settingsPopup.IsOpen = false;
     }
 }
开发者ID:danielcsouza,项目名称:BananalTour,代码行数:7,代码来源:ResultadoBusca.xaml.cs


示例17: TextBox_KeyDown

        private void TextBox_KeyDown(object sender, Windows.UI.Xaml.Input.KeyRoutedEventArgs e)
        {
            var textBox = sender as TextBox;
            NewToDoItemNameTextBox = textBox;

            if (!string.IsNullOrEmpty(textBox.Text)
                && textBox.Text.Length > 3)
            {
                if (AddNewItemConfirmButton != null)
                    AddNewItemConfirmButton.IsEnabled = true;

                if (e.Key == Windows.System.VirtualKey.Enter)
                {
                    // Handle 'Enter' key for keyboard users
                    if (e.Key == Windows.System.VirtualKey.Enter)
                    {
                        e.Handled = true;
                        CreateNewToDoItem(textBox);
                    }
                }
            }
            else
            {
                if (AddNewItemConfirmButton != null)
                    AddNewItemConfirmButton.IsEnabled = false;
            }
        }
开发者ID:MuffPotter,项目名称:201505-MVA,代码行数:27,代码来源:MainPage.xaml.cs


示例18: putCredentials

 public void putCredentials(Windows.Data.Json.JsonObject jsonObject, string username, string password)
 {
     token = jsonObject.GetNamedString("token");
     currentUser = jsonObject.GetNamedNumber("userId").ToString();
     localSettings.Values["token"] = token;
     localSettings.Values["userId"] = currentUser;
 }
开发者ID:seymurramizli,项目名称:Professionals,代码行数:7,代码来源:Authentication.cs


示例19: symbolCombo_SelectionChanged

		// Cancel current shape request when the symbol selection changes 
		private async void symbolCombo_SelectionChanged(object sender, Windows.UI.Xaml.Controls.SelectionChangedEventArgs e)
		{
			if (MyMapView.Editor.IsActive)
				MyMapView.Editor.Cancel.Execute(null);

			await AcceptPointsAsync();
		}
开发者ID:jordanparfitt,项目名称:arcgis-runtime-samples-dotnet,代码行数:8,代码来源:TextSymbols.xaml.cs


示例20:

 void ITmdbObject.ProcessJson(Windows.Data.Json.JsonObject jsonObject)
 {
     Id = (int)jsonObject.GetSafeNumber("id");
     Name = jsonObject.GetSafeString("name");
     PosterPath = jsonObject.GetSafeString("poster_path");
     BackdropPath = jsonObject.GetSafeString("backdrop_path");
 }
开发者ID:Rawrpwnzl,项目名称:TMDbWrapper,代码行数:7,代码来源:BelongsToCollection.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Resources.ResourceLoader类代码示例发布时间:2022-05-24
下一篇:
C# WindowType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap