public MainWindow() { InitializeComponent(); RtbResult.IsReadOnly = true; BtnSave.IsEnabled = false; Load(Path); var data = new DataBaseManager(new MySqlConnectionFactory(), Settings.Server, Settings.DbName, Settings.DbUser, Settings.DbPassword); var queryProvider = Settings.AlphabeticalTables ? (IQueryProvider) new SqlQueryProviderAlpha(Settings.TableNames) : new SqlQueryProvider(Settings.TableNames); if (Settings.UseDictionary) { if (_dictionary == null) { _dictionary = LoadDictionary(); _main = _dictionary; } } else { if (_unigrams == null) { _unigrams = LoadUnigrams(); _main = _unigrams; } } _letterChanger = new DiacriticMarksAdder(); _splitter = Settings.SentenceSpliterOn ? new SentencesSplitter() : null; _iManager = Settings.IgnorePunctationMarks ? new InterpunctionManager() : null; _connector = (Settings.NoOfMethod == 0) ? (INgramsConnector) new UpDown() : new Hierarchy(); _analyzer = new DiacriticMarksRestorer(_letterChanger, _main, _splitter, _iManager, _connector); _analyzer.SetData(data); _analyzer.SetQueryProvider(queryProvider); _analyzer.SetNgram(Settings.Type); _timer.Elapsed += OnTimerElapsed; Style noSpaceStyle = new Style(typeof(Paragraph)); noSpaceStyle.Setters.Add(new Setter(Paragraph.MarginProperty, new Thickness(0))); RtbInput.Resources.Add(typeof(Paragraph), noSpaceStyle); RtbResult.Resources.Add(typeof(Paragraph), noSpaceStyle); }
/// <summary> /// Handles the Click event of the MenuButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void MenuButton_Click(object sender, RoutedEventArgs e) { var subWindow = new SettingsWindow(); subWindow.ShowDialog(); if (!subWindow.ChangeSettings) { return; } var data = new DataBaseManager(new MySqlConnectionFactory(), Settings.Server, Settings.DbName, Settings.DbUser, Settings.DbPassword); var queryProvider = Settings.AlphabeticalTables ? (IQueryProvider) new SqlQueryProviderAlpha(Settings.TableNames) : new SqlQueryProvider(Settings.TableNames); if (Settings.UseDictionary) { if (_dictionary == null) { _dictionary = LoadDictionary(); _main = _dictionary; } } else { if (_unigrams == null) { _unigrams = LoadUnigrams(); _main = _unigrams; } } _letterChanger = new DiacriticMarksAdder(); _splitter = Settings.SentenceSpliterOn ? new SentencesSplitter() : null; _iManager = Settings.IgnorePunctationMarks ? new InterpunctionManager() : null; _connector = (Settings.NoOfMethod == 0) ? (INgramsConnector) new UpDown() : new Hierarchy(); _analyzer = new DiacriticMarksRestorer(_letterChanger, _main, _splitter, _iManager, _connector); _analyzer.SetData(data); _analyzer.SetQueryProvider(queryProvider); _analyzer.SetNgram(Settings.Type); }
private static void Initialize() { var data = new DataBaseManager(new MySqlConnectionFactory(), Settings.Server, Settings.DbName, Settings.DbUser, Settings.DbPassword); var queryProvider = Settings.AlphabeticalTables ? (IQueryProvider) new SqlQueryProviderAlpha(Settings.TableNames) : new SqlQueryProvider(Settings.TableNames); if (Settings.UseDictionary) { if (_dictionary == null) { _dictionary = LoadDictionary(); _main = _dictionary; } } else { if (_unigrams == null) { _unigrams = LoadUnigrams(); _main = _unigrams; } } _diacriticMarksAdder = new DiacriticMarksAdder(); _splitter = Settings.SentenceSpliterOn ? new SentencesSplitter() : null; _iManager = Settings.IgnorePunctationMarks ? new InterpunctionManager() : null; _connector = (Settings.NoOfMethod == 0) ? (INgramsConnector) new UpDown() : new Hierarchy(); _analyzer = new DiacriticMarksRestorer(_diacriticMarksAdder, _main, _splitter, _iManager, _connector); _analyzer.SetData(data); _analyzer.SetQueryProvider(queryProvider); _analyzer.SetNgram(Settings.Type); Timer.Interval = 90; Timer.Elapsed += OnTimerElapsed; }