You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it would be nice to give the user the ability to manage the user words by his own.
the following implementation works.
the new code is between >>> and <<<
public class WordDictionary : System.ComponentModel.Component
{
...
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
public delegate string [] LoadUserWordsDelegate () ;
public delegate void SaveUserWordsDelegate ( string [] Words ) ;
public LoadUserWordsDelegate LoadUserWords { set ; get ; }
public SaveUserWordsDelegate SaveUserWords { set ; get ; }
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
it would be nice to give the user the ability to manage the user words by his own.
the following implementation works.
the new code is between >>> and <<<
public class WordDictionary : System.ComponentModel.Component
{
...
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
public delegate string [] LoadUserWordsDelegate () ;
public delegate void SaveUserWordsDelegate ( string [] Words ) ;
public LoadUserWordsDelegate LoadUserWords { set ; get ; }
public SaveUserWordsDelegate SaveUserWords { set ; get ; }
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
public WordDictionary()
{
InitializeComponent();
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
LoadUserWords = null ;
SaveUserWords = null ;
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
}
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
if ( LoadUserWords != null )
{
string [] Words = LoadUserWords () ;
foreach ( string Word in Words )
_userWords.Add(Word, Word);
}
else
{
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// original code
}
}
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
if ( SaveUserWords != null )
{
List < string > Words = new List < string > () ;
foreach (string tempWord in _userWords.Keys)
Words . Add ( tempWord ) ;
SaveUserWords ( Words . ToArray () );
}
else
{
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// original code
}
}
}
The text was updated successfully, but these errors were encountered: