public Admin(StepDirectory stepDirectory, CommandCenter commandCenter) { _stepDirectory = stepDirectory; _commandCenter = commandCenter; InitializeComponent(); _toggler = this.Toggler(); _stepDirectory.StepsUpdated += (d, e) => Dispatcher.Invoke((Action)(() => StepsUpdated(d,e))); StepChanged += (d, e) => { }; ExecuteCommandWithParameters += (d, e) => { }; LoadItems(_stepDirectory.Steps); }
private void StepsUpdated(StepDirectory stepDirectory, IEnumerable<Step> steps) { Step newSelectedStep = null; if(StepList.SelectedItems.Count > 0) { var stepName = StepList.SelectedItems.Cast<Step>().First().Metadata.Name; newSelectedStep = steps.SingleOrDefault( s => stepName.ToLowerInvariant() == s.Metadata.Name.ToLowerInvariant()); } LoadItems(steps); if(newSelectedStep != null) { StepList.SelectedItem = newSelectedStep; StepChanged(this, newSelectedStep); } }
private void InitializeSteps() { _stepDirectory = new StepDirectory(FindPathForDirectory("steps"), _engine); }