/// <summary> /// Adds commands to the main window. /// </summary> /// <param name="window">The application window to which command visuals, menus, etc. are to be added.</param> /// <param name="commandProviders">The command providers.</param> public static void AddCommandsToMainWindow(this NativeWindow window, IEnumerable <ICommandProvider> commandProviders) { // Visit providers by weight. foreach (var commandProvider in commandProviders.OrderBy(c => c.Weight)) { // Collect all the command groups and sort them by weight. var commandGroups = commandProvider.CommandGroups.OrderBy(g => g.Weight); window.AddCommandGroups(commandGroups); } window.AddCommandsToMainWindowComplete(); }