Esempio n. 1
0
        public PreMadeChatCommandControlViewModel(PreMadeChatCommandModelBase command)
        {
            this.command = command;

            this.setting = ChannelSession.Settings.PreMadeChatCommandSettings.FirstOrDefault(c => c.Name.Equals(this.command.Name));
            if (this.setting == null)
            {
                this.setting = new PreMadeChatCommandSettingsModel(this.command);
                ChannelSession.Settings.PreMadeChatCommandSettings.Add(this.setting);
            }

            this.TestCommand = this.CreateCommand((System.Func <object, System.Threading.Tasks.Task>)(async(parameter) =>
            {
                UserViewModel currentUser = ChannelSession.GetCurrentUser();
                await command.Perform(new CommandParametersModel(currentUser, arguments: new List <string>()
                {
                    "@" + currentUser.Username
                }));
            }));
        }
Esempio n. 2
0
        public PreMadeChatCommandControlViewModel(PreMadeChatCommandModelBase command)
        {
            this.command = command;

            this.setting = ChannelSession.Settings.PreMadeChatCommandSettings.FirstOrDefault(c => c.Name.Equals(this.command.Name));
            if (this.setting == null)
            {
                this.setting = new PreMadeChatCommandSettingsModel(this.command);
                ChannelSession.Settings.PreMadeChatCommandSettings.Add(this.setting);
            }

            this.TestCommand = this.CreateCommand(async() =>
            {
                UserViewModel currentUser = ChannelSession.GetCurrentUser();
                await ChannelSession.Services.Command.Queue(command, new CommandParametersModel(currentUser, arguments: new List <string>()
                {
                    "@" + currentUser.Username
                }));
            });
        }