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


C# List.OrderBy方法代码示例

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


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

示例1: ApplySortOrder

 private void ApplySortOrder( ref List<PhoneBookSearchResult> results, Library.Enums.SearchType type )
 {
     switch (type) {
         case Library.Enums.SearchType.Department:
             results = results.OrderBy( o => o.Department ).ThenBy( o => o.FullName ).ToList();
             break;
         case Library.Enums.SearchType.PhoneNumber:
         case Library.Enums.SearchType.Name:
         default:
             results = results.OrderBy( o => o.FullName ).ToList();
             break;
     }
 }
开发者ID:vkocjancic,项目名称:PhoneBookSearcher,代码行数:13,代码来源:MainWindow.xaml.cs

示例2: DetalleOrden

        private void DetalleOrden()
        {
            try
            {
                List<Clases.DetalleOrdenViewModel> detalle =
                    new List<Clases.DetalleOrdenViewModel>();

                foreach (Core.Venta.DetalleOrden item in this.orden.DetalleProducto)
                {
                    detalle.Add(
                        new Clases.DetalleOrdenViewModel(this.conexion)
                        {
                            DescripcionProducto = item.Producto.Descripcion,
                            PrecioProducto = Funcion.FormatoDecimal(item.Producto.PrecioVenta),
                            Cantidad = item.Cantidad,
                            Imagen = item.Producto.Imagen
                        }
                        );
                }

                this.dtgDetalleVenta.ItemsSource = detalle.OrderBy(x => x.DescripcionProducto);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
开发者ID:jerobux,项目名称:SHomies,代码行数:27,代码来源:DatosOrden.xaml.cs

示例3: SetGridData

 public void SetGridData(List<Product> products)
 {
     Products = products;
     InitializeFilters();
     _GridViewResult.Clear();
     _GridViewResult.AddRange((from p in products.OrderBy(o => o.ProductCategory) select new ProductGridViewModel(p)));
     foreach (ProductGridViewModel m in _GridViewResult)
     {
         ProductsGrid.Items.Add(m);
     }
 }
开发者ID:Saphora,项目名称:FA,代码行数:11,代码来源:ProductsGridControl.xaml.cs

示例4: UserControl_IsVisibleChanged

        // funkcja odpowiedzialna za ładowanie danych do elementów GUI
        private async void UserControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            try
            {
                if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
                    return;
                db = ViewLogic.dbContext;
                StocktakingViewModel.Stocktaking.SelectedTab = Tab.Devs;
                if (db == null || loadUI == false)
                    return;

                System.Windows.Data.CollectionViewSource deviceRecordViewSource =
                    (System.Windows.Data.CollectionViewSource)this.Resources["deviceRecordViewSource"];
                await db.sprzet.LoadAsync();
                List<sprzet> sprzety = db.sprzet.Local.ToList();
                List<DeviceRecord> rekordy = new List<DeviceRecord>();
                foreach (sprzet s in sprzety)
                {
                    rekordy.Add(new DeviceRecord(s));
                }
                deviceRecordViewSource.Source = rekordy.OrderBy(r => r.id);

                System.Windows.Data.CollectionViewSource sprzet_typViewSource =
                    (System.Windows.Data.CollectionViewSource)this.Resources["sprzet_typViewSource"];
                await db.sprzet_typ.LoadAsync();
                sprzet_typViewSource.Source = db.sprzet_typ.Local.ToBindingList();

                System.Windows.Data.CollectionViewSource roomRecordViewSource =
                    (System.Windows.Data.CollectionViewSource)this.Resources["roomRecordViewSource"];
                await db.sala.LoadAsync();
                List<sala> sale = db.sala.Local.ToList();
                List<RoomRecord> rekordyS = new List<RoomRecord>();
                foreach (sala s in sale)
                {
                    rekordyS.Add(new RoomRecord(s));
                }
                roomRecordViewSource.Source = rekordyS.OrderBy(r => r.id);

                System.Windows.Data.CollectionViewSource zakladViewSource =
                    (System.Windows.Data.CollectionViewSource)this.Resources["zakladViewSource"];
                await db.zaklad.LoadAsync();
                zakladViewSource.Source = db.zaklad.Local.ToList();

                loadUI = false;
            }
            catch (Exception)
            {
                ViewLogic.Blad("Wystapił bład w UserControl_IsVisibleChanged!");
            }
        }
开发者ID:losinieckipiotr,项目名称:BD2Ti2015Projekt,代码行数:51,代码来源:InstituteDevicesListView.xaml.cs

示例5: LoadHand

        public void LoadHand(List<Kaart> kaarten)
        {
            StackPanelHand.Children.Clear();

            foreach (Kaart k in kaarten.OrderBy(o => o.Soort.ID).ThenBy(o => o.Nummer))
            {
                Bitmap bmp = (Bitmap)Properties.Resources.ResourceManager.GetObject(k.Soort.Naam.ToUpper() + "_" + k.Nummer);
                System.Windows.Controls.Image img = new System.Windows.Controls.Image();
                img.Source = Bitmap2BitmapImage(bmp);
                img.Tag = k;
                img.MouseUp += img_MouseUp;
                StackPanelHand.Children.Add(img);
            }
        }
开发者ID:SyringesCo,项目名称:Wiesgame,代码行数:14,代码来源:GameWindow.xaml.cs

示例6: BuildTimeReport

		public static TimeData[] BuildTimeReport(DateTime fromDate, DateTime toDate, SortOrder so)
		{
			TimeData[] entries = TimeDataInterface.GetEntries(fromDate, toDate, so);

			try {
			    bool countCalls = App.Settings.manuallyTrackRvs;

				if (!countCalls) return entries;
				RvPreviousVisitData[] calls = RvPreviousVisitsDataInterface.GetCallsByDate(fromDate, toDate);

				if (calls != null) {
					var entriesMore = new List<TimeData>(entries);

					foreach (var c in calls) {
						bool found = false;
						foreach (var e in entries) {
							if (e.Date.Date != c.Date.Date) continue;
							// Check for call data which happened on the same date as another service day
							// If it did, add the values, otherwise continue
							e.Magazines += c.Magazines;
							e.Books += c.Books;
							e.Brochures += c.Brochures;
						        e.Tracts += c.Tracts;
							e.ReturnVisits += RvPreviousVisitsDataInterface.IsInitialCall(c) ? 0 : 1;
							found = true;
							break;
						}

						if (!found) { // We found a call, but no service time was recorded on this date
							entriesMore.Add(new TimeData()
											{
												Magazines = c.Magazines,
												Books = c.Books,
												Brochures = c.Brochures,
                                                                                                Tracts = c.Tracts,
												Date = c.Date,
												ReturnVisits = RvPreviousVisitsDataInterface.IsInitialCall(c) ? 0 : 1
											});
						}
					}
					entries = entriesMore.OrderBy(s => s.Date).ToArray();
				}
				return entries;
			} catch {
				return entries;
			}
		}
开发者ID:darthcaedus58,项目名称:my-time-wp7,代码行数:47,代码来源:Reporting.cs

示例7: client_ExecuteAsyncCompleted

        private void client_ExecuteAsyncCompleted(RestResponse response)
        {
            HtmlDocument doc = new HtmlDocument();
            doc.LoadHtml(response.Content);

            List<Account> data = new List<Account>();

            var nodes = from e in doc.DocumentNode.DescendantNodes()
                        where e.Name == "li" &&
                              e.Attributes.Contains("class") == true &&
                              e.Attributes["class"].Value == "account"
                        select e;
            foreach (HtmlNode node in nodes)
            {
                Account a = new Account();
                a.Name = (from e in node.DescendantNodes()
                          where e.Name == "span" &&
                                e.Attributes.Contains("class") == true &&
                                e.Attributes["class"].Value == "nickname"
                          select e).First().InnerText;
                a.Balance = (from e in node.DescendantNodes()
                             where e.Name == "span" &&
                                   e.Attributes.Contains("class") == true &&
                                   e.Attributes["class"].Value == "balance"
                             select e).First().InnerText;
                a.LastUpdated = (from e in node.DescendantNodes()
                                 where e.Name == "span" &&
                                       e.Attributes.Contains("class") == true &&
                                       e.Attributes["class"].Value == "last-updated"
                                 select e).First().InnerText;

                data.Add(a);
            }

            this.listBox1.ItemsSource = data.OrderBy(i => i.Name);

            double total = 0.00;
            foreach (Account a in data)
            {
                total += Convert.ToDouble(a.Balance.Replace("$", "").Replace("–", "-"));
            }

            this.textBlock1.Text = String.Format("{0:c}", total);

            this.ToggleProgressBar();
        }
开发者ID:jstart,项目名称:Mojito,代码行数:46,代码来源:OldMainPage.xaml.cs

示例8: PopulateGrid

        void PopulateGrid()
        {
            ParticipantResults = new List<ParticipantResult>();

            foreach (Participant p in Participants)
            {

                // todo: make this less dependant on `Places`
                if (Places.ContainsKey(p.Id))
                    ParticipantResults.Add(new ParticipantResult(p, Places[p.Id]));
                else
                    ParticipantResults.Add(new ParticipantResult(p));
            }

            ParticipantResults = ParticipantResults.OrderBy(p => p.LastName).ToList();

            dataGridResults.ItemsSource = ParticipantResults;
        }
开发者ID:dhaigh,项目名称:Swimalicious,代码行数:18,代码来源:EventResults.xaml.cs

示例9: CalculateToolBarPositionInfo

            internal static ToolBarPositionInfo CalculateToolBarPositionInfo(RadToolBar sourceToolBar, RadToolBarTray tray, Point mousePosition)
            {
                var band = CalculateBand(sourceToolBar, tray, mousePosition);

                List<RadToolBar> toolBars = new List<RadToolBar>();
                foreach (RadToolBar toolBar in tray.Items)
                {
                    if (toolBar != sourceToolBar && toolBar.Band == band.Band)
                    {
                        toolBars.Add(toolBar);
                    }
                }
                toolBars = toolBars.OrderBy(tb => tb.BandIndex).ToList();

                int bandIndex = CalculateBandIndex(tray.Orientation, sourceToolBar, toolBars, mousePosition);

                return new ToolBarPositionInfo(band.Band, band.NewBand, bandIndex, toolBars);
            }
开发者ID:Motaz-Al-Zoubi,项目名称:xaml-sdk,代码行数:18,代码来源:BandUtilititesSL.cs

示例10: GetJournalsByCropIdCompleted

        private void GetJournalsByCropIdCompleted(List<JournalModel> journals)
        {
            List<JournalModel> journalsWithImage = new List<JournalModel>();
            foreach (JournalModel jm in journals)
            {
                byte[] photoByte = jm.Photo;
                if (photoByte != null)
                {
                    using (MemoryStream ms = new MemoryStream(photoByte))
                    {
                        BitmapImage bmpImage = new BitmapImage();
                        bmpImage.SetSource(ms);
                        jm.BitmapPhoto = bmpImage;
                    }
                }
                journalsWithImage.Add(jm);
            }

            journalListBox.ItemsSource = journalsWithImage.OrderBy(x => x.DateEntered).ToList();
        }
开发者ID:vlado-github,项目名称:CropManager,代码行数:20,代码来源:JournalDetails.xaml.cs

示例11: RandomLayout

        public void RandomLayout()
        {
            foreach (var item in ClusterTable.LayerGroup)
            {
                List<Models.Comunity> comunityList = new List<Models.Comunity>();
                List<Models.Layer> layerList = new List<Models.Layer>();
                foreach (var layer in item.Items)
                {
                    layerList.Add(layer);
                    comunityList.AddRange(layer.Comunities);
                    layer.Comunities.Clear();
                }

                int c = 0;
                foreach (var comunity in comunityList.OrderBy(n=>new Guid()))
                {
                    layerList[c % layerList.Count].Comunities.Add(comunity);
                    c++;
                }
            }
        }
开发者ID:kiichi54321,项目名称:ClusterViewForSliverlinght,代码行数:21,代码来源:Clustering.cs

示例12: GenerateColumns

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

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

            var sortedRules = rules.OrderBy(cur => cur.Index);
            foreach(var rule in sortedRules)
            {
                dataGrid.Columns.Add(new DataGridTemplateColumn
                {
                    Header = rule,
                    HeaderTemplateSelector = RuleSelectorHeaderTemplateSelector.Instance,
                    CellTemplateSelector = DTReadOnlyCellTemplateSelector.Instance,
                    MinWidth = 70
                });
            }
        }
开发者ID:pedone,项目名称:DecisionTableAnalizer,代码行数:21,代码来源:AddMissingRulesDialog.xaml.cs

示例13: allChecked

        /* ALL CHECKED */
        private void allChecked(object sender, RoutedEventArgs e)
        {
            if (salesList != null)
            {
                inStockFilter.IsChecked = false;
                dairyFilter.IsChecked = false;
                bakeryFilter.IsChecked = false;
                meatFilter.IsChecked = false;
                produceFilter.IsChecked = false;

                salesList = initResults;

                if (sortAZ.IsSelected) { salesList = salesList.OrderBy(Items => Items.name).ToList(); }
                if (sortZA.IsSelected) { salesList = salesList.OrderBy(Items => Items.name).Reverse().ToList(); }
                if (sortLoHi.IsSelected) { salesList = salesList.OrderBy(Items => Items.price).ToList(); }
                if (sortHiLo.IsSelected) { salesList = salesList.OrderBy(Items => Items.price).Reverse().ToList(); }
                if (sortLoc.IsSelected) { salesList = salesList.OrderBy(Items => Items.location).ToList(); }

                salesListBox.ItemsSource = salesList;
            }
        }
开发者ID:edelaltares,项目名称:CPSC481,代码行数:22,代码来源:Sales.xaml.cs

示例14: UserControl_IsVisibleChanged

        //metoda uruchamiajaca sie wtedy gdy zostanie zmieniona widocznosc zakladki oraz gdy
        //uzytkownik przejdzie na ta zakladke
        //ladowane tutaj sa rekordy do gridow oraz inne typy do comboboxa
        private async void UserControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            try
            {
                if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
                    return;
                db = ViewLogic.dbContext;
                StocktakingViewModel.Stocktaking.SelectedTab = Tab.UsrAcc; 
                if (db == null || loadUI == false)
                    return;

                System.Windows.Data.CollectionViewSource userRecordViewSource =
                    ((System.Windows.Data.CollectionViewSource)(this.FindResource("userRecordViewSource")));
                List<UserRecord> rekordy = new List<UserRecord>();
                await db.konto.LoadAsync();//operacja asynchroniczna
                List<konto> konta = db.konto.Local.ToList();
                foreach (konto k in konta)
                {
                    rekordy.Add(new UserRecord(k));
                }
                userRecordViewSource.Source = rekordy.OrderBy(r => r.id);

                System.Windows.Data.CollectionViewSource konto_typViewSource =
                    ((System.Windows.Data.CollectionViewSource)(this.FindResource("konto_typViewSource")));
                await db.konto_typ.LoadAsync();//operacja asynchroniczna
                konto_typViewSource.Source = db.konto_typ.Local.ToBindingList().OrderBy(t => t.id);

                typComboBox.ItemsSource = db.konto_typ.Local.ToList().OrderBy(t => t.id);

                System.Windows.Data.CollectionViewSource pracownikViewSource =
                    ((System.Windows.Data.CollectionViewSource)(this.FindResource("pracownikViewSource")));
                pracownikViewSource.Source = await db.pracownik.Where(p => p.konto.Count == 0).ToListAsync();//operacja asnychroniczna

                loadUI = false;
            }
            catch (Exception)
            {
                ViewLogic.Blad("Wystapił bład w UserControl_IsVisibleChanged!");
            }
        }
开发者ID:losinieckipiotr,项目名称:BD2Ti2015Projekt,代码行数:43,代码来源:UserAccountView.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.OrderBy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。