Enhanced: Added event support to add a new tree node when an new enhanced procedure is created in a new working draft from the source
Enhanced: Allow for creating new links from doc version to an non-linked enhanced doc version
This commit is contained in:
parent
af78064dd2
commit
09e74a6d34
@ -82,6 +82,8 @@ namespace VEPROMS
|
||||
_SelectedStepTabPanel.MyStepTabRibbon.ProgressBar = bottomProgBar;
|
||||
_SelectedStepTabPanel.MyStepTabRibbon.ContActionSummaryRequest -= MyStepTabRibbon_ContActionSummaryRequest;
|
||||
_SelectedStepTabPanel.MyStepTabRibbon.ContActionSummaryRequest += MyStepTabRibbon_ContActionSummaryRequest;
|
||||
_SelectedStepTabPanel.MyStepTabRibbon.AddProcToDVInTree -= new StepTabRibbonEvent(MyStepTabRibbon_AddProcToDocVersionInTree);
|
||||
_SelectedStepTabPanel.MyStepTabRibbon.AddProcToDVInTree += new StepTabRibbonEvent(MyStepTabRibbon_AddProcToDocVersionInTree);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -937,6 +939,12 @@ namespace VEPROMS
|
||||
if (SelectedStepTabPanel!=null && SelectedStepTabPanel.MyStepTabRibbon != null)
|
||||
SelectedStepTabPanel.MyStepTabRibbon.SetUpdRoValBtn(SelectedStepTabPanel.MyStepTabRibbon.NewerRoFst());
|
||||
}
|
||||
// Add a tree node for a procedure if this is the first procedure in the docversion, added from
|
||||
// step editor (used for creating enhanced procedure in empty docversion)
|
||||
void MyStepTabRibbon_AddProcToDocVersionInTree(object sender, StepTabRibbonEventArgs args)
|
||||
{
|
||||
tv.AdjustTree(args.Proc as ProcedureInfo);
|
||||
}
|
||||
void MyStepTabRibbon_PrintRequest(object sender, StepTabRibbonEventArgs args)
|
||||
{
|
||||
// Fix for B2013-173:
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -146,15 +146,56 @@ namespace VEPROMS
|
||||
{
|
||||
if (emc.IsDirty)
|
||||
{
|
||||
bool isnew = true;
|
||||
foreach (DVEnhancedDocument dved in _DocVersionConfig.MyEnhancedDocuments)
|
||||
{
|
||||
if (dved.Type == Convert.ToInt32(emc.Type))
|
||||
{
|
||||
// pdfxoffset must be int? how to check
|
||||
isnew = false;
|
||||
dved.Name = emc.Name;
|
||||
dved.PdfToken = emc.PdfToken;
|
||||
try
|
||||
{
|
||||
dved.PdfX = Convert.ToInt32(emc.PdfXOffset);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
dved.PdfX = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isnew) // make new link for this and the enhanced it points to.
|
||||
{
|
||||
int ipdfx = 0;
|
||||
try
|
||||
{
|
||||
ipdfx = Convert.ToInt32(emc.PdfXOffset);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ipdfx = 0;
|
||||
}
|
||||
int itype = 0;
|
||||
try
|
||||
{
|
||||
itype = Convert.ToInt32(emc.Type);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
itype = 1;
|
||||
}
|
||||
// get index into combo box for doc version selected.
|
||||
int selindx = cbxEnhVersions.SelectedIndex;
|
||||
DocVersionInfo dvisel = NewEnhVersions[selindx];
|
||||
_DocVersionConfig.MyEnhancedDocuments.Add(new DVEnhancedDocument(emc.Name, itype, dvisel.VersionID, ipdfx, emc.PdfToken));
|
||||
using (DocVersion dv = DocVersion.Get(dvisel.VersionID))
|
||||
{
|
||||
DocVersionConfig dvc = dv.MyConfig as DocVersionConfig;
|
||||
dvc.MyEnhancedDocuments.Add(new DVEnhancedDocument("Source", 0, (int)_DocVersionConfig.MyDocVersion.VersionID, 10, "S"));
|
||||
dvc.SaveDVEnhancedDocuments();
|
||||
dv.Config = dvc.ToString();
|
||||
dv.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -406,6 +447,46 @@ namespace VEPROMS
|
||||
}
|
||||
private void InitEnhanced()
|
||||
{
|
||||
// if this working draft has no enhanced documents, then put display a button for creating the enhanced links -
|
||||
// but only if there are enhanced docversions to link to.
|
||||
// Otherwise, set up the form with the data as it is.
|
||||
if (_DocVersionConfig.MyEnhancedDocuments == null || _DocVersionConfig.MyEnhancedDocuments.Count == 0)
|
||||
{
|
||||
// also check that the format for this docversion does NOT have enhanced back/dev, i.e. it's format is an enhanced
|
||||
// document
|
||||
if (!(((_DocVersionConfig.MyDocVersion.MyDocVersionInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds) ||
|
||||
((_DocVersionConfig.MyDocVersion.MyDocVersionInfo.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedDeviations) == E_PurchaseOptions.EnhancedDeviations)))
|
||||
{
|
||||
bool validEmptyEnhancedExists = false;
|
||||
// See if there are available (enhanced) DocVersions that can be linked to from this (source) DocVersion
|
||||
DocVersionInfoList nonenhdvs = DocVersionInfoList.GetNonEnhancedDocVersions(); // this is a list of docversions that have no 'Enhanced' in config data
|
||||
foreach (DocVersionInfo nonenhdv in nonenhdvs)
|
||||
{
|
||||
if (nonenhdv.VersionID != _DocVersionConfig.MyDocVersion.VersionID)
|
||||
{
|
||||
if (((nonenhdv.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds) ||
|
||||
((nonenhdv.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedDeviations) == E_PurchaseOptions.EnhancedDeviations))
|
||||
{
|
||||
validEmptyEnhancedExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (validEmptyEnhancedExists) break;
|
||||
}
|
||||
if (validEmptyEnhancedExists)
|
||||
{
|
||||
Button btnEnh = new Button();
|
||||
btnEnh.Text = "Link to Enhanced Document(s)";
|
||||
btnEnh.Width = 220;
|
||||
btnEnh.Location = new Point(290, 271);
|
||||
btnEnh.Parent = tcpGeneral;
|
||||
btnEnh.Click += new EventHandler(btnEnh_Click);
|
||||
}
|
||||
}
|
||||
btnEnhanced.Visible = false;
|
||||
tiEnhanced.Visible = false;
|
||||
return;
|
||||
}
|
||||
btnEnhanced.Visible = true;
|
||||
tiEnhanced.Visible = true;
|
||||
// get enhanced tab's data if:
|
||||
@ -431,16 +512,10 @@ namespace VEPROMS
|
||||
bsMiniEnhanced.DataSource = _Enhanced;
|
||||
cbxEnhVersions.SelectedIndex = 0;
|
||||
cbxEnhVersions.Enabled = false;
|
||||
btnNewEnh.Visible = false;
|
||||
}
|
||||
else if (hasEnhancedPO)
|
||||
{
|
||||
// if this is not a source, i.e. does not have myenhanceddocuments, then FOR NOW - UNTIL 'NEW' is done, turn off enhanced tab:
|
||||
if (_DocVersionConfig.MyEnhancedDocuments == null || _DocVersionConfig.MyEnhancedDocuments.Count == 0)
|
||||
{
|
||||
btnEnhanced.Visible = false;
|
||||
tiEnhanced.Visible = false;
|
||||
return;
|
||||
}
|
||||
// first set up existing enhanced linked documents (this is a listbox on left of form)
|
||||
_Enhanced = new List<EnhancedMiniConfig>();
|
||||
lbEnhanced.Visible = true;
|
||||
@ -460,9 +535,21 @@ namespace VEPROMS
|
||||
if (cbxEnhVersions.Items.Count>0) cbxEnhVersions.SelectedIndex = 0;
|
||||
if (lbEnhanced.Items.Count > 0) lbEnhanced.SelectedIndex = 0;
|
||||
bsMiniEnhanced.DataSource = bsEnhanced.Current as EnhancedMiniConfig;
|
||||
btnNewEnh.Visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
void btnEnh_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MessageBox.Show(this, "Are you sure you want to Link Enhanced Document(s) to this Working Draft?", "Add Enhanced Link", MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
|
||||
{
|
||||
btnEnhanced.Visible = true;
|
||||
tiEnhanced.Visible = true;
|
||||
Button btnEnh = (Button)sender;
|
||||
btnEnh.Visible = false;
|
||||
btnEnhanced_Click(sender, e);
|
||||
}
|
||||
}
|
||||
void btnPC_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MessageBox.Show(this, "Are you sure you want to add Applicability to this Working Draft?", "Add Applicability", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Stop) == DialogResult.Yes)
|
||||
@ -1252,12 +1339,68 @@ namespace VEPROMS
|
||||
|
||||
private void lbEnhanced_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (!_Initializing && lbEnhanced.SelectedIndex > -1)
|
||||
if (!_Initializing && lbEnhanced.SelectedIndex > -1 && !doingNew)
|
||||
{
|
||||
bsMiniEnhanced.DataSource = bsEnhanced.Current as EnhancedMiniConfig;
|
||||
if (cbxEnhVersions.Items.Count >= lbEnhanced.Items.Count)
|
||||
cbxEnhVersions.SelectedIndex = lbEnhanced.SelectedIndex;
|
||||
}
|
||||
}
|
||||
private List<DocVersionInfo> NewEnhVersions = new List<DocVersionInfo>();
|
||||
private bool doingNew = false;
|
||||
private void btnNewEnh_Click(object sender, EventArgs e)
|
||||
{
|
||||
_Initializing = true;
|
||||
doingNew = true;
|
||||
// the 'New' button is only enabled for Source documents.
|
||||
EnhancedMiniConfig cfg = new EnhancedMiniConfig();
|
||||
cfg.Name = "New Enhanced";
|
||||
// need to have a unique number for this enhanced link, find largest and then increment by 1.
|
||||
int maxtype = -1;
|
||||
if (_DocVersionConfig.MyEnhancedDocuments != null && _DocVersionConfig.MyEnhancedDocuments.Count > 0)
|
||||
{
|
||||
foreach (DVEnhancedDocument dve in _DocVersionConfig.MyEnhancedDocuments)
|
||||
{
|
||||
maxtype = Math.Max(maxtype, dve.Type);
|
||||
}
|
||||
}
|
||||
if (maxtype < 0) maxtype = 1;
|
||||
else maxtype++;
|
||||
cfg.Type = maxtype.ToString();
|
||||
|
||||
if (_Enhanced == null)
|
||||
_Enhanced = new List<EnhancedMiniConfig>();
|
||||
_Enhanced.Add(cfg);
|
||||
bsEnhanced.DataSource = null;
|
||||
bsEnhanced.DataSource = _Enhanced;
|
||||
cbxEnhVersions.Items.Clear();
|
||||
NewEnhVersions.Clear();
|
||||
DocVersionInfoList nonenhdvs = DocVersionInfoList.GetNonEnhancedDocVersions(); // this is a list of docversions that have no 'Enhanced' in config data
|
||||
foreach (DocVersionInfo nonenhdv in nonenhdvs)
|
||||
{
|
||||
if (nonenhdv.VersionID != _DocVersionConfig.MyDocVersion.VersionID)
|
||||
{
|
||||
if (((nonenhdv.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedBackgrounds) == E_PurchaseOptions.EnhancedBackgrounds) ||
|
||||
((nonenhdv.ActiveFormat.PlantFormat.FormatData.PurchaseOptions.Value & E_PurchaseOptions.EnhancedDeviations) == E_PurchaseOptions.EnhancedDeviations))
|
||||
{
|
||||
NewEnhVersions.Add(nonenhdv);
|
||||
cbxEnhVersions.Items.Add(nonenhdv.SearchDVPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cbxEnhVersions.Items.Count > 0)
|
||||
{
|
||||
cbxEnhVersions.Enabled = true;
|
||||
cbxEnhVersions.SelectedIndex = 0;
|
||||
}
|
||||
else
|
||||
cbxEnhVersions.Enabled = false;
|
||||
bsMiniEnhanced.DataSource = cfg;
|
||||
lbEnhanced.SelectedItem = cfg;
|
||||
tbEnhType.Enabled = false;
|
||||
btnNewEnh.Enabled = false; // for now, only do 1 at a time.
|
||||
_Initializing = false;
|
||||
}
|
||||
}
|
||||
[XmlRoot("Enhanced")]
|
||||
public class EnhancedMiniConfig
|
||||
|
@ -123,12 +123,6 @@
|
||||
<metadata name="docVersionConfigBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>415, 17</value>
|
||||
</metadata>
|
||||
<metadata name="docVersionConfigBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>415, 17</value>
|
||||
</metadata>
|
||||
<metadata name="superTooltip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>643, 17</value>
|
||||
</metadata>
|
||||
<data name="ppCmbxFormat.SuperTooltip" xml:space="preserve">
|
||||
<value>Allows you to specify the default format to use for all procedures in this set.
|
||||
|
||||
@ -202,6 +196,12 @@ Check "Show Default Settings" to display the "default" duplexing setting (below
|
||||
<metadata name="bsEnhanced.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>817, 17</value>
|
||||
</metadata>
|
||||
<metadata name="bsMiniApple.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>118, 17</value>
|
||||
</metadata>
|
||||
<metadata name="bsApples.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="documentInfoListBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>181, 113</value>
|
||||
</metadata>
|
||||
@ -221,24 +221,6 @@ Check "Show Default Settings" to display the "default" duplexing setting (below
|
||||
gg==
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="bsMiniApple.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>118, 17</value>
|
||||
</metadata>
|
||||
<metadata name="bsMiniEnhanced.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 65</value>
|
||||
</metadata>
|
||||
<metadata name="bsEnhanced.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>817, 17</value>
|
||||
</metadata>
|
||||
<metadata name="bsMiniApple.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>118, 17</value>
|
||||
</metadata>
|
||||
<metadata name="bsApples.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="bsApples.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="ROPrefixBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>238, 17</value>
|
||||
</metadata>
|
||||
|
Loading…
x
Reference in New Issue
Block a user