B2022-088: Find Doc Ro button not working in Word Sections

B2022-089: Updating RO Crashes
This commit is contained in:
Jake
2022-08-08 10:04:21 +00:00
parent b6d69fbd4c
commit f8269a7ac6
13 changed files with 271 additions and 125 deletions

View File

@@ -311,7 +311,7 @@ namespace Volian.Controls.Library
// Stop the timer
_searchTimer.Stop();
// Process RO Search
// Process RO Value Search
if (MyRTB != null && !MyRTB.IsDisposed)
{
ProcessSearch(MyRTB.SelectedText, (int)ROFSTLookup.SearchTypes.StartsWith);
@@ -475,10 +475,8 @@ namespace Volian.Controls.Library
FlexibleMessageBox.Show(this, "Text must be selected in the document in order for an RO find to be performed.", "Select Text", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
else
{
ProcessSearch(mytext, (int)ROFSTLookup.SearchTypes.StartsWith);
}
ProcessSearch(mytext, (int)ROFSTLookup.SearchTypes.StartsWith);
}
}
@@ -868,7 +866,7 @@ namespace Volian.Controls.Library
if (dti.MyDSOTabPanel != null) // A Word Document tab is the active tab
{
string accPageID = string.Format("<{0}>", roc.appid);
string accPageID = string.Format("<{0}>", roc.appid.ToUpper());
// Insert the RO text at the current cursor position in the word document
// NOTE: assuming any type of RO can be put in an Accessory (MSWord) Document
@@ -881,7 +879,6 @@ namespace Volian.Controls.Library
{
if (CheckROSelection(roc)) // check for RO type is valid for this type of step/substep
{
// the roid may be 12 or 16 chars long, with the last 4 set if there is unit specific value
// Pad to 16 to store in the RoUsage table.
string padroid = ROFSTLookup.FormatRoidKey(roc.roid, true);
string linktxt = string.Format(@"#Link:ReferencedObject:<NewID> {0} {1}", padroid, MyROFST.RODbID);
@@ -1017,47 +1014,51 @@ namespace Volian.Controls.Library
// tries to process a search while the main tab/procedure is closing
try
{
if (!this.Enabled)
searchValue = string.Empty;
if (!string.IsNullOrEmpty(searchValue))
if (this.Enabled && !string.IsNullOrEmpty(searchValue))
{
Dictionary<string, string> dicRoVals = new Dictionary<string, string>();
searchValue = searchValue.Replace('\u2011', '-').Replace(@"\u9586?", @"\\");
if (_lastSearchValue != searchValue)
// B2022-088: Find Doc Ro button not working in Word Sections
if (searchValue.StartsWith("<") && searchValue.EndsWith(">"))
{
if (MyROFST != null && searchValue.Length >= 2)
{
dicRoVals = MyROFSTLookup.Search(searchValue, searchTypeID, false, MaxNumSearchRecords);
}
ROFSTLookup.rochild roc = MyROFSTLookup.GetROChildByAccPageID(searchValue);
if (roc.ID >= 0 && !string.IsNullOrEmpty(roc.value))
dicRoVals.Add(roc.roid, roc.value);
}
else if (searchValue.Length >= 2 && searchValue != _lastSearchValue)
{
dicRoVals = MyROFSTLookup.Search(searchValue, searchTypeID, false, MaxNumSearchRecords);
}
if (dicRoVals != null && dicRoVals.Count > 0)
{
lbFound.SelectedValueChanged -= new EventHandler(lbFound_SelectedValueChanged);
lbFound.DataSource = new BindingSource(dicRoVals, null);
lbFound.ValueMember = "Key"; // roid
lbFound.DisplayMember = "Value"; // default value
if (dicRoVals.Count > 0)
{
lbFound.SelectedValueChanged -= new EventHandler(lbFound_SelectedValueChanged);
lbFound.SelectionMode = SelectionMode.One;
lbFound.SelectedIndex = -1;
lbFound.Visible = true;
lbFound.DataSource = new BindingSource(dicRoVals, null);
lbFound.ValueMember = "Key"; // roid
lbFound.DisplayMember = "Value"; // default value
lbFound.SelectedValueChanged += new EventHandler(lbFound_SelectedValueChanged);
lbFound.SelectionMode = SelectionMode.One;
lbFound.SelectedIndex = -1;
lbFound.Visible = true;
if (lbFound.Items != null && lbFound.Items.Count == 1)
lbFound.SelectedIndex = 0;
}
else
{
lbFound.DataSource = null;
lbFound.Visible = false;
}
lbFound.SelectedValueChanged += new EventHandler(lbFound_SelectedValueChanged);
if (lbFound.Items != null && lbFound.Items.Count == 1)
lbFound.SelectedIndex = 0;
}
else
{
searchValue = string.Empty;
lbFound.DataSource = null;
lbFound.Visible = false;
}
}
else
{
searchValue = string.Empty;
lbFound.DataSource = null;
lbFound.Visible = false;
}

View File

@@ -513,8 +513,9 @@ namespace Volian.Controls.Library
else
{
string[] subs = m.Groups[3].Value.Split(" ".ToCharArray());
val = lookup.GetRoValue(subs[1]);
if (val == null || val == "?") val = lookup.GetRoValue(subs[1].Substring(0, 12));
// B2022-088: Find Doc Ro button not working in Word Sections
val = lookup.GetRoChild(subs[1]).value;
if (val == null || val == "?") val = lookup.GetRoChild(subs[1].Substring(0, 12)).value;
if (val == "?")
{
// Do 'empty' image box.