protected override void OpenCore(string path) { var sequence = sequencePersistence.OpenSequence(path); var viewModel = new SequenceViewModel(sequence); fileEditorService.OpenSequenceInRegion(RegionNames.SequenceEditorRegion, path, viewModel); }
private void OpenSequence() { OpenRequest.Raise(fileNotification, n => { if (n.Confirmed) { var sequence = sequencePersistence.OpenSequence(n.Path); var missingChannels = configService == null ? new string[0] : sequence.PrimarySequence .Concat(sequence.AbortSequence) .Select(evt => evt.ChannelName) .Except(configService.Config.Channels.Select(channel => channel.Name)); if (missingChannels.Any()) { var builder = new StringBuilder(); foreach (var channel in missingChannels) { builder.AppendLine(channel); } // Missing channel names UnableToOpenSequenceNotification.Raise(new Notification { Title = "Unable to Open Sequence", Content = "Cannot open a sequence for running that has channel names not in the current configuration.\n" + "Missing channels:\n" + builder.ToString() }); } else { var viewModel = new SequenceViewModel(sequence); fileEditorService.OpenSequenceInRegion(RegionNames.SequenceRunnerRegion, n.Path, viewModel); } } }); }
public SequenceManagerViewModel(ISequenceEditorService fileEditorService, ISequencePersistence sequencePersistence) { NewSequenceCommand = new DelegateCommand(() => fileEditorService.OpenSequenceInRegion( RegionNames.SequenceEditorRegion, NewSequenceName, new SequenceViewModel(new Sequence()))); SaveSequenceCommand = new DelegateCommand <string>(str => SaveSequence(str != null ? Convert.ToBoolean(str) : false), _ => CurrentSequence != null); this.fileEditorService = fileEditorService; this.sequencePersistence = sequencePersistence; }