Exemple #1
0
        void AutocorrectInit()
        {
            using (Stream stream = new FileStream("rudi_hand_font.txt", FileMode.Open))
            {
                var serializer = new DataContractJsonSerializer(typeof(Dictionary<char, DataStylusToken>));
                var data = (Dictionary<char, DataStylusToken>)serializer.ReadObject(stream);

                foreach (var token in data)
                {
                    StrokeCollection strokes = token.Value.Representation();

                    // We made our characters in 100x100 boxes.
                    StylusToken stylusToken = new StylusToken(strokes);
                    stylusToken.Normalize();
                    fontData.Add(token.Key, stylusToken);
                }
            }

            spellchecker.Add("hackathon");

            // To display autocorrect stuff.
            suggestionsBox = new SuggestionsBox(this);

            OverlayCanvas.Children.Add(suggestionsBox);
            Grid.SetRow(suggestionsBox, 0);
            Grid.SetColumn(suggestionsBox, 0);
            suggestionsBox.Background = new SolidColorBrush(Colors.LightGray);
            suggestionsBox.Visibility = Visibility.Collapsed;
        }
Exemple #2
0
        void AutocorrectInit()
        {
            using (Stream stream = new FileStream("rudi_hand_font.txt", FileMode.Open))
            {
                var serializer = new DataContractJsonSerializer(typeof(Dictionary <char, DataStylusToken>));
                var data       = (Dictionary <char, DataStylusToken>)serializer.ReadObject(stream);

                foreach (var token in data)
                {
                    StrokeCollection strokes = token.Value.Representation();

                    // We made our characters in 100x100 boxes.
                    StylusToken stylusToken = new StylusToken(strokes);
                    stylusToken.Normalize();
                    fontData.Add(token.Key, stylusToken);
                }
            }

            spellchecker.Add("hackathon");

            // To display autocorrect stuff.
            suggestionsBox = new SuggestionsBox(this);

            OverlayCanvas.Children.Add(suggestionsBox);
            Grid.SetRow(suggestionsBox, 0);
            Grid.SetColumn(suggestionsBox, 0);
            suggestionsBox.Background = new SolidColorBrush(Colors.LightGray);
            suggestionsBox.Visibility = Visibility.Collapsed;
        }