This is a migrated thread and some comments may be shown as answers.

Spell Checker adding words to database instead of iso for custom

7 Answers 147 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
danparker276
Top achievements
Rank 2
danparker276 asked on 11 May 2011, 09:43 PM
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?

7 Answers, 1 is accepted

Sort by
0
danparker276
Top achievements
Rank 2
answered on 16 May 2011, 10:54 PM
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
0
Boby
Telerik team
answered on 17 May 2011, 01:39 PM
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
0
danparker276
Top achievements
Rank 2
answered on 17 May 2011, 04:34 PM
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.
0
Accepted
Boby
Telerik team
answered on 19 May 2011, 08:08 AM
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
0
danparker276
Top achievements
Rank 2
answered on 19 May 2011, 05:09 PM
Yeah, that works for me.  I also skip the isolated storage with RadNonPersistentCustomDictionary

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

0
Kotte
Top achievements
Rank 1
answered on 12 Oct 2011, 07:25 PM
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
0
Kotte
Top achievements
Rank 1
answered on 13 Oct 2011, 04:09 PM
Hi,


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


Thanks,
Kotte
Tags
RichTextBox
Asked by
danparker276
Top achievements
Rank 2
Answers by
danparker276
Top achievements
Rank 2
Boby
Telerik team
Kotte
Top achievements
Rank 1
Share this question
or