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


C# System.Diagnostics.Contains方法代码示例

本文整理汇总了C#中System.Diagnostics.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# System.Diagnostics.Contains方法的具体用法?C# System.Diagnostics.Contains怎么用?C# System.Diagnostics.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Diagnostics的用法示例。


在下文中一共展示了System.Diagnostics.Contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MainWindow

        public MainWindow()
        {
            InitializeComponent();

            //AddHandler(MouseRightButtonDownEvent, new MouseButtonEventHandler(Window_MouseRightButtonDown), true);
            AddHandler(CustomButton.BubbledClickEvent, new RoutedEventHandler(AddBorder));

            MouseDown += (s, e) =>
            {
                TheText.Background = Brushes.Beige;
            };

            TheText.MouseDown += (s, e) =>
            {
                TheText.Background = Brushes.Azure;
                //This keeps the MouseDown handler on the window from raising
                e.Handled = true;
            };

            //MouseEnter is registered with a Direct routing strategy
            MouseEnter += (s, e) =>
            {
                TheText.Foreground = Brushes.Blue;
            };

            TheText.MouseEnter += (s, e) =>
            {
                TheText.Foreground = Brushes.Red;
            };

            TheOuterButton.Click += (s, e) =>
            {
                TheOuterButton.BorderBrush = new SolidColorBrush(new Color { R = 120, G = 145, B = 135 });
            };

            TheInnerButton.Click += (s, e) =>
            {
                TheOuterButton.BorderBrush = new SolidColorBrush(new Color { R = 45, G = 20, B = 35 });
                e.Handled = true;
            };

            //Setting handled here keeps the TextInput event on the TextBox from firing
            TheTextBox.PreviewTextInput += (s, e) =>
            {
                var numbers = new[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
                if (e.Text.ToCharArray().All(x => !numbers.Contains(x)))
                    e.Handled = true;
            };

            TheCustomButton.DirectClick += (s, e) => Debug.WriteLine("Outer Direct Click");
            TheCustomButton.TunneledClick += (s, e) => Debug.WriteLine("Outer Tunneled Click");
            TheCustomButton.BubbledClick += (s, e) => Debug.WriteLine("Outer Bubbled Click");
            TheInnerCustomButton.DirectClick += (s, e) => Debug.WriteLine("Inner Direct Click");
            TheInnerCustomButton.TunneledClick += (s, e) => Debug.WriteLine("Inner Tunneled Click");
            TheInnerCustomButton.BubbledClick += (s, e) => Debug.WriteLine("Inner Bubbled Click");
        }
开发者ID:jchristian,项目名称:wpf_experimentation,代码行数:56,代码来源:MainWindow.xaml.cs

示例2: Seed

        public override void Seed()
        {
            if (_entities.Query<Place>().Any()) return;

            var earth = _queryProcessor.Execute(new GetPlaceByWoeIdQuery { WoeId = GeoPlanetPlace.EarthWoeId });
            Debug.Assert(earth != null);

            var geoPlanetContinents = _geoPlanet.Continents()
                .OrderBy(c => c.Name)
                .ToArray()
            ;
            foreach (var geoPlanetContinent in geoPlanetContinents)
            {
                var continent = _queryProcessor.Execute(new GetPlaceByWoeIdQuery { WoeId = geoPlanetContinent.WoeId });
                Debug.Assert(continent != null);
            }

            //var countriesToImport = new[]
            //{
            //    "United States", "China", "United Kingdom", "Peru", "South Africa", "Australia", "India", "Egypt",
            //};
            var countriesToImport = new[]
            {
                "United States", "China", "United Kingdom",
            };
            var geoPlanetCountries = _geoPlanet.Countries()
                .Where(c => countriesToImport.Contains(c.Name))
                .OrderBy(c => c.Name)
                .ToArray()
            ;
            foreach (var geoPlanetCountry in geoPlanetCountries)
            {
                var country = _queryProcessor.Execute(new GetPlaceByWoeIdQuery { WoeId = geoPlanetCountry.WoeId });
                Debug.Assert(country != null);
            }

            foreach (var geoPlanetCountry in geoPlanetCountries)
            {
                var geoPlanetStates = _geoPlanet.States(geoPlanetCountry.WoeId)
                    .OrderBy(s => s.Name)
                    .Take(5)
                    .ToArray()
                ;
                if (!geoPlanetStates.Any()) continue;
                foreach (var geoPlanetState in geoPlanetStates)
                {
                    var state = _queryProcessor.Execute(new GetPlaceByWoeIdQuery { WoeId = geoPlanetState.WoeId });
                    Debug.Assert(state != null);
                }
            }
        }
开发者ID:danludwig,项目名称:UCosmic,代码行数:51,代码来源:PlaceByGeoPlanetEntitySeeder.cs


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