823 lines
		
	
	
		
			33 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			823 lines
		
	
	
		
			33 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| 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;
 | |
| using DevComponents.DotNetBar;
 | |
| using DevComponents.DotNetBar.Controls;
 | |
| using Volian.Controls.Library;
 | |
| 
 | |
| namespace VEPROMS
 | |
| {
 | |
| 	public partial class frmProcedureProperties : DevComponents.DotNetBar.Office2007Form
 | |
| 	{
 | |
| 		private bool _Initializing = false;
 | |
| 		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 _DefaultDisableDuplex = false;
 | |
| 		private ProcedureConfig _ProcedureConfig;
 | |
| 		private StepTabRibbon _MyStepTabRibbon;
 | |
| 
 | |
| 		public frmProcedureProperties(ProcedureConfig procedureConfig)
 | |
| 		{
 | |
| 			_ProcedureConfig = procedureConfig;
 | |
| 			_Initializing = true;
 | |
| 			InitializeComponent();
 | |
| 			btnGeneral.PerformClick();  // always start with General tab or button
 | |
| 			_Initializing = false;
 | |
| 			// build the title bar caption
 | |
| 			//this.Text = string.Format("{0}  {1} Properties", procedureConfig.Number, procedureConfig.Title);
 | |
| 			ItemInfo itmInfo = ItemInfo.Get(_ProcedureConfig.MyProcedure.ItemID);
 | |
| 			this.Text = string.Format("{0}  {1} Properties", itmInfo.DisplayNumber, itmInfo.DisplayText);
 | |
| 			ppProcTitleStpRTB.Font = ppProcTitleStpRTB.FormatFont = new System.Drawing.Font("Microsoft Sans Serif", 10F);
 | |
| 			ppProcTitleStpRTB.FieldToEdit = E_FieldToEdit.Text;
 | |
| 			ppProcTitleStpRTB.BorderStyle = BorderStyle.Fixed3D;
 | |
| 			ppProcTitleStpRTB.MyItemInfo = itmInfo;
 | |
| 			ppProcTitleStpRTB.RefreshDisplay(true);
 | |
| 			ppProcNumStpRTB.Font = ppProcNumStpRTB.FormatFont = new System.Drawing.Font("Microsoft Sans Serif", 10F);
 | |
| 			ppProcNumStpRTB.FieldToEdit = E_FieldToEdit.Number;
 | |
| 			ppProcNumStpRTB.BorderStyle = BorderStyle.Fixed3D;
 | |
| 			ppProcNumStpRTB.MyItemInfo = itmInfo;
 | |
| 			ppProcNumStpRTB.RefreshDisplay(true);
 | |
| 
 | |
| 			_MyStepTabRibbon = new StepTabRibbon();
 | |
| 			//_MyStepTabRibbon.Dock = System.Windows.Forms.DockStyle.Top;
 | |
| 			//_MyStepTabRibbon.Location = new System.Drawing.Point(0, 0);
 | |
| 			_MyStepTabRibbon.Name = "displayTabRibbon1";
 | |
| 			_MyStepTabRibbon.Visible = false;
 | |
| 			//defaultSettingsVisiblity();
 | |
| 		}
 | |
| 
 | |
| 		private void ppBtnOK_Click(object sender, EventArgs e)
 | |
| 		{
 | |
| 			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();
 | |
| 			_ProcedureConfig.Print_NotInMergeAll = cbNotIncludeInMerged.Checked;
 | |
| 			_ProcedureConfig.MyProcedure.Save().Dispose();
 | |
| 			SaveText(ppProcTitleStpRTB);
 | |
| 			SaveText(ppProcNumStpRTB);
 | |
| 			_ProcedureConfig.MyProcedure.MyProcedureInfo.CreateEnhanced = cbEnhanced.Checked;
 | |
| 
 | |
|             // if there is a change to the format, clean up any overridden formats that point to the selected item before saving the format change:
 | |
|             // To determine a change to the format, first see if selection changed in list and then see if the format selected does not match
 | |
|             // what was set on procedure, if necessary resolve for an inherited format.
 | |
| 
 | |
|             if (_ProcedureConfig.MyProcedure.MyProcedureInfo.ActiveFormat != null && 
 | |
|                 _ProcedureConfig.MyProcedure.MyProcedureInfo.ActiveFormat.FormatID != _cmbxformatOriginal)
 | |
|             {
 | |
|                 // clean up & then refresh the configs
 | |
|                 using (ContentInfoList cil = ContentInfoList.ClearOverrideFormatsByItem(_ProcedureConfig.MyProcedure.ItemID, _cmbxformatOriginal, _ProcedureConfig.MyProcedure.MyProcedureInfo.ActiveFormat.FormatID))
 | |
|                 {
 | |
|                     foreach (ContentInfo ci in cil)
 | |
|                     {
 | |
|                         using (Content c = ci.Get())
 | |
|                         {
 | |
|                             // first refresh configs because the ContentInfo.Refresh causes events to occur that refresh screen
 | |
|                             // and if configs aren't done first, the screen refresh, if based on config data, will not be correct.
 | |
|                             foreach (ItemInfo ii in ci.ContentItems) ii.RefreshConfig();
 | |
|                             ContentInfo.Refresh(c);
 | |
|                         }
 | |
|                     }
 | |
|                 }
 | |
|             }
 | |
| 			DialogResult = DialogResult.OK;
 | |
| 			this.Close();
 | |
| 		}
 | |
| 		public void SaveText(StepRTB myStepRTB)
 | |
| 		{
 | |
| 			if (myStepRTB.ReadOnly) return;
 | |
| 			if (!myStepRTB.ActiveMode) return;
 | |
| 			if (!myStepRTB.IsDirty && myStepRTB.Text.Contains("(Resolved Transition Text)") == false) return;
 | |
| 			bool success = myStepRTB.OrigDisplayText.Save((RichTextBox)myStepRTB);
 | |
| 			if (success)
 | |
| 			{
 | |
| 				myStepRTB.FindAllLinks();
 | |
| 				myStepRTB.OrigRTF = myStepRTB.Rtf;
 | |
| 				myStepRTB.ClearUndo();
 | |
| 			}
 | |
| 		}
 | |
| 		private void ppBtnCancel_Click(object sender, EventArgs e)
 | |
| 		{
 | |
| 			procedureConfigBindingSource.CancelEdit();
 | |
| 			_ProcedureConfig.MyProcedure.MyProcedureInfo.CreateEnhanced = false;
 | |
| 			this.DialogResult = DialogResult.Cancel;
 | |
| 			this.Close();
 | |
| 		}
 | |
| 
 | |
| 		/// <summary>
 | |
| 		/// Use the ParentLookup to grab the default values
 | |
| 		///  - set the watermark property (where applicable) of the control with that value
 | |
| 		///  - set the default setting labels with that value
 | |
| 		/// ** the default setting labels appear when the Show Default Values checkbox is checked by the user.
 | |
| 		/// </summary>
 | |
| 		private void FindDefaultValues()
 | |
| 		{
 | |
| 			_ProcedureConfig.ParentLookup = true;
 | |
| 			// Get the default format name
 | |
| 			_DefaultFormatName = _ProcedureConfig.DefaultFormatSelection;
 | |
| 			SetupDefault(_DefaultFormatName, ppLblFormatDefault, ppCmbxFormat);
 | |
| 			// Get the default Change Bar Type
 | |
| 			_DefaultChgBarType = _ProcedureConfig.Print_ChangeBar.ToString();
 | |
| 			SetupDefault(EnumDescConverter.GetEnumDescription(_ProcedureConfig.Print_ChangeBar), ppLblChangeBarTypeDefault, ppCmbxChangeBarType);
 | |
| 
 | |
| 			// Get the default Change Bar Location
 | |
| 			_DefaultChgBarLoc = _ProcedureConfig.Print_ChangeBarLoc.ToString();
 | |
| 			SetupDefault(EnumDescConverter.GetEnumDescription(_ProcedureConfig.Print_ChangeBarLoc), ppLblChgBarPosDefault, ppCmbxChgBarPos);
 | |
| 
 | |
| 			// Get the default Change Bar text
 | |
| 			_DefaultChgBarText = _ProcedureConfig.Print_ChangeBarText.ToString();
 | |
| 			SetupDefault(EnumDescConverter.GetEnumDescription(_ProcedureConfig.Print_ChangeBarText), ppLblChgBarTxtTypeDefault, ppCmbxChgBarTxtType);
 | |
| 
 | |
| 			// 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 Print Pagination
 | |
| 			//_DefaultPagination = _ProcedureConfig.Print_Pagination.ToString();
 | |
| 			//SetupDefault(EnumDescConverter.GetEnumDescription(_ProcedureConfig.Print_Pagination), ppLblPaginationDefault, ppCmbxPagination);
 | |
| 
 | |
| 			// Get the default Watermark
 | |
| 			_DefaultWatermark = _ProcedureConfig.Print_Watermark.ToString();
 | |
| 			SetupDefault(EnumDescConverter.GetEnumDescription(_ProcedureConfig.Print_Watermark), ppLblWatermarkDefault, ppCmbxWatermark);
 | |
| 
 | |
| 			// Get the default Format Columns
 | |
| 			_DefaultFormatColumns = _ProcedureConfig.Format_Columns.ToString();
 | |
| 			SetupDefault(EnumDescConverter.GetEnumDescription(_ProcedureConfig.Format_Columns), ppLblStpEditorColsDefault, ppCmbxStpEditorCols);
 | |
| 
 | |
| 			// Get the default Disable Duplex
 | |
| 			_DefaultDisableDuplex = _ProcedureConfig.Print_DisableDuplex;
 | |
| 			ppLblAutoDuplexDefault.Text = string.Format("(Duplex {0})", (_DefaultDisableDuplex) ? "OFF" : "ON");
 | |
| 
 | |
| 
 | |
| 			_ProcedureConfig.ParentLookup = false;
 | |
| 		}
 | |
|         private int? _cmbxformatOriginal = null;
 | |
| 		private void frmProcedureProperties_Load(object sender, EventArgs e)
 | |
| 		{
 | |
| 			_Initializing = true;
 | |
| 			procedureConfigBindingSource.DataSource = _ProcedureConfig;
 | |
| 
 | |
| 			//formatInfoListBindingSource.DataSource = FormatInfoList.Get();
 | |
| 
 | |
| 			ppCmbxFormat.DataSource = null;
 | |
| 			ppCmbxFormat.DisplayMember = "FullName";
 | |
| 			ppCmbxFormat.ValueMember = "FullName";
 | |
| 			ppCmbxFormat.DataSource = FormatInfoList.SortedFormatInfoList;
 | |
|             if (_ProcedureConfig.MyProcedure.MyProcedureInfo.ActiveFormat != null) _cmbxformatOriginal = _ProcedureConfig.MyProcedure.MyProcedureInfo.ActiveFormat.FormatID;
 | |
|             if (_ProcedureConfig.FormatSelection != null)
 | |
|                 ppCmbxFormat.SelectedValue = _ProcedureConfig.FormatSelection;
 | |
|             else
 | |
|                 ppCmbxFormat.SelectedIndex = -1;
 | |
| 
 | |
| 			// Get the saved settings for this user
 | |
| 			//
 | |
| 			// This setting tells us if we should 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" (this is a system wide user setting)
 | |
| 			// 1 - Button Dialog (default)
 | |
| 			// 2 - Tab Dialog
 | |
| 			if ((int)Settings.Default["PropPageStyle"] == (int)PropPgStyle.Tab)
 | |
| 			{
 | |
| 				tcProcProp.TabsVisible = true;
 | |
| 				panProcBtns.Visible = false;
 | |
| 				this.Width -= panProcBtns.Width;
 | |
| 			}
 | |
| 
 | |
| 			// Get the default values for the property page information
 | |
| 			FindDefaultValues();
 | |
| 
 | |
| 			// if we are creating a new procedure, initially set the format to the default format
 | |
| 			if (_ProcedureConfig.CreatingNew)// .FormatSelection == null)
 | |
| 				ppCmbxFormat.SelectedValue = _ProcedureConfig.DefaultFormatSelection;
 | |
| 
 | |
| 			// Assign the data sources to the combo boxes
 | |
| 			ppCmbxChgBarPos.DataSource = EnumDetail<PrintChangeBarLoc>.Details();
 | |
| 			ppCmbxChgBarPos.DisplayMember = "Description";
 | |
| 			ppCmbxChgBarPos.ValueMember = "EValue";
 | |
| 			ppCmbxChgBarPos.SelectedIndex = -1;
 | |
| 
 | |
| 			ppCmbxChgBarTxtType.DataSource = EnumDetail<PrintChangeBarText>.Details();
 | |
| 			ppCmbxChgBarTxtType.DisplayMember = "Description";
 | |
| 			ppCmbxChgBarTxtType.ValueMember = "EValue";
 | |
| 			ppCmbxChgBarTxtType.SelectedIndex = -1;
 | |
| 
 | |
| 			ppCmbxChangeBarType.DataSource = EnumDetail<PrintChangeBar>.Details();
 | |
| 			ppCmbxChangeBarType.DisplayMember = "Description";
 | |
| 			ppCmbxChangeBarType.ValueMember = "EValue";
 | |
| 			ppCmbxChangeBarType.SelectedIndex = -1;
 | |
| 
 | |
| 			//ppCmbxPagination.DataSource = EnumDetail<PrintPagination>.Details();
 | |
| 			//ppCmbxPagination.DisplayMember = "Description";
 | |
| 			//ppCmbxPagination.ValueMember = "EValue";
 | |
| 			//ppCmbxPagination.SelectedIndex = -1;
 | |
| 
 | |
| 			ppCmbxWatermark.DataSource = EnumDetail<PrintWatermark>.Details();
 | |
| 			ppCmbxWatermark.DisplayMember = "Description";
 | |
| 			ppCmbxWatermark.ValueMember = "EValue";
 | |
| 			ppCmbxWatermark.SelectedIndex = -1;
 | |
| 
 | |
| 			ppCmbxStpEditorCols.DataSource = EnumDetail<FormatColumns>.Details();
 | |
| 			ppCmbxStpEditorCols.DisplayMember = "Description";
 | |
| 			ppCmbxStpEditorCols.ValueMember = "EValue";
 | |
| 			ppCmbxStpEditorCols.SelectedIndex = -1;
 | |
| 
 | |
| 			// the only time the create enhanced checkbox is visisble is if this is a 'New' procedure in a set that is the 'Source'.
 | |
| 			cbEnhanced.Visible = false;
 | |
| 			DocVersionConfig dvc = _ProcedureConfig.MyProcedure.MyProcedureInfo.MyDocVersion.MyConfig as DocVersionConfig;
 | |
| 			if (_ProcedureConfig.CreatingNew && dvc != null && dvc.MyEnhancedDocuments != null && dvc.MyEnhancedDocuments.Count > 0 && dvc.MyEnhancedDocuments[0].Type != 0)
 | |
| 				cbEnhanced.Visible = true;
 | |
| 			cbNotIncludeInMerged.Checked = _ProcedureConfig.Print_NotInMergeAll;
 | |
| 			_Initializing = false;
 | |
| 
 | |
| 		}
 | |
| 
 | |
| 		#region General tab
 | |
| 
 | |
| 		/// <summary>
 | |
| 		/// This is the General button used on the button interface design
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender">object</param>
 | |
| 		/// <param name="e">EventArgs</param>
 | |
| 		private void btnGeneral_Click(object sender, EventArgs e)
 | |
| 		{
 | |
| 			ProcessButtonClick(tiGeneral, btnGeneral);
 | |
| 		}
 | |
| 
 | |
| 		/// <summary>
 | |
| 		/// Selection in Default Column Mode combo box changed.
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender">object</param>
 | |
| 		/// <param name="e">EventArgs</param>
 | |
| 		private void ppCmbxStpEditorCols_SelectedValueChanged(object sender, EventArgs e)
 | |
| 		{
 | |
| 			if (!_Initializing)
 | |
| 			{
 | |
| 				FormatColumns fc = (FormatColumns)Enum.Parse(typeof(FormatColumns), _DefaultFormatColumns);
 | |
| 				ProcessCmbxSelectionEnumChanged(ppCmbxStpEditorCols, fc, ppBtnDefEdCols, ppLblStpEditorColsDefault);
 | |
| 				//if ((ppCmbxStpEditorCols.SelectedIndex != -1) && ppCmbxStpEditorCols.SelectedValue.Equals(fc))
 | |
| 				//{
 | |
| 				//    ppBtnDefEdCols.Focus();
 | |
| 				//    ppBtnDefEdCols.PerformClick();
 | |
| 				//}
 | |
| 				//ppBtnDefEdCols.Visible = ppCmbxStpEditorCols.SelectedValue != null;
 | |
| 				//ppLblStpEditorColsDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefEdCols.Visible;
 | |
| 				//tcpGeneral.Focus();
 | |
| 			}
 | |
| 		}
 | |
| 		#endregion
 | |
| 
 | |
| 		#region Format Settings tab
 | |
| 
 | |
| 		/// <summary>
 | |
| 		/// This is the Format Settings button used on the button interface design
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender">object</param>
 | |
| 		/// <param name="e">EventArgs</param>
 | |
| 		private void btnFmtStngs_Click(object sender, EventArgs e)
 | |
| 		{
 | |
| 			ProcessButtonClick(tiFmtStngs, btnFmtStngs);
 | |
| 			// added for code change C2017-004 - select default format in dropdown list
 | |
| 			if (_InitialIndex < -1) _InitialIndex = ppCmbxFormat.SelectedIndex; // save the current format selection (happens here when current section is set to the default format)
 | |
| 		}
 | |
| 
 | |
| 		private void ppBtnDefaultFmt_Click(object sender, EventArgs e)
 | |
| 		{
 | |
| 			ppCmbxFormat.SelectedIndex = -1; //reset to the default Format setting
 | |
| 			//tcpFormatSettings.Focus();
 | |
| 		}
 | |
| 
 | |
| 		// Commented out as part of code change C2017-004. this also makes it consistent with section properties
 | |
| 		/// <summary>
 | |
| 		/// Selection in Format combo box changed.
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender">object</param>
 | |
| 		/// <param name="e">EventArgs</param>
 | |
| 		//private void ppCmbxFormat_SelectedValueChanged(object sender, EventArgs e)
 | |
| 		//{
 | |
| 		//	ProcessCmbxSelectedValueChange(ppCmbxFormat, _DefaultFormatName, ppBtnDefaultFmt, ppLblFormatDefault);
 | |
| 		//}
 | |
| 
 | |
| 		/// <summary>
 | |
| 		/// Enable or disable the user specified change bar options base on the type
 | |
| 		/// of change bar selected.
 | |
| 		/// </summary>
 | |
| 		private void setEnabledUserSpecifiedChgBarCombos(PrintChangeBar pcb)
 | |
| 		{
 | |
| 			//ppGpbxUserSpecCB.Enabled =
 | |
| 			//ppCmbxChgBarPos.Enabled =
 | |
| 			//ppCmbxChgBarTxtType.Enabled =
 | |
| 			//ppBtnDefaultCbPos.Enabled =
 | |
| 			//ppBtnDefCbTxtTyp.Enabled = (ppCmbxChangeBarType.SelectedValue != null &&
 | |
| 			//  ppCmbxChangeBarType.SelectedValue.Equals(ProcedureConfig.PrintChangeBar.WithUserSpecified)) ||
 | |
| 			//  (ppCmbxChangeBarType.SelectedValue == null && pcb.Equals(DocVersionConfig.PrintChangeBar.WithUserSpecified));
 | |
| 
 | |
| 			ppGpbxUserSpecCB.Enabled = (ppCmbxChangeBarType.SelectedValue != null &&
 | |
| 				ppCmbxChangeBarType.SelectedValue.Equals(PrintChangeBar.WithUserSpecified)) ||
 | |
| 				(ppCmbxChangeBarType.SelectedValue == null && pcb.Equals(PrintChangeBar.WithUserSpecified));
 | |
| 		}
 | |
| 
 | |
| 		/// <summary>
 | |
| 		/// Selection in Change Bar combo box changed.
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender">object</param>
 | |
| 		/// <param name="e">EventArgs</param>
 | |
| 		private void ppCmbxChangeBarType_SelectedValueChanged(object sender, EventArgs e)
 | |
| 		{
 | |
| 			//Console.WriteLine("### SelectedValueChanged");
 | |
| 			if (!_Initializing)
 | |
| 			{
 | |
| 				PrintChangeBar pcb = (PrintChangeBar)Enum.Parse(typeof(PrintChangeBar), _DefaultChgBarType);
 | |
| 				ProcessCmbxSelectionEnumChanged(ppCmbxChangeBarType, pcb, ppBtnDefaultChgBar, ppLblChangeBarTypeDefault);
 | |
| 				setEnabledUserSpecifiedChgBarCombos(pcb);
 | |
| 				//tcpFormatSettings.Focus();
 | |
| 			}
 | |
| 		}
 | |
| 
 | |
| 		/// <summary>
 | |
| 		/// Reset to the parent setting.
 | |
| 		/// Find the parent setting and assign it to _ProcedureConfig.PrintChangeBar.  
 | |
| 		/// This will force the database to be updated.
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender"></param>
 | |
| 		/// <param name="e"></param>
 | |
| 		private void ppBtnDefaultChgBar_Click(object sender, EventArgs e)
 | |
| 		{
 | |
| 			// Get the parent setting
 | |
| 			PrintChangeBar pcb = (PrintChangeBar)Enum.Parse(typeof(PrintChangeBar), _DefaultChgBarType);
 | |
| 			// Compare parent setting with current setting
 | |
| 			//_Initializing = true;
 | |
| 			if (pcb != _ProcedureConfig.Print_ChangeBar)
 | |
| 				_ProcedureConfig.Print_ChangeBar = pcb; // this will force a database update (write)
 | |
| 			ppCmbxChangeBarType.SelectedIndex = -1;  //reset to the default Change Bar setting
 | |
| 			//_Initializing = false;
 | |
| 			//tcpFormatSettings.Focus();
 | |
| 		}
 | |
| 
 | |
| 		/// <summary>
 | |
| 		/// Selection in Change Bar Position combo box changed.
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender">object</param>
 | |
| 		/// <param name="e">EventArgs</param>
 | |
| 		private void ppCmbxChgBarPos_SelectedValueChanged(object sender, EventArgs e)
 | |
| 		{
 | |
| 			if (!_Initializing)
 | |
| 			{
 | |
| 				PrintChangeBarLoc cbl = (PrintChangeBarLoc)Enum.Parse(typeof(PrintChangeBarLoc), _DefaultChgBarLoc);
 | |
| 				ProcessCmbxSelectionEnumChanged(ppCmbxChgBarPos, cbl, ppBtnDefaultCbPos, ppLblChgBarPosDefault);
 | |
| 				//tcpFormatSettings.Focus();
 | |
| 			}
 | |
| 		}
 | |
| 
 | |
| 		/// <summary>
 | |
| 		/// Reset to the parent setting.
 | |
| 		/// Find the parent setting and assign it to _ProcedureConfig.Print_ChangeBarLoc.  
 | |
| 		/// This will force the database to be updated.
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender"></param>
 | |
| 		/// <param name="e"></param>
 | |
| 		private void ppBtnDefaultCbPos_Click(object sender, EventArgs e)
 | |
| 		{
 | |
| 			// Get the parent setting
 | |
| 			PrintChangeBarLoc cbl = (PrintChangeBarLoc)Enum.Parse(typeof(PrintChangeBarLoc), _DefaultChgBarLoc);
 | |
| 			// Compare parent setting with current setting
 | |
| 			if (cbl != _ProcedureConfig.Print_ChangeBarLoc)
 | |
| 				_ProcedureConfig.Print_ChangeBarLoc = cbl; // this will force a database update (write)
 | |
| 			ppCmbxChgBarPos.SelectedIndex = -1;  //reset to the default Change Bar Position setting
 | |
| 			//tcpFormatSettings.Focus();
 | |
| 		}
 | |
| 
 | |
| 		/// <summary>
 | |
| 		/// Selection in Change Bar Text Type combo box changed.
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender">object</param>
 | |
| 		/// <param name="e">EventArgs</param>
 | |
| 		private void ppCmbxChgBarTxtType_SelectedValueChanged(object sender, EventArgs e)
 | |
| 		{
 | |
| 			if (!_Initializing)
 | |
| 			{
 | |
| 				PrintChangeBarText cbt = (PrintChangeBarText)Enum.Parse(typeof(PrintChangeBarText), _DefaultChgBarText);
 | |
| 				ProcessCmbxSelectionEnumChanged(ppCmbxChgBarTxtType, cbt, ppBtnDefCbTxtTyp, ppLblChgBarTxtTypeDefault);
 | |
| 				setEnabledUserSpecifiedChgBarText();
 | |
| 				//tcpFormatSettings.Focus();
 | |
| 			}
 | |
| 		}
 | |
| 
 | |
| 		/// <summary>
 | |
| 		/// Reset to the parent setting.
 | |
| 		/// Find the parent setting and assign it to _ProcedureConfig.Print_ChangeBarText.  
 | |
| 		/// This will force the database to be updated.
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender"></param>
 | |
| 		/// <param name="e"></param>
 | |
| 		private void ppBtnDefCbTxtTyp_Click(object sender, EventArgs e)
 | |
| 		{
 | |
| 			// Get the parent setting
 | |
| 			PrintChangeBarText cbt = (PrintChangeBarText)Enum.Parse(typeof(PrintChangeBarText), _DefaultChgBarText);
 | |
| 			// Compare parent setting with current setting
 | |
| 			if (cbt != _ProcedureConfig.Print_ChangeBarText)
 | |
| 				_ProcedureConfig.Print_ChangeBarText = cbt; // this will force a database update (write)
 | |
| 			ppCmbxChgBarTxtType.SelectedIndex = -1;  //reset to the default Change Bar Text Type setting
 | |
| 			//tcpFormatSettings.Focus();
 | |
| 		}
 | |
| 
 | |
| 		/// <summary>
 | |
| 		/// Enable or disable the user specified change bar text based on the selected
 | |
| 		/// change bar text type (selected in the user specific change bar grouping)
 | |
| 		/// </summary>
 | |
| 		private void setEnabledUserSpecifiedChgBarText()
 | |
| 		{
 | |
| 			//ppGpbxUserSpecTxt.Enabled =
 | |
| 			//ppTxbxChangeBarUserMsgOne.Enabled =
 | |
| 			//ppTxbxChgBarUserMsgTwo.Enabled =
 | |
| 			//ppBtnDefCbTxt1.Enabled =
 | |
| 			//ppBtnDefCbTxt2.Enabled = (ppCmbxChgBarTxtType.SelectedValue != null &&
 | |
| 			//ppCmbxChgBarTxtType.SelectedValue.Equals(ProcedureConfig.PrintChangeBarText.UserDef));
 | |
| 
 | |
| 			// This string is used to check against our default setting to see if User Defined Changebar Text is active
 | |
| 			string decUserDef = PrintChangeBarText.UserDef.ToString();
 | |
| 
 | |
| 			ppGpbxUserSpecTxt.Enabled = (ppCmbxChgBarTxtType.SelectedValue != null &&
 | |
| 			ppCmbxChgBarTxtType.SelectedValue.Equals(PrintChangeBarText.UserDef)) ||
 | |
| 			(ppCmbxChgBarTxtType.SelectedIndex == -1 && _DefaultChgBarText.Equals(decUserDef));
 | |
| 
 | |
| 		}
 | |
| 
 | |
| 		#endregion
 | |
| 
 | |
| 		#region Output Settings tab
 | |
| 
 | |
| 		/// <summary>
 | |
| 		/// This is the Output Settings button used on the button interface design
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender">object</param>
 | |
| 		/// <param name="e">EventArgs</param>
 | |
| 		private void btnOutputStngs_Click(object sender, EventArgs e)
 | |
| 		{
 | |
| 			ProcessButtonClick(tiOutputStngs, btnOutputStngs);
 | |
| 		}
 | |
| 
 | |
| 		/// <summary>
 | |
| 		/// Selection in Pagination combo box changed.
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender">object</param>
 | |
| 		/// <param name="e">EventArgs</param>
 | |
| 		//private void ppCmbxPagination_SelectedValueChanged(object sender, EventArgs e)
 | |
| 		//{
 | |
| 		//    if (!_Initializing)
 | |
| 		//    {
 | |
| 		//        PrintPagination pgtn = (PrintPagination)Enum.Parse(typeof(PrintPagination), _DefaultPagination);
 | |
| 		//        ProcessCmbxSelectionEnumChanged(ppCmbxPagination, pgtn, ppBtnDefPagination, ppLblPaginationDefault);
 | |
| 		//        //tcpOutputSettings.Focus();
 | |
| 		//    }
 | |
| 		//}
 | |
| 
 | |
| 		/// <summary>
 | |
| 		/// Reset to the parent setting.
 | |
| 		/// Find the parent setting and assign it to _ProcedureConfig.Print_Pagination.  
 | |
| 		/// This will force the database to be updated.
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender"></param>
 | |
| 		/// <param name="e"></param>
 | |
| 		//private void ppBtnDefPagination_Click(object sender, EventArgs e)
 | |
| 		//{
 | |
| 		//    // Get the parent setting
 | |
| 		//    PrintPagination pgtn = (PrintPagination)Enum.Parse(typeof(PrintPagination), _DefaultPagination);
 | |
| 		//    // Compare parent setting with current setting
 | |
| 		//    if (pgtn != _ProcedureConfig.Print_Pagination)
 | |
| 		//        _ProcedureConfig.Print_Pagination = pgtn; // this will force a database update (write)
 | |
| 		//    ppCmbxPagination.SelectedIndex = -1;  //reset to the default Pagination setting
 | |
| 		//    //tcpOutputSettings.Focus();
 | |
| 		//}
 | |
| 
 | |
| 		/// <summary>
 | |
| 		/// Selection in Watermark combo box changed.
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender">object</param>
 | |
| 		/// <param name="e">EventArgs</param>
 | |
| 		private void ppCmbxWatermark_SelectedValueChanged(object sender, EventArgs e)
 | |
| 		{
 | |
| 			if (!_Initializing)
 | |
| 			{
 | |
| 				PrintWatermark wtr = (PrintWatermark)Enum.Parse(typeof(PrintWatermark), _DefaultWatermark);
 | |
| 				ProcessCmbxSelectionEnumChanged(ppCmbxWatermark, wtr, ppBtnDefWatermark, ppLblWatermarkDefault);
 | |
| 				//tcpOutputSettings.Focus();
 | |
| 			}
 | |
| 		}
 | |
| 
 | |
| 		/// <summary>
 | |
| 		/// Reset to the parent setting.
 | |
| 		/// Find the parent setting and assign it to _ProcedureConfig.Print_Watermark.  
 | |
| 		/// This will force the database to be updated.
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender"></param>
 | |
| 		/// <param name="e"></param>
 | |
| 		private void ppBtnDefWatermark_Click(object sender, EventArgs e)
 | |
| 		{
 | |
| 			// Get the parent setting
 | |
| 			PrintWatermark wtr = (PrintWatermark)Enum.Parse(typeof(PrintWatermark), _DefaultWatermark);
 | |
| 			// Compare parent setting with current setting
 | |
| 			if (wtr != _ProcedureConfig.Print_Watermark)
 | |
| 				_ProcedureConfig.Print_Watermark = wtr; // this will force a database update (write)
 | |
| 			ppCmbxWatermark.SelectedIndex = -1;  //reset to the default Watermark setting
 | |
| 		}
 | |
| 
 | |
| 		#endregion
 | |
| 
 | |
| 		#region View Settings tab
 | |
| 
 | |
| 		///// <summary>
 | |
| 		///// This is the View Settings button used on the button interface design
 | |
| 		///// </summary>
 | |
| 		///// <param name="sender">object</param>
 | |
| 		///// <param name="e">EventArgs</param>
 | |
| 		//private void btnVwStngs_Click(object sender, EventArgs e)
 | |
| 		//{
 | |
| 		//    ProcessButtonClick(tiViewStngs, btnVwStngs);
 | |
| 		//}
 | |
| 		#endregion
 | |
| 
 | |
| 		#region Generic functions used on this property page
 | |
| 
 | |
| 		/// <summary>
 | |
| 		/// Determines what labels (showing default values) are visable on the property pages
 | |
| 		/// </summary>
 | |
| 		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;
 | |
| 			ppLblAutoDuplexDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDeftDisAutoDuplx.Visible;
 | |
| 		}
 | |
| 
 | |
| 		/// <summary>
 | |
| 		/// Select the corresponding tab and set the button's state to checked
 | |
| 		/// </summary>
 | |
| 		/// <param name="tab">Property Page Tab</param>
 | |
| 		/// <param name="button">Corresponding Property Page Button</param>
 | |
| 		private void ProcessButtonClick(TabItem tab, ButtonX button)
 | |
| 		{
 | |
| 			ClearAllCheckedButtons();
 | |
| 			tcProcProp.SelectedTab = tab;
 | |
| 			button.Checked = true;
 | |
| 		}
 | |
| 
 | |
| 		/// <summary>
 | |
| 		/// For the Button Interface property page style, when a button is selected (pressed),
 | |
| 		/// it will remain in the checked state even when a different button is selected.  Thus
 | |
| 		/// we must clear the checked state of the buttons when a button is selected, then set
 | |
| 		/// the newly selected button's state to checked.
 | |
| 		/// </summary>
 | |
| 		private void ClearAllCheckedButtons()
 | |
| 		{
 | |
| 			btnGeneral.Checked = false;
 | |
| 			btnFmtStngs.Checked = false;
 | |
| 			btnOutputStngs.Checked = false;
 | |
| 			//btnVwStngs.Checked = false;
 | |
| 		}
 | |
| 
 | |
| 		/// <summary>
 | |
| 		/// This is a generic Enter Event function for use with all of the property page tabs.
 | |
| 		/// Found that the visiblity value of buttons is not recorded until the property page in which it resides is diplayed.
 | |
| 		/// Thus we need to call defaultSettingVisiblity() to check and set visiblity states.
 | |
| 		/// </summary>
 | |
| 		/// <param name="sender"> type object</param>
 | |
| 		/// <param name="e">type EventArgs</param>
 | |
| 		private void tabpage_Enter(object sender, EventArgs e)
 | |
| 		{
 | |
| 			// Show or hide the labels containing the default values
 | |
| 			//if (!_Initializing)
 | |
| 			defaultSettingsVisiblity();
 | |
| 		}
 | |
| 
 | |
| 		/// <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;
 | |
| 			}
 | |
| 		}
 | |
| 
 | |
| 		/// <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 = (cmbx.SelectedValue != null);
 | |
| 			deflabel.Visible = ppCbShwDefSettings.Checked && button.Visible;
 | |
| 		}
 | |
| 		// Commented out as part of code change C2017-004 - select default format on dropdown
 | |
| 		///// <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;
 | |
| 		//}
 | |
| 		#endregion
 | |
| 
 | |
| 		private void ppProcTitleStpRTB_Enter(object sender, EventArgs e)
 | |
| 		{
 | |
| 			_MyStepTabRibbon.MyStepRTB = ppProcTitleStpRTB;
 | |
| 		}
 | |
| 
 | |
| 		private void ppProcNumStpRTB_Enter(object sender, EventArgs e)
 | |
| 		{
 | |
| 			_MyStepTabRibbon.MyStepRTB = ppProcNumStpRTB;
 | |
| 		}
 | |
| 
 | |
| 		private void ppBtnDefCbTxt1_Click(object sender, EventArgs e)
 | |
| 		{
 | |
| 			// Compare default setting with current setting
 | |
| 			// Reset with the default and hide the default button and label
 | |
| 			if (_DefaultChgBarUsrMsg1 != _ProcedureConfig.Print_UserCBMess1)
 | |
| 			{
 | |
| 				_ProcedureConfig.Print_UserCBMess1 = _DefaultChgBarUsrMsg1;
 | |
| 				ppLblChgBarUserMsgOneDefault.Visible = false;
 | |
| 				ppBtnDefCbTxt1.Visible = false;
 | |
| 				//tcpFormatSettings.Focus();
 | |
| 			}
 | |
| 
 | |
| 		}
 | |
| 
 | |
| 		private void ppBtnDefCbTxt2_Click(object sender, EventArgs e)
 | |
| 		{
 | |
| 			// Compare default setting with current setting
 | |
| 			// Reset with the default and hide the default button and label
 | |
| 			if (_DefaultChgBarUsrMsg2 != _ProcedureConfig.Print_UserCBMess2)
 | |
| 			{
 | |
| 				_ProcedureConfig.Print_UserCBMess2 = _DefaultChgBarUsrMsg2;
 | |
| 				ppLblChgBarUserMsgTwoDefault.Visible = false;
 | |
| 				ppBtnDefCbTxt2.Visible = false;
 | |
| 				//tcpFormatSettings.Focus();
 | |
| 			}
 | |
| 		}
 | |
| 
 | |
| 		private void ppBtnDefEdCols_Click(object sender, EventArgs e)
 | |
| 		{
 | |
| 			// Get the parent setting
 | |
| 			FormatColumns fc = (FormatColumns)Enum.Parse(typeof(FormatColumns), _DefaultFormatColumns);
 | |
| 			if (fc != _ProcedureConfig.Format_Columns)
 | |
| 				_ProcedureConfig.Format_Columns = fc; // this will force a database update (write)
 | |
| 			ppCmbxStpEditorCols.SelectedIndex = -1; //reset to the default
 | |
| 			//tcpGeneral.Focus();
 | |
| 		}
 | |
| 
 | |
| 		private void ppBtnDefWatermark_Click_1(object sender, EventArgs e)
 | |
| 		{
 | |
| 			// Get the parent setting
 | |
| 			PrintWatermark wtr = (PrintWatermark)Enum.Parse(typeof(PrintWatermark), _DefaultWatermark);
 | |
| 			// Compare parent setting with current setting
 | |
| 			if (wtr != _ProcedureConfig.Print_Watermark)
 | |
| 				_ProcedureConfig.Print_Watermark = wtr; // this will force a database update (write)
 | |
| 			ppCmbxWatermark.SelectedIndex = -1;
 | |
| 			//tcpOutputSettings.Focus();
 | |
| 		}
 | |
| 
 | |
| 		private void ppBtnDeftDisAutoDuplx_Click(object sender, EventArgs e)
 | |
| 		{
 | |
| 			ppChbxDisAutoDuplex.Checked = _DefaultDisableDuplex;
 | |
| 			_ProcedureConfig.Print_DisableDuplex = ppChbxDisAutoDuplex.Checked;
 | |
| 			ppBtnDeftDisAutoDuplx.Visible = false;
 | |
| 			ppLblAutoDuplexDefault.Visible = false;
 | |
| 			//tcpOutputSettings.Focus();
 | |
| 		}
 | |
| 
 | |
| 		private void ppTxbxChangeBarUserMsgOne_TextChanged(object sender, EventArgs e)
 | |
| 		{
 | |
| 			ppBtnDefCbTxt1.Visible = ((ppTxbxChangeBarUserMsgOne.Text != null) && !ppTxbxChangeBarUserMsgOne.Text.Equals(_DefaultChgBarUsrMsg1));
 | |
| 			ppLblChgBarUserMsgOneDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefCbTxt1.Visible;
 | |
| 			//tcpOutputSettings.Focus();
 | |
| 		}
 | |
| 
 | |
| 		private void ppTxbxChgBarUserMsgTwo_TextChanged(object sender, EventArgs e)
 | |
| 		{
 | |
| 			ppBtnDefCbTxt2.Visible = ((ppTxbxChgBarUserMsgTwo.Text != null) && !ppTxbxChgBarUserMsgTwo.Text.Equals(_DefaultChgBarUsrMsg2));
 | |
| 			ppLblChgBarUserMsgTwoDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefCbTxt2.Visible;
 | |
| 			//tcpOutputSettings.Focus();
 | |
| 		}
 | |
| 
 | |
| 		private void ppChbxDisAutoDuplex_CheckedChanged(object sender, EventArgs e)
 | |
| 		{
 | |
| 
 | |
| 			if (!_Initializing)
 | |
| 			{
 | |
| 				_ProcedureConfig.Print_DisableDuplex = ppChbxDisAutoDuplex.Checked;
 | |
| 				ppBtnDeftDisAutoDuplx.Visible = _DefaultDisableDuplex != ppChbxDisAutoDuplex.Checked;
 | |
| 				ppLblAutoDuplexDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDeftDisAutoDuplx.Visible;
 | |
| 				//tcpOutputSettings.Focus();
 | |
| 			}
 | |
| 		}
 | |
| 
 | |
| 		private void frmProcedureProperties_Shown(object sender, EventArgs e)
 | |
| 		{
 | |
| 			ppProcNumStpRTB.Focus();
 | |
| 
 | |
| 		}
 | |
| 
 | |
| 		private void ppCmbxFormat_DropDown(object sender, EventArgs e)
 | |
| 		{
 | |
| 			_Initializing = true;
 | |
| 			// C2017-004 - if using the default format, position the dropdown to the default format
 | |
| 			if (ppCmbxFormat.SelectedIndex == -1)
 | |
| 				ppCmbxFormat.SelectedValue = _DefaultFormatName;
 | |
| 			_Initializing = false;
 | |
| 		}
 | |
| 
 | |
| 		private void ppCmbxFormat_DropDownClosed(object sender, EventArgs e)
 | |
| 		{
 | |
| 			// upon exit of the dropdown if the default format is selected - click the Default button
 | |
| 			if ((string)(ppCmbxFormat.SelectedValue) == _DefaultFormatName)
 | |
| 			{
 | |
| 				ppBtnDefaultFmt.PerformClick();
 | |
| 				btnFmtStngs.Focus();
 | |
| 			}
 | |
| 		}
 | |
| 
 | |
| 		// added as part of code change C2017-004. this also makes it consistent with section properties
 | |
| 		int _InitialIndex = -2;
 | |
| 		private void ppCmbxFormat_SelectedIndexChanged(object sender, EventArgs e)
 | |
| 		{
 | |
| 			if (_Initializing)
 | |
| 			{
 | |
| 				// determine if the default button and the default description text should visable
 | |
| 				ppBtnDefaultFmt.Visible = !(ppCmbxFormat.SelectedValue == null || ppCmbxFormat.SelectedIndex == -1);
 | |
| 				ppLblFormatDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultFmt.Visible;
 | |
| 				return;
 | |
| 			}
 | |
| 			if (_InitialIndex < -1) _InitialIndex = ppCmbxFormat.SelectedIndex; // save the current format selection (happens here when current section format is not the default section)
 | |
| 			if ((ppCmbxFormat.SelectedIndex != -1) && _DefaultFormatName != null && _DefaultFormatName.Equals(ppCmbxFormat.SelectedValue))
 | |
| 			{
 | |
| 				ppBtnDefaultFmt.Focus();
 | |
| 				ppBtnDefaultFmt.PerformClick();
 | |
| 			}
 | |
| 			// determine if the default button and the default description text should visable
 | |
| 			ppBtnDefaultFmt.Visible = !(ppCmbxFormat.SelectedValue == null || ppCmbxFormat.SelectedIndex == -1);
 | |
| 			ppLblFormatDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultFmt.Visible;
 | |
| 		}
 | |
| 
 | |
| 	}
 | |
| } |