void BtnFlipSeq_Click(object sender, RoutedEventArgs e) { SequenceFile sequenceFile = file as SequenceFile; if (file == null) { return; } if (sequenceFile.isRenderedWithLineNumbers) { sequenceFile.ConvertFileToLabels(); } else { sequenceFile.ConvertFileToLineNumbers(); } UpdateText(); }
void BtnProcessAllFiles_Click(object sender, RoutedEventArgs e) { //get a folder to look for files var dialog = new CommonOpenFileDialog(); dialog.IsFolderPicker = true; CommonFileDialogResult result = dialog.ShowDialog(); workingFolderPath = dialog.FileName; Directory.SetCurrentDirectory(workingFolderPath); viewers = new List <ConfigViewer>(); //remove anything open before docPane.Children.Clear(); List <ConfigFile> filesToLoad = new List <ConfigFile>(); //wire up the global variables sequenceFile = new SequenceFile(Path.Combine(workingFolderPath, "sequences.ini"), Colors.White, Colors.Black); variableFile = new ConfigFile(Path.Combine(workingFolderPath, "variables.ini")); filesToLoad.Add(sequenceFile); filesToLoad.Add(variableFile); string[] otherFiles = { Path.Combine(workingFolderPath, "safety.ini") , Path.Combine(workingFolderPath, "pid.ini") }; foreach (var otherFile in otherFiles) { if (File.Exists(otherFile)) { filesToLoad.Add(new ConfigFile(otherFile)); } } foreach (ConfigFile file in filesToLoad) { //create a new panel for Avalon Dock LayoutDocumentPane ldp = new LayoutDocumentPane(); LayoutDocument ld = new LayoutDocument(); ld.Title = Path.GetFileName(file.originalPath); ld.CanClose = false; ConfigViewer viewer = new ConfigViewer(file); viewers.Add(viewer); //add text editor to the Dock ld.Content = viewer; ldp.Children.Add(ld); docPane.Children.Add(ldp); //create a tool pane with the labels LayoutAnchorable toolWindow = new LayoutAnchorable(); toolWindow.Title = Path.GetFileNameWithoutExtension(file.originalPath); toolWindow.CanClose = false; //create teh ListBox to store labels ListBox boxOfLabels = new ListBox(); boxOfLabels.ItemsSource = file.labels; //wire up the dbl click event boxOfLabels.MouseDoubleClick += (object ss, MouseButtonEventArgs eee) => { viewer.NavigateToLabel(boxOfLabels.SelectedValue.ToString()); }; toolWindow.Content = boxOfLabels; toolPane.Children.Add(toolWindow); toolPane.DockWidth = new GridLength(150); } }