public static ascx_CodeStreams load_by_File_and_MethodName(this ascx_CodeStreams ascxCodeStreams, string file, string methodName) { if (ascxCodeStreams.AllSavedMethodStreams.isNull()) { "There are no SavedMethodStreams loaded".error(); } else if (ascxCodeStreams.AllSavedMethodStreams_MappedByFileName.hasKey(file).isFalse()) { "There is no MethodStream loaded for file: {0}".error(file); } else { foreach (var savedMethodStream in ascxCodeStreams.AllSavedMethodStreams_MappedByFileName[file]) { if (savedMethodStream.RootMethod.Name == methodName) { "Found a match, loading data for method: {0}".info(savedMethodStream.RootMethod.Signature); ascxCodeStreams.loadMethodStream(savedMethodStream); return(ascxCodeStreams); } } "could not find a match for method {0} inside file {1}".error(methodName, file); } return(ascxCodeStreams); }
public static ascx_CodeStreams buildGuiToViewFolderContents(this ascx_CodeStreams ascxCodeStreams, string initialFolder) { "in buildGuiToViewFolderContents, with initialFolder set to: {0}".info(initialFolder); var availableStreamsPanel = ascxCodeStreams.insert_Left(200, "Available Streams"); var sourceFolder = availableStreamsPanel.insert_Above(20) .add_Label("Source Folder:") .top(2) .append_TextBox("") .align_Right(availableStreamsPanel); Action <string> loadFilesFromFolder = (folder) => { var availableStreams = availableStreamsPanel.clear().add_TreeViewWithFilter(folder.files()); //, (filePath)=> filePath.fileName()); availableStreams.afterSelect <string>( (file) => { var savedMethodStream = file.load <Saved_MethodStream>(); ascxCodeStreams.loadMethodStream(savedMethodStream); }); availableStreams.selectFirst(); }; sourceFolder.onDrop( (folder) => { sourceFolder.set_Text(folder); loadFilesFromFolder(folder); }); sourceFolder.onEnter(loadFilesFromFolder); if (initialFolder.valid() && initialFolder.dirExists()) { loadFilesFromFolder(initialFolder); } return(ascxCodeStreams); }