C2026-043-Tech-Debt_v1 - Stash 1
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using DevComponents.DotNetBar;
|
||||
using C1.Win.C1SpellChecker;
|
||||
|
||||
namespace Volian.Controls.Library
|
||||
@@ -19,31 +14,26 @@ namespace Volian.Controls.Library
|
||||
private int _ErrorCount;
|
||||
private int _ErrorIndex = -1; // current error index
|
||||
private bool _AutoSuggest = true;
|
||||
private string _NoSuggestionsText = "(no suggestions)";
|
||||
private readonly string _NoSuggestionsText = "(no suggestions)";
|
||||
|
||||
Dictionary<string, string> _changeAll = new Dictionary<string, string>();
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "Keeping Collections Not ReadOnly")]
|
||||
Dictionary<string, string> _changeAll = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="CharRange"/> object that represents the error currently
|
||||
/// displayed in the dialog.
|
||||
/// </summary>
|
||||
public CharRange CurrentError
|
||||
{
|
||||
get { return _Errors[_ErrorIndex]; }
|
||||
}
|
||||
public bool DidCorrectSpelling = false; // B2015-024 have Spell Checker text changes be in editorial mode (not assign a change bar but keep existing change bar)
|
||||
/// <summary>
|
||||
/// Gets the <see cref="CharRange"/> object that represents the error currently
|
||||
/// displayed in the dialog.
|
||||
/// </summary>
|
||||
public CharRange CurrentError => _Errors[_ErrorIndex];
|
||||
public bool DidCorrectSpelling = false; // B2015-024 have Spell Checker text changes be in editorial mode (not assign a change bar but keep existing change bar)
|
||||
|
||||
public VlnSpellCheckDlg()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
/// <summary>
|
||||
/// Initializes the dialog to use the given parameters.
|
||||
/// </summary>
|
||||
/// <param name="spell"><see cref="C1SpellChecker"/> to use for spelling.</param>
|
||||
/// <param name="editor"><see cref="ISpellCheckableEditor"/> that contains the text to spell-check.</param>
|
||||
/// <param name="errors"><see cref="CharRangeList"/> that contains the initial error list.</param>
|
||||
public void Initialize(C1SpellChecker spell, ISpellCheckableEditor editor, CharRangeList errors)
|
||||
public VlnSpellCheckDlg() => InitializeComponent();
|
||||
/// <summary>
|
||||
/// Initializes the dialog to use the given parameters.
|
||||
/// </summary>
|
||||
/// <param name="spell"><see cref="C1SpellChecker"/> to use for spelling.</param>
|
||||
/// <param name="editor"><see cref="ISpellCheckableEditor"/> that contains the text to spell-check.</param>
|
||||
/// <param name="errors"><see cref="CharRangeList"/> that contains the initial error list.</param>
|
||||
public void Initialize(C1SpellChecker spell, ISpellCheckableEditor editor, CharRangeList errors)
|
||||
{
|
||||
_Spell = spell;
|
||||
_Editor = editor;
|
||||
@@ -55,18 +45,15 @@ namespace Volian.Controls.Library
|
||||
_ErrorCount += _Errors.Count;
|
||||
btnAddToDictionary.Visible = _Spell.UserDictionary.Enabled;
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the total number of errors detected in the control.
|
||||
/// </summary>
|
||||
public int ErrorCount
|
||||
{
|
||||
get { return _ErrorCount; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the total number of errors detected in the control.
|
||||
/// </summary>
|
||||
public int ErrorCount => _ErrorCount;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the index of the current error into the <see cref="Errors"/> list.
|
||||
/// </summary>
|
||||
public int ErrorIndex
|
||||
/// <summary>
|
||||
/// Gets or sets the index of the current error into the <see cref="Errors"/> list.
|
||||
/// </summary>
|
||||
public int ErrorIndex
|
||||
{
|
||||
get { return _ErrorIndex; }
|
||||
set
|
||||
@@ -105,7 +92,7 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
// fire load event
|
||||
base.OnLoad(e);
|
||||
//AddHandle();
|
||||
//AddHandle(); //For Debugging
|
||||
// show first error (after firing load event)
|
||||
ErrorIndex = 0;
|
||||
}
|
||||
@@ -204,8 +191,6 @@ namespace Volian.Controls.Library
|
||||
// show 'Add' button only if user dictionary is enabled
|
||||
btnAddToDictionary.Visible = _Spell.UserDictionary.Enabled;
|
||||
|
||||
// all ready, fire ErrorDisplayed event
|
||||
//OnErrorDisplayed(EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void SetupSuggestions(string badWord)
|
||||
@@ -251,23 +236,17 @@ namespace Volian.Controls.Library
|
||||
return false;
|
||||
}
|
||||
|
||||
private void btnChange_Click(object sender, EventArgs e)
|
||||
{
|
||||
UpdateEditor(txbBadWord.Text);
|
||||
}
|
||||
private void btnChange_Click(object sender, EventArgs e) => UpdateEditor(txbBadWord.Text);
|
||||
|
||||
private void btnChangeAll_Click(object sender, EventArgs e)
|
||||
private void btnChangeAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
_changeAll[CurrentError.Text] = txbBadWord.Text;
|
||||
UpdateEditor(txbBadWord.Text);
|
||||
}
|
||||
|
||||
private void btnIgnore_Click(object sender, EventArgs e)
|
||||
{
|
||||
ErrorIndex++;
|
||||
}
|
||||
private void btnIgnore_Click(object sender, EventArgs e) => ErrorIndex++;
|
||||
|
||||
private void btnIgnoreAll_Click(object sender, EventArgs e)
|
||||
private void btnIgnoreAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
//Console.WriteLine("handle: {0}", this.Handle);
|
||||
_Spell.IgnoreList.Add(CurrentError.Text);
|
||||
@@ -299,9 +278,6 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
|
||||
private void btnRemove_Click(object sender, EventArgs e)
|
||||
{
|
||||
UpdateEditor("");
|
||||
}
|
||||
}
|
||||
private void btnRemove_Click(object sender, EventArgs e) => UpdateEditor("");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user