debugged and fixed many issues in the property pages
This commit is contained in:
@@ -8,17 +8,23 @@ using System.Windows.Forms;
|
||||
using VEPROMS.CSLA.Library;
|
||||
using VEPROMS.Properties;
|
||||
using DevComponents.DotNetBar;
|
||||
using DevComponents.DotNetBar.Controls;
|
||||
using Volian.Controls.Library;
|
||||
using DescriptiveEnum;
|
||||
|
||||
namespace VEPROMS
|
||||
{
|
||||
public partial class frmSectionProperties : DevComponents.DotNetBar.Office2007Form
|
||||
{
|
||||
private string _DefaultFormatName = null;
|
||||
private string _DefaultNumColumns = null;
|
||||
private string _DefaultPaginationStyle = null;
|
||||
private string _DefaultPrintSize = null;
|
||||
private bool _Initializing;
|
||||
private SectionConfig _SectionConfig;
|
||||
private Document _DocumentToDelete = null;
|
||||
private StepTabRibbon _MyStepTabRibbon;
|
||||
private bool _isStepSection = true;
|
||||
|
||||
public frmSectionProperties(SectionConfig sectionConfig)
|
||||
{
|
||||
@@ -50,10 +56,13 @@ namespace VEPROMS
|
||||
_MyStepTabRibbon.Name = "displayTabRibbon1";
|
||||
_MyStepTabRibbon.Visible = false;
|
||||
|
||||
// if creating a new section, enable the StepSect and WordSect radio buttons
|
||||
rbStepSect.Enabled = rbWordSect.Enabled = !(ii.HasWordContent || ii.HasStepContent);
|
||||
|
||||
// set up some of the format tab:
|
||||
|
||||
cbIsStepSection.Enabled = !(ii.HasWordContent || ii.HasStepContent);
|
||||
SetupPpCmbxSectionType();
|
||||
ShowAvailableOptionsForSectionType();
|
||||
|
||||
// check type of section from document styles to determine if the stepsection checkbox should
|
||||
// be checked.
|
||||
int secindx = (int)sectionConfig.SectionType;
|
||||
@@ -63,7 +72,10 @@ namespace VEPROMS
|
||||
{
|
||||
if (pf.DocStyles.DocStyleList[i].Index == secindx)
|
||||
{
|
||||
cbIsStepSection.Checked = pf.DocStyles.DocStyleList[i].IsStepSection;
|
||||
//_isStepSection = pf.DocStyles.DocStyleList[i].IsStepSection;
|
||||
//SetupPpCmbxSectionType();
|
||||
//ShowAvailableOptionsForSectionType();
|
||||
rbStepSect.Checked = pf.DocStyles.DocStyleList[i].IsStepSection;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,14 +120,41 @@ namespace VEPROMS
|
||||
_SectionConfig.ParentLookup = true;
|
||||
// Get the default format name
|
||||
_DefaultFormatName = _SectionConfig.DefaultFormatSelection;
|
||||
if (_DefaultFormatName != null && !(_DefaultFormatName.Equals("")))
|
||||
{
|
||||
ppLblFormatDefault.Text = string.Format("({0})", _DefaultFormatName);
|
||||
ppCmbxFormat.WatermarkText = string.Format("{0}", _DefaultFormatName);
|
||||
}
|
||||
SetupDefault(_DefaultFormatName, ppLblFormatDefault, ppCmbxFormat);
|
||||
//if (_DefaultFormatName != null && !(_DefaultFormatName.Equals("")))
|
||||
//{
|
||||
// string defName = string.Format("{0}", _DefaultFormatName);
|
||||
// ppLblFormatDefault.Text = defName;
|
||||
// ppCmbxFormat.WatermarkText = defName;
|
||||
//}
|
||||
_DefaultNumColumns = _SectionConfig.Section_ColumnMode.ToString();
|
||||
SetupDefault(EnumDescConverter.GetEnumDescription(_SectionConfig.Section_ColumnMode), ppLblDefaultNumColumns, ppCmbxNumColumns);
|
||||
|
||||
_DefaultPaginationStyle = _SectionConfig.Section_Pagination.ToString();
|
||||
SetupDefault(EnumDescConverter.GetEnumDescription(_SectionConfig.Section_Pagination), ppLblDefPaginationStyle, ppCmbxSectPagination);
|
||||
|
||||
//_DefaultPrintSize = _SectionConfig.Section_AttachmentPrintSize.ToString();
|
||||
//SetupDefault(EnumDescConverter.GetEnumDescription(_SectionConfig.Section_AttachmentPrintSize), ppLblDefaultPrintSize, ppCmbxAccPgPrintSize);
|
||||
|
||||
_SectionConfig.ParentLookup = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the watermark and default label
|
||||
/// </summary>
|
||||
/// <param name="defaultText">The default text</param>
|
||||
/// <param name="lbl">Label that displays the current default when view defaults is set</param>
|
||||
/// <param name="cmboEx">Combo box with a watermark property</param>
|
||||
private static void SetupDefault(string defaultText, Label lbl, ComboBoxEx cmbo)
|
||||
{
|
||||
if (defaultText != null && !(defaultText.Equals("")))
|
||||
{
|
||||
string deftext = string.Format("{0}", defaultText);
|
||||
lbl.Text = deftext;
|
||||
cmbo.WatermarkText = deftext;
|
||||
}
|
||||
}
|
||||
|
||||
private void frmSectionProperties_Load(object sender, EventArgs e)
|
||||
{
|
||||
_Initializing = true;
|
||||
@@ -156,7 +195,16 @@ namespace VEPROMS
|
||||
ppCmbxNumColumns.ValueMember = "EValue";
|
||||
ppCmbxNumColumns.SelectedIndex = -1;
|
||||
|
||||
if (!cbIsStepSection.Enabled) ppCmbxLibDocFill();
|
||||
//ppCmbxAccPgPrintSize.DataSource = EnumDetail<SectionConfig.AttPrintSize>.Details();
|
||||
//ppCmbxAccPgPrintSize.DisplayMember = "Description";
|
||||
//ppCmbxAccPgPrintSize.ValueMember = "Evalue";
|
||||
//ppCmbxAccPgPrintSize.SelectedIndex = -1;
|
||||
|
||||
if (!_isStepSection)
|
||||
ppCmbxLibDocFill();
|
||||
|
||||
ShowAvailableOptionsForSectionType();
|
||||
|
||||
_Initializing = false;
|
||||
}
|
||||
|
||||
@@ -229,17 +277,17 @@ namespace VEPROMS
|
||||
/// </summary>
|
||||
/// <param name="sender">object</param>
|
||||
/// <param name="e">EventArgs</param>
|
||||
private void ppCmbxFormat_SelectedValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if ((ppCmbxFormat.SelectedIndex != -1) && _DefaultFormatName != null && _DefaultFormatName.Equals(ppCmbxFormat.SelectedValue))
|
||||
{
|
||||
ppBtnDefaultFmt.Focus();
|
||||
ppBtnDefaultFmt.PerformClick();
|
||||
}
|
||||
ppBtnDefaultFmt.Visible = (ppCmbxFormat.SelectedValue != null);
|
||||
ppLblFormatDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultFmt.Visible;
|
||||
SetupPpCmbxSectionType();
|
||||
}
|
||||
//private void ppCmbxFormat_SelectedValueChanged(object sender, EventArgs e)
|
||||
//{
|
||||
// if ((ppCmbxFormat.SelectedIndex != -1) && _DefaultFormatName != null && _DefaultFormatName.Equals(ppCmbxFormat.SelectedValue))
|
||||
// {
|
||||
// ppBtnDefaultFmt.Focus();
|
||||
// ppBtnDefaultFmt.PerformClick();
|
||||
// }
|
||||
// ppBtnDefaultFmt.Visible = (ppCmbxFormat.SelectedValue != null);
|
||||
// ppLblFormatDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultFmt.Visible;
|
||||
// SetupPpCmbxSectionType();
|
||||
//}
|
||||
|
||||
private void SetupPpCmbxSectionType()
|
||||
{
|
||||
@@ -255,19 +303,57 @@ namespace VEPROMS
|
||||
// a word section, only list word section styles. If neither content types has been defined,
|
||||
// list both.
|
||||
DocStyleList locDocStyles = new DocStyleList(null);
|
||||
ItemInfo ii = ItemInfo.Get(_SectionConfig.MySection.ItemID);
|
||||
//ItemInfo ii = ItemInfo.Get(_SectionConfig.MySection.ItemID);
|
||||
int selindx = -1;
|
||||
for (int i = 0; i < pf.DocStyles.DocStyleList.Count; i++)
|
||||
{
|
||||
if (cbIsStepSection.Checked && pf.DocStyles.DocStyleList[i].IsStepSection) locDocStyles.Add(pf.DocStyles.DocStyleList[i]);
|
||||
else if (!cbIsStepSection.Checked && !pf.DocStyles.DocStyleList[i].IsStepSection) locDocStyles.Add(pf.DocStyles.DocStyleList[i]);
|
||||
if (_isStepSection && pf.DocStyles.DocStyleList[i].IsStepSection)
|
||||
locDocStyles.Add(pf.DocStyles.DocStyleList[i]); // add only step section types
|
||||
else if (!_isStepSection && !pf.DocStyles.DocStyleList[i].IsStepSection)
|
||||
locDocStyles.Add(pf.DocStyles.DocStyleList[i]); // add only accessory (MS Word) section types
|
||||
|
||||
if (_SectionConfig.SectionType == pf.DocStyles.DocStyleList[i].Index) selindx = locDocStyles.Count - 1;
|
||||
}
|
||||
ppCmbxStyleSectionType.DataSource = locDocStyles;
|
||||
ppCmbxStyleSectionType.SelectedIndex = selindx;
|
||||
|
||||
if (!cbIsStepSection.Checked) ppCmbxLibDocFill();
|
||||
if (!_isStepSection)
|
||||
ppCmbxLibDocFill();
|
||||
_Initializing = myInit;
|
||||
if (_isStepSection)
|
||||
SetupCheckoffsDropdowns();
|
||||
}
|
||||
|
||||
private void SetupCheckoffsDropdowns()
|
||||
{
|
||||
if (!_isStepSection) return; // not needed for accessory pages (word attachments)
|
||||
bool myInit = _Initializing;
|
||||
_Initializing = true;
|
||||
PlantFormat pf = _SectionConfig.MyDefaultFormat.PlantFormat;
|
||||
CheckOffList chkoffList = pf.FormatData.ProcData.CheckOffData.CheckOffList;
|
||||
CheckOffHeaderList chkoffHeaderList = pf.FormatData.ProcData.CheckOffData.CheckOffHeaderList;
|
||||
if (chkoffList != null && chkoffList.Count > 0)
|
||||
{
|
||||
ppGpbxSignoffCheckoff.Enabled = true;
|
||||
ppCmbxCheckoffType.DataSource = chkoffList;
|
||||
ppCmbxCheckoffType.SelectedIndex = _SectionConfig.Section_CheckoffListSelection;
|
||||
}
|
||||
else
|
||||
{
|
||||
ppGpbxSignoffCheckoff.Enabled = false;
|
||||
}
|
||||
if (chkoffHeaderList != null && chkoffHeaderList.Count > 0)
|
||||
{
|
||||
lblCheckoffHeading.Enabled = true;
|
||||
ppCmbxCheckoffHeading.Enabled = true;
|
||||
ppCmbxCheckoffHeading.DataSource = chkoffHeaderList;
|
||||
ppCmbxCheckoffHeading.SelectedIndex = _SectionConfig.Section_CheckoffHeaderSelection;
|
||||
}
|
||||
else
|
||||
{
|
||||
lblCheckoffHeading.Enabled = false;
|
||||
ppCmbxCheckoffHeading.Enabled = false;
|
||||
}
|
||||
_Initializing = myInit;
|
||||
}
|
||||
|
||||
@@ -295,11 +381,6 @@ namespace VEPROMS
|
||||
if (ppCmbxStyleSectionType.SelectedValue != null)
|
||||
_SectionConfig.SectionType = (int)(ppCmbxStyleSectionType.SelectedValue);
|
||||
}
|
||||
private void cbIsStepSection_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_Initializing) return;
|
||||
SetupPpCmbxSectionType();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -317,7 +398,7 @@ namespace VEPROMS
|
||||
private void ppBtnCvrtToLibDoc_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Double Check that this is not a step section, if so just return.
|
||||
if (cbIsStepSection.Checked) return;
|
||||
if (_isStepSection) return;
|
||||
// If current section is library document, user selected to convert to non-library document. If
|
||||
// this is the case, data from lib doc must be copied to new document and the section must point
|
||||
// to id.
|
||||
@@ -424,9 +505,9 @@ namespace VEPROMS
|
||||
/// </summary>
|
||||
/// <param name="sender">object</param>
|
||||
/// <param name="e">EventArgs</param>
|
||||
private void btnViewStngs_Click(object sender, EventArgs e)
|
||||
private void btnAutomation_Click(object sender, EventArgs e)
|
||||
{
|
||||
ProcessButtonClick(tiViewStnns, btnViewStngs);
|
||||
ProcessButtonClick(tiAutomation, btnAutomation);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -440,6 +521,10 @@ namespace VEPROMS
|
||||
{
|
||||
ppLblDefSettingsInfo.Visible = ppCbShwDefSettings.Checked;
|
||||
ppLblFormatDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultFmt.Visible;
|
||||
ppLblDefaultNumColumns.Visible = _isStepSection && ppCbShwDefSettings.Checked && ppBtnDefaultNumColumns.Visible;
|
||||
ppLblDefPaginationStyle.Visible = _isStepSection && ppCbShwDefSettings.Checked && ppBtnDefaultPaginationStyle.Visible;
|
||||
//ppLblDefaultPrintSize.Visible = !_isStepSection && ppCbShwDefSettings.Checked && ppBtnDefaultPrintSize.Visible;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -453,7 +538,7 @@ namespace VEPROMS
|
||||
btnGeneral.Checked = false;
|
||||
btnFormat.Checked = false;
|
||||
btnLibDocs.Checked = false;
|
||||
btnViewStngs.Checked = false;
|
||||
btnAutomation.Checked = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -481,6 +566,47 @@ namespace VEPROMS
|
||||
if (!_Initializing)
|
||||
defaultSettingsVisiblity();
|
||||
}
|
||||
/// <summary>
|
||||
/// Process a change in the combo box selection
|
||||
/// </summary>
|
||||
/// <param name="cmbx">Combo Box Name</param>
|
||||
/// <param name="defstr">string containing default text</param>
|
||||
/// <param name="button">button to reset to default value</param>
|
||||
/// <param name="deflabel">label containing the default</param>
|
||||
private void ProcessCmbxSelectedValueChange(ComboBoxEx cmbx, string defstr, ButtonX button, Label deflabel)
|
||||
{
|
||||
if ((cmbx.SelectedIndex != -1) && defstr != null && defstr.Equals(cmbx.SelectedValue))
|
||||
{
|
||||
button.Visible = true;
|
||||
button.Focus();
|
||||
button.PerformClick();
|
||||
}
|
||||
button.Visible = (cmbx.SelectedValue != null);
|
||||
deflabel.Visible = (ppCbShwDefSettings.Checked) && button.Visible;
|
||||
}
|
||||
/// <summary>
|
||||
/// Process a change in the enum combo box selection
|
||||
/// </summary>
|
||||
/// <param name="cmbx">Combo Box Name</param>
|
||||
/// <param name="defstr">the default enum value</param>
|
||||
/// <param name="button">button to reset to default value</param>
|
||||
/// <param name="deflabel">label containing the default</param>
|
||||
private void ProcessCmbxSelectionEnumChanged(ComboBoxEx cmbx, object enumval, ButtonX button, Label deflabel)
|
||||
{
|
||||
if ((cmbx.SelectedIndex != -1) &&
|
||||
cmbx.SelectedValue.Equals(enumval))
|
||||
{
|
||||
_Initializing = true;
|
||||
button.Visible = true;
|
||||
button.Focus();
|
||||
button.PerformClick();
|
||||
cmbx.SelectedIndex = -1; // This will hide the Default button
|
||||
_Initializing = false;
|
||||
}
|
||||
//button.Visible = ((!_FolderConfig.Name.Equals("VEPROMS")) && (cmbx.SelectedValue != null));
|
||||
button.Visible = ((cmbx.SelectedValue != null) && (cmbx.SelectedIndex >= 0));
|
||||
deflabel.Visible = ppCbShwDefSettings.Checked && button.Visible;
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void ppSectNumberStpRTB_Enter(object sender, EventArgs e)
|
||||
@@ -492,7 +618,77 @@ namespace VEPROMS
|
||||
{
|
||||
_MyStepTabRibbon.MyStepRTB = ppSectTitleStpRTB;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void ShowAvailableOptionsForSectionType()
|
||||
{
|
||||
lblColumns.Visible = _isStepSection;
|
||||
ppCmbxNumColumns.Visible = _isStepSection;
|
||||
lblPagination.Visible = _isStepSection;
|
||||
ppCmbxSectPagination.Visible = _isStepSection;
|
||||
//lblPrintSize.Visible = !_isStepSection;
|
||||
//ppCmbxAccPgPrintSize.Visible = !_isStepSection;
|
||||
ppGpbxSignoffCheckoff.Visible = _isStepSection;
|
||||
}
|
||||
|
||||
private void rbStepSect_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
_isStepSection = rbStepSect.Checked;
|
||||
rbWordSect.Checked = !rbStepSect.Checked;
|
||||
SetupPpCmbxSectionType();
|
||||
ShowAvailableOptionsForSectionType();
|
||||
}
|
||||
|
||||
private void ppCmbxSectPagination_SelectedValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
SectionConfig.SectionPagination secpgn = (SectionConfig.SectionPagination)Enum.Parse(typeof(SectionConfig.SectionPagination), _DefaultPaginationStyle);
|
||||
ProcessCmbxSelectionEnumChanged(ppCmbxSectPagination, secpgn, ppBtnDefaultPaginationStyle, ppLblDefPaginationStyle);
|
||||
tcpFormat.Focus();
|
||||
}
|
||||
|
||||
private void ppCmbxNumColumns_SelectedValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
SectionConfig.SectionColumnMode seccols = (SectionConfig.SectionColumnMode)Enum.Parse(typeof(SectionConfig.SectionColumnMode), _DefaultNumColumns);
|
||||
ProcessCmbxSelectionEnumChanged(ppCmbxNumColumns, seccols, ppBtnDefaultNumColumns, ppLblDefaultNumColumns);
|
||||
tcpFormat.Focus();
|
||||
}
|
||||
|
||||
//private void ppCmbxAccPgPrintSize_SelectedValueChanged(object sender, EventArgs e)
|
||||
//{
|
||||
// SectionConfig.AttPrintSize attsize = (SectionConfig.AttPrintSize)Enum.Parse(typeof(SectionConfig.AttPrintSize), _DefaultPrintSize);
|
||||
// ProcessCmbxSelectionEnumChanged(ppCmbxAccPgPrintSize, attsize, ppBtnDefaultPrintSize, ppLblDefaultPrintSize);
|
||||
//}
|
||||
|
||||
private void ppBtnDefaultPaginationStyle_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Get the parent setting
|
||||
SectionConfig.SectionPagination secpgn = (SectionConfig.SectionPagination)Enum.Parse(typeof(SectionConfig.SectionPagination), _DefaultPaginationStyle);
|
||||
// Compare parent setting with current setting
|
||||
if (secpgn != _SectionConfig.Section_Pagination)
|
||||
_SectionConfig.Section_Pagination = secpgn; // this will force a database update (write)
|
||||
ppCmbxSectPagination.SelectedIndex = -1;//reset to the default Section Pagination Style setting
|
||||
tcpFormat.Focus();
|
||||
}
|
||||
|
||||
private void ppBtnDefaultNumColumns_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Get the parent setting
|
||||
SectionConfig.SectionColumnMode seccols = (SectionConfig.SectionColumnMode)Enum.Parse(typeof(SectionConfig.SectionColumnMode), _DefaultNumColumns);
|
||||
// Compare parent setting with current setting
|
||||
if (seccols != _SectionConfig.Section_ColumnMode)
|
||||
_SectionConfig.Section_ColumnMode = seccols; // this will force a database update (write)
|
||||
ppCmbxNumColumns.SelectedIndex = -1;//reset to the default Number of Columns setting
|
||||
tcpFormat.Focus();
|
||||
}
|
||||
|
||||
//private void ppBtnDefaultPrintSize_Click(object sender, EventArgs e)
|
||||
//{
|
||||
// // Get the parent setting
|
||||
// SectionConfig.AttPrintSize attsize = (SectionConfig.AttPrintSize)Enum.Parse(typeof(SectionConfig.AttPrintSize), _DefaultPrintSize);
|
||||
// // Compare parent setting with current setting
|
||||
// if (attsize != _SectionConfig.Section_AttachmentPrintSize)
|
||||
// _SectionConfig.Section_AttachmentPrintSize = attsize; // this will force a database update (write)
|
||||
// ppCmbxAccPgPrintSize.SelectedIndex = -1;//reset to the default Accessory page Print Size setting
|
||||
// tcpFormat.Focus();
|
||||
//}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user