[]
        
(Showing Draft Content)

C1.WPF.SpellChecker.SpellDictionaryBase.LoadAsync

LoadAsync Method

LoadAsync(string)

Loads the dictionary from a Uri pointing to the compressed dictionary data.

Declaration
public void LoadAsync(string uri)
Parameters
Type Name Description
string uri

Uri that points to the compressed dictionary data.

Remarks

When this method completes, it fires the LoadCompleted event.

LoadAsync(Uri)

Loads the dictionary from a Uri pointing to the compressed dictionary data.

Declaration
public void LoadAsync(Uri uri)
Parameters
Type Name Description
Uri uri

Uri that points to the compressed dictionary data.

Remarks
<p>When this method completes, it fires the <xref href="C1.WPF.SpellChecker.SpellDictionaryBase.LoadCompleted" data-throw-if-not-resolved="false"></xref> event.</p>
<p>
    <b>LoadAsync</b> downloads the dictionary by creating a <xref href="System.Net.WebClient" data-throw-if-not-resolved="false"></xref> object and calling

its OpenReadAsync(Uri) method. This call will fail if the server is not configured to serve the file extension used by the dictionary file. If this happens, you have a few easy ways to solve the problem:

  • Rename the dictionary file to use an extension that is allowed by IIS. A good choice would be to use the 'zip' extension (dictionary files really are zip files). This is the easiest option because it does not require any changes to the server and no server-side code.
  • If you do not want to rename the file, configure IIS to allow serving "dct" files. This is done by adding the "dct" extension to the list of supported MIME types on the server. The drawback with this option is that it requires changes to the server configuration.
  • Write a web service that reads the dictionary file and returns its contents as a byte array. Then open a MemoryStream using the array as the initial data and use the main dictionary's Load(Stream) method to load the dictionary from the MemoryStream. The drawback with this option is that it requires additional code on the client as well as on the server side of the application.