public SpellingPage() : base(Guid) { InitializeComponent(); Text = Resources.StrSpelling; _lstDictionaries.Style = GitterApplication.DefaultStyle; _lstDictionaries.Columns.Add(new CustomListBoxColumn(0, Resources.StrName) { SizeMode = ColumnSizeMode.Fill }); var loaded = SpellingService.GetLoadedLocales(); foreach (var locale in SpellingService.GetAvailableLocales()) { string cultureName = locale; try { var ci = CultureInfo.GetCultureInfo(locale.ToLower().Replace('_', '-')); cultureName = ci.DisplayName; } catch { } _lstDictionaries.Items.Add(new CustomListBoxRow <string>(locale, new TextSubItem(0, cultureName)) { IsChecked = loaded.Contains(locale), }); } }
static void Execute() { // Instantiate the spelling service SpellingService spellingService = new SpellingService(); // Add words to the dictionary spellingService.AddDictionary( new List <string>() { "divorciado", "solteiro", "casado", "viúvo" } ); string wordSuggestion = spellingService.SuggestCorrection("devorciado"); Task <List <string> > wordsSuggestion = spellingService.SuggestCorrection( new List <string>() { "casada", "solteira", "divorciado(a)" } ); wordsSuggestion.Wait(); System.Console.WriteLine(wordsSuggestion.ToString()); System.Console.ReadKey(); }
public void LoadEditorSettings() { this.Editor.TextArea.IndentationStrategy = null; this.ToggleMarkdownSyntaxHighlighting(this._settings.Editor_MarkdownSyntaxHighlightingEnabled); this.ToggleLineNumbers(this._settings.Editor_LineNumbersEnabled); this.SetWordWrap(this._settings.Editor_WordWrap); if (Fonts.SystemFontFamilies.Contains(this._settings.Editor_FontFamily)) { this.Editor.FontFamily = this._settings.Editor_FontFamily; } else { if (Fonts.SystemFontFamilies.Contains(new FontFamily("Courier New"))) { this.Editor.FontFamily = new FontFamily("Courier New"); } } this.Editor.FontSize = this._settings.Editor_FontSize; this.Editor.FontWeight = this._settings.Editor_FontWeight; this.Editor.Foreground = this._settings.Editor_ForegroundColor.ToBrush(); this.Editor.Background = this._settings.Editor_BackgroundColor.ToBrush(); this.Editor.TextArea.TextView.LinkTextForegroundBrush = this._settings.Editor_HyperlinkForegroundColor.ToBrush(); MarkdownEditor._logger.Trace("Setting spell check dictionary language: " + this._settings.Editor_SpellCheckLanguage); this.SpellingService = new SpellingService(); this.SpellingService.SetLanguage(this._settings.Editor_SpellCheckLanguage); this.ToggleSpellCheck(this._settings.Editor_SpellCheckEnabled); this.Editor.Options = new TextEditorOptions { AllowScrollBelowDocument = true, CutCopyWholeLine = false, EnableEmailHyperlinks = this._settings.Editor_EnableHyperlinks, EnableHyperlinks = this._settings.Editor_EnableHyperlinks, EnableImeSupport = true, ConvertTabsToSpaces = this._settings.Editor_UseSpacesAsTabs, ShowColumnRuler = this._settings.Editor_ShowColumnGuide, ColumnRulerPosition = this._settings.CodeEditor_ColumnGuidePosition, ShowEndOfLine = this._settings.Editor_DisplayFormattingMarks, ShowSpaces = this._settings.Editor_DisplayFormattingMarks, ShowTabs = this._settings.Editor_DisplayFormattingMarks }; this.SetMarkdownProcessor(this._settings.Markdown_MarkdownProcessor); this.ToggleAutoSave(this._settings.IO_AutoSaveEnabled); }
public static void LoadFrom(Section section) { Verify.Argument.IsNotNull(section, "section"); var appearanceNode = section.TryGetSection("Appearance"); if (appearanceNode != null) { var textRenderer = appearanceNode.TryGetParameter("TextRenderer"); if (textRenderer != null) { switch (textRenderer.Value as string) { case "GDI": GitterApplication.TextRenderer = GitterApplication.GdiTextRenderer; break; case "GDI+": GitterApplication.TextRenderer = GitterApplication.GdiPlusTextRenderer; break; } } } var servicesNode = section.TryGetSection("Services"); if (servicesNode != null) { var spellingSection = servicesNode.TryGetSection("Spelling"); if (spellingSection != null) { SpellingService.LoadFrom(spellingSection); } } var featuresSection = section.TryGetSection("IntegrationFeatures"); if (featuresSection != null) { GitterApplication.IntegrationFeatures.LoadFrom(featuresSection); } }
public bool Execute() { foreach (CustomListBoxRow <string> item in _lstDictionaries.Items) { bool loaded = SpellingService.IsLoaded(item.DataContext); if (loaded) { if (!item.IsChecked) { SpellingService.UnloadLocale(item.DataContext); } } else { if (item.IsChecked) { SpellingService.LoadLocale(item.DataContext); } } } return(true); }
public static void SaveTo(Section section) { Verify.Argument.IsNotNull(section, "section"); var appearanceNode = section.GetCreateSection("Appearance"); if (GitterApplication.TextRenderer == GitterApplication.GdiTextRenderer) { appearanceNode.SetValue("TextRenderer", "GDI"); } else if (GitterApplication.TextRenderer == GitterApplication.GdiPlusTextRenderer) { appearanceNode.SetValue("TextRenderer", "GDI+"); } var servicesNode = section.GetCreateSection("Services"); var spellingNode = servicesNode.GetCreateSection("Spelling"); SpellingService.SaveTo(spellingNode); var featuresSection = section.GetCreateSection("IntegrationFeatures"); GitterApplication.IntegrationFeatures.SaveTo(featuresSection); }
public ArticlesController() { _spellingService = new SpellingService(); }