saeedhushmand
یک شنبه 04 تیر 1391, 19:35 عصر
چه جوری می تونم در کد زیر به جای فایل txt از listbox استفاده کنم
Choices texts = new Choices();
string[] lines = File.ReadAllLines(Environment.CurrentDirectory + "\\action.txt");
foreach (string line in lines)
{
if (line.StartsWith("--") || line == String.Empty) continue;
var parts = line.Split(new char[] { '|' });
words.Add(new Word() { Text = parts[0], AttachedText = parts[1], IsShellCommand = (parts[2] == "true") });
texts.Add(parts[0]);
}
Grammar wordsList = new Grammar(new GrammarBuilder(texts));
speechRecognitionEngine.LoadGrammar(wordsList);
Choices texts = new Choices();
string[] lines = File.ReadAllLines(Environment.CurrentDirectory + "\\action.txt");
foreach (string line in lines)
{
if (line.StartsWith("--") || line == String.Empty) continue;
var parts = line.Split(new char[] { '|' });
words.Add(new Word() { Text = parts[0], AttachedText = parts[1], IsShellCommand = (parts[2] == "true") });
texts.Add(parts[0]);
}
Grammar wordsList = new Grammar(new GrammarBuilder(texts));
speechRecognitionEngine.LoadGrammar(wordsList);