Ejemplo n.º 1
0
 public static ICommand ToCommand(this Operation operation, ILogger logger, ConfigManager config)
 {
     var runOp = operation as RunOperation;
     if (runOp != null)
         return RunProcessCommand.FromOperation(runOp, logger, config);
     return new EmptyCommand();
 }
Ejemplo n.º 2
0
 public static RunProcessCommand FromOperation(RunOperation operation, ILogger logger, ConfigManager config)
 {
     return new RunProcessCommand()
     {
         Title = operation.Title,
         OriginalTitle = operation.Title,
         ExecutablePath = operation.ExecutablePath,
         Arguments = operation.Arguments,
         WorkingFolder = operation.WorkingFolder,
         Logger = logger,
         DontClearLog = operation.DontClearLog,
         Config = config,
         Confirmation = operation.Confirmation
     };
 }
Ejemplo n.º 3
0
        public void OpenConfig(string path)
        {
            var man = new ConfigManager(path);
            man.Load();
            ConfigManager = man;

            ParameterViewModels.Apply(p => p.DealloateParent());
            ParameterViewModels.Clear();
            ParameterViewModels.AddRange(man.Config.Parameters.Select(p => new ParameterViewModel(p, this)));

            var currentStep = SelectedStep;
            Steps.Clear();
            Steps.AddRange(man.Config.Steps);
            SelectedStep = Steps.FirstOrDefault(s => s.Name == currentStep?.Name)
                                ?? Steps.FirstOrDefault(s => s.IsDefault)
                                ?? Steps.FirstOrDefault();

            Logger.LogSuccess("Config loaded: " + path);
        }