Changed the destination picker behavior to not sort, this makes it possible to do the sorting in the destinations itself. OneNote places the current page on top, the printer list also starts with the default... etc.

This commit is contained in:
RKrom 2014-07-29 16:13:12 +02:00
commit cc7f303e08
9 changed files with 31 additions and 8 deletions

View file

@ -91,7 +91,23 @@ namespace Greenshot.Destinations {
/// </summary>
/// <returns>IEnumerable<IDestination></returns>
public override IEnumerable<IDestination> DynamicDestinations() {
PrinterSettings settings = new PrinterSettings();
string defaultPrinter = settings.PrinterName;
List<string> printers = new List<string>();
foreach (string printer in PrinterSettings.InstalledPrinters) {
printers.Add(printer);
}
printers.Sort(delegate(string p1, string p2) {
if(defaultPrinter.Equals(p1)) {
return -1;
}
if(defaultPrinter.Equals(p2)) {
return 1;
}
return p1.CompareTo(p2);
});
foreach(string printer in printers) {
yield return new PrinterDestination(printer);
}
}