示例#1
0
        //<Snippet2>
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            IList dictionaries = SpellCheck.GetCustomDictionaries(richTextBox1);

            // customwords2.lex is included as a resource file
            dictionaries.Add(new Uri(@"pack://application:,,,/WPFCustomDictionary;component/customwords2.lex"));
        }
示例#2
0
        public DictionaryForm()
        {
            CheckForIllegalCrossThreadCalls = false;
            InitializeComponent();              //Initialize all Form components.
            spellingChecker = new SpellCheck(); //Create a new spell checker object.
            theHeadword     = new Headword();

            setupSQL();

            // Create a SQL DATABASE if one doesn't exist;

            // Create a clock for the application.
            clockSetup();

            // Initialize semantic and social fields by reading
            // in the values from the class and populating the ComboBoxes.
            semanticSocial = new SemanticSocial();
            for (int i = 0; i < semanticSocial.ListCount; i++)
            {
                lb_Semantics.Items.Add(semanticSocial[i].Semantic);
                lb_SocialUsage.Items.Add(semanticSocial[i].Social);
            }

            // Set the first item to be selected/highlighted in the GUI.
            lb_Semantics.SelectedIndex   = 0;
            lb_SocialUsage.SelectedIndex = 0;
        }
示例#3
0
    public static void Main(string[] args)
    {
        Application.Init();

        //Create the Window
        Window myWin = new Window("GtkSpell# Sample App");
        myWin.Resize(200,200);

        //Create a TextView
        TextView myTextView = new TextView();

        SpellCheck mySpellCheck;

        //Bind GtkSpell to our textview
        if (args.Length > 0)
          mySpellCheck = new SpellCheck(myTextView, args[0]);
        else
          mySpellCheck = new SpellCheck(myTextView, "en-us");

        //spellCheck.Detach();
        //spellCheck.();

        //Add the TextView to the form
        myWin.Add(myTextView);

        //Show Everything
        myWin.ShowAll();

        myWin.DeleteEvent += new DeleteEventHandler(delete);

        Application.Run();
    }
        //Parametr int zawiera informację do jakiej zakladki będzie RTB ladowany.
        //I w zależności od tego będą różne funkcje przypisywane do przycisku BtnSave.
        //1 - Strona_RichTextBox ładowany do zakłdaki WIZYTA
        //2 - Strona_RichTextBox ładowany do zakłdaki HISTORIA
        //3 - Strona_RichTextBox ładowany do zakłdaki SKIEROWANIA

        #endregion

        public Strona_RichTextBox(StronaWizyta_Zestawienie page, int parametrStrony)
        {
            try
            {
                InitializeComponent();
                stronaWizyta_Zestawienie = page;
                this.parametrStrony      = parametrStrony;

                cmbFontFamily.ItemsSource = Fonts.SystemFontFamilies.OrderBy(f => f.Source);
                cmbFontFamily.FontSize    = 16;
                cmbFontSize.ItemsSource   = new List <double>()
                {
                    8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72
                };
                cmbFontSize.FontSize = 16;

                SpellCheck.SetIsEnabled(rtbEditor, true);
                dictionaries = SpellCheck.GetCustomDictionaries(rtbEditor);
                dictionaries.Add(new Uri(adresSlownika));
                rtbEditor.ContextMenu = GetContextMenu();

                //Drag&Drop
                rtbEditor.AddHandler(RichTextBox.DragOverEvent, new DragEventHandler(RichTextBox_DragOver), true);
                rtbEditor.AddHandler(RichTextBox.DropEvent, new DragEventHandler(RichTextBox_Drop), true);
                rtbEditor.Padding   = new Thickness(margines);
                rtbEditor.AllowDrop = true;

                gdZamien.Visibility = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                ErrorMessage(ex);
            }
        }
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources.
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                // unsubscribe to the event where a user wishes to correct a
                // misspelled word via the context menu..
                SpellCheck.UserWordReplace -= SpellCheck_UserWordReplace;

                // unsubscribe to the Scintilla text changed event..
                Scintilla.TextChanged -= Scintilla_TextChanged;

                SpellCheck.WordAddDictionaryRequested -= SpellCheck_WordAddDictionaryOrIgnoreRequested;

                SpellCheck.WordIgnoreRequested -= SpellCheck_WordAddDictionaryOrIgnoreRequested;

                // save the user's dictionary to a file..
                SpellCheck.SaveUserDictionaryToFile(UserDictionaryFile);

                // save the user's ignore word list to a file..
                SpellCheck.SaveUserWordIgnoreListToFile(UserIgnoreWordFile);

                // dispose of the ScintillaSpellCheck class..
                using (SpellCheck)
                {
                    SpellCheck = null; // empty using clause is ugly :-(
                }
            }
        }
示例#6
0
        public DictionaryForm()
        {
            InitializeComponent();              //Initialize all Form components.
            spellingChecker = new SpellCheck(); //Create a new spell checker object.
            theHeadword     = new Headword();

            CheckForIllegalCrossThreadCalls = false;

            // Create a clock for the application.
            timer = new Timer();
            timer.Start();            // Start the timer.
            timer.Interval = 1000;    // Set the interval to 1 second.
            timer.Tick    += delegate // Add an event handler to the Tick event.
            {
                // Call getTime to get and format the time.
                // Also, change the display.
                string time = DateTime.Now.ToString("hh:mm:ss tt");
                l_clock.Text = time; // Set the time on the Form.
            };

            // Initialize semantic and social fields by reading
            // in the values from the class and populating the ComboBoxes.
            semanticSocial = new SemanticSocial();
            for (int i = 0; i < semanticSocial.ListCount; i++)
            {
                lb_Semantics.Items.Add(semanticSocial[i].Semantic);
                lb_SocialUsage.Items.Add(semanticSocial[i].Social);
            }

            // Set the first item to be selected/highlighted in the GUI.
            lb_Semantics.SelectedIndex   = 0;
            lb_SocialUsage.SelectedIndex = 0;
        }
示例#7
0
        public WordLogic()
        {
            dataAccess = DatabaseFactory.CreateWordlistDatabase();

            InitWordList();
            spellCheck     = new SpellCheck(WordList);
            wordNormalizer = new WordNormalizer();
        }
        public MainWindow()
        {
            InitializeComponent();

            //myTextBox.SpellCheck.IsEnabled = true;

            SpellCheck.SetIsEnabled(textBoxBase: myTextBox, value: true);
        }
        /// <summary>
        /// Sets the SpellCheck attr.
        /// </summary>
        /// <param name="spellCheck">The spellCheck.</param>
        /// <returns>
        /// The VTag instance
        /// </returns>
        public VTag SetSpellCheckAttr(SpellCheck spellCheck)
        {
            if (!string.IsNullOrWhiteSpace(spellCheck.ToString()))
            {
                return this.AddAttribute(WellKnownXNames.SpellCheck, spellCheck.ToString());
            }

            return this.RemoveAttribute(WellKnownXNames.SpellCheck);
        }
        private void SpellCheckCheckBox_Checked(object sender, RoutedEventArgs e)
        {
            RibbonCheckBox checkbox = sender as RibbonCheckBox;

            if (checkbox != null && MainTextBox != null) // Can happen on initial XAML load.
            {
                SpellCheck.SetIsEnabled(MainTextBox, checkbox.IsChecked.Value);
            }
        }
 void SetSpellCheck(Word word, SpellCheck check)
 {
     if (wordChecker.ContainsKey(word))
     {
         wordChecker[word] = check;
     }
     else
     {
         wordChecker.Add(word, check);
     }
 }
示例#12
0
        public TextInput()
        {
            InitializeComponent();

            // <TextBox SpellCheck.IsEnabled="True"/>
            // This is a special hack for Textbox only.
            //richTextBox.SpellCheck.IsEnabled = true;

            // This is how natuarally the ZAML synatax is interprested.
            SpellCheck.SetIsEnabled(richTextBox, true);
        }
示例#13
0
        public Window1()
        {
            InitializeComponent();

            // Xaml:
            //   <TextBox Width="300" SpellCheck.IsEnabled="True" />

            //myTextBox.SpellCheck.IsEnabled = true;

            SpellCheck.SetIsEnabled(myTextBox, true);
        }
示例#14
0
        public DemonSpellRepository(Unit caster)
        {
            Spell corruption      = new Spell("Corruption", 0.3 * caster.MaxMana);
            Spell shadowBlast     = new Spell("Shadow Blast", 0.3 * caster.MaxMana);
            Spell eyeOfTheVoid    = new Spell("Eye Of The Void", 0.2 * caster.MaxMana);
            Spell rippingHellFire = new Spell("Ripping Hell-Fire", 0.8 * caster.MaxMana);

            spells     = new List <Spell>();
            spellCheck = new SpellCheck();
            spells.Add(corruption);
            spells.Add(shadowBlast);
            spells.Add(eyeOfTheVoid);
            spells.Add(rippingHellFire);
        }
        public void _11_DescriptionTextBox_ShouldBeConfiguredCorrectly()
        {
            AssertHasFormControls();

            Assert.That(_descriptionTextBox.TextWrapping, Is.EqualTo(TextWrapping.Wrap), "Text must be wrapped.");
            Assert.That(_descriptionTextBox.AcceptsReturn, Is.True, "It must be possible to type multiple lines of text.");

            var invalidLanguageMessage = "The language for spell checking should be flemish (belgian dutch).";

            Assert.That(_descriptionTextBox.Language, Is.Not.Null, invalidLanguageMessage);
            Assert.That(_descriptionTextBox.Language.IetfLanguageTag, Is.EqualTo("nl-be").IgnoreCase, invalidLanguageMessage);

            Assert.That(SpellCheck.GetIsEnabled(_descriptionTextBox), Is.True, "Spell checking must be enabled.");
        }
        public ShamanSpellRepository(Unit caster)
        {
            Spell thunderStrike = new Spell("Thunder Strike", 0.5 * caster.MaxMana);
            Spell earthStrike   = new Spell("Earth Strike", 0.5 * caster.MaxMana);
            Spell flameStrike   = new Spell("Flame Strike", 0.25 * caster.MaxMana);
            Spell waterStrike   = new Spell("Water Strike", 0.25 * caster.MaxMana);

            spells     = new List <Spell>();
            spellCheck = new SpellCheck();
            spells.Add(thunderStrike);
            spells.Add(earthStrike);
            spells.Add(flameStrike);
            spells.Add(waterStrike);
        }
示例#17
0
        public GryphonSpellRepository(Unit caster)
        {
            Spell divingClaw     = new Spell("Diving Claw", 0.3 * caster.MaxMana);
            Spell petrifyingGaze = new Spell("Petryfying Gaze", 0.5 * caster.MaxMana);
            Spell gust           = new Spell("Gust", 0.3 * caster.MaxMana);
            Spell peck           = new Spell("Peck", 0.2 * caster.MaxMana);

            spells     = new List <Spell>();
            spellCheck = new SpellCheck();
            spells.Add(divingClaw);
            spells.Add(petrifyingGaze);
            spells.Add(gust);
            spells.Add(peck);
        }
        public WyrmSpellRepository(Unit caster)
        {
            Spell tidalSlash = new Spell("Tidal Slash", 0.15 * caster.MaxMana);
            Spell dive       = new Spell("Dive", 0.3 * caster.MaxMana);
            Spell hyperSpeed = new Spell("Hyper Speed", 0.3 * caster.MaxMana);
            Spell thunder    = new Spell("Thunder", 0.5 * caster.MaxMana);

            spells     = new List <Spell>();
            spellCheck = new SpellCheck();
            spells.Add(tidalSlash);
            spells.Add(dive);
            spells.Add(hyperSpeed);
            spells.Add(thunder);
        }
示例#19
0
        public SkeletonSpellRepository(Unit caster)
        {
            Spell tombStone            = new Spell("Tombstone", 0.3 * caster.MaxMana);
            Spell wrathOfTheNecropolis = new Spell("Wrath Of The Necropolis", 0.5 * caster.MaxMana);
            Spell suffocation          = new Spell("Suffocation", 0.3 * caster.MaxMana);
            Spell horrifyingScream     = new Spell("Horrifying Scream", 0.3 * caster.MaxMana);

            spells     = new List <Spell>();
            spellCheck = new SpellCheck();
            spells.Add(tombStone);
            spells.Add(wrathOfTheNecropolis);
            spells.Add(suffocation);
            spells.Add(horrifyingScream);
        }
        public GiantSpellRepository(Unit caster)
        {
            Spell overGrowth       = new Spell("Overgrowth", 0.4 * caster.MaxMana);
            Spell calmingMind      = new Spell("Calming Mind", 0.1 * caster.MaxMana);
            Spell ragingMind       = new Spell("Raging Mind", 0.5 * caster.MaxMana);
            Spell overpoweringFist = new Spell("Overpowering Fist", 0.5 * caster.MaxMana);

            spells     = new List <Spell>();
            spellCheck = new SpellCheck();
            spells.Add(overGrowth);
            spells.Add(calmingMind);
            spells.Add(ragingMind);
            spells.Add(overpoweringFist);
        }
        public ZombieSpellRepository(Unit caster)
        {
            Spell infectingBite = new Spell("Infecting Bite", 0.4 * caster.MaxMana);
            Spell feed          = new Spell("Feed", 0.5 * caster.MaxMana);
            Spell mutation      = new Spell("Mutation", 0.5 * caster.MaxMana);
            Spell decay         = new Spell("Decay", 0.1 * caster.MaxMana);

            spells     = new List <Spell>();
            spellCheck = new SpellCheck();
            spells.Add(infectingBite);
            spells.Add(feed);
            spells.Add(mutation);
            spells.Add(decay);
        }
        public SaintSpellRepository(Unit caster)
        {
            Spell sacredWords  = new Spell("Sacred Words", 0.4 * caster.MaxMana);
            Spell illumination = new Spell("Illumination", 0.3 * caster.MaxMana);
            Spell holySmite    = new Spell("Holy Smite", 0.15 * caster.MaxMana);
            Spell judgementDay = new Spell("Judgement Day", 0.5 * caster.MaxMana);

            spells     = new List <Spell>();
            spellCheck = new SpellCheck();
            spells.Add(sacredWords);
            spells.Add(illumination);
            spells.Add(holySmite);
            spells.Add(judgementDay);
        }
        public ReptileSpellRepository(Unit caster)
        {
            Spell poisonSpit       = new Spell("Poison Spit", 0.3 * caster.MaxMana);
            Spell reflectingScales = new Spell("Reflelcting Scales", 0.3 * caster.MaxMana);
            Spell skinChange       = new Spell("Skin Change", 0.4 * caster.MaxMana);
            Spell scratch          = new Spell("Scratch", 0.15 * caster.MaxMana);

            spells     = new List <Spell>();
            spellCheck = new SpellCheck();
            spells.Add(poisonSpit);
            spells.Add(reflectingScales);
            spells.Add(skinChange);
            spells.Add(scratch);
        }
示例#24
0
        public BeastSpellRepository(Unit caster)
        {
            Spell furiousRoar = new Spell("Furious Roar", 0.2 * caster.MaxMana);
            Spell bite        = new Spell("Bite", 0.2 * caster.MaxMana);
            Spell thickHide   = new Spell("Thick Hide", 0.5 * caster.MaxMana);
            Spell lickWounds  = new Spell("Lick Wounds", 0.4 * caster.MaxMana);

            spells     = new List <Spell>();
            spellCheck = new SpellCheck();
            spells.Add(furiousRoar);
            spells.Add(bite);
            spells.Add(thickHide);
            spells.Add(lickWounds);
        }
示例#25
0
        protected override void OnPropertyChanged(LimeProperty prop, PropertyChangedEventArgs e)
        {
            if (string.IsNullOrEmpty(e.PropertyName))
            {
                wxValidation.Source = prop;
            }

            if (string.IsNullOrEmpty(e.PropertyName) || e.PropertyName == "Multiline")
            {
                if (prop != null && prop.Multiline)
                {
                    wxMain.TextWrapping = TextWrapping.Wrap;
                    wxMain.MaxLines     = 5;
                    if (prop.Type == typeof(string))
                    {
                        wxMain.SetBinding(SpellCheck.IsEnabledProperty, new Binding("SpellCheck")
                        {
                            Source = Global.User
                        });
                    }
                    else
                    {
                        SpellCheck.SetIsEnabled(wxMain, false);
                    }
                    ToolTip = null;
                }
                else
                {
                    wxMain.TextWrapping = TextWrapping.NoWrap;
                    SpellCheck.SetIsEnabled(wxMain, false);
                    if (HeaderEnabled)
                    {
                        wxMain.SetBinding(ToolTipProperty, new Binding("Text")
                        {
                            RelativeSource = new RelativeSource(RelativeSourceMode.Self)
                        });
                    }
                    else
                    {
                        ToolTip = null;
                    }
                }
            }

            if (string.IsNullOrEmpty(e.PropertyName) || e.PropertyName == "ReadOnly")
            {
                wxMain.IsReadOnly = ReadOnly || (prop != null && prop.ReadOnly);
            }
        }
示例#26
0
        public void Exec()
        {
            Console.WriteLine("\nSlovník obsahuje: {0} slov.", SpellCheck.LoadWords(VocabularyPath).Count);
            Console.WriteLine();
            string cmd = string.Empty;

            do
            {
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.Write("> ");
                Console.ForegroundColor = ConsoleColor.Green;
                cmd = Console.ReadLine();
                ProcessCommand(cmd);
            } while (cmd != Manager._CMD_QUIT);
        }
示例#27
0
        static void Main(string[] args)
        {
            Manager    manager    = new Manager();
            SpellCheck spellcheck = new SpellCheck(1, 1, 1);

            if (args.Length == 2)
            {
                manager.SetInput(args[1]);
                manager.SetVocabulary(args[0]);
                manager.Exec();
            }
            else
            {
                Console.WriteLine("Program musí být spuštěn se dvěma parametry: program <slovník.txt> <text.txt>");
            }
        }
示例#28
0
        public void TestIsValidWord()
        {
            SpellCheck spellChecker = new SpellCheck();

            spellChecker.loadWords(@"C:\Users\brett\source\repos\Tweetcabulary\Tweetcabulary\English.dic");

            Assert.IsTrue(spellChecker.IsValidWord("toast"));
            Assert.IsTrue(spellChecker.IsValidWord("platitudinous"));
            Assert.IsTrue(spellChecker.IsValidWord("Platitudinous"));
            Assert.IsTrue(spellChecker.IsValidWord("xylophone"));
            Assert.IsFalse(spellChecker.IsValidWord(""));
            Assert.IsFalse(spellChecker.IsValidWord(" "));
            Assert.IsFalse(spellChecker.IsValidWord("fakeword"));
            Assert.IsFalse(spellChecker.IsValidWord("platitoodinous"));
            Assert.IsFalse(spellChecker.IsValidWord("toastt"));
        }
        private void DialogCircuitLoaded(object sender, RoutedEventArgs e)
        {
            ControlTemplate template = this.category.Template;

            if (template != null)
            {
                if (template.FindName("PART_EditableTextBox", this.category) is TextBox textBox)
                {
                    SpellCheck spellCheck = textBox.SpellCheck;
                    if (spellCheck != null)
                    {
                        spellCheck.IsEnabled = true;
                    }
                }
            }
        }
示例#30
0
        /// <summary>
        /// Initializes a new instance of SmartTextBox.
        /// </summary>
        public SmartTextBox()
        {
            // Make sure that spellchecking is active for this TextBox.
            SpellCheck.SetIsEnabled(this, true);

            // Initialize the ListBox which displays suggestions.
            this.suggestionList = new ListBox();
            ScrollViewer.SetVerticalScrollBarVisibility(this.suggestionList, ScrollBarVisibility.Hidden);
            this.suggestionList.IsKeyboardFocusWithinChanged         += suggestionList_IsKeyboardFocusWithinChanged;
            this.suggestionList.ItemContainerGenerator.StatusChanged += suggestionList_ItemContainerGenerator_StatusChanged;
            this.suggestionList.MouseDoubleClick += suggestionList_MouseDoubleClick;
            this.suggestionList.PreviewKeyDown   += suggestionList_PreviewKeyDown;

            // Initialize the adorner which shows the Listbox.
            this.adorner = new UIElementAdorner(this, this.suggestionList);
        }
示例#31
0
        public ChatSubpageBase() : base("FileFind.Meshwork.GtkClient.meshwork.glade", "ChatRoomWindow")
        {
            base.FocusGrabbed += base_FocusGrabbed;

            try {
                spellCheck = new SpellCheck(inputTextView, CultureInfo.CurrentCulture.Name);
            } catch (Exception ex) {
                Core.LoggingService.LogWarning("Spell check is not avaliable because: " + ex.ToString());
            }

            TextTag myBoldTag = new TextTag("Bold");

            myBoldTag.Weight = Pango.Weight.Bold;

            TextTag nobodysTimeTag = new TextTag("NobodysTime");

            nobodysTimeTag.SizePoints = 7;

            TextTag myTimeTag = new TextTag("MyTime");

            myTimeTag.Foreground = "darkblue";
            myTimeTag.SizePoints = 7;

            TextTag otherTimeTag = new TextTag("OtherTime");

            otherTimeTag.Foreground = "darkred";
            otherTimeTag.SizePoints = 7;

            TextTag myNickTag = new TextTag("MyNickname");

            myNickTag.Foreground = "darkblue";
            myNickTag.Weight     = Pango.Weight.Bold;

            TextTag otherNickTag = new TextTag("OtherNickname");

            otherNickTag.Foreground = "darkred";
            otherNickTag.Weight     = Pango.Weight.Bold;

            chatTextView.Buffer.TagTable.Add(myBoldTag);
            chatTextView.Buffer.TagTable.Add(nobodysTimeTag);
            chatTextView.Buffer.TagTable.Add(myTimeTag);
            chatTextView.Buffer.TagTable.Add(otherTimeTag);
            chatTextView.Buffer.TagTable.Add(myNickTag);
            chatTextView.Buffer.TagTable.Add(otherNickTag);
        }
示例#32
0
        private void OnApplyTemplate()
        {
            _passwordBox.ApplyTemplate();

            TextBox = _passwordBox.GetTemplateChild <TextBox>(nameof(TextBox));

            if (TextBox != null)
            {
                TextBox.IsUndoEnabled = false;
                SpellCheck.SetIsEnabled(TextBox, false);
                TextBox.CommandBindings.Add(TextBoxCutBinding);
                TextBox.CommandBindings.Add(TextBoxCopyBinding);
                TextBox.TextChanged += OnTextBoxTextChanged;
                UpdateTextBox();
            }

            UpdateVisualState(false);
        }
示例#33
0
        public ChatSubpageBase()
            : base("FileFind.Meshwork.GtkClient.meshwork.glade", "ChatRoomWindow")
        {
            base.FocusGrabbed += base_FocusGrabbed;

            try {
                spellCheck = new SpellCheck (inputTextView, CultureInfo.CurrentCulture.Name);
            } catch (Exception ex) {
                LoggingService.LogWarning("Spell check is not avaliable because: " + ex.ToString());
            }

            TextTag myBoldTag = new TextTag ("Bold");
            myBoldTag.Weight = Pango.Weight.Bold;

            TextTag nobodysTimeTag = new TextTag ("NobodysTime");
            nobodysTimeTag.SizePoints = 7;

            TextTag myTimeTag = new TextTag ("MyTime");
            myTimeTag.Foreground = "darkblue";
            myTimeTag.SizePoints = 7;

            TextTag otherTimeTag = new TextTag ("OtherTime");
            otherTimeTag.Foreground = "darkred";
            otherTimeTag.SizePoints = 7;

            TextTag myNickTag = new TextTag ("MyNickname");
            myNickTag.Foreground = "darkblue";
            myNickTag.Weight = Pango.Weight.Bold;

            TextTag otherNickTag = new TextTag ("OtherNickname");
            otherNickTag.Foreground = "darkred";
            otherNickTag.Weight = Pango.Weight.Bold;

            chatTextView.Buffer.TagTable.Add (myBoldTag);
            chatTextView.Buffer.TagTable.Add (nobodysTimeTag);
            chatTextView.Buffer.TagTable.Add (myTimeTag);
            chatTextView.Buffer.TagTable.Add (otherTimeTag);
            chatTextView.Buffer.TagTable.Add (myNickTag);
            chatTextView.Buffer.TagTable.Add (otherNickTag);
        }