private void startButton_Click(object sender, EventArgs e) { IComplementarable completion = SetCompletionType(algComboBox.SelectedIndex); if (completion != null) { Dictionary <string, int> vocabularyWords = GetTxtVocabularyWords(); Dictionary <string, int> sourceWords = GetTxtSourceWords(); CompletionManager completionManager = new CompletionManager(completion, sortCB.Checked, vocabularyWords); if (sourceWords != null) { completionManager.Insert(sourceWords); } mainForm.Initialize(completionManager, (int)limitNum.Value); Close(); } else { string databasePath = GetDbPath(); if (databasePath != "") { CompletionManager completionManager = new CompletionManager(new DatabaseCompletion(databasePath, vocabularyCB.Checked), sortCB.Checked, null); mainForm.Initialize(completionManager, (int)limitNum.Value); Close(); } } }
public CompletionManager(IComplementarable completionSource, Dictionary <string, int> initialWords = null, bool sortByUsesCount = true) { completion = completionSource; if (initialWords != null) { completion.InsertWords(initialWords); } sortingByUsesCount = sortByUsesCount; }