本文整理汇总了C#中Entry.displayLines方法的典型用法代码示例。如果您正苦于以下问题:C# Entry.displayLines方法的具体用法?C# Entry.displayLines怎么用?C# Entry.displayLines使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entry
的用法示例。
在下文中一共展示了Entry.displayLines方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
//.........这里部分代码省略.........
NoteFilter filter = new NoteFilter();
Console.WriteLine();
Console.WriteLine("What word do you want to search through the notes for?");
Console.WriteLine("Enter word: ");
filter.Words = Console.ReadLine();
//filter.Words = "business";
//Creates a new NoteList struct, which returns a list of individual notes out of a larger set of them
NoteList noteList = new NoteList();
//This finds all notes containing the word that was given by the user
noteList = noteStore.findNotes(authToken, filter, offset, maxNotes);
//This stores the Guids of the notes containing the word
ArrayList guidList = new ArrayList();
// For each note in the list of notes...
foreach (Note fetchedNote in noteList.Notes)
{
//Console.WriteLine(" * " + fetchedNote.Guid);
// Add guid to list
guidList.Add(fetchedNote.Guid);
}
// For each guid in the list...
foreach (String Guid in guidList)
{
// Get the contents of the matching notes
String text = noteStore.getNoteContent(authToken, Guid);
// Then split the contents by line
string[] split = Regex.Split(text, "\\n");
Console.WriteLine();
int MAX = split.Length;
String line1;
String line2;
String line3;
// This for-loop cycles through each line in the array of lines and tests if the line contains the word.
// If so, it sets the note Guid as well as the surrounding lines as properties to a new Entry object.
for (int n = 0; n < MAX; n++)
{
Boolean b = split[n].Contains(filter.Words);
if (b == true)
{
line2 = split[n];
line1 = split[n - 1];
line3 = split[n + 1];
Entry postgresEntry = new Entry();
postgresEntry.setGuid(Guid);
postgresEntry.setLine1(line1);
postgresEntry.setLine2(line2);
postgresEntry.setLine3(line3);
Console.WriteLine("Note GUID: " + postgresEntry.getGuid());
Console.WriteLine();
postgresEntry.displayLines();
postgresEntry.InsertRow();
Console.WriteLine();
//postgresEntry.getLastInsertedRow();
NoteEntry mysqlNote = new NoteEntry();
mysqlNote.Guid = Guid;
mysqlNote.Line1 = line1;
mysqlNote.Line2 = line2;
mysqlNote.Line3 = line3;
repository.Create(mysqlNote);
}
}
}
Console.WriteLine();
Console.WriteLine("These lines have been saved to a Postgresql database using ODBC.");
Console.WriteLine("They have also been saved to a MySQL database using Fluent NHibernate.");
Console.WriteLine();
Console.WriteLine("Which row do you want to retrieve from the MySQL database?");
String id = Console.ReadLine();
int num = int.Parse(id);
NoteEntry noteEntry = repository.RetrieveById(num);
Console.WriteLine("This is entry " + num + " retrieved from the MySQL database...");
Console.WriteLine();
Console.WriteLine("GUID: " + noteEntry.Guid);
Console.WriteLine("Line 1: " + noteEntry.Line1);
Console.WriteLine("Line 2: " + noteEntry.Line2);
Console.WriteLine("Line 3: " + noteEntry.Line3);
Console.WriteLine();
Console.WriteLine("Click ENTER to continue...");
Console.ReadLine();
}