public override async Task Execute(params object[] args) { OneNote.Scope scope; SortBy sorting; bool ascending; bool pinNotes; using (var dialog = new SortDialog()) { if (args != null && args.Length > 0 && args[0] is OneNote.Scope scopeArg) { dialog.SetScope(scopeArg); } if (dialog.ShowDialog(owner) != DialogResult.OK) { return; } scope = dialog.Scope; sorting = dialog.Sorting; ascending = dialog.Direction == SortDialog.Directions.Ascending; pinNotes = dialog.PinNotes; } logger.WriteLine($"sort scope:{scope} sorting:{sorting} ascending:{ascending}"); switch (scope) { case OneNote.Scope.Children: SortPages(sorting, ascending, true); break; case OneNote.Scope.Pages: SortPages(sorting, ascending, false); break; case OneNote.Scope.Sections: await SortSections(sorting, ascending, pinNotes); break; case OneNote.Scope.Notebooks: await SortNotebooks(sorting, ascending); break; } await Task.Yield(); }
public override async Task Execute(params object[] args) { OneNote.Scope scope; SortDialog.Sortings sorting; SortDialog.Directions direction; bool pinNotes; using (var dialog = new SortDialog()) { if (dialog.ShowDialog(owner) != DialogResult.OK) { return; } scope = dialog.Scope; sorting = dialog.Soring; direction = dialog.Direction; pinNotes = dialog.PinNotes; } logger.WriteLine($"sort scope:{scope} sorting:{sorting} direction:{direction}"); switch (scope) { case OneNote.Scope.Pages: SortPages(sorting, direction); break; case OneNote.Scope.Sections: SortSections(sorting, direction, pinNotes); break; case OneNote.Scope.Notebooks: SortNotebooks(sorting, direction); break; } await Task.Yield(); }