コード例 #1
0
        public DemoRichTextBox()
        {
            InitializeComponent();

            var spellChecker = new C1SpellChecker();

            richTB.SpellChecker = spellChecker;
            spellChecker.MainDictionary.Load(Application.GetResourceStream(new Uri("/" + _asmName + ";component/Resources/C1Spell_en-US.dct", UriKind.Relative)).Stream);

            var stream = Application.GetResourceStream(new Uri("/" + _asmName + ";component/Resources/dickens.htm", UriKind.Relative)).Stream;
            var html   = new StreamReader(stream).ReadToEnd();

            richTB.HtmlFilter.ConvertingHtmlNode += OnConvertingHtmlNode;
            richTB.Html             = html;
            richTB.NavigationMode   = NavigationMode.Always;
            richTB.RequestNavigate += OnRequestNavigate;

            ribbon.ApplyTemplate();
            var rb = C1.WPF.VTreeHelper.GetChildOfType(ribbon, typeof(C1SimplifiedRibbon)) as C1SimplifiedRibbon;

            if (rb != null)
            {
                rb.IsCollapsed = false;
                ((C1SimplifiedTabItem)rb.RibbonItems[2]).IsSelected = true;
            }
        }
コード例 #2
0
        public AsYouTypeSpellCheck()
        {
            InitializeComponent();

            rtb.Text = @"Some facts about Mark Twain (spelling errors intentional ;-)

A steambat pilot neded a vast knowldege of the ever-chaging river to be able to stop at any of the hundreds of ports and wood-lots along the river banks. Twain meticulosly studied 2,000 miles (3,200 km) of the Mississipi for more than two years before he received his steamboat pilot license in 1859.

While training, Samuel covinced his younger brother Henry to work with him. Heny was killed on June 21, 1858, when the steamboat he was working on, the Pennsylvania, exploded. Twain had foreseen this death in a detailed dream a month earlier, [13] which inspired his interest in parasychology; he was an early member of the Society for Psychical Research.[14] Twain was guilt-strcken over his brother's death and held himself responsible for the rest of his life. However, he continued to work on the river and served as a river pilot until the American Civil War broke out in 1861 and traffic along the Mississipi was curtaled.

Missouri was a slave state and considered by many to be part of the South, and was represented in both the Confederate and Federal governments during the Civil War. When the war began, Twain and his friends formed a Confederate militia (depcted in an 1885 short story, ""The Private History of a Campaign That Failed""), which drilled for only two weeks before disbanding.[15] Twain joinded his brother, Orion, who had been apointed secretary to the teritorial govenor of Nevada, James W. Nye, and headed west.
 
Twain then traveled to San Francisco, California, where he comtinued as a journalist and began lecturing. He met other writers such as Bret Harte, Artemus Ward and Dan DeQuille. An assignment in Hawaii became the basis for his first lectures.[18] In 1867, a local newspaper funded a trip to the Mediterrannean. During his tohr of Europe and the Midddle East, he wrote a popular colection of travel letters wich were compled as The Inocents Abroad in 1869.";

            toolbar.RichTextBox = rtb;

            var spell = new C1SpellChecker();

            rtb.SpellChecker = spell;
            spell.MainDictionary.Load(Application.GetResourceStream(new Uri("/" + new AssemblyName(Assembly.GetExecutingAssembly().FullName).Name + ";component/Resources/C1Spell_en-US.dct", UriKind.Relative)).Stream);

            var theme = new C1ThemeOffice2016White();

            C1Theme.ApplyTheme(LayoutRoot, theme);

            var adornerLayer = AdornerLayer.GetAdornerLayer(LayoutRoot);

            if (adornerLayer != null)
            {
                // this will aplly theme to everything displayed in adorner, including any C1Window instances
                C1Theme.ApplyTheme(adornerLayer, theme);
            }
        }
コード例 #3
0
 public Form1()
 {
     InitializeComponent();
     _editor  = this.syntaxEditor1;
     _wrapper = new SyntaxEditorWrapper(_editor);
     _spell   = this.c1SpellChecker1;
     _spell.SetActiveSpellChecking(_wrapper, true);
 }
コード例 #4
0
        public DialogHelpTextWindow()
        {
            InitializeComponent();
            var spell = new C1SpellChecker();

            spell.MainDictionary.LoadAsync("C1Spell_en-US.dct");
            this.c1RichTextBox1.SpellChecker = spell;
            this.DataContext = this;
        }
コード例 #5
0
        public DemoRichTextBoxFilter()
        {
            InitializeComponent();

            var spellChecker = new C1SpellChecker();
            richToolbar.SpellChecker = spellChecker;
            spellChecker.MainDictionary.LoadAsync("C1Spell_en-US.dct");

            richTextBox.Html = html;
        }
コード例 #6
0
        public DemoRichTextBoxFilter()
        {
            InitializeComponent();

            var spellChecker = new C1SpellChecker();

            richToolbar.SpellChecker = spellChecker;
            spellChecker.MainDictionary.LoadAsync("C1Spell_en-US.dct");

            richTextBox.Html = html;
        }
コード例 #7
0
        //------------------------------------------------------------------------
        #region ** object model

        /// <summary>
        /// Initializes the dialog to use the given parameters.
        /// </summary>
        /// <param name="spell"><see cref="C1SpellChecker"/> to use for spelling.</param>
        /// <param name="editor"><see cref="ISpellCheckableEditor"/> that contains the text to spell-check.</param>
        /// <param name="errors"><see cref="CharRangeList"/> that contains the initial error list.</param>
        public void Initialize(C1SpellChecker spell, ISpellCheckableEditor editor, CharRangeList errors)
        {
            _spell  = spell;
            _editor = editor;
            _errors = errors;
            if (_errors == null)
            {
                _errors = _spell.CheckText(_editor.Text);
            }
            _errorCount += _errors.Count;
        }
コード例 #8
0
        public AsYouTypeSpellCheck()
        {
            this.InitializeComponent();
            rtb.Text = Strings.SpellCheck;
            var spell = new C1SpellChecker();

            rtb.SpellChecker = spell;
            Assembly asm    = typeof(DemoRtfFilter).GetTypeInfo().Assembly;
            Stream   stream = asm.GetManifestResourceStream("RichTextBoxSamples.Resources.C1Spell_en-US.dct");

            spell.MainDictionary.Load(stream);
        }
コード例 #9
0
        //------------------------------------------------------------------------
        #region ** object model

        /// <summary>
        /// Initializes the dialog to use the given parameters.
        /// </summary>
        /// <param name="spell"><see cref="C1SpellChecker"/> to use for spelling.</param>
        /// <param name="editor"><see cref="ISpellCheckableEditor"/> that contains the text to spell-check.</param>
        /// <param name="errors"><see cref="CharRangeList"/> that contains the initial error list.</param>
        public void Initialize(C1SpellChecker spell, ISpellCheckableEditor editor, CharRangeList errors)
        {
            // save references to all objects
            _spell  = spell;
            _editor = editor;
            _errors = errors;
            if (_errors == null)
            {
                _errors = _spell.CheckText(_editor.Text);
            }
            _errorCount += _errors.Count;

            // go show the first error
            ErrorIndex = 0;
        }
コード例 #10
0
        // ctor
        public RichTextBoxCustomSpell()
        {
            // initialize error markers
            _errorUnderline = CreateErrorUnderline();
            _noUnderline    = new TextDecorationCollection();
            _errorRanges    = new List <TextRange>();

            // initialize timer used to perform the spell-checking
            _timer          = new DispatcherTimer();
            _timer.Interval = TimeSpan.FromMilliseconds(SPELLCHECK_DELAY);
            _timer.Tick    += new EventHandler(_timer_Tick);

            // initialize the spell checker
            _spell = new C1SpellChecker();
            _spell.DictionaryChanged += _spell_DictionaryChanged;
        }
コード例 #11
0
        public DemoRichTextBox()
        {
            InitializeComponent();

            var spellChecker = new C1SpellChecker();
            richTB.SpellChecker = spellChecker;
            spellChecker.MainDictionary.Load(Application.GetResourceStream(new Uri("/" + _asmName + ";component/Resources/C1Spell_en-US.dct", UriKind.Relative)).Stream);

            var stream = Application.GetResourceStream(new Uri("/" + _asmName + ";component/Resources/dickens.htm", UriKind.Relative)).Stream;
            var html = new StreamReader(stream).ReadToEnd();
            richTB.HtmlFilter.ConvertingHtmlNode += OnConvertingHtmlNode;
            richTB.Html = html;
            richTB.NavigationMode = NavigationMode.Always;
            richTB.RequestNavigate += OnRequestNavigate;
            richTB.LayoutUpdated += new EventHandler(richTB_LayoutUpdated);
        }
コード例 #12
0
        public AsYouTypeSpellCheck()
        {
            InitializeComponent();

            rtb.Text = @"Some facts about Mark Twain (spelling errors intentional ;-)

            A steambat pilot neded a vast knowldege of the ever-chaging river to be able to stop at any of the hundreds of ports and wood-lots along the river banks. Twain meticulosly studied 2,000 miles (3,200 km) of the Mississipi for more than two years before he received his steamboat pilot license in 1859.

            While training, Samuel covinced his younger brother Henry to work with him. Heny was killed on June 21, 1858, when the steamboat he was working on, the Pennsylvania, exploded. Twain had foreseen this death in a detailed dream a month earlier, [13] which inspired his interest in parasychology; he was an early member of the Society for Psychical Research.[14] Twain was guilt-strcken over his brother's death and held himself responsible for the rest of his life. However, he continued to work on the river and served as a river pilot until the American Civil War broke out in 1861 and traffic along the Mississipi was curtaled.

            Missouri was a slave state and considered by many to be part of the South, and was represented in both the Confederate and Federal governments during the Civil War. When the war began, Twain and his friends formed a Confederate militia (depcted in an 1885 short story, ""The Private History of a Campaign That Failed""), which drilled for only two weeks before disbanding.[15] Twain joinded his brother, Orion, who had been apointed secretary to the teritorial govenor of Nevada, James W. Nye, and headed west.

            Twain then traveled to San Francisco, California, where he comtinued as a journalist and began lecturing. He met other writers such as Bret Harte, Artemus Ward and Dan DeQuille. An assignment in Hawaii became the basis for his first lectures.[18] In 1867, a local newspaper funded a trip to the Mediterrannean. During his tohr of Europe and the Midddle East, he wrote a popular colection of travel letters wich were compled as The Inocents Abroad in 1869.";

            toolbar.RichTextBox = rtb;

            var spell = new C1SpellChecker();
            rtb.SpellChecker = spell;
            spell.MainDictionary.Load(Application.GetResourceStream(new Uri("/" + new AssemblyName(Assembly.GetExecutingAssembly().FullName).Name + ";component/Resources/C1Spell_en-US.dct", UriKind.Relative)).Stream);
        }
コード例 #13
0
        //------------------------------------------------------------------------
        #region ** object model

        /// <summary>
        /// Initializes the dialog to use the given parameters.
        /// </summary>
        /// <param name="spell"><see cref="C1SpellChecker"/> to use for spelling.</param>
        /// <param name="editor"><see cref="ISpellCheckableEditor"/> that contains the text to spell-check.</param>
        /// <param name="errors"><see cref="CharRangeList"/> that contains the initial error list.</param>
        public void Initialize(C1SpellChecker spell, ISpellCheckableEditor editor, CharRangeList errors)
        {
            // initialize members
            _spell  = spell;
            _editor = editor;
            _errors = errors;

            // initialize 'change all' list
            _changeAll.Clear();
            foreach (string key in _spell.AutoReplaceList.Keys)
            {
                _changeAll[key] = _spell.AutoReplaceList[key];
            }

            // initialize error list
            if (_errors == null)
            {
                _errors = _spell.CheckText(_editor.Text);
            }
            _errorCount += _errors.Count;
        }
コード例 #14
0
        public DemoRichTextBox()
        {
            InitializeComponent();
            Tag = Properties.Resources.Demo;

            var spellChecker = new C1SpellChecker();

            richTB.SpellChecker = spellChecker;
            spellChecker.MainDictionary.Load(Application.GetResourceStream(new Uri("/" + _asmName + ";component/Resources/C1Spell_en-US.dct", UriKind.Relative)).Stream);

            var stream = Application.GetResourceStream(new Uri("/" + _asmName + ";component/Resources/dickens.htm", UriKind.Relative)).Stream;
            var html   = new StreamReader(stream).ReadToEnd();

            richTB.HtmlFilter.ConvertingHtmlNode += OnConvertingHtmlNode;
            richTB.Html             = html;
            richTB.NavigationMode   = NavigationMode.Always;
            richTB.RequestNavigate += OnRequestNavigate;

            //ribbon.IsCollapsed = false;
            //ribbon.SelectedTabIndex = 1;
        }
コード例 #15
0
        public SetLanguage(C1SpellChecker spellChecker)
        {
            InitializeComponent();

            // save reference to spell checker
            _spellChecker = spellChecker;

            // populate list
            _list.Items.Add("Default (built-in English US)");
            foreach (string fn in Directory.GetFiles(Application.StartupPath, "c1spell_*.dct"))
            {
                Dictionary item = new Dictionary(fn);
                if (item.IsValid)
                {
                    _list.Items.Add(item);
                }
            }

            // select current
            _list.SelectedIndex = 0;
            string current = _spellChecker.MainDictionary.FileName;

            if (!string.IsNullOrEmpty(current))
            {
                foreach (Object item in _list.Items)
                {
                    Dictionary dct = item as Dictionary;
                    if (dct != null &&
                        string.Equals(Path.GetFileName(dct.FileName), Path.GetFileName(current), StringComparison.OrdinalIgnoreCase))
                    {
                        _list.SelectedItem = dct;
                        break;
                    }
                }
            }
        }
コード例 #16
0
        //------------------------------------------------------------
        #region ** create/dispose

        // populate the ribbon
        public C1TextEditorRibbon()
        {
            // create spell checker
            _spellChecker = new C1SpellChecker();

            // configure tooltips
            this.ToolTipSettings.MaximumWidth = 240;
            //this.ToolTipSettings.Font = new Font("Calibri", 9);

            // initialize ribbon
            InitTabs();
            InitQat();
            InitApplicationMenu();

            // apply settings
            Settings settings = Settings.Default;

            Qat.BelowRibbon = settings.QatBelowRibbon;
            ShowErrors      = settings.ShowErrors;
            Dictionary      = settings.Dictionary;

            // update UI when app is idle
            Application.Idle += Application_Idle;
        }
コード例 #17
0
        /// <summary>
        /// Initializes the dialog to use the given parameters.
        /// </summary>
        /// <param name="spell"><see cref="C1SpellChecker"/> to use for spelling.</param>
        /// <param name="editor"><see cref="ISpellCheckableEditor"/> that contains the text to spell-check.</param>
        /// <param name="errors"><see cref="CharRangeList"/> that contains the initial error list.</param>
        public void Initialize(C1SpellChecker spell, ISpellCheckableEditor editor, CharRangeList errors)
        {
            // save references to all objects
            _spell = spell;
            _editor = editor;
            _errors = errors;
            if (_errors == null)
            {
                _errors = _spell.CheckText(_editor.Text);
            }
            _errorCount += _errors.Count;

            // go show the first error
            ErrorIndex = 0;
        }