public CommandGroupControlViewModel(CommandGroupSettings groupSettings, IEnumerable <CommandBase> commands) { this.GroupSettings = groupSettings; foreach (CommandBase command in commands) { this.Commands.Add(command); } }
private void SetGroupTimerInterval() { this.GroupTimerTextBox.IsEnabled = false; if (!string.IsNullOrEmpty(this.CommandGroupComboBox.Text)) { this.GroupTimerTextBox.IsEnabled = true; if (ChannelSession.Settings.CommandGroups.ContainsKey(this.CommandGroupComboBox.Text)) { CommandGroupSettings settings = ChannelSession.Settings.CommandGroups[this.CommandGroupComboBox.Text]; if (settings.TimerInterval > 0) { this.GroupTimerTextBox.Text = settings.TimerInterval.ToString(); } } } }
private void RefreshList() { this.timerCommands.Clear(); IEnumerable <TimerCommand> commands = ChannelSession.Settings.TimerCommands.ToList(); foreach (var group in commands.GroupBy(c => c.GroupName ?? string.Empty).OrderByDescending(g => !string.IsNullOrEmpty(g.Key)).ThenBy(g => g.Key)) { IEnumerable <CommandBase> cmds = (nameOrder > 0) ? group.OrderBy(c => c.Name) : group.OrderByDescending(c => c.Name); CommandGroupSettings groupSettings = null; if (!string.IsNullOrEmpty(cmds.First().GroupName) && ChannelSession.Settings.CommandGroups.ContainsKey(cmds.First().GroupName)) { groupSettings = ChannelSession.Settings.CommandGroups[cmds.First().GroupName]; } this.timerCommands.Add(new CommandGroupControlViewModel(groupSettings, cmds)); } }
protected void FullRefresh() { this.CommandGroups.Clear(); IEnumerable <CommandBase> commands = this.GetCommands(); foreach (var group in commands.GroupBy(c => c.GroupName ?? "ZZZZZZZZZZZZZZZZZZZZZZZ").OrderBy(g => g.Key)) { CommandGroupSettings groupSettings = null; string groupName = group.First().GroupName; if (!string.IsNullOrEmpty(groupName) && ChannelSession.Settings.CommandGroups.ContainsKey(groupName)) { groupSettings = ChannelSession.Settings.CommandGroups[groupName]; } this.CommandGroups.Add(new CommandGroupControlViewModel(groupSettings, group)); } }
public void AddCommand(CommandBase command) { foreach (CommandGroupControlViewModel group in this.CommandGroups) { if (string.Equals(group.GroupName, command.GroupName)) { group.AddCommand(command); return; } } CommandGroupSettings groupSettings = null; if (!string.IsNullOrEmpty(command.GroupName) && ChannelSession.Settings.CommandGroups.ContainsKey(command.GroupName)) { groupSettings = ChannelSession.Settings.CommandGroups[command.GroupName]; } this.CommandGroups.Add(new CommandGroupControlViewModel(groupSettings, new List <CommandBase>() { command })); }
private void RefreshList() { string filter = this.ActionGroupNameFilterTextBox.Text; if (!string.IsNullOrEmpty(filter)) { filter = filter.ToLower(); } this.actionGroupCommands.Clear(); IEnumerable <ActionGroupCommand> commands = ChannelSession.Settings.ActionGroupCommands.ToList(); foreach (var group in commands.Where(c => string.IsNullOrEmpty(filter) || c.Name.ToLower().Contains(filter)).GroupBy(c => c.GroupName ?? string.Empty).OrderByDescending(g => !string.IsNullOrEmpty(g.Key)).ThenBy(g => g.Key)) { IEnumerable <CommandBase> cmds = (nameOrder > 0) ? group.OrderBy(c => c.Name) : group.OrderByDescending(c => c.Name); CommandGroupSettings groupSettings = null; if (!string.IsNullOrEmpty(cmds.First().GroupName) && ChannelSession.Settings.CommandGroups.ContainsKey(cmds.First().GroupName)) { groupSettings = ChannelSession.Settings.CommandGroups[cmds.First().GroupName]; } this.actionGroupCommands.Add(new CommandGroupControlViewModel(groupSettings, cmds)); } }
public CommandGroupControlViewModel(CommandGroupSettings groupSettings, IEnumerable <CommandBase> commands) { this.GroupSettings = groupSettings; this.allCommands.AddRange(commands); this.RefreshCommands(); }
private void RefreshList() { string filter = this.CommandNameFilterTextBox.Text; if (!string.IsNullOrEmpty(filter)) { filter = filter.ToLower(); } this.customChatCommands.Clear(); this.NameSortingIcon.Visibility = Visibility.Collapsed; if (nameOrder == 1) { this.NameSortingIcon.Visibility = Visibility.Visible; this.NameSortingIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.ArrowDown; } else if (nameOrder == -1) { this.NameSortingIcon.Visibility = Visibility.Visible; this.NameSortingIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.ArrowUp; } this.CommandsSortingIcon.Visibility = Visibility.Collapsed; if (commandsOrder == 1) { this.CommandsSortingIcon.Visibility = Visibility.Visible; this.CommandsSortingIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.ArrowDown; } else if (commandsOrder == -1) { this.CommandsSortingIcon.Visibility = Visibility.Visible; this.CommandsSortingIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.ArrowUp; } this.PermissionsSortingIcon.Visibility = Visibility.Collapsed; if (permissionsOrder == 1) { this.PermissionsSortingIcon.Visibility = Visibility.Visible; this.PermissionsSortingIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.ArrowDown; } else if (permissionsOrder == -1) { this.PermissionsSortingIcon.Visibility = Visibility.Visible; this.PermissionsSortingIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.ArrowUp; } this.CooldownSortingIcon.Visibility = Visibility.Collapsed; if (cooldownOrder == 1) { this.CooldownSortingIcon.Visibility = Visibility.Visible; this.CooldownSortingIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.ArrowDown; } else if (cooldownOrder == -1) { this.CooldownSortingIcon.Visibility = Visibility.Visible; this.CooldownSortingIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.ArrowUp; } IEnumerable <ChatCommand> commands = ChannelSession.Settings.ChatCommands.ToList(); foreach (var group in commands.Where(c => string.IsNullOrEmpty(filter) || c.Name.ToLower().Contains(filter)).GroupBy(c => c.GroupName ?? string.Empty).OrderByDescending(g => !string.IsNullOrEmpty(g.Key)).ThenBy(g => g.Key)) { IEnumerable <CommandBase> cmds = group; if (nameOrder != 0) { cmds = (nameOrder > 0) ? group.OrderBy(c => c.Name) : group.OrderByDescending(c => c.Name); } else if (commandsOrder != 0) { cmds = (commandsOrder > 0) ? group.OrderBy(c => c.CommandsString) : group.OrderByDescending(c => c.CommandsString); } else if (permissionsOrder != 0) { cmds = (permissionsOrder > 0) ? group.OrderBy(c => c.Requirements.Role.RoleNameString) : group.OrderByDescending(c => c.Requirements.Role.RoleNameString); } else if (cooldownOrder != 0) { cmds = (cooldownOrder > 0) ? group.OrderBy(c => c.Requirements.Cooldown.CooldownAmount) : group.OrderByDescending(c => c.Requirements.Cooldown.CooldownAmount); } CommandGroupSettings groupSettings = null; if (!string.IsNullOrEmpty(cmds.First().GroupName) && ChannelSession.Settings.CommandGroups.ContainsKey(cmds.First().GroupName)) { groupSettings = ChannelSession.Settings.CommandGroups[cmds.First().GroupName]; } this.customChatCommands.Add(new CommandGroupControlViewModel(groupSettings, cmds)); } }