This commit is contained in:
397
PROMS/VEPROMS_UI/frmProcedureProperties.cs
Normal file
397
PROMS/VEPROMS_UI/frmProcedureProperties.cs
Normal file
@@ -0,0 +1,397 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using VEPROMS.CSLA.Library;
|
||||
using VEPROMS.Properties;
|
||||
using DescriptiveEnum;
|
||||
|
||||
namespace VEPROMS
|
||||
{
|
||||
public partial class frmProcedureProperties : DevComponents.DotNetBar.Office2007Form
|
||||
{
|
||||
private string _DefaultFormatName = null;
|
||||
private string _DefaultPagination = null;
|
||||
private string _DefaultWatermark = null;
|
||||
private string _DefaultChgBarType = null;
|
||||
private string _DefaultChgBarLoc = null;
|
||||
private string _DefaultChgBarText = null;
|
||||
private string _DefaultChgBarUsrMsg1 = null;
|
||||
private string _DefaultChgBarUsrMsg2 = null;
|
||||
private string _DefaultFormatColumns = null;
|
||||
private bool _Initializing;
|
||||
private ProcedureConfig _ProcedureConfig;
|
||||
|
||||
public frmProcedureProperties(ProcedureConfig procedureConfig)
|
||||
{
|
||||
_ProcedureConfig = procedureConfig;
|
||||
_Initializing = true;
|
||||
InitializeComponent();
|
||||
btnGeneral.PerformClick(); // always start with General tab or button
|
||||
_Initializing = false;
|
||||
// build the caption
|
||||
this.Text = string.Format("{0} {1} Properties", procedureConfig.Number, procedureConfig.Title);
|
||||
}
|
||||
|
||||
private void ppBtnOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
procedureConfigBindingSource.EndEdit();
|
||||
// Save Default settings for User
|
||||
//
|
||||
// Save whether we should display the default values on this property page
|
||||
Settings.Default.ShowDefaultProcedureProp = ppCbShwDefSettings.Checked;
|
||||
Settings.Default.Save();
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void ppBtnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
procedureConfigBindingSource.CancelEdit();
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void FindDefaultValues()
|
||||
{
|
||||
_ProcedureConfig.ParentLookup = true;
|
||||
// Get the default format name
|
||||
_DefaultFormatName = _ProcedureConfig.DefaultFormatSelection;
|
||||
if (_DefaultFormatName != null && !(_DefaultFormatName.Equals("")))
|
||||
{
|
||||
ppLblFormatDefault.Text = string.Format("({0})", _DefaultFormatName);
|
||||
ppCmbxFormat.WatermarkText = string.Format("{0}", _DefaultFormatName);
|
||||
}
|
||||
|
||||
// Get the default Change Bar Type
|
||||
_DefaultChgBarType = _ProcedureConfig.Print_ChangeBar.ToString();
|
||||
if (!(_DefaultChgBarType.Equals("")))
|
||||
{
|
||||
string tstr = EnumDescConverter.GetEnumDescription(_ProcedureConfig.Print_ChangeBar);
|
||||
ppLblChangeBarTypeDefault.Text = string.Format("({0})", tstr);
|
||||
ppCmbxChangeBarType.WatermarkText = string.Format("{0}", tstr);
|
||||
}
|
||||
|
||||
// Get the default Change Bar Location
|
||||
_DefaultChgBarLoc = _ProcedureConfig.Print_ChangeBarLoc.ToString();
|
||||
if (!(_DefaultChgBarLoc.Equals("")))
|
||||
{
|
||||
string tstr = EnumDescConverter.GetEnumDescription(_ProcedureConfig.Print_ChangeBarLoc);
|
||||
ppLblChgBarPosDefault.Text = string.Format("({0})", tstr);
|
||||
ppCmbxChgBarPos.WatermarkText = string.Format("{0}", tstr);
|
||||
}
|
||||
|
||||
// Get the default Change Bar text
|
||||
_DefaultChgBarText = _ProcedureConfig.Print_ChangeBarText.ToString();
|
||||
if (!(_DefaultChgBarText.Equals("")))
|
||||
{
|
||||
string tstr = EnumDescConverter.GetEnumDescription(_ProcedureConfig.Print_ChangeBarText);
|
||||
ppLblChgBarTxtTypeDefault.Text = string.Format("({0})", tstr);
|
||||
ppCmbxChgBarTxtType.WatermarkText = string.Format("{0}", tstr);
|
||||
}
|
||||
|
||||
// Get the default User Change Bar Message 1
|
||||
_DefaultChgBarUsrMsg1 = _ProcedureConfig.Print_UserCBMess1;
|
||||
if (!(_DefaultChgBarUsrMsg1.Equals("")))
|
||||
ppLblChgBarUserMsgOneDefault.Text = string.Format("({0})", _DefaultChgBarUsrMsg1);
|
||||
|
||||
// Get the default User Change Bar Message 2
|
||||
_DefaultChgBarUsrMsg2 = _ProcedureConfig.Print_UserCBMess2;
|
||||
if (!(_DefaultChgBarUsrMsg2.Equals("")))
|
||||
ppLblChgBarUserMsgTwoDefault.Text = string.Format("({0})", _DefaultChgBarUsrMsg2);
|
||||
|
||||
// Get the default RO Graphic file extension
|
||||
//_DefaultROGraficFileExtension = _FolderConfig.Graphics_defaultext;
|
||||
//if (!(_DefaultROGraficFileExtension.Equals("")))
|
||||
// folderPropGraphicFileExtDefault.Text = string.Format("({0})", _DefaultROGraficFileExtension);
|
||||
|
||||
// Get the default Referenced Objects prefix
|
||||
//_DefaultROPrefix = _FolderConfig.Default_SPPrefix;
|
||||
//if (!(_DefaultROPrefix.Equals("")))
|
||||
// folderPropROPrefixDefault.Text = string.Format("({0})", _DefaultROPrefix);
|
||||
|
||||
// Get the default RO Graphics prefix
|
||||
//_DefaultImagePrefix = _FolderConfig.Default_IMPrefix;
|
||||
//if (!(_DefaultImagePrefix.Equals("")))
|
||||
// folderProptImagePrefixDefault.Text = string.Format("({0})", _DefaultImagePrefix);
|
||||
|
||||
// Get the default Print Pagination
|
||||
_DefaultPagination = _ProcedureConfig.Print_Pagination.ToString();
|
||||
if (!(_DefaultPagination.Equals("")))
|
||||
{
|
||||
string tstr = EnumDescConverter.GetEnumDescription(_ProcedureConfig.Print_Pagination);
|
||||
ppLblPaginationDefault.Text = string.Format("({0})", tstr);
|
||||
ppCmbxPagination.WatermarkText = string.Format("{0}", tstr);
|
||||
}
|
||||
|
||||
// Get the default Watermark
|
||||
_DefaultWatermark = _ProcedureConfig.Print_Watermark.ToString();
|
||||
if (!(_DefaultWatermark.Equals("")))
|
||||
{
|
||||
string tstr = EnumDescConverter.GetEnumDescription(_ProcedureConfig.Print_Watermark);
|
||||
ppLblWatermarkDefault.Text = string.Format("({0})", tstr);
|
||||
ppCmbxWatermark.WatermarkText = string.Format("{0}", tstr);
|
||||
}
|
||||
|
||||
// Get the default Format Columns
|
||||
_DefaultFormatColumns = _ProcedureConfig.Format_Columns.ToString();
|
||||
if (!(_DefaultFormatColumns.Equals("")))
|
||||
{
|
||||
string tstr = EnumDescConverter.GetEnumDescription(_ProcedureConfig.Format_Columns);
|
||||
ppLblStpEditorColsDefault.Text = string.Format("({0})", tstr);
|
||||
ppCmbxStpEditorCols.WatermarkText = string.Format("{0}", tstr);
|
||||
}
|
||||
|
||||
_ProcedureConfig.ParentLookup = false;
|
||||
}
|
||||
|
||||
|
||||
private void frmProcedureProperties_Load(object sender, EventArgs e)
|
||||
{
|
||||
_Initializing = true;
|
||||
procedureConfigBindingSource.DataSource = _ProcedureConfig;
|
||||
|
||||
formatInfoListBindingSource.DataSource = FormatInfoList.Get();
|
||||
|
||||
// Get the saved settings for this user
|
||||
//
|
||||
// Get setting telling us whether to display the default values on this property page
|
||||
ppCbShwDefSettings.Checked = (Settings.Default["ShowDefaultProcedureProp"] != null) ? Settings.Default.ShowDefaultProcedureProp : false;
|
||||
|
||||
// Get the User's property page style "PropPageStyle"
|
||||
// 1 - Button Dialog (default)
|
||||
// 2 - Tab Dialog
|
||||
if ((int)Settings.Default["PropPageStyle"] == 2) // tabbed interface
|
||||
{
|
||||
tcProcProp.TabsVisible = true;
|
||||
panProcBtns.Visible = false;
|
||||
this.Width -= panProcBtns.Width;
|
||||
}
|
||||
|
||||
|
||||
// Get the default values for the property page information
|
||||
FindDefaultValues();
|
||||
|
||||
ppCmbxChgBarPos.DataSource = EnumDetail<ProcedureConfig.PrintChangeBarLoc>.Details();
|
||||
ppCmbxChgBarPos.DisplayMember = "Description";
|
||||
ppCmbxChgBarPos.ValueMember = "EValue";
|
||||
|
||||
ppCmbxChgBarTxtType.DataSource = EnumDetail<ProcedureConfig.PrintChangeBarText>.Details();
|
||||
ppCmbxChgBarTxtType.DisplayMember = "Description";
|
||||
ppCmbxChgBarTxtType.ValueMember = "EValue";
|
||||
|
||||
ppCmbxChangeBarType.DataSource = EnumDetail<ProcedureConfig.PrintChangeBar>.Details();
|
||||
ppCmbxChangeBarType.DisplayMember = "Description";
|
||||
ppCmbxChangeBarType.ValueMember = "EValue";
|
||||
|
||||
ppCmbxPagination.DataSource = EnumDetail<ProcedureConfig.PrintPagination>.Details();
|
||||
ppCmbxPagination.DisplayMember = "Description";
|
||||
ppCmbxPagination.ValueMember = "EValue";
|
||||
|
||||
ppCmbxWatermark.DataSource = EnumDetail<ProcedureConfig.PrintWatermark>.Details();
|
||||
ppCmbxWatermark.DisplayMember = "Description";
|
||||
ppCmbxWatermark.ValueMember = "EValue";
|
||||
|
||||
ppCmbxStpEditorCols.DataSource = EnumDetail<ProcedureConfig.FormatColumns>.Details();
|
||||
ppCmbxStpEditorCols.DisplayMember = "Description";
|
||||
ppCmbxStpEditorCols.ValueMember = "EValue";
|
||||
|
||||
_Initializing = false;
|
||||
}
|
||||
|
||||
private void defaultSettingsVisiblity()
|
||||
{
|
||||
ppLblDefSettingsInfo.Visible = ppCbShwDefSettings.Checked;
|
||||
|
||||
ppLblWatermarkDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefWatermark.Visible;
|
||||
ppLblPaginationDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefPagination.Visible;
|
||||
ppLblStpEditorColsDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefEdCols.Visible;
|
||||
ppLblFormatDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultFmt.Visible;
|
||||
ppLblChangeBarTypeDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultChgBar.Visible;
|
||||
ppLblChgBarPosDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultCbPos.Visible;
|
||||
ppLblChgBarTxtTypeDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefCbTxtTyp.Visible;
|
||||
ppLblChgBarUserMsgOneDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefCbTxt1.Visible;
|
||||
ppLblChgBarUserMsgTwoDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefCbTxt2.Visible;
|
||||
}
|
||||
|
||||
private void ckbxShowDefSettings_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
defaultSettingsVisiblity();
|
||||
}
|
||||
|
||||
private void ppBtnDefaultFmt_Click(object sender, EventArgs e)
|
||||
{
|
||||
ppCmbxFormat.SelectedIndex = -1;
|
||||
}
|
||||
|
||||
private void ppCmbxFormat_SelectedValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if ((ppCmbxFormat.SelectedIndex != -1) && _DefaultFormatName.Equals(ppCmbxFormat.SelectedValue))
|
||||
{
|
||||
ppBtnDefaultFmt.Focus();
|
||||
ppBtnDefaultFmt.PerformClick();
|
||||
}
|
||||
ppBtnDefaultFmt.Visible = (ppCmbxFormat.SelectedValue != null);
|
||||
ppLblFormatDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultFmt.Visible;
|
||||
}
|
||||
|
||||
private void setEnabledUserSpecifiedChgBarCombos()
|
||||
{
|
||||
ppGpbxUserSpecCB.Enabled =
|
||||
ppCmbxChgBarPos.Enabled =
|
||||
ppCmbxChgBarTxtType.Enabled =
|
||||
ppBtnDefaultCbPos.Enabled =
|
||||
ppBtnDefCbTxtTyp.Enabled = (ppCmbxChangeBarType.SelectedValue != null &&
|
||||
ppCmbxChangeBarType.SelectedValue.Equals(ProcedureConfig.PrintChangeBar.WithUserSpecified));
|
||||
}
|
||||
|
||||
private void ppCmbxChangeBarType_SelectedValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if ((ppCmbxChgBarPos.SelectedIndex != -1) && _DefaultChgBarType.Equals(ppCmbxChangeBarType.SelectedValue))
|
||||
{
|
||||
ppBtnDefaultChgBar.Focus();
|
||||
ppBtnDefaultChgBar.PerformClick();
|
||||
}
|
||||
ppBtnDefaultChgBar.Visible = (ppCmbxChangeBarType.SelectedValue != null);
|
||||
ppLblChangeBarTypeDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultChgBar.Visible;
|
||||
setEnabledUserSpecifiedChgBarCombos();
|
||||
}
|
||||
|
||||
private void ppBtnDefaultChgBar_Click(object sender, EventArgs e)
|
||||
{
|
||||
ppCmbxChangeBarType.SelectedIndex = -1;
|
||||
}
|
||||
|
||||
private void ppCmbxChgBarPos_SelectedValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if ((ppCmbxChgBarPos.SelectedIndex != -1) && _DefaultChgBarLoc.Equals(ppCmbxChgBarPos.SelectedValue))
|
||||
{
|
||||
ppBtnDefaultCbPos.Focus();
|
||||
ppBtnDefaultCbPos.PerformClick();
|
||||
}
|
||||
ppBtnDefaultCbPos.Visible = (ppCmbxChgBarPos.SelectedValue != null);
|
||||
ppLblChgBarPosDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultCbPos.Visible;
|
||||
}
|
||||
|
||||
private void ppBtnDefaultCbPos_Click(object sender, EventArgs e)
|
||||
{
|
||||
ppCmbxChgBarPos.SelectedIndex = -1;
|
||||
}
|
||||
|
||||
private void ppBtnDefCbTxtTyp_Click(object sender, EventArgs e)
|
||||
{
|
||||
ppCmbxChgBarTxtType.SelectedIndex = -1;
|
||||
}
|
||||
|
||||
private void setEnabledUserSpecifiedChgBarText()
|
||||
{
|
||||
ppGpbxUserSpecTxt.Enabled =
|
||||
ppTxbxChangeBarUserMsgOne.Enabled =
|
||||
ppTxbxChgBarUserMsgTwo.Enabled =
|
||||
ppBtnDefCbTxt1.Enabled =
|
||||
ppBtnDefCbTxt2.Enabled = (ppCmbxChgBarTxtType.SelectedValue != null &&
|
||||
ppCmbxChgBarTxtType.SelectedValue.Equals(ProcedureConfig.PrintChangeBarText.UserDef));
|
||||
}
|
||||
|
||||
private void ppCmbxChgBarTxtType_SelectedValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if ((ppCmbxChgBarTxtType.SelectedIndex != -1) && _DefaultChgBarText.Equals(ppCmbxChgBarTxtType.SelectedValue))
|
||||
{
|
||||
ppBtnDefCbTxtTyp.Focus();
|
||||
ppBtnDefCbTxtTyp.PerformClick();
|
||||
}
|
||||
ppBtnDefCbTxtTyp.Visible = (ppCmbxChgBarTxtType.SelectedValue != null);
|
||||
ppLblChgBarTxtTypeDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefCbTxtTyp.Visible;
|
||||
setEnabledUserSpecifiedChgBarText();
|
||||
}
|
||||
|
||||
private void ppCmbxPagination_SelectedValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if ((ppCmbxPagination.SelectedIndex != -1) && _DefaultPagination.Equals(ppCmbxPagination.SelectedValue))
|
||||
{
|
||||
ppBtnDefPagination.Focus();
|
||||
ppBtnDefPagination.PerformClick();
|
||||
}
|
||||
ppBtnDefPagination.Visible = ppCmbxPagination.SelectedValue != null;
|
||||
ppLblPaginationDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefPagination.Visible;
|
||||
}
|
||||
|
||||
private void ppBtnDefPagination_Click(object sender, EventArgs e)
|
||||
{
|
||||
ppCmbxPagination.SelectedIndex = -1;
|
||||
}
|
||||
|
||||
private void ppCmbxWatermark_SelectedValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if ((ppCmbxWatermark.SelectedIndex != -1) && _DefaultWatermark.Equals(ppCmbxWatermark.SelectedValue))
|
||||
{
|
||||
ppBtnDefWatermark.Focus();
|
||||
ppBtnDefWatermark.PerformClick();
|
||||
}
|
||||
ppBtnDefWatermark.Visible = ppCmbxWatermark.SelectedValue != null;
|
||||
ppLblWatermarkDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefWatermark.Visible;
|
||||
}
|
||||
|
||||
private void ppBtnDefWatermark_Click(object sender, EventArgs e)
|
||||
{
|
||||
ppCmbxWatermark.SelectedIndex = -1;
|
||||
}
|
||||
|
||||
private void ppCmbxStpEditorCols_SelectedValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
ProcedureConfig.FormatColumns fc = (ProcedureConfig.FormatColumns)Enum.Parse(typeof(ProcedureConfig.FormatColumns), _DefaultFormatColumns);
|
||||
if ((ppCmbxStpEditorCols.SelectedIndex != -1) && ppCmbxStpEditorCols.SelectedValue.Equals(fc))
|
||||
{
|
||||
ppBtnDefEdCols.Focus();
|
||||
ppBtnDefEdCols.PerformClick();
|
||||
}
|
||||
ppBtnDefEdCols.Visible = ppCmbxStpEditorCols.SelectedValue != null;
|
||||
ppLblStpEditorColsDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefEdCols.Visible;
|
||||
}
|
||||
|
||||
private void tabGeneral_Layout(object sender, LayoutEventArgs e)
|
||||
{
|
||||
// Note this is called for all the tabs
|
||||
if (!_Initializing)
|
||||
defaultSettingsVisiblity();
|
||||
}
|
||||
|
||||
private void btnGeneral_Click(object sender, EventArgs e)
|
||||
{
|
||||
ClearAllCheckedButtons();
|
||||
tcProcProp.SelectedTab = tiGeneral;
|
||||
btnGeneral.Checked = true;
|
||||
}
|
||||
|
||||
private void btnFmtStngs_Click(object sender, EventArgs e)
|
||||
{
|
||||
ClearAllCheckedButtons();
|
||||
tcProcProp.SelectedTab = tiFmtStngs;
|
||||
btnFmtStngs.Checked = true;
|
||||
}
|
||||
|
||||
private void btnOutputStngs_Click(object sender, EventArgs e)
|
||||
{
|
||||
ClearAllCheckedButtons();
|
||||
tcProcProp.SelectedTab = tiOutputStngs;
|
||||
btnOutputStngs.Checked = true;
|
||||
}
|
||||
|
||||
private void btnVwStngs_Click(object sender, EventArgs e)
|
||||
{
|
||||
ClearAllCheckedButtons();
|
||||
tcProcProp.SelectedTab = tiViewStngs;
|
||||
btnVwStngs.Checked = true;
|
||||
}
|
||||
|
||||
private void ClearAllCheckedButtons()
|
||||
{
|
||||
btnGeneral.Checked = false;
|
||||
btnFmtStngs.Checked = false;
|
||||
btnOutputStngs.Checked = false;
|
||||
btnVwStngs.Checked = false;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user