/// <summary> /// Initializes a new instance of the <see cref="InstalledModsControlViewModel" /> class. /// </summary> /// <param name="gameService">The game service.</param> /// <param name="localizationManager">The localization manager.</param> /// <param name="modService">The mod service.</param> /// <param name="appStateService">The application state service.</param> /// <param name="modSelectedSortOrder">The mod selected sort order.</param> /// <param name="modNameSortOrder">The mod name sort order.</param> /// <param name="modVersionSortOrder">The mod version sort order.</param> /// <param name="filterMods">The filter mods.</param> /// <param name="appAction">The application action.</param> /// <param name="notificationAction">The notification action.</param> public InstalledModsControlViewModel(IGameService gameService, ILocalizationManager localizationManager, IModService modService, IAppStateService appStateService, SortOrderControlViewModel modSelectedSortOrder, SortOrderControlViewModel modNameSortOrder, SortOrderControlViewModel modVersionSortOrder, SearchModsControlViewModel filterMods, IAppAction appAction, INotificationAction notificationAction) { this.modService = modService; this.gameService = gameService; this.appStateService = appStateService; this.appAction = appAction; this.notificationAction = notificationAction; this.localizationManager = localizationManager; ModNameSortOrder = modNameSortOrder; ModVersionSortOrder = modVersionSortOrder; ModSelectedSortOrder = modSelectedSortOrder; FilterMods = filterMods; }
/// <summary> /// Initializes the default sort order. /// </summary> /// <param name="dictKey">The dictionary key.</param> /// <param name="vm">The vm.</param> /// <param name="defaultOrder">The default order.</param> /// <param name="text">The text.</param> /// <param name="appState">State of the application.</param> protected virtual void InitDefaultSortOrder(string dictKey, SortOrderControlViewModel vm, Implementation.SortOrder defaultOrder, string text, IAppState appState) { if (!string.IsNullOrWhiteSpace(appState.InstalledModsSortColumn) && Enum.IsDefined(typeof(Implementation.SortOrder), appState.InstalledModsSortMode)) { if (dictKey.Equals(appState.InstalledModsSortColumn)) { var sort = (Implementation.SortOrder)appState.InstalledModsSortMode; vm.SortOrder = sort; } else { vm.SortOrder = Implementation.SortOrder.None; } } else { vm.SortOrder = defaultOrder; } vm.Text = text; sortOrders.Add(dictKey, vm); }