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


C# List.First方法代码示例

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


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

示例1: CalcAgeChampions

        // takes list of participants sorted by place in age division, returns top 3..ish
        List<AgeChampion> CalcAgeChampions(List<AgeChampion> champions, List<Participant> participants, int place = 1)
        {
            Participant p = participants.First();
            participants.Remove(p);

            // no points scored, cannot be a champion
            if (ParticipantPoints(p) == 0)
                return champions;

            champions.Add(new AgeChampion(p, place, ParticipantPoints(p)));

            // no more possible champions
            if (participants.Count == 0)
                return champions;

            // if the same number of points, equal age champion w/ same place
            if (champions.Last().Points == ParticipantPoints(participants.First()))
                CalcAgeChampions(champions, participants, place);

            // room for more champions
            else if (champions.Count < 3)
                CalcAgeChampions(champions, participants, place + 1);

            return champions;
        }
开发者ID:dhaigh,项目名称:Swimalicious,代码行数:26,代码来源:AgeChampions.xaml.cs

示例2: MainWindow

 public MainWindow()
 {
     InitializeComponent();
     _rules_them_all = OperationsManager.OperationsManager.GetInstance();
     this.DataContext = this._rules_them_all;
     string version_string = Assembly.GetExecutingAssembly().GetName().Version.Major.ToString() + "." + Assembly.GetExecutingAssembly().GetName().Version.Minor.ToString();
     string program_title = "ASML-McCallister Home Security ";
     this.Title = program_title + version_string;
     lblNumMissiles.Content = _rules_them_all.NumberMissiles.ToString();
     _rules_them_all.ChangedTargets += on_targets_changed;
     _rules_them_all.sdCompleted += Search_Destroy_Complete;
     _rules_them_all._timer.TimeCaptured += new EventHandler<TimerEventArgs>(_timer_TimeCaptured);
     _video_plugins = new List<IVideoPlugin>();
     // add video plugins to list here
     _video_plugins.Add(new DefaultVideo());
     // set current plugin here.
     _eye_of_sauron = _video_plugins.First();
     // setup resoultion information and event handler, start plugin.
     _eye_of_sauron.Width = (int)imgVideo.Width;
     _eye_of_sauron.Height = (int)imgVideo.Height;
     _eye_of_sauron.NewImage += new EventHandler(on_image_changed);
     _eye_of_sauron.Start();
     // Mode List initialization
     cmbModes.ItemsSource = _rules_them_all.Modes;
     _rules_them_all.OutOfAmmo += on_out_of_ammo;
     _rules_them_all.AmmoReduced += On_Ammo_Reduced;
     this.Closing += MainWindow_Closing;
 }
开发者ID:zactyy,项目名称:cpts323,代码行数:28,代码来源:MainWindow.xaml.cs

示例3: AddProfileDialog

        public AddProfileDialog(Window owner)
        {
            InitializeComponent();

            this.Owner = owner;

            OkCommand = new DelegateCommand(ExecuteOk, CanExecuteOk);
            _MainLayout.DataContext = this;

            Loaded += (sender, e) => MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));

            IPHostEntry ips = Dns.GetHostEntry(Dns.GetHostName());

            HostList = new List<string>();
            HostList.Add(string.Empty);
            HostList.Add(LOCALHOST_NAME);

            if (ips != null)
            {
                foreach (IPAddress ipAddress in ips.AddressList)
                {
                    HostList.Add(ipAddress.ToString());
                }
            }

            Host = HostList.First();
        }
开发者ID:linyunfeng,项目名称:mtapi,代码行数:27,代码来源:AddProfileDialog.xaml.cs

示例4: MainWindow

        public MainWindow()
        {
            InitializeComponent();
            // 以下を追加
            this.btnDownload.Click += (sender, e) =>
            {
                var client = new System.Net.WebClient();
                byte[] buffer = client.DownloadData("http://k-db.com/?p=all&download=csv");
                string str = Encoding.Default.GetString(buffer);
                string[] rows = str.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);

                // 1行目をラベルに表示
                this.lblTitle.Content = rows[0];
                // 2行目以下はカンマ区切りから文字列の配列に変換しておく
                List<string[]> list = new List<string[]>();
                rows.ToList().ForEach(row => list.Add(row.Split(new char[] { ',' })));
                // ヘッダの作成(データバインド用の設計)
                GridView view = new GridView();
                list.First().Select((item, cnt) => new { Count = cnt, Item = item }).ToList().ForEach(header =>
                {
                    view.Columns.Add(
                        new GridViewColumn()
                        {
                            Header = header.Item,
                            DisplayMemberBinding = new Binding(string.Format("[{0}]", header.Count))
                        });
                });
                // これらをリストビューに設定
                lvStockList.View = view;
                lvStockList.ItemsSource = list.Skip(1);
            };
        }
开发者ID:kudakas,项目名称:KabutradeTool1,代码行数:32,代码来源:MainWindow.xaml.cs

示例5: fillComboSchueler

 private void fillComboSchueler()
 {
     //TODO
     //Get Schueler where isGuide = false
     List<Schueler> content = new List<Schueler>();
     content.Add(new Schueler(1, "Hansi", "Jaeger", "5BHIFS", false));
     content.Add(new Schueler(1, "Markus", "Weber", "5BHIFS", false));
     content.Add(new Schueler(1, "Michael", "Delfser", "5BHIFS", false));
     cmbSchueler.SelectedItem = content.First();
     cmbSchueler.ItemsSource = content;
 }
开发者ID:Joniras,项目名称:Tatue-Organiser,代码行数:11,代码来源:AddGuideFromSchueler.xaml.cs

示例6: LaunchWindow

        public LaunchWindow()
        {
            string gameConfigurationFolder = "GameConfiguration";
            string gameConfigurationsPath = Path.Combine(gameConfigurationFolder, "gameConfigs.json");

            InitializeComponent();

            if (!Directory.Exists(gameConfigurationFolder))
                Directory.CreateDirectory(gameConfigurationFolder);

            //Loading the last used configurations for hammer
            RegistryKey rk = Registry.CurrentUser.OpenSubKey(@"Software\Valve\Hammer\General");

            var configs = new List<GameConfiguration>();

            //try loading json
            if (File.Exists(gameConfigurationsPath))
            {
                string jsonLoadText = File.ReadAllText(gameConfigurationsPath);
                configs.AddRange(JsonConvert.DeserializeObject<List<GameConfiguration>>(jsonLoadText));
            }

            //try loading from registry
            if (rk != null)
            {
                string BinFolder = (string)rk.GetValue("Directory");

                string gameData = Path.Combine(BinFolder, "GameConfig.txt");

                configs.AddRange(GameConfigurationParser.Parse(gameData));
            }

            //finalise config loading
            if (configs.Any())
            {
                //remove duplicates
                configs = configs.GroupBy(g => g.Name).Select(grp => grp.First()).ToList();

                //save
                string jsonSaveText = JsonConvert.SerializeObject(configs, Formatting.Indented);
                File.WriteAllText(gameConfigurationsPath, jsonSaveText);

                if (configs.Count == 1)
                    Launch(configs.First());

                GameGrid.ItemsSource = configs;
            }
            else//oh noes
            {
                LaunchButton.IsEnabled = false;
                WarningLabel.Content = "No Hammer configurations found. Cannot launch.";
            }
        }
开发者ID:ruarai,项目名称:CompilePal,代码行数:53,代码来源:LaunchWindow.xaml.cs

示例7: ProcessSelectionWindow

 public ProcessSelectionWindow( IEnumerable<EnvDTE.Process> processes )
     : base()
 {
     Processes = new List<ProcessItem> ();
     if ( processes.Count() == 0 ) {
         throw new ArgumentException ( "processes must contain items to show this dialog." );
     }
     foreach ( var p in processes ) {
         Processes.Add ( new ProcessItem ( p ) );
     }
     InitializeComponent ( );
     DataContext = this;
     this.Title = "{0} - {1}".With ( this.Title, Processes.First ( ).ShortName );
 }
开发者ID:modulexcite,项目名称:AttachToAny,代码行数:14,代码来源:ProcessSelectionWindow.xaml.cs

示例8: HorarioProximo

        private void HorarioProximo(List<string> saidasDiretas, TextBlock tb)
        {
            string proxSaida;
            try
            {
                proxSaida = saidasDiretas.Where(x => String.Compare(x, DateTime.Now.ToShortTimeString()) > 0).First();
            }
            catch (Exception)
            {
                proxSaida = saidasDiretas.First();
            }

            tb.Text = proxSaida;
        }
开发者ID:BlackBerets,项目名称:circular,代码行数:14,代码来源:MainPage.xaml.cs

示例9: expandPath

        private void expandPath(TreeViewItem item, List<String> path){
            if (path.Count == 0) return;
            for(int i=0; i< item.Items.Count; i++){
                TreeViewItem t = item.Items[i] as TreeViewItem;
                if (t.Header.ToString().Equals(path.First()))
                {
                    t.IsExpanded = true;
                    path.RemoveAt(0);
                    if (path.Count == 0)
                        t.IsSelected = true;
                    else
                        expandPath(t, path);
                    break;
                }
            }

        }
开发者ID:muzefm,项目名称:ebucms,代码行数:17,代码来源:UIRssWizard.xaml.cs

示例10: GroupToEdges

		public IEnumerable<Edge> GroupToEdges(List<Point> points)
		{
			List<Edge> edges = new List<Edge>();

			while (points.Any())
			{
				creatingTime.Start();
				var point = points.First();
				points.Remove(point);

				var edge = new Edge(point);
				creatingTime.Stop();

				edges.Add(GrowEdge(edge, points));
			}

			return edges;
		}
开发者ID:villj2,项目名称:ch.bfh.bti7301.searchrobot,代码行数:18,代码来源:EdgeDetectionAlgorithm.cs

示例11: ListOrganisationCompleted

 void ListOrganisationCompleted(List<Organisation> orgList)
 {
     Globals.IsBusy = false;
     _originalItemSource.Clear();
     foreach (Organisation item in orgList)
     {
         item.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(OrganisationItem_PropertyChanged);
         _originalItemSource.Add(item);
     }
     gvwOrganisations.ItemsSource = orgList;
     if (_seletedOrgId > 0 && orgList.Count(i => i.OrganisationId == _seletedOrgId) > 0)
     {
         gvwOrganisations.SelectedItem = orgList.First(i => i.OrganisationId == _seletedOrgId);
     }
     else if (orgList.Count > 0)
     {
         gvwOrganisations.SelectedItem = orgList[0];
     }
 }
开发者ID:netthanhhung,项目名称:Medical,代码行数:19,代码来源:PortalAdminPage.xaml.cs

示例12: GenerateColumns

        private void GenerateColumns(DataGrid dataGrid, List<RowViewModel> rows)
        {
            if (dataGrid == null || rows.Count == 0)
                return;

            var nameColumn = dataGrid.Columns.First();
            dataGrid.Columns.Clear();
            dataGrid.Columns.Add(nameColumn);

            var ruleCount = rows.First().States.Count;
            for (int i = 0; i < ruleCount; i++)
            {
                dataGrid.Columns.Add(new DataGridTemplateColumn
                {
                    Header = i + 1,
                    CellTemplateSelector = DTCellTemplateSelector.Instance,
                    MinWidth = 70
                });
            }
        }
开发者ID:pedone,项目名称:DecisionTableAnalizer,代码行数:20,代码来源:DecisionTableView.xaml.cs

示例13: Bannissement

        public Bannissement()
        {
            CultureManager.UICultureChanged += CultureManager_UICultureChanged;

            InitializeComponent();

            // Header de la fenetre
            App.Current.MainWindow.Title = Nutritia.UI.Ressources.Localisation.FenetreBannissement.Titre;

            LstMembre = new ObservableCollection<Membre>();
            LstBanni = new ObservableCollection<Membre>();
            TousLesMembres = new List<Membre>(ServiceFactory.Instance.GetService<IMembreService>().RetrieveAll());

            TousLesMembres.Remove(TousLesMembres.First(membre => membre.IdMembre == App.MembreCourant.IdMembre));

            RemplirListe();

            //SearchBox
            dgRecherche.DataGridCollection = CollectionViewSource.GetDefaultView(LstMembre);
            dgRecherche.DataGridCollection.Filter = new Predicate<object>(Filter);
        }
开发者ID:Nutritia,项目名称:nutritia,代码行数:21,代码来源:FenetreBannissement.xaml.cs

示例14: MainWindow

        public MainWindow()
        {
            InitializeComponent();
            _rules_them_all = OperationsManager.OperationsManager.GetInstance();
            this.DataContext = this._rules_them_all;
            string version_string = Assembly.GetExecutingAssembly().GetName().Version.Major.ToString() + "." + Assembly.GetExecutingAssembly().GetName().Version.Minor.ToString();
            string program_title = "ASML-McCallister Home Security ";
            this.Title = program_title + version_string;
            lblNumMissiles.Content = _rules_them_all.NumberMissiles.ToString();
            _rules_them_all.ChangedTargets += on_targets_changed;
            _rules_them_all.sdCompleted += Search_Destroy_Complete;
            _rules_them_all._timer.TimeCaptured += new EventHandler<TimerEventArgs>(_timer_TimeCaptured);
            _video_plugins = new List<IVideoPlugin>();
            bool PluginFunctioning = true;
            _detection_counter = 0;
            try
            {
                // add video plugins to list here
                _video_plugins.Add(new DefaultVideo());

            }
            catch (Exception)
            {
                PluginFunctioning = false;

            }
            // fail silently if video is not present or does not work.
            if (PluginFunctioning == true)
            {
                // set current plugin here.
                _eye_of_sauron = _video_plugins.First();
                _eye_of_sauron.NewImage += new EventHandler(on_image_changed);
                _eye_of_sauron.Start();
            }
            // Mode List initialization
            cmbModes.ItemsSource = _rules_them_all.Modes;
            _rules_them_all.AmmoReduced += On_Ammo_Reduced;
            this.Closing += MainWindow_Closing;
        }
开发者ID:zactyy,项目名称:cpts323,代码行数:39,代码来源:MainWindow.xaml.cs

示例15: PopulateLayoutRadioButtonsFromDisk

        /// <summary>
        /// Populates the layout radio buttons from disk.
        /// </summary>
        private void PopulateLayoutRadioButtonsFromDisk()
        {
            List<RadioButton> radioButtonList = new List<RadioButton>();
            var rockConfig = RockConfig.Load();
            List<string> filenameList = Directory.GetFiles( ".", "*.dplx" ).ToList();
            foreach ( var fileName in filenameList )
            {
                DplxFile dplxFile = new DplxFile( fileName );
                DocumentLayout documentLayout = new DocumentLayout( dplxFile );
                RadioButton radLayout = new RadioButton();
                if ( !string.IsNullOrWhiteSpace( documentLayout.Title ) )
                {
                    radLayout.Content = documentLayout.Title.Trim();
                }
                else
                {
                    radLayout.Content = fileName;
                }

                radLayout.Tag = fileName;
                radLayout.IsChecked = rockConfig.LayoutFile == fileName;
                radioButtonList.Add( radLayout );
            }

            if ( !radioButtonList.Any( a => a.IsChecked ?? false ) )
            {
                if ( radioButtonList.FirstOrDefault() != null )
                {
                    radioButtonList.First().IsChecked = true;
                }
            }

            lstLayouts.Items.Clear();
            foreach ( var item in radioButtonList.OrderBy( a => a.Content ) )
            {
                lstLayouts.Items.Add( item );
            }
        }
开发者ID:tcavaletto,项目名称:Rock-CentralAZ,代码行数:41,代码来源:SelectLayoutPage.xaml.cs


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