Enhanced: rename a method name for clarification
Enhanced: convert 16-32 bit link data at procedure level Enhanced: convert 16-32 bit link data at procedure level.
This commit is contained in:
@@ -13,8 +13,15 @@ namespace Volian.Controls.Library
|
||||
public partial class dlgEnhMissingItem : Form
|
||||
{
|
||||
StepTabRibbon STRibbon = null;
|
||||
private ItemInfo _SourceItem = null;
|
||||
private int _EnhType = -1;
|
||||
private bool _Initializing = false;
|
||||
public bool OKSelected = false;
|
||||
public dlgEnhMissingItem(StepTabRibbon strbn, ItemInfo srcItem, int enhType)
|
||||
{
|
||||
_Initializing = true;
|
||||
_SourceItem = srcItem;
|
||||
_EnhType = enhType;
|
||||
InitializeComponent();
|
||||
STRibbon = strbn;
|
||||
btnOK.Enabled = true;
|
||||
@@ -23,48 +30,87 @@ namespace Volian.Controls.Library
|
||||
if (iil == null || iil.Count == 0)
|
||||
{
|
||||
rbLinkToExisting.Enabled = false;
|
||||
cbUnlinkEnhancedItems.Enabled = false;
|
||||
cbUnlinkedEnhancedItems.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
rbLinkToExisting.Enabled = true;
|
||||
cbUnlinkEnhancedItems.DataSource = iil;
|
||||
cbUnlinkEnhancedItems.SelectedIndex = -1;
|
||||
cbUnlinkEnhancedItems.Enabled = false;
|
||||
cbUnlinkedEnhancedItems.DataSource = iil;
|
||||
cbUnlinkedEnhancedItems.SelectedIndex = -1;
|
||||
cbUnlinkedEnhancedItems.Enabled = false;
|
||||
}
|
||||
if (srcItem.IsProcedure) this.Text = "Create Missing Enhanced Item for " + srcItem.DisplayNumber;
|
||||
else this.Text = "Create Missing Enhanced Item";
|
||||
_Initializing = false;
|
||||
}
|
||||
|
||||
private void btnOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (rbCreateNew.Checked)
|
||||
{
|
||||
STRibbon.enhUseExist = null;
|
||||
STRibbon.enhDoConv = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemInfo ii = cbUnlinkEnhancedItems.SelectedItem as ItemInfo;
|
||||
ItemInfo ii = cbUnlinkedEnhancedItems.SelectedItem as ItemInfo;
|
||||
STRibbon.enhUseExist = ii;
|
||||
}
|
||||
OKSelected = true;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void rbLinkToExisting_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (rbLinkToExisting.Checked)
|
||||
{
|
||||
cbUnlinkEnhancedItems.Enabled = true;
|
||||
cbUnlinkEnhancedItems.SelectedIndex = -1;
|
||||
cbUnlinkedEnhancedItems.Enabled = true;
|
||||
cbUnlinkedEnhancedItems.SelectedIndex = -1;
|
||||
btnOK.Enabled = false; // disable until user selects an item from combobox
|
||||
}
|
||||
else
|
||||
cbUnlinkEnhancedItems.Enabled = false;
|
||||
cbUnlinkedEnhancedItems.Enabled = false;
|
||||
}
|
||||
|
||||
private void rbCreateNew_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (rbCreateNew.Checked) btnOK.Enabled = true;
|
||||
}
|
||||
|
||||
private void cbUnlinkEnhancedItems_SelectedIndexChanged(object sender, EventArgs e)
|
||||
private void cbUnlinkedEnhancedItems_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_Initializing) return;
|
||||
// cbUnlinkedEnhancedItems combo box has a list of all items in the enhanced document
|
||||
// that can be linked to from this item.
|
||||
btnOK.Enabled = true;
|
||||
STRibbon.enhDoConv = false;
|
||||
// if on a procedure, take the selected enhanced procedure & see if there are non-procedure items
|
||||
// within it that can be linked based on old 16 bit data. If no sections/steps are returned, only the
|
||||
// procedure can be linked so it really isn't a match. Otherwise, prompt user to see if they want to
|
||||
// convert the data. If so, convert all items within it that can be linked. If not, just link as before.
|
||||
if (_SourceItem.IsProcedure)
|
||||
{
|
||||
ItemInfo ii = cbUnlinkedEnhancedItems.SelectedItem as ItemInfo;
|
||||
ContentInfoList cil = ContentInfoList.Get16BitEnhancedContents(_SourceItem.ItemID, ii.ItemID, _EnhType);
|
||||
bool foundSubItem = false; // in returned list, see if there are any sections/steps. If none, don't prompt
|
||||
foreach (ContentInfo ci in cil)
|
||||
{
|
||||
if (ci.Type >= 10000)
|
||||
{
|
||||
foundSubItem = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (foundSubItem)
|
||||
{
|
||||
DialogResult dr = MessageBox.Show("The procedure that is selected has enhanced data. Do you want to convert it (this will link any section/steps that can be linked)?", "Enhanced Links", MessageBoxButtons.YesNo);
|
||||
if (dr == DialogResult.Yes)
|
||||
{
|
||||
STRibbon.enhUseExist = ii;
|
||||
STRibbon.enhDoConv = true;
|
||||
btnOK_Click(sender, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user