當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。