Spell Checker adding words to database instead of iso for custom

8 posts, 1 answers
  1. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 11 May 2011 Link to this post

    When I right click and add a new word to the spell checker I want it to write to my database instead of going into a custom dictionary in isolated storage.  I want people to have their words on every computer they are on. 
    Adding words from the database is no problem, but I can't seem to figure out how to get new words that are added.

    The DataChanged event is called and I have my DataChanged function:
    void SpellChecker_DataChanged(object sender, EventArgs e)

    But I don't know how to check the action that it's being added and what the word is.  Is this the right way to do it?
  2. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 16 May 2011 Link to this post

    basically, my solution to this is to get the word in the _DataChanged event.  It's working, but it might not be the best way.
    void SpellChecker_DataChanged(object sender, EventArgs e)
    {
        Telerik.Windows.Documents.Proofing.DocumentSpellChecker dsc = (Telerik.Windows.Documents.Proofing.DocumentSpellChecker)sender;
        ICustomWordDictionary spellchecker  = dsc.GetCustomDictionary(CultureInfo.CurrentCulture);
        string newWord= spellchecker.Words.Last(); //Add to my current dictionary, might not have to do this
        dsc.AddWord(newWord);

          ... Below call a wcf service to put this new word into my database
  3. DevCraft banner
  4. Boby
    Admin
    Boby avatar
    595 posts

    Posted 17 May 2011 Link to this post

    Hi Dan Parker,
    You can stick to the solution you came up with if it fits your needs. We can, however, provide you with another solution if you open a support ticket, where we can continue this conversation in private.

    Greetings,
    Boby
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 17 May 2011 Link to this post

    As long as you don't see any holes in what I'm doing I'm fine with this.  This is something that won't get called very often, so I don't have to worry about the extra time it would take to do this.
  6. Answer
    Boby
    Admin
    Boby avatar
    595 posts

    Posted 19 May 2011 Link to this post

    Hi danparker276,

    Your solution is not optimal, but is correct - so if you are satisfied with the performance, you could use it.

    Don't hesitate to contact us if you have other questions.

    Regards,
    Boby
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 19 May 2011 Link to this post

    Yeah, that works for me.  I also skip the isolated storage with RadNonPersistentCustomDictionary

    radRichTextBox.SpellChecker = new DocumentSpellChecker(new  RadNonPersistentCustomDictionary());

  8. Kotte
    Kotte avatar
    48 posts
    Member since:
    Feb 2011

    Posted 12 Oct 2011 Link to this post

    Hi ,

    I am trying to add a custom dictionary to RadSpellCheck.

    I created Test.txt file with few words and added to the project and loading to IsolatedStorage


    IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication();          
    isoStore.CreateDirectory("SpellCheck");
    IsolatedStorageFileStream isoStream1 =  new IsolatedStorageFileStream("Test.txt", FileMode.Create, isoStore);
    isoStream1.Close();

    Creating the Custom Dictionary..
    RadIsolatedStorageCustomDictionary dictionary = new RadIsolatedStorageCustomDictionary(IsolatedStorageScope.Application, "Test.txt");
    DocumentSpellChecker spellchecker = new DocumentSpellChecker(dictionary);
    this._richTextBox.SpellChecker = spellchecker;

    Adding Dictionary
     Stream tdfFileStream = Application.GetResourceStream(new Uri("/MC.Client.Controls;component/Resources/en-US.tdf", UriKind.RelativeOrAbsolute)).Stream;
     RadDictionary dictionary1 = new RadDictionary();
     dictionary1.Load(tdfFileStream);
     ((DocumentSpellChecker)this._richTextBox.SpellChecker).AddDictionary(dictionary, CultureInfo.CurrentCulture);

    its still showing the default dictionary and I did not find the words from Test.txt file.
    Am I missing any thing.
    Can you please post a sample working project which loads custom dictionary file like (ex: CustomDictionary.txt )

    Thanks,
    Kotte
  9. Kotte
    Kotte avatar
    48 posts
    Member since:
    Feb 2011

    Posted 13 Oct 2011 Link to this post

    Hi,


    I am able to fix the issue.Its working fine now.


    Thanks,
    Kotte
Back to Top
DevCraft banner