Esempio n. 1
0
        public void RunCommand(CommandViewModel viewModel)
        {
            switch (viewModel)
            {
            case UserCommandViewModel userCommandViewModel:
                foreach (var line in userCommandViewModel.Command.Lines)
                {
                    //RunnerService.Run(line.Text);
                }
                break;

            case AllCommandViewModel allCommandViewModel:
                //RunnerService.Run($"{allCommandViewModel.Prefix} {viewModel.Description}");
                break;

            case VariableViewModel _:
                //viewModel.Description = RunnerService.GetVariableValue(viewModel.Name)?.ToString() ?? string.Empty;
                break;

            case ProcessViewModel _:
                //RunnerService.Run(viewModel.Name);
                break;

            default:
                throw new NotImplementedException();
            }
        }
Esempio n. 2
0
        public async Task EditCommandAsync(CommandViewModel viewModel)
        {
            switch (viewModel)
            {
            case UserCommandViewModel userCommandViewModel:
                var newCommand      = (Command)userCommandViewModel.Command.Clone();
                var dialogViewModel = new CommandSettingsViewModel(newCommand);
                var result          = await this.ShowDialogAsync(dialogViewModel);

                if (result != true)
                {
                    return;
                }

                foreach (var key in userCommandViewModel.Command.Keys)
                {
                    StorageService.Remove(key.Text);
                }
                foreach (var key in newCommand.Keys)
                {
                    StorageService[key.Text] = newCommand;
                }

                var index = UserCommands.IndexOf(userCommandViewModel);
                UserCommands.Remove(userCommandViewModel);
                UserCommands.Insert(index, new UserCommandViewModel(newCommand));

                break;

            default:
                throw new NotImplementedException();
            }
        }
Esempio n. 3
0
        public void DeleteCommand(CommandViewModel viewModel)
        {
            switch (viewModel)
            {
            case UserCommandViewModel userCommandViewModel:
                foreach (var key in userCommandViewModel.Command.Keys)
                {
                    StorageService.Remove(key.Text);
                }
                UserCommands.Remove(userCommandViewModel);
                break;

            case ProcessViewModel processViewModel:
                //processViewModel.Process.Cancel();
                NotifyOfPropertyChange(nameof(Processes));
                break;

            default:
                throw new NotImplementedException();
            }
        }