public void SetButtons(System.Collections.Generic.IEnumerable <DialogButton> buttonList) { buttonBox.Clear(); foreach (var b in buttonList.OrderBy(b => b == DefaultButton).Reverse()) { var button = new Button { Font = Font.SystemFont }; var tb = b; button.Clicked += delegate { OnClicked(tb); }; button.MinWidth = 77; // Dialog buttons have a minimal width of 77px on Mac if (b.PackOrigin == PackOrigin.End) { buttonBox.PackEnd(button); } else { buttonBox.PackStart(button); } buttons [b] = button; UpdateButton(b, button); } }
// Allgemeines Select mit einstellbarer Sortierung // Mittels sort wird ein übergebenes Resultset bezüglich der angegebenen Spalte sortiert und // die sortierte Liste zurückgegeben protected IQueryable <T> OrderFunc <T>(System.Collections.Generic.IEnumerable <T> tab, string ColName, bool desc) { System.Reflection.PropertyInfo pinfo = typeof(T).GetProperty(ColName); if (desc) { return(tab.OrderByDescending(t => pinfo.GetValue(t, null)).AsQueryable()); } else { return(tab.OrderBy(t => pinfo.GetValue(t, null)).AsQueryable()); } }
public static System.Collections.Generic.IEnumerable <T> Sort <T, TKey>(this System.Collections.Generic.IEnumerable <T> source, string sortDirection, Func <T, TKey> keySelector, Func <TKey, TKey, int> comparerMethod) { System.Collections.Generic.IEnumerable <T> result; if (sortDirection == "ASC") { result = source.OrderBy(keySelector, new MyComparer <TKey>(comparerMethod)); } else { result = source.OrderByDescending(keySelector, new MyComparer <TKey>(comparerMethod)); } return(result); }
/// <summary> /// Construtor padr�o. /// </summary> /// <param name="word"></param> /// <param name="count"></param> /// <param name="channelId"></param> /// <param name="parameters"></param> public WordRank2(string word, int count, int channelId, System.Collections.Generic.IEnumerable <Parameter> parameters) { Word = word; Count = count; ChannelId = channelId; if (parameters != null) { Parameters = parameters.OrderBy(f => f.Name).ToArray(); } else { Parameters = new Parameter[0]; } }
static void PrintSystemFonts() { var collection = new SixLabors.Fonts.FontCollection(); System.Collections.Generic.IEnumerable <FontFamily> families = SystemFonts.Collection.Families; IOrderedEnumerable <FontFamily> orderd = families.OrderBy(x => x.Name); int len = families.Max(x => x.Name.Length); foreach (FontFamily f in orderd) { Console.Write(f.Name.PadRight(len)); Console.Write('\t'); Console.Write(string.Join(",", f.AvailableStyles.OrderBy(x => x).Select(x => x.ToString()))); Console.WriteLine(); } }