private async void TextBox_data_MouseDoubleClick(object sender, MouseButtonEventArgs e) { var fileName = MyLib.Open(); if (fileName == null) { return; } var encodingSelected = MessageBox.Show("\"Yes\" to use UTF-8\r\n\"No\" to use UTF-16 (Unicode)", "", MessageBoxButton.YesNo); if (encodingSelected == MessageBoxResult.None) { return; } Log.Assert(encodingSelected == MessageBoxResult.Yes || encodingSelected == MessageBoxResult.No); var encoding = encodingSelected == MessageBoxResult.Yes ? Encoding.UTF8 : Encoding.Unicode; int dataPreprocessMethodId = radioPanel_newData.SelectedIndex; bool debugMode = (bool)checkBox_debugMode.IsChecked; await stackPanel_tasksQueue.EnqueueTaskAsync($"Read Data {fileName} {encoding} {debugMode} {dataPreprocessMethodId}", new Func <Task>(async() => { mainData = await Task.Run(() => TextProcess.ReadTextStream(new FileStream(fileName, FileMode.Open, FileAccess.Read), encoding, debugMode)); await Task.Run(() => TextProcess.Process(ref mainData, dataPreprocessMethodId)); Log.Write(" OK"); })); }
private async void Button_new_Click(object sender, RoutedEventArgs e) { var fileName = MyLib.Open(); if (fileName == null) { return; } var encodingSelected = MessageBox.Show("\"Yes\" to use UTF-8\r\n\"No\" to use UTF-16 (Unicode)", "", MessageBoxButton.YesNo); if (encodingSelected == MessageBoxResult.None) { return; } Log.Assert(encodingSelected == MessageBoxResult.Yes || encodingSelected == MessageBoxResult.No); var encoding = encodingSelected == MessageBoxResult.Yes ? Encoding.UTF8 : Encoding.Unicode; int maxWordLength = int.Parse(inputField_data["maxWordLength"].Text); bool debugMode = (bool)checkBox_debugMode.IsChecked; int processMethod = radioPanel_newData.SelectedIndex; await stackPanel_tasksQueue.EnqueueTaskAsync($"BuildDataAsync({fileName},{encoding},{processMethod},{maxWordLength},{debugMode})", new Func <Task>(async() => await Task.Run(() => BuildData( new FileStream(fileName, FileMode.Open, FileAccess.Read), encoding, processMethod, maxWordLength, debugMode)))); }
private async void Button_load_Click(object sender, RoutedEventArgs e) { var fileName = MyLib.Open(); if (fileName == null) { return; } await stackPanel_tasksQueue.EnqueueTaskAsync($"Read Trie {fileName}", new Func <Task>(async() => { Log.WriteLine("Loading trie..."); await Task.Run(() => trie.Load(new FileStream(fileName, FileMode.Open, FileAccess.Read))); Log.Write(" OK"); })); }