1764 lines
62 KiB
C#
1764 lines
62 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 System.IO;
|
|
using VEPROMS.CSLA.Library;
|
|
using DevComponents;
|
|
using DevComponents.DotNetBar;
|
|
using DevComponents.DotNetBar.Controls;
|
|
using System.Drawing.Imaging;
|
|
using VEPROMS.Properties;
|
|
using DescriptiveEnum;
|
|
|
|
namespace VEPROMS
|
|
{
|
|
public partial class frmFolderProperties : DevComponents.DotNetBar.Office2007Form
|
|
{
|
|
private bool _Initializing = false;
|
|
private FolderConfig _FolderConfig;
|
|
private bool _IsVepromsNode = false;
|
|
private bool _IsDefaultSettingNode = false;
|
|
|
|
private string _DefaultFormatName = null;
|
|
private string _DefaultChgBarType = null;
|
|
private string _DefaultChgBarLoc = null;
|
|
private string _DefaultChgBarText = null;
|
|
private string _DefaultChgBarUsrMsg1 = null;
|
|
private string _DefaultChgBarUsrMsg2 = null;
|
|
private string _DefaultROGraficFileExtension = null;
|
|
//private string _DefaultImagePrefix = null;
|
|
//private string _DefaultROPrefix = null;
|
|
//private string _DefaultPagination = null;
|
|
private string _DefaultWatermark = null;
|
|
private bool _DefaultDisableDuplex = false;
|
|
private string _DefaultFormatColumns = null;
|
|
//private string _ROcolor;
|
|
//private string _TransColor;
|
|
//private string _EditBckgndColor;
|
|
//private string _ViewBckgndColor;
|
|
private bool _ValidateTextBox = true;
|
|
|
|
public frmFolderProperties(FolderConfig folderConfig)
|
|
{
|
|
_FolderConfig = folderConfig;
|
|
_IsVepromsNode = !folderConfig.HasParent; // top tree node does not have a parent
|
|
if (!_IsVepromsNode)
|
|
_IsDefaultSettingNode = _FolderConfig.MyFolder.MyParent.MyParent == null;
|
|
_Initializing = true;
|
|
InitializeComponent();
|
|
btnGeneral.PerformClick(); // always start with General tab or button
|
|
_Initializing = false;
|
|
// Build window caption
|
|
this.Text = string.Format("{0} Properties",folderConfig.Name);
|
|
if (_IsDefaultSettingNode)
|
|
{
|
|
// Change these labels for the first node after the VE-PROMS node.
|
|
ppLblDefSettingsInfo.Text = "* Default Proms settings are shown in italics";
|
|
ppCbShwDefSettings.Text = "Show Default Proms Settings";
|
|
}
|
|
}
|
|
|
|
/// <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()
|
|
{
|
|
_FolderConfig.ParentLookup = true;
|
|
// Get the default format name
|
|
_DefaultFormatName = _FolderConfig.DefaultFormatSelection;
|
|
SetupDefault(_DefaultFormatName, ppLblFormatDefault, ppCmbxFormat);
|
|
|
|
// Get the default Change Bar Type
|
|
_DefaultChgBarType = _FolderConfig.Print_ChangeBar.ToString();
|
|
SetupDefault(EnumDescConverter.GetEnumDescription(_FolderConfig.Print_ChangeBar), ppLblChangeBarTypeDefault, ppCmbxChangeBarType);
|
|
|
|
// Get the default Change Bar Location
|
|
_DefaultChgBarLoc = _FolderConfig.Print_ChangeBarLoc.ToString();
|
|
SetupDefault(EnumDescConverter.GetEnumDescription(_FolderConfig.Print_ChangeBarLoc), ppLblChgBarPosDefault, ppCmbxChgBarPos);
|
|
|
|
// Get the default Change Bar text
|
|
_DefaultChgBarText = _FolderConfig.Print_ChangeBarText.ToString();
|
|
SetupDefault(EnumDescConverter.GetEnumDescription(_FolderConfig.Print_ChangeBarText), ppLblChgBarTxtTypeDefault, ppCmbxChgBarTxtType);
|
|
|
|
// Get the default User Change Bar Message 1
|
|
_DefaultChgBarUsrMsg1 = _FolderConfig.Print_UserCBMess1;
|
|
if (!(_DefaultChgBarUsrMsg1.Equals("")))
|
|
ppLblChgBarUserMsgOneDefault.Text = string.Format("({0})", _DefaultChgBarUsrMsg1);
|
|
|
|
// Get the default User Change Bar Message 2
|
|
_DefaultChgBarUsrMsg2 = _FolderConfig.Print_UserCBMess2;
|
|
if (!(_DefaultChgBarUsrMsg2.Equals("")))
|
|
ppLblChgBarUserMsgTwoDefault.Text = string.Format("({0})", _DefaultChgBarUsrMsg2);
|
|
|
|
// Get the default RO Graphic file extension
|
|
_DefaultROGraficFileExtension = _FolderConfig.Graphics_defaultext;
|
|
// if no graphic file extension was saved, use Tif
|
|
if (_DefaultROGraficFileExtension.Equals(""))
|
|
{
|
|
ppCmbxGrphFileExt.SelectedIndex = 5;
|
|
_DefaultROGraficFileExtension = ppCmbxGrphFileExt.Text;
|
|
}
|
|
SetupDefault(_DefaultROGraficFileExtension, ppLblGrphFileExtDefault, ppCmbxGrphFileExt);
|
|
|
|
// Get the default Print Pagination
|
|
//_DefaultPagination = _FolderConfig.Print_Pagination.ToString();
|
|
//SetupDefault(EnumDescConverter.GetEnumDescription(_FolderConfig.Print_Pagination), ppLblPaginationDefault, ppCmbxPagination);
|
|
|
|
// Get the default Watermark
|
|
_DefaultWatermark = _FolderConfig.Print_Watermark.ToString();
|
|
SetupDefault(EnumDescConverter.GetEnumDescription(_FolderConfig.Print_Watermark), ppLblWatermarkDefault, ppCmbxWatermark);
|
|
|
|
// Get the default Disable Duplex
|
|
_DefaultDisableDuplex = _FolderConfig.Print_DisableDuplex;
|
|
ppLblAutoDuplexDefault.Text = string.Format("(Duplex {0})", (_DefaultDisableDuplex) ? "OFF" : "ON");
|
|
|
|
// Get the default Format Columns
|
|
_DefaultFormatColumns = _FolderConfig.Format_Columns.ToString();
|
|
SetupDefault(EnumDescConverter.GetEnumDescription(_FolderConfig.Format_Columns), ppLblStpEditorColsDefault, ppCmbxStpEditorCols);
|
|
|
|
_FolderConfig.ParentLookup = false;
|
|
}
|
|
|
|
private AnnotationTypeInfoList myAnnotationTypeInfoList = null;
|
|
private LocalAnnotationTypeInfoList myLocalAnnotationTypeInfoList = null;
|
|
private StageInfoList myStageInfoList = null;
|
|
private LocalStageInfoList myLocalStageInfoList = null;
|
|
private void frmFolderProperties_Load(object sender, EventArgs e)
|
|
{
|
|
_Initializing = true;
|
|
// populate the a list box of possible graphic file types
|
|
// supported by .NET
|
|
// foreach (ImageCodecInfo info in ImageCodecInfo.GetImageDecoders())
|
|
// {
|
|
// string st = string.Format("{0} - ({1})", info.FormatDescription, info.FilenameExtension);
|
|
// //string st = string.Format("{0}", info.FormatDescription);
|
|
// comboBoxEx1.Items.Add(st);
|
|
// }
|
|
|
|
imageCodecInfoBindingSource.DataSource = ImageCodecInfo.GetImageDecoders();
|
|
//formatInfoListBindingSource.DataSource = FormatInfoList.Get();
|
|
folderConfigBindingSource.DataSource = _FolderConfig;
|
|
|
|
ppCmbxFormat.DataSource = null;
|
|
ppCmbxFormat.DisplayMember = "FullName";
|
|
ppCmbxFormat.ValueMember = "FullName";
|
|
ppCmbxFormat.DataSource = FormatInfoList.SortedFormatInfoList;
|
|
// 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["ShowDefaultFolderProp"] != null)? Settings.Default.ShowDefaultFolderProp : false;
|
|
if (_IsVepromsNode || Settings.Default["ShowDefaultFolderProp"] == null)
|
|
ppCbShwDefSettings.Checked = false;
|
|
else
|
|
ppCbShwDefSettings.Checked = Settings.Default.ShowDefaultFolderProp;
|
|
|
|
// 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)
|
|
{
|
|
tcFolder.TabsVisible = true;
|
|
panButtons.Visible = false;
|
|
this.Width -= panButtons.Width;
|
|
}
|
|
|
|
// Get the default values for the property page information
|
|
FindDefaultValues();
|
|
|
|
// Setup as to which "tabs" to display on the property page
|
|
// - the first (top) tree node shows different "tabs" than the
|
|
// other folder type of tree nodes
|
|
if (_IsVepromsNode) //(!_FolderConfig.HasParent)
|
|
{
|
|
// if we are at the top node of the tree, remove the Folder Property page tabs
|
|
// that do not pertain to this level (top of tree)
|
|
this.tcFolder.Tabs.Remove(tiOutputSettings);
|
|
this.tcFolder.Tabs.Remove(tiEditSettings);
|
|
// for format settings, include it if the top node's format is NOT the base, i.e. formatid != 1.
|
|
// this is done so that PROMS EXPRESS folder specific info can be displayed/used for the top
|
|
// node of the tree. The formatid for the top folder for PROMS EXPRESS databases must be
|
|
// set manually to the PROMS EXPRESS format.
|
|
if (_FolderConfig.MyFolder.MyFormat.FormatID == 1)
|
|
{
|
|
this.tcFolder.Tabs.Remove(tiFmtSettings);
|
|
this.btnFormatSettings.Visible = false;
|
|
}
|
|
//this.tcFolder.Tabs.Remove(tiAnnoTypes); // TEMPORARY - JSJ
|
|
//this.tcFolder.Tabs.Remove(tiApprvStages);// TEMPORARY - JSJ
|
|
//this.btnAnnoTypes.Visible = false; // TEMPORARY - JSJ
|
|
//this.btnApprvStages.Visible = false; // TEMPORARY - JSJ
|
|
this.btnOutputSettings.Visible = false;
|
|
this.btnEdSettings.Visible = false;
|
|
ppLblDefSettingsInfo.Visible = false;
|
|
ppCbShwDefSettings.Visible = false; // hide check box for showing default values for top node
|
|
ppCbShwDefSettings.Checked = false;
|
|
// FOR NOW, don't show Start Message tab
|
|
// TODO: later on, not needed for initial release.
|
|
this.tcFolder.Tabs.Remove(tiStMsg);
|
|
this.btnStMsg.Visible = false;
|
|
|
|
// Also, for the referenced object tab, the top node (veproms system level) should
|
|
// allow setting of the default graphics file extension. No other folder level allows this.
|
|
ppCmbxGrphFileExt.Visible = true;
|
|
ppLblGrphFileExtDefault.Visible = false; // true;
|
|
lblGrphFileExt.Visible = true;
|
|
ppBtnDefaultGrphFileExt.Visible = false; // true;
|
|
myStageInfoList = StageInfoList.Get();
|
|
lbRevisionStages.DataSource = myLocalStageInfoList = new LocalStageInfoList(myStageInfoList);
|
|
lbRevisionStages.DisplayMember = "Name";
|
|
myAnnotationTypeInfoList = AnnotationTypeInfoList.Get();
|
|
lbAnnotationTypes.DataSource = myLocalAnnotationTypeInfoList = new LocalAnnotationTypeInfoList(myAnnotationTypeInfoList);
|
|
lbAnnotationTypes.DisplayMember = "Name";
|
|
// make visible the text box to allow the user to change the Procedure Panel's heading (title) on the panel bar
|
|
ppRTxtHeading.Visible = true;
|
|
lblHeading.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
// don't show Start Message or ref obj tab if not at top level
|
|
this.tcFolder.Tabs.Remove(tiStMsg);
|
|
this.tcFolder.Tabs.Remove(tiRefObj);
|
|
this.tcFolder.Tabs.Remove(tiAnnoTypes);
|
|
this.tcFolder.Tabs.Remove(tiRevisionStages);
|
|
this.btnStMsg.Visible = false;
|
|
this.btnRefObjs.Visible = false;
|
|
this.btnAnnoTypes.Visible = false;
|
|
this.btnRevisionStages.Visible = false;
|
|
|
|
/* This color settings property page is currently no visible...
|
|
*
|
|
// this was coded for demo purposes... setup the text colors for the sample text
|
|
// of the Step Editor Text Colors property
|
|
_ROcolor = _FolderConfig.Color_ro;
|
|
if (_ROcolor == string.Empty) _ROcolor = "Orange";
|
|
_EditBckgndColor = _FolderConfig.Color_editbackground;
|
|
if (_EditBckgndColor == string.Empty) _EditBckgndColor = "LightGray";
|
|
_ViewBckgndColor = _FolderConfig.Default_BkColor.Name;
|
|
if (_ViewBckgndColor == string.Empty) _ViewBckgndColor = "White";
|
|
_TransColor = _FolderConfig.Color_transition;
|
|
if (_TransColor == string.Empty) _TransColor = "Orange";
|
|
SetupSampleTextBoxes();
|
|
* */
|
|
|
|
// Assign the data sources to the combo boxes
|
|
ppCmbxChangeBarType.DataSource = EnumDetail<PrintChangeBar>.Details();
|
|
ppCmbxChangeBarType.DisplayMember = "Name";
|
|
ppCmbxChangeBarType.ValueMember = "EValue";
|
|
ppCmbxChangeBarType.SelectedValue = -1;
|
|
|
|
ppCmbxChgBarPos.DataSource = EnumDetail<PrintChangeBarLoc>.Details();
|
|
ppCmbxChgBarPos.DisplayMember = "Name";
|
|
ppCmbxChgBarPos.ValueMember = "EValue";
|
|
ppCmbxChgBarPos.SelectedValue = -1;
|
|
|
|
ppCmbxChgBarTxtType.DataSource = EnumDetail<PrintChangeBarText>.Details();
|
|
ppCmbxChgBarTxtType.DisplayMember = "Name";
|
|
ppCmbxChgBarTxtType.ValueMember = "EValue";
|
|
ppCmbxChgBarTxtType.SelectedValue = -1;
|
|
|
|
//ppCmbxPagination.DataSource = EnumDetail<PrintPagination>.Details();
|
|
//ppCmbxPagination.DisplayMember = "Name";
|
|
//ppCmbxPagination.ValueMember = "EValue";
|
|
//ppCmbxPagination.SelectedValue = -1;
|
|
|
|
ppCmbxWatermark.DataSource = EnumDetail<PrintWatermark>.Details();
|
|
ppCmbxWatermark.DisplayMember = "Name";
|
|
ppCmbxWatermark.ValueMember = "EValue";
|
|
ppCmbxWatermark.SelectedValue = -1;
|
|
|
|
ppCmbxStpEditorCols.DataSource = EnumDetail<FormatColumns>.Details();
|
|
ppCmbxStpEditorCols.DisplayMember = "Name";
|
|
ppCmbxStpEditorCols.ValueMember = "EValue";
|
|
ppCmbxStpEditorCols.SelectedValue = -1;
|
|
|
|
ppCbShwDefSettings.Visible = true; // display check box for showing default values
|
|
|
|
// Also, for the referenced object tab, the top node (veproms system level) should
|
|
// allow setting of the default graphics file extension. No other folder level allows this.
|
|
ppCmbxGrphFileExt.Visible = false;
|
|
ppLblGrphFileExtDefault.Visible = false;
|
|
this.lblGrphFileExt.Visible = false;
|
|
|
|
// Set the auto duplex controls based on whether the format allows this:
|
|
// Note that the controls' visibility would not set correctly using the following two lines of code. That
|
|
// is why the more explicit logic was done.
|
|
//ppChbxDisAutoDuplex.Visible = _DocVersionConfig.MyDocVersion.MyFormat.PlantFormat.FormatData.PrintData.AllowDuplex;
|
|
//ppLblAutoDuplexDefault.Visible = ppBtnDeftDisAutoDuplx.Visible = ppLblAutoDuplexDefault.Visible;
|
|
FolderInfo fi = FolderInfo.Get(_FolderConfig.MyFolder.FolderID);
|
|
if (fi.ActiveFormat.PlantFormat.FormatData.PrintData.AllowDuplex)
|
|
{
|
|
ppChbxDisAutoDuplex.Visible = true;
|
|
ppLblAutoDuplexDefault.Visible = true;
|
|
ppBtnDeftDisAutoDuplx.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
ppChbxDisAutoDuplex.Visible = false;
|
|
ppLblAutoDuplexDefault.Visible = false;
|
|
ppBtnDeftDisAutoDuplx.Visible = false;
|
|
}
|
|
// HIDE the text box that allows the user to change the Procedure Panel's heading (title) on the panel bar
|
|
ppRTxtHeading.Visible = false;
|
|
lblHeading.Visible = false;
|
|
}
|
|
_Initializing = false;
|
|
}
|
|
|
|
private void ppBtnCancel_Click(object sender, EventArgs e)
|
|
{
|
|
folderConfigBindingSource.CancelEdit();
|
|
DialogResult = DialogResult.Cancel;
|
|
this.Close();
|
|
}
|
|
|
|
private void ppBtnCancel_MouseEnter(object sender, EventArgs e)
|
|
{
|
|
_ValidateTextBox = false;
|
|
}
|
|
|
|
private void ppBtnCancel_MouseLeave(object sender, EventArgs e)
|
|
{
|
|
_ValidateTextBox = true;
|
|
}
|
|
|
|
private void ppBtnOK_Click(object sender, EventArgs e)
|
|
{
|
|
if (btnRevisoinStageUndo.Enabled)
|
|
btnRevisoinStageUndo.PerformClick();
|
|
if (btnAnnoTypeUndo.Enabled)
|
|
btnAnnoTypeUndo.PerformClick();
|
|
//if (btnAnnoTypeSave.Enabled) return;
|
|
folderConfigBindingSource.EndEdit();
|
|
// Save Default settings for User
|
|
//
|
|
// Save whether we should display the default values on this property page
|
|
Settings.Default.ShowDefaultFolderProp = ppCbShwDefSettings.Checked;
|
|
Settings.Default.Save();
|
|
_FolderConfig.MyFolder.Config = _FolderConfig.ToString();
|
|
_FolderConfig.MyFolder.Save().Dispose();
|
|
SaveApprStages();
|
|
SaveAnnotationTypes();
|
|
DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
|
|
private void SaveApprStages()
|
|
{
|
|
if (myStageInfoList == null) return;
|
|
foreach (StageInfo si in myStageInfoList)// spin through old list (database)
|
|
{
|
|
LocalStageInfo found = null;
|
|
foreach (LocalStageInfo lsi in myLocalStageInfoList)// find match in new list
|
|
if (si.StageID == lsi.ID)
|
|
found = lsi;
|
|
if (found != null)
|
|
{
|
|
if (found.Name != si.Name || found.IsApproved != si.IsApproved)// if different then save changes
|
|
{
|
|
using (Stage stg = si.Get())
|
|
{
|
|
stg.Name = found.Name;
|
|
stg.IsApproved = found.IsApproved;
|
|
stg.UserID = Volian.Base.Library.VlnSettings.UserID;
|
|
stg.DTS = DateTime.Now;
|
|
stg.Save();
|
|
}
|
|
}
|
|
myLocalStageInfoList.Remove(found);
|
|
}
|
|
else// if missing then delete
|
|
{
|
|
using (Stage stg = si.Get())
|
|
{
|
|
stg.Delete();
|
|
stg.Save();
|
|
}
|
|
}
|
|
}
|
|
// Add remaining as new
|
|
foreach (LocalStageInfo lsi in myLocalStageInfoList)
|
|
{
|
|
using (Stage stg = Stage.MakeStage(lsi.Name, "", lsi.IsApproved, DateTime.Now, Volian.Base.Library.VlnSettings.UserID))
|
|
stg.Save();
|
|
}
|
|
StageInfoList.Refresh();
|
|
}
|
|
|
|
private void SaveAnnotationTypes()
|
|
{
|
|
if (myAnnotationTypeInfoList == null) return;
|
|
foreach (AnnotationTypeInfo ai in myAnnotationTypeInfoList) //spin through old list (database)
|
|
{
|
|
LocalAnnotationTypeInfo found = null;
|
|
foreach(LocalAnnotationTypeInfo lai in myLocalAnnotationTypeInfoList) // find match in new list
|
|
if (ai.TypeID == lai.TypeID )
|
|
found = lai;
|
|
if (found != null)
|
|
{
|
|
if (found.Name != ai.Name)// if different then save changes
|
|
{
|
|
using (AnnotationType at = ai.Get())
|
|
{
|
|
at.Name = found.Name;
|
|
at.UserID = Volian.Base.Library.VlnSettings.UserID;
|
|
at.DTS = DateTime.Now;
|
|
at.Save();
|
|
}
|
|
}
|
|
myLocalAnnotationTypeInfoList.Remove(found);
|
|
}
|
|
else// if missing then delete
|
|
{
|
|
using (AnnotationType at = ai.Get())
|
|
{
|
|
at.Delete();
|
|
at.Save();
|
|
}
|
|
}
|
|
|
|
}
|
|
foreach (LocalAnnotationTypeInfo lai in myLocalAnnotationTypeInfoList)
|
|
{
|
|
using (AnnotationType at = AnnotationType.New(lai.Name, "", DateTime.Now, Volian.Base.Library.VlnSettings.UserID))
|
|
at.Save();
|
|
}
|
|
AnnotationTypeInfoList.Refresh();
|
|
}
|
|
|
|
#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);
|
|
}
|
|
|
|
private void ppRTxtName_Leave(object sender, EventArgs e)
|
|
{
|
|
if (ppRTxtName.Text == null || ppRTxtName.Text == "")
|
|
{
|
|
MessageBox.Show("Cannot have a blank Name.");
|
|
return;
|
|
}
|
|
if (ppRTxtName.Text != _FolderConfig.Name)
|
|
{
|
|
// need a folderinfo to check for unique names...
|
|
bool isunique = _FolderConfig.CheckUniqueName(ppRTxtName.Text);
|
|
if (!isunique)
|
|
{
|
|
MessageBox.Show(string.Format("The Name '{0}' that was entered is not a unique folder name", ppRTxtName.Text));
|
|
ppRTxtName.Text = _FolderConfig.Name;
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Referenced Objects tab
|
|
|
|
/// <summary>
|
|
/// This is the Referenced Objects button used on the button interface design
|
|
/// </summary>
|
|
/// <param name="sender">object</param>
|
|
/// <param name="e">EventArgs</param>
|
|
private void btnRefObjs_Click(object sender, EventArgs e)
|
|
{
|
|
ProcessButtonClick(tiRefObj, btnRefObjs);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Selection in Graphic File Extension combo box changed.
|
|
/// </summary>
|
|
/// <param name="sender">object</param>
|
|
/// <param name="e">EventArgs</param>
|
|
private void ppCmbxGrphFileExt_SelectedValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (!_Initializing)
|
|
ProcessCmbxSelectedValueChange(ppCmbxGrphFileExt, _DefaultROGraficFileExtension, ppBtnDefaultGrphFileExt, ppLblGrphFileExtDefault);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Reset to the parent setting.
|
|
/// Find the parent setting and assign it to _FolderConfig.Graphics_defaultext.
|
|
/// This will force the database to be updated.
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void ppBtnDefaultGrfExt_Click(object sender, EventArgs e)
|
|
{
|
|
// Compare parent setting with current setting
|
|
if (_DefaultROGraficFileExtension.Equals(_FolderConfig.Graphics_defaultext))
|
|
_FolderConfig.Graphics_defaultext = _DefaultROGraficFileExtension;// this will force a database update (write)
|
|
ppCmbxGrphFileExt.SelectedIndex = -1; //reset to the default Graphic File Extension setting
|
|
//tcpRefObjs.Focus();
|
|
}
|
|
|
|
/// <summary>
|
|
/// TEMPORARY - TO PROVIDE DEMO FUNCTIONALITY
|
|
/// An RO Folder was selected, find the RO.FST file and populate the RO and Image database combo boxes
|
|
/// </summary>
|
|
/// <param name="sender">object</param>
|
|
/// <param name="e">EventArgs</param>
|
|
private void ppTxbxRoFoldLoc_TextChanged(object sender, EventArgs e)
|
|
{
|
|
//TODO:
|
|
//string tpath = ppTxbxRoFoldLoc.Text + "\\RO.FST";
|
|
//if (File.Exists(tpath))
|
|
//{
|
|
// build a list of available RO Accessory Page ID's
|
|
//ROFst rofst = ROFst.Get(_DocVersionConfig.MyDocVersion.DocVersionDocVersionROFsts[0].MyROFst.ROFstID);//new ROFst(tpath, null);
|
|
//ROFst.rodbi[] rodblist = rofst.GetRODatabaseList();
|
|
//for (int i = 0; i < rodblist.Length; i++)
|
|
//{
|
|
// string mitem = string.Format("{0} - {1}", rodblist[i].dbiTitle, rodblist[i].dbiAP);
|
|
// switch (rodblist[i].dbiType)
|
|
// {
|
|
// case 7: ppCmbxDefROPrefix.Items.Add(mitem); // setpoint
|
|
// break;
|
|
// case 8: ppCmbxDefImgPrefix.Items.Add(mitem); // graphic
|
|
// break;
|
|
// default: // user defined
|
|
// ppCmbxDefROPrefix.Items.Add(mitem);
|
|
// ppCmbxDefImgPrefix.Items.Add(mitem);
|
|
// break;
|
|
// }
|
|
//}
|
|
//}
|
|
}
|
|
#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 btnOutputSettings_Click(object sender, EventArgs e)
|
|
{
|
|
ProcessButtonClick(tiOutputSettings, btnOutputSettings);
|
|
}
|
|
|
|
/// <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 || !_IsDefaultSettingNode)
|
|
// {
|
|
// PrintPagination pgtn = (PrintPagination)Enum.Parse(typeof(PrintPagination), _DefaultPagination);
|
|
// ProcessCmbxSelectionEnumChanged(ppCmbxPagination, pgtn, ppBtnDefPagination, ppLblPaginationDefault);
|
|
// }
|
|
//}
|
|
|
|
/// <summary>
|
|
/// Reset to the parent setting.
|
|
/// Find the parent setting and assign it to _FolderConfig.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)
|
|
//{
|
|
// Console.WriteLine("ppBtnDefPagination_Click");
|
|
// // Get the parent setting
|
|
// PrintPagination pgtn = (PrintPagination)Enum.Parse(typeof(PrintPagination), _DefaultPagination);
|
|
// // Compare parent setting with current setting
|
|
// if (pgtn != _FolderConfig.Print_Pagination)
|
|
// _FolderConfig.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);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Reset to the parent setting.
|
|
/// Find the parent setting and assign it to _FolderConfig.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 != _FolderConfig.Print_Watermark)
|
|
_FolderConfig.Print_Watermark = wtr; // this will force a database update (write)
|
|
ppCmbxWatermark.SelectedIndex = -1; //reset to the default Watermark setting
|
|
//tcpOutputSettings.Focus();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Checkbox of the Disable Automatic Duplex changed.
|
|
/// </summary>
|
|
/// <param name="sender">object</param>
|
|
/// <param name="e">EventArgs</param>
|
|
private void ppChbxDisAutoDuplex_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (!_Initializing)
|
|
{
|
|
_FolderConfig.Print_DisableDuplex = ppChbxDisAutoDuplex.Checked;
|
|
ppBtnDeftDisAutoDuplx.Visible = (!_FolderConfig.Name.Equals("VEPROMS")) && (_DefaultDisableDuplex != ppChbxDisAutoDuplex.Checked);
|
|
ppLblAutoDuplexDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDeftDisAutoDuplx.Visible;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Startup Message tab
|
|
|
|
/// <summary>
|
|
/// This is the Startup Message button used on the button interface design
|
|
/// </summary>
|
|
/// <param name="sender">object</param>
|
|
/// <param name="e">EventArgs</param>
|
|
private void btnStMsg_Click(object sender, EventArgs e)
|
|
{
|
|
ProcessButtonClick(tiStMsg, btnStMsg);
|
|
}
|
|
|
|
#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 btnFormatSettings_Click(object sender, EventArgs e)
|
|
{
|
|
ProcessButtonClick(tiFmtSettings, btnFormatSettings);
|
|
}
|
|
|
|
/// <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)
|
|
{
|
|
if (!_Initializing)
|
|
ProcessCmbxSelectedValueChange(ppCmbxFormat, _DefaultFormatName, ppBtnDefaultFmt, ppLblFormatDefault);
|
|
}
|
|
|
|
private void ppBtnDefaultFmt_Click(object sender, EventArgs e)
|
|
{
|
|
ppCmbxFormat.SelectedIndex = -1; //reset to the default Format setting
|
|
//tcpFmtSettings.Focus();
|
|
}
|
|
|
|
/// <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(FolderConfig.PrintChangeBar.WithUserSpecified)) ||
|
|
//(ppCmbxChangeBarType.SelectedValue == null && pcb.Equals(FolderConfig.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)
|
|
{
|
|
if (!_Initializing)
|
|
{
|
|
PrintChangeBar pcb = (PrintChangeBar)Enum.Parse(typeof(PrintChangeBar), _DefaultChgBarType);
|
|
ProcessCmbxSelectionEnumChanged(ppCmbxChangeBarType, pcb, ppBtnDefaultChgBar, ppLblChangeBarTypeDefault);
|
|
setEnabledUserSpecifiedChgBarCombos(pcb);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Reset to the parent setting.
|
|
/// Find the parent setting and assign it to _FolderConfig.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 != _FolderConfig.Print_ChangeBar)
|
|
_FolderConfig.Print_ChangeBar = pcb; // this will force a database update (write)
|
|
ppCmbxChangeBarType.SelectedIndex = -1; //reset combo box to the default Change Bar setting
|
|
//_Initializing = false;
|
|
//tcpFmtSettings.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);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Reset to the parent setting.
|
|
/// Find the parent setting and assign it to _FolderConfig.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 != _FolderConfig.Print_ChangeBarLoc)
|
|
_FolderConfig.Print_ChangeBarLoc = cbl; // this will force a database update (write)
|
|
ppCmbxChgBarPos.SelectedIndex = -1; //reset to the default Change Bar Position setting
|
|
//tcpFmtSettings.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();
|
|
//tcpFmtSettings.Focus();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Reset to the parent setting.
|
|
/// Find the parent setting and assign it to _FolderConfig.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 != _FolderConfig.Print_ChangeBarText)
|
|
_FolderConfig.Print_ChangeBarText = cbt; // this will force a database update (write)
|
|
ppCmbxChgBarTxtType.SelectedIndex = -1; //reset to the default Change Bar Text Type setting
|
|
//tcpFmtSettings.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(FolderConfig.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));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Selection in Change Bar User Message One text changed.
|
|
/// </summary>
|
|
/// <param name="sender">object</param>
|
|
/// <param name="e">EventArgs</param>
|
|
private void ppTxbxChangeBarUserMsgOne_TextChanged(object sender, EventArgs e)
|
|
{
|
|
//ppBtnDefCbTxt1.Visible = (!_FolderConfig.Name.Equals("VEPROMS")) &&
|
|
// ((ppTxbxChangeBarUserMsgOne.Text != null) && !ppTxbxChangeBarUserMsgOne.Text.Equals(_DefaultChgBarUsrMsg1));
|
|
ppBtnDefCbTxt1.Visible = ((ppTxbxChangeBarUserMsgOne.Text != null) && !ppTxbxChangeBarUserMsgOne.Text.Equals(_DefaultChgBarUsrMsg1));
|
|
ppLblChgBarUserMsgOneDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefCbTxt1.Visible;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Selection in Change Bar User Message Two text changed.
|
|
/// </summary>
|
|
/// <param name="sender">object</param>
|
|
/// <param name="e">EventArgs</param>
|
|
private void ppTxbxChangeBarUserMsgTwo_TextChanged(object sender, EventArgs e)
|
|
{
|
|
//ppBtnDefCbTxt2.Visible = (!_FolderConfig.Name.Equals("VEPROMS")) &&
|
|
// ((ppTxbxChgBarUserMsgTwo.Text != null) && !ppTxbxChgBarUserMsgTwo.Text.Equals(_DefaultChgBarUsrMsg2));
|
|
ppBtnDefCbTxt2.Visible = ((ppTxbxChgBarUserMsgTwo.Text != null) && !ppTxbxChgBarUserMsgTwo.Text.Equals(_DefaultChgBarUsrMsg2));
|
|
ppLblChgBarUserMsgTwoDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefCbTxt2.Visible;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Editor Settings tab
|
|
|
|
/// <summary>
|
|
/// This is the Editor Settings button used on the button interface design
|
|
/// </summary>
|
|
/// <param name="sender">object</param>
|
|
/// <param name="e">EventArgs</param>
|
|
private void btnEdSettings_Click(object sender, EventArgs e)
|
|
{
|
|
ProcessButtonClick(tiEditSettings, btnEdSettings);
|
|
}
|
|
|
|
#region Editor Color Property Page Settings
|
|
/** The property page for these color settings is not visible for now.
|
|
*
|
|
/// <summary>
|
|
/// Set the text and background colors for the sample text for the Step Editor Text Colors
|
|
/// on the Editor Settings property page
|
|
/// </summary>
|
|
private void SetupSampleTextBoxes()
|
|
{
|
|
ppPanelViewSample.BackColor = cGetColor(_ViewBckgndColor);
|
|
ppLblViewRO.ForeColor = cGetColor(_ROcolor);
|
|
ppLblViewTrans.ForeColor = cGetColor(_TransColor);
|
|
ppPanelEditSample.BackColor = cGetColor(_EditBckgndColor);
|
|
ppLblEditRO.ForeColor = cGetColor(_ROcolor);
|
|
ppLblEditTrans.ForeColor = cGetColor(_TransColor);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Selection in View Mode Background Color changed.
|
|
/// </summary>
|
|
/// <param name="sender">object</param>
|
|
/// <param name="e">EventArgs</param>
|
|
private void ppColorPickerViewModebckgnd_SelectedColorChanged(object sender, EventArgs e)
|
|
{
|
|
_ViewBckgndColor = strMakeColorName(ppColorPickerViewModebckgnd.SelectedColor);
|
|
SetupSampleTextBoxes();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Selection in Edit Mode Background Color changed.
|
|
/// </summary>
|
|
/// <param name="sender">object</param>
|
|
/// <param name="e">EventArgs</param>
|
|
private void ppColorPickerEditModeBckGnd_SelectedColorChanged(object sender, EventArgs e)
|
|
{
|
|
_EditBckgndColor = strMakeColorName(ppColorPickerEditModeBckGnd.SelectedColor);
|
|
_FolderConfig.Color_editbackground = _EditBckgndColor;
|
|
SetupSampleTextBoxes();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Selection in Transition Color changed.
|
|
/// </summary>
|
|
/// <param name="sender">object</param>
|
|
/// <param name="e">EventArgs</param>
|
|
private void ppColorPickerTransition_SelectedColorChanged(object sender, EventArgs e)
|
|
{
|
|
_TransColor = strMakeColorName(ppColorPickerTransition.SelectedColor);
|
|
SetupSampleTextBoxes();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Selection in RO Color changed.
|
|
/// </summary>
|
|
/// <param name="sender">object</param>
|
|
/// <param name="e">EventArgs</param>
|
|
private void ppColorPickerRO_SelectedColorChanged(object sender, EventArgs e)
|
|
{
|
|
_ROcolor = strMakeColorName(ppColorPickerRO.SelectedColor);
|
|
SetupSampleTextBoxes();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Preview the current color under mouse pointer
|
|
/// For View Mode Background
|
|
/// </summary>
|
|
/// <param name="sender">object</param>
|
|
/// <param name="e">ColorPreviewEventArgs</param>
|
|
private void ppColorPickerViewModebckgnd_ColorPreview(object sender, DevComponents.DotNetBar.ColorPreviewEventArgs e)
|
|
{
|
|
ppPanelViewSample.BackColor = e.Color;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Finalize the current color under mouse pointer
|
|
/// For View Mode Background
|
|
/// </summary>
|
|
/// <param name="sender">object</param>
|
|
/// <param name="e">EventArgs</param>
|
|
private void ppColorPickerViewModebckgnd_PopupFinalized(object sender, EventArgs e)
|
|
{
|
|
ppPanelViewSample.BackColor = cGetColor(_ViewBckgndColor);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Preview the current color under mouse pointer
|
|
/// For Edit Mode Background
|
|
/// </summary>
|
|
/// <param name="sender">object</param>
|
|
/// <param name="e">ColorPreviewEventArgs</param>
|
|
private void ppColorPickerEditModeBckGnd_ColorPreview(object sender, DevComponents.DotNetBar.ColorPreviewEventArgs e)
|
|
{
|
|
ppPanelEditSample.BackColor = e.Color;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Finalize the current color under mouse pointer
|
|
/// For Edit Mode Background
|
|
/// </summary>
|
|
/// <param name="sender">object</param>
|
|
/// <param name="e">EventArgs</param>
|
|
private void ppColorPickerEditModeBckGnd_PopupFinalized(object sender, EventArgs e)
|
|
{
|
|
ppPanelEditSample.BackColor = cGetColor(_EditBckgndColor);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Preview the current color under mouse pointer
|
|
/// For Transition
|
|
/// </summary>
|
|
/// <param name="sender">object</param>
|
|
/// <param name="e">ColorPreviewEventArgs</param>
|
|
private void ppColorPickerTransition_ColorPreview(object sender, DevComponents.DotNetBar.ColorPreviewEventArgs e)
|
|
{
|
|
ppLblViewTrans.ForeColor = e.Color;
|
|
ppLblEditTrans.ForeColor = e.Color;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Finalize the current color under mouse pointer
|
|
/// For Transition
|
|
/// </summary>
|
|
/// <param name="sender">object</param>
|
|
/// <param name="e">EventArgs</param>
|
|
private void ppColorPickerTransition_PopupFinalized(object sender, EventArgs e)
|
|
{
|
|
ppLblViewTrans.ForeColor = cGetColor(_TransColor);
|
|
ppLblEditTrans.ForeColor = cGetColor(_TransColor);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Preview the current color under mouse pointer
|
|
/// For RO
|
|
/// </summary>
|
|
/// <param name="sender">object</param>
|
|
/// <param name="e">ColorPreviewEventArgs</param>
|
|
private void ppColorPickerRO_ColorPreview(object sender, DevComponents.DotNetBar.ColorPreviewEventArgs e)
|
|
{
|
|
ppLblViewRO.ForeColor = e.Color;
|
|
ppLblEditRO.ForeColor = e.Color;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Finalize the current color under mouse pointer
|
|
/// For RO
|
|
/// </summary>
|
|
/// <param name="sender">object</param>
|
|
/// <param name="e">EventArgs</param>
|
|
private void ppColorPickerRO_PopupFinalized(object sender, EventArgs e)
|
|
{
|
|
ppLblViewRO.ForeColor = cGetColor(_ROcolor);
|
|
ppLblEditRO.ForeColor = cGetColor(_ROcolor);
|
|
}
|
|
**/
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// Selection in Step Editor Columns 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 fcl = (FormatColumns)Enum.Parse(typeof(FormatColumns), _DefaultFormatColumns);
|
|
ProcessCmbxSelectionEnumChanged(ppCmbxStpEditorCols, fcl, ppBtnDefEdCols, ppLblStpEditorColsDefault);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Reset to the parent setting.
|
|
/// Find the parent setting and assign it to _FolderConfig.Format_Columns.
|
|
/// This will force the database to be updated.
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void ppBtnDefEdCols_Click(object sender, EventArgs e)
|
|
{
|
|
// Get the parent setting
|
|
FormatColumns fcl = (FormatColumns)Enum.Parse(typeof(FormatColumns), _DefaultFormatColumns);
|
|
// Compare parent setting with current setting
|
|
if (fcl != _FolderConfig.Format_Columns)
|
|
_FolderConfig.Format_Columns = fcl; // this will force a database update (write)
|
|
ppCmbxStpEditorCols.SelectedIndex = -1; //reset to the default Step Editor Columns setting
|
|
//tcpEdSettings.Focus();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Generic functions used on this property page
|
|
|
|
/// <summary>
|
|
/// Convert the given System.Drawing.Color to a string containing either the color's name or the Argb.
|
|
/// </summary>
|
|
/// <param name="c">System.Drawing.Color</param>
|
|
/// <returns></returns>
|
|
private string strMakeColorName(Color c)
|
|
{
|
|
string rtnstring = "";
|
|
if (c.IsNamedColor)
|
|
rtnstring = c.Name;
|
|
else
|
|
rtnstring = string.Format("[A={0},R={1},G={2},B={3}]", c.A, c.R, c.G, c.B);
|
|
return rtnstring;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get a System.Drawing.Color from an Argb or color name
|
|
/// </summary>
|
|
/// <param name="strColor">Color Name or "[(alpha,)red,green,blue]"</param>
|
|
/// <returns></returns>
|
|
// a copy of this function was put in frmVEPROMS.CS
|
|
private static Color cGetColor(string strColor)
|
|
{
|
|
Color rtnColor; // = new Color();
|
|
if (strColor == null || strColor.Equals(""))
|
|
rtnColor = Color.White;
|
|
else
|
|
{
|
|
if (strColor[0] == '[')
|
|
{
|
|
string[] parts = strColor.Substring(1, strColor.Length - 2).Split(",".ToCharArray());
|
|
int parts_cnt = 0;
|
|
foreach (string s in parts)
|
|
{
|
|
parts[parts_cnt] = parts[parts_cnt].TrimStart(' '); // remove preceeding blanks
|
|
parts_cnt++;
|
|
}
|
|
if (parts_cnt == 3)
|
|
rtnColor = Color.FromArgb(Int32.Parse(parts[0]), Int32.Parse(parts[1]), Int32.Parse(parts[2]));
|
|
else
|
|
rtnColor = Color.FromArgb(Int32.Parse(parts[0].Substring(2)), Int32.Parse(parts[1].Substring(2)), Int32.Parse(parts[2].Substring(2)), Int32.Parse(parts[3].Substring(2)));
|
|
}
|
|
else rtnColor = Color.FromName(strColor);
|
|
}
|
|
return rtnColor;
|
|
}
|
|
|
|
/// <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>
|
|
/// Determines what labels (showing default values) are visable on the property pages
|
|
/// </summary>
|
|
private void defaultSettingsVisiblity()
|
|
{
|
|
ppLblDefSettingsInfo.Visible = ppCbShwDefSettings.Checked;
|
|
|
|
ppLblChgBarUserMsgOneDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefCbTxt1.Visible;
|
|
ppLblChgBarUserMsgTwoDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefCbTxt2.Visible;
|
|
|
|
ppLblAutoDuplexDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDeftDisAutoDuplx.Visible;
|
|
ppLblStpEditorColsDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefEdCols.Visible;
|
|
ppLblGrphFileExtDefault.Visible = (ppCbShwDefSettings.Checked || _IsVepromsNode) && ppBtnDefaultGrphFileExt.Visible;
|
|
ppLblWatermarkDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefWatermark.Visible;
|
|
//ppLblPaginationDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefPagination.Visible;
|
|
ppLblChgBarTxtTypeDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefCbTxtTyp.Visible;
|
|
ppLblFormatDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultFmt.Visible;
|
|
ppLblChangeBarTypeDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultChgBar.Visible;
|
|
ppLblChgBarPosDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultCbPos.Visible;
|
|
}
|
|
|
|
/// <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.Focus();
|
|
button.PerformClick();
|
|
}
|
|
button.Visible = (cmbx.SelectedValue != null);//(!_FolderConfig.Name.Equals("VEPROMS")) && (cmbx.SelectedValue != null);
|
|
deflabel.Visible = (ppCbShwDefSettings.Checked || _IsVepromsNode) && 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 = (!_IsVepromsNode && (cmbx.SelectedValue != null)&&(cmbx.SelectedIndex >= 0));
|
|
deflabel.Visible = ppCbShwDefSettings.Checked && button.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();
|
|
tcFolder.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;
|
|
btnEdSettings.Checked = false;
|
|
btnFormatSettings.Checked = false;
|
|
btnOutputSettings.Checked = false;
|
|
btnRefObjs.Checked = false;
|
|
btnStMsg.Checked = false;
|
|
btnAnnoTypes.Checked = false;
|
|
btnRevisionStages.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();
|
|
}
|
|
#endregion
|
|
|
|
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 != _FolderConfig.Print_UserCBMess1)
|
|
{
|
|
//_Initializing = true;
|
|
_FolderConfig.Print_UserCBMess1 = _DefaultChgBarUsrMsg1; // this will force a database update (write)
|
|
ppLblChgBarUserMsgOneDefault.Visible = false;
|
|
ppBtnDefCbTxt1.Visible = false;
|
|
//tcpFmtSettings.Focus();
|
|
//_Initializing = false;
|
|
}
|
|
}
|
|
|
|
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 != _FolderConfig.Print_UserCBMess2)
|
|
{
|
|
_FolderConfig.Print_UserCBMess2 = _DefaultChgBarUsrMsg2; // this will force a database update (write)
|
|
ppLblChgBarUserMsgTwoDefault.Visible = false;
|
|
ppBtnDefCbTxt2.Visible = false;
|
|
//tcpFmtSettings.Focus();
|
|
}
|
|
}
|
|
|
|
private void ppBtnDeftDisAutoDuplx_Click(object sender, EventArgs e)
|
|
{
|
|
ppChbxDisAutoDuplex.Checked = _DefaultDisableDuplex;
|
|
_FolderConfig.Print_DisableDuplex = ppChbxDisAutoDuplex.Checked;
|
|
ppBtnDeftDisAutoDuplx.Visible = false;
|
|
ppLblAutoDuplexDefault.Visible = false;
|
|
//tcpOutputSettings.Focus();
|
|
}
|
|
|
|
private void frmFolderProperties_Shown(object sender, EventArgs e)
|
|
{
|
|
ppRTxtName.Focus();
|
|
}
|
|
|
|
private void btnAnnoTypes_Click(object sender, EventArgs e)
|
|
{
|
|
ProcessButtonClick(tiAnnoTypes, btnAnnoTypes);
|
|
}
|
|
|
|
private void btnApprvStages_Click(object sender, EventArgs e)
|
|
{
|
|
ProcessButtonClick(tiRevisionStages, btnRevisionStages);
|
|
}
|
|
|
|
#region Annotation Types
|
|
private void lbAnnotationTypes_SelectedIndexChanged(object sender, System.EventArgs e)
|
|
{
|
|
if (btnAnnoTypeUndo.Enabled)
|
|
{
|
|
btnAnnoTypeUndo.Enabled = false;
|
|
btnAnnoTypeApply.Enabled = false;
|
|
//DialogResult dr = MessageBox.Show("The Annotation Description was changed. \n\nSave your Changes?", "Annotation Desctiption", MessageBoxButtons.YesNo);
|
|
//if (dr == DialogResult.Yes)
|
|
//{
|
|
myLocalAnnotationTypeInfoList[_LastAnnotationTypeInfoIndex].Name = tbxAnnotationDescription.Text;
|
|
RefreshAnnotationTypeList();
|
|
//}
|
|
}
|
|
LoadLocalAnnotationTypeInfo();
|
|
}
|
|
|
|
private int _LastAnnotationTypeInfoIndex = 0;
|
|
private void LoadLocalAnnotationTypeInfo()
|
|
{
|
|
btnAnnoTypeUndo.Enabled = false;
|
|
btnAnnoTypeApply.Enabled = false;
|
|
_LastAnnotationTypeInfoIndex = lbAnnotationTypes.SelectedIndex;
|
|
|
|
LocalAnnotationTypeInfo ai = lbAnnotationTypes.SelectedValue as LocalAnnotationTypeInfo;
|
|
if (ai == null)
|
|
{
|
|
tbxAnnotationDescription.Text = "";
|
|
tbxAnnotationDescription.Enabled = false;
|
|
btnAnnoTypeUndo.Enabled = false;
|
|
btnAnnoTypeApply.Enabled = false;
|
|
btnAnnoTypeNew.Enabled = true;
|
|
btnAnnoTypeRemove.Enabled = false;
|
|
txbxRemoveMsg.Visible = false;
|
|
lblAnnoTypeCntMessage.Visible = false;
|
|
return;
|
|
}
|
|
tbxAnnotationDescription.Enabled = true;
|
|
tbxAnnotationDescription.Text = ai.Name;
|
|
btnAnnoTypeUndo.Enabled = false;
|
|
btnAnnoTypeApply.Enabled = false;
|
|
if (ai.AnnotationTypeAnnotationCount == 0)
|
|
{
|
|
btnAnnoTypeRemove.Enabled = true;
|
|
txbxRemoveMsg.Visible = false;
|
|
lblAnnoTypeCntMessage.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
string countMsg = string.Format("{0} is used in {1} places", ai.Name, ai.AnnotationTypeAnnotationCount);
|
|
btnAnnoTypeRemove.Enabled = false;
|
|
lblAnnoTypeCntMessage.Text = countMsg;
|
|
txbxRemoveMsg.Visible = true;
|
|
lblAnnoTypeCntMessage.Visible = true;
|
|
}
|
|
if (lbAnnotationTypes.SelectedIndex >= 0)
|
|
{
|
|
tbxAnnotationDescription.Focus();
|
|
tbxAnnotationDescription.SelectAll();
|
|
}
|
|
}
|
|
|
|
private void tbxAnnotationDescription_TextChanged(object sender, EventArgs e)
|
|
{
|
|
btnAnnoTypeUndo.Enabled = true;
|
|
btnAnnoTypeApply.Enabled = true;
|
|
}
|
|
|
|
private void tiAnnoTypes_Click(object sender, EventArgs e)
|
|
{
|
|
lbAnnotationTypes.SelectedIndex = -1;
|
|
lbAnnotationTypes.Invalidate();
|
|
}
|
|
|
|
private void RefreshAnnotationTypeList()
|
|
{
|
|
lbAnnotationTypes.DataSource = null;
|
|
lbAnnotationTypes.DataSource = myLocalAnnotationTypeInfoList;//myAnnotationTypeInfoList = AnnotationTypeInfoList.Get();
|
|
lbAnnotationTypes.DisplayMember = "Name";
|
|
}
|
|
|
|
private void btnAnnoTypeNew_Click(object sender, EventArgs e)
|
|
{
|
|
if (btnAnnoTypeUndo.Enabled) // save the current changes
|
|
{
|
|
btnAnnoTypeUndo.Enabled = false;
|
|
btnAnnoTypeApply.Enabled = false;
|
|
myLocalAnnotationTypeInfoList[_LastAnnotationTypeInfoIndex].Name = tbxAnnotationDescription.Text;
|
|
RefreshAnnotationTypeList();
|
|
}
|
|
LocalAnnotationTypeInfo lati = new LocalAnnotationTypeInfo("New Annotation Type");
|
|
lati.Name = string.Format("{0} {1}", lati.Name, lati.TypeID);
|
|
myLocalAnnotationTypeInfoList.Add(lati);
|
|
//myLocalAnnotationTypeInfoList.Add(new LocalAnnotationTypeInfo("New Annotation Type"));
|
|
btnAnnoTypeUndo.Enabled = false;
|
|
btnAnnoTypeApply.Enabled = false;
|
|
RefreshAnnotationTypeList();
|
|
btnAnnoTypeRemove.Enabled = true;
|
|
lbAnnotationTypes.SelectedIndex = lbAnnotationTypes.Items.Count - 1;
|
|
_LastAnnotationTypeInfoIndex = lbAnnotationTypes.SelectedIndex;
|
|
}
|
|
|
|
private void btnAnnoTypeUndo_Click(object sender, EventArgs e)
|
|
{
|
|
tbxAnnotationDescription.Undo();
|
|
btnAnnoTypeUndo.Enabled = false;
|
|
btnAnnoTypeApply.Enabled = false;
|
|
//int saveIdx = lbAnnotationTypes.SelectedIndex;
|
|
//LocalAnnotationTypeInfo ai = lbAnnotationTypes.SelectedValue as LocalAnnotationTypeInfo;
|
|
//btnAnnoTypeSave.Enabled = false;
|
|
//ai.Name = tbxAnnotationDescription.Text;
|
|
//RefreshAnnotationTypeList();
|
|
//lbAnnotationTypes.SelectedIndex = saveIdx;
|
|
}
|
|
|
|
private void btnAnnoTypeRemove_Click(object sender, EventArgs e)
|
|
{
|
|
LocalAnnotationTypeInfo ai = lbAnnotationTypes.SelectedValue as LocalAnnotationTypeInfo;
|
|
myLocalAnnotationTypeInfoList.Remove(ai);
|
|
int saveIdx = lbAnnotationTypes.SelectedIndex;
|
|
btnAnnoTypeRemove.Enabled = false;
|
|
btnAnnoTypeUndo.Enabled = false;
|
|
btnAnnoTypeApply.Enabled = false;
|
|
RefreshAnnotationTypeList();
|
|
if (saveIdx > lbAnnotationTypes.Items.Count - 1)
|
|
lbAnnotationTypes.SelectedIndex = saveIdx - 1;
|
|
else
|
|
{
|
|
lbAnnotationTypes.SelectedIndex = saveIdx;
|
|
LoadLocalAnnotationTypeInfo();
|
|
}
|
|
}
|
|
|
|
private void tbxAnnotationDescription_Validating(object sender, CancelEventArgs e)
|
|
{
|
|
if (_ValidateTextBox)
|
|
{
|
|
string newname = tbxAnnotationDescription.Text;
|
|
LocalAnnotationTypeInfo ai = lbAnnotationTypes.SelectedValue as LocalAnnotationTypeInfo;
|
|
if (newname.Trim().Length == 0)
|
|
{
|
|
MessageBox.Show("An Annotation Type Name Cannot Be Blank", "Annotation Type");
|
|
e.Cancel = true;
|
|
}
|
|
else
|
|
{
|
|
foreach (LocalAnnotationTypeInfo lati in myLocalAnnotationTypeInfoList)
|
|
if (lati.Name == newname && lati.TypeID != ai.TypeID)
|
|
{
|
|
MessageBox.Show("An Annotation Type of this Name already exists.", "Annotation Type");
|
|
e.Cancel = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void btnAnnoTypeRemove_MouseEnter(object sender, EventArgs e)
|
|
{
|
|
_ValidateTextBox = false;
|
|
}
|
|
|
|
private void btnAnnoTypeRemove_MouseLeave(object sender, EventArgs e)
|
|
{
|
|
_ValidateTextBox = true;
|
|
}
|
|
|
|
#endregion
|
|
#region Revision Stages
|
|
|
|
private void tbRevisionStage_TextChanged(object sender, EventArgs e)
|
|
{
|
|
btnRevisoinStageUndo.Enabled = true;
|
|
btnRevisionStageApply.Enabled = true;
|
|
}
|
|
|
|
|
|
private void btnRevisionStageNew_Click(object sender, EventArgs e)
|
|
{
|
|
LocalStageInfo lsi = new LocalStageInfo("New Stage", 0);
|
|
lsi.Name = string.Format("{0} {1}", lsi.Name, lsi.ID);
|
|
//myLocalStageInfoList.Add(new LocalStageInfo("New Stage", 0));
|
|
myLocalStageInfoList.Add(lsi);
|
|
btnRevisoinStageUndo.Enabled = false;
|
|
btnRevisionStageApply.Enabled = false;
|
|
RefreshRevisionStagesList();
|
|
btnRevisionStageRemove.Enabled = true;
|
|
lbRevisionStages.SelectedIndex = lbRevisionStages.Items.Count - 1;
|
|
}
|
|
|
|
private void RefreshRevisionStagesList()
|
|
{
|
|
lbRevisionStages.DataSource = null;
|
|
lbRevisionStages.DataSource = myLocalStageInfoList;
|
|
lbRevisionStages.DisplayMember = "Name";
|
|
}
|
|
|
|
private void btnRevisionStageRemove_Click(object sender, EventArgs e)
|
|
{
|
|
LocalStageInfo si = lbRevisionStages.SelectedValue as LocalStageInfo;
|
|
myLocalStageInfoList.Remove(si);
|
|
int savIdx = lbRevisionStages.SelectedIndex;
|
|
btnRevisionStageRemove.Enabled = false;
|
|
btnRevisoinStageUndo.Enabled = false;
|
|
btnRevisionStageApply.Enabled = false;
|
|
RefreshRevisionStagesList();
|
|
if (savIdx > lbRevisionStages.Items.Count - 1)
|
|
lbRevisionStages.SelectedIndex = savIdx - 1;
|
|
else
|
|
{
|
|
lbRevisionStages.SelectedIndex = savIdx;
|
|
LoadLocalStageInfo();
|
|
}
|
|
|
|
}
|
|
|
|
private void btnRevisionStageUndo_Click(object sender, EventArgs e)
|
|
{
|
|
tbRevisionStage.Undo();
|
|
btnRevisoinStageUndo.Enabled = false;
|
|
btnRevisionStageApply.Enabled = false;
|
|
LocalStageInfo si = lbRevisionStages.SelectedValue as LocalStageInfo;
|
|
rbApprovalStage.Checked = (si.IsApproved > 0);
|
|
rbWorkflowStage.Checked = (si.IsApproved == 0);
|
|
//int savIdx = lbRevisionStages.SelectedIndex;
|
|
//LocalStageInfo si = lbRevisionStages.SelectedValue as LocalStageInfo;
|
|
//si.Name = tbRevisionStage.Text;
|
|
//si.IsApproved = rbRevisionStage.Checked ? 1 : 0;
|
|
//RefreshRevisionStagesList();
|
|
//lbRevisionStages.SelectedIndex = savIdx;
|
|
|
|
}
|
|
|
|
private void lbRevisionStages_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (btnRevisoinStageUndo.Enabled)
|
|
{
|
|
btnRevisoinStageUndo.Enabled = false;
|
|
btnRevisionStageApply.Enabled = false;
|
|
//DialogResult dr = MessageBox.Show("The Approval Stage Description was changed. \n\nSave your Changes?", "Approval Stage Desctiption", MessageBoxButtons.YesNo);
|
|
//if (dr == DialogResult.Yes)
|
|
//{
|
|
myLocalStageInfoList[_LastStageInfoIndex].Name = tbRevisionStage.Text;
|
|
myLocalStageInfoList[_LastStageInfoIndex].IsApproved = rbApprovalStage.Checked ? 1 : 0;
|
|
RefreshRevisionStagesList();
|
|
//}
|
|
}
|
|
LoadLocalStageInfo();
|
|
}
|
|
private int _LastStageInfoIndex = -1;
|
|
private void LoadLocalStageInfo()
|
|
{
|
|
btnRevisoinStageUndo.Enabled = false;
|
|
btnRevisionStageApply.Enabled = false;
|
|
_LastStageInfoIndex = lbRevisionStages.SelectedIndex;
|
|
LocalStageInfo si = lbRevisionStages.SelectedValue as LocalStageInfo;
|
|
if (si == null)
|
|
{
|
|
tbRevisionStage.Text = "";
|
|
tbRevisionStage.Enabled = false;
|
|
btnRevisoinStageUndo.Enabled = false;
|
|
btnRevisionStageApply.Enabled = false;
|
|
btnRevisionStageNew.Enabled = true;
|
|
btnRevisionStageRemove.Enabled = false;
|
|
return;
|
|
}
|
|
tbRevisionStage.Enabled = true;
|
|
tbRevisionStage.Text = si.Name;
|
|
if (si.IsApproved > 0)
|
|
rbApprovalStage.Checked = true;
|
|
else
|
|
rbWorkflowStage.Checked = true;
|
|
btnRevisoinStageUndo.Enabled = false;
|
|
btnRevisionStageApply.Enabled = false;
|
|
btnRevisionStageRemove.Enabled = true;
|
|
if (lbRevisionStages.SelectedIndex >= 0)
|
|
{
|
|
tbRevisionStage.Focus();
|
|
tbRevisionStage.SelectAll();
|
|
}
|
|
}
|
|
|
|
private void tiRevisionStages_Click(object sender, EventArgs e)
|
|
{
|
|
lbRevisionStages.SelectedIndex = -1;
|
|
lbRevisionStages.Invalidate();
|
|
}
|
|
|
|
private void rbWorkflowStage_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
btnRevisoinStageUndo.Enabled = true;
|
|
btnRevisionStageApply.Enabled = true;
|
|
}
|
|
|
|
private void rbApproveStage_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
btnRevisoinStageUndo.Enabled = true;
|
|
btnRevisionStageApply.Enabled = true;
|
|
}
|
|
|
|
private void tbRevisionStage_Validating(object sender, CancelEventArgs e)
|
|
{
|
|
if (_ValidateTextBox)
|
|
{
|
|
string newname = tbRevisionStage.Text;
|
|
LocalStageInfo si = lbRevisionStages.SelectedValue as LocalStageInfo;
|
|
if (newname.Trim().Length == 0)
|
|
{
|
|
MessageBox.Show("The Revision Stage Name Cannot Be Blank", "Revision Stage");
|
|
e.Cancel = true;
|
|
}
|
|
else
|
|
{
|
|
foreach (LocalStageInfo lsi in myLocalStageInfoList)
|
|
if (lsi.Name == newname && lsi.ID != si.ID)
|
|
{
|
|
MessageBox.Show("A Revision Stage of this Name already exists.", "Revision Stage");
|
|
e.Cancel = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void btnRevisionStageRemove_MouseEnter(object sender, EventArgs e)
|
|
{
|
|
_ValidateTextBox = false;
|
|
}
|
|
|
|
private void btnRevisionStageRemove_MouseLeave(object sender, EventArgs e)
|
|
{
|
|
_ValidateTextBox = true;
|
|
}
|
|
|
|
private void rbReviseStage_MouseEnter(object sender, EventArgs e)
|
|
{
|
|
_ValidateTextBox = false;
|
|
}
|
|
|
|
private void rbReviseStage_MouseLeave(object sender, EventArgs e)
|
|
{
|
|
_ValidateTextBox = true;
|
|
}
|
|
|
|
private void rbApproveStage_MouseEnter(object sender, EventArgs e)
|
|
{
|
|
_ValidateTextBox = false;
|
|
}
|
|
|
|
private void rbApproveStage_MouseLeave(object sender, EventArgs e)
|
|
{
|
|
_ValidateTextBox = true;
|
|
}
|
|
#endregion
|
|
|
|
private void btnRevisionStageApply_Click(object sender, EventArgs e)
|
|
{
|
|
//add code to apply changes
|
|
btnRevisoinStageUndo.Enabled = false;
|
|
btnRevisionStageApply.Enabled = false;
|
|
LocalStageInfo si = lbRevisionStages.SelectedValue as LocalStageInfo;
|
|
//rbApprovalStage.Checked = (si.IsApproved > 0);
|
|
//rbWorkflowStage.Checked = (si.IsApproved == 0);
|
|
si.Name = tbRevisionStage.Text;
|
|
si.IsApproved = rbApprovalStage.Checked ? 1 : 0;
|
|
RefreshRevisionStagesList();
|
|
}
|
|
|
|
private void btnAnnoTypeApply_Click(object sender, EventArgs e)
|
|
{
|
|
//add code
|
|
btnAnnoTypeUndo.Enabled = false;
|
|
btnAnnoTypeApply.Enabled = false;
|
|
LocalAnnotationTypeInfo ati = lbAnnotationTypes.SelectedValue as LocalAnnotationTypeInfo;
|
|
ati.Name = tbxAnnotationDescription.Text;
|
|
RefreshAnnotationTypeList();
|
|
}
|
|
|
|
|
|
}
|
|
public partial class LocalStageInfo
|
|
{
|
|
private static int _UniqueID = 0;
|
|
protected static int UniqueID
|
|
{ get { return --_UniqueID; } }
|
|
private int _MyUniqueID = UniqueID;
|
|
public int MyUniqueID // Absolutely Unique ID - Editable
|
|
{ get { return _MyUniqueID; } }
|
|
private int _ID;
|
|
public int ID
|
|
{
|
|
get { return _ID; }
|
|
set { _ID = value; }
|
|
}
|
|
private string _Name;
|
|
public string Name
|
|
{
|
|
get { return _Name; }
|
|
set { _Name = value; }
|
|
}
|
|
private int _IsApproved;
|
|
public int IsApproved
|
|
{
|
|
get { return _IsApproved; }
|
|
set { _IsApproved = value; }
|
|
}
|
|
private int _StageVersionCount;
|
|
public int StageVersionCount
|
|
{
|
|
get { return _StageVersionCount; }
|
|
set { _StageVersionCount = value; }
|
|
}
|
|
public LocalStageInfo(string name, int isApproved)
|
|
{
|
|
ID = MyUniqueID;
|
|
Name = name;
|
|
IsApproved = isApproved;
|
|
StageVersionCount = 0;
|
|
}
|
|
public LocalStageInfo(StageInfo si)
|
|
{
|
|
ID = si.StageID;
|
|
Name = si.Name;
|
|
IsApproved = si.IsApproved;
|
|
StageVersionCount = si.StageVersionCount;
|
|
}
|
|
public override string ToString()
|
|
{
|
|
return string.Format("{0} {1}", ID, Name);
|
|
}
|
|
}
|
|
public partial class LocalStageInfoList : List<LocalStageInfo>
|
|
{
|
|
public LocalStageInfoList(StageInfoList sil)
|
|
{
|
|
foreach (StageInfo si in sil)
|
|
Add(new LocalStageInfo(si));
|
|
}
|
|
}
|
|
|
|
public partial class LocalAnnotationTypeInfo
|
|
{
|
|
private static int _UniqueID = 0;
|
|
protected static int UniqueID
|
|
{ get { return --_UniqueID; } }
|
|
private int _MyUniqueID = UniqueID;
|
|
public int MyUniqueID // Absolutely Unique ID - Editable
|
|
{ get { return _MyUniqueID; } }
|
|
private int _TypeID;
|
|
public int TypeID
|
|
{
|
|
get { return _TypeID; }
|
|
set { _TypeID = value; }
|
|
}
|
|
private string _Name;
|
|
public string Name
|
|
{
|
|
get { return _Name; }
|
|
set { _Name = value; }
|
|
}
|
|
private int _AnnotationTypeAnnotationCount;
|
|
public int AnnotationTypeAnnotationCount
|
|
{
|
|
get { return _AnnotationTypeAnnotationCount; }
|
|
set { _AnnotationTypeAnnotationCount = value; }
|
|
}
|
|
public LocalAnnotationTypeInfo(string name)
|
|
{
|
|
TypeID = MyUniqueID;
|
|
Name = name;
|
|
AnnotationTypeAnnotationCount = 0;
|
|
}
|
|
public LocalAnnotationTypeInfo(AnnotationTypeInfo ai)
|
|
{
|
|
TypeID = ai.TypeID;
|
|
Name = ai.Name;
|
|
AnnotationTypeAnnotationCount = ai.AnnotationTypeAnnotationCount;
|
|
}
|
|
public override string ToString()
|
|
{
|
|
return string.Format("{0} {1}", TypeID, Name);
|
|
}
|
|
}
|
|
public partial class LocalAnnotationTypeInfoList : List<LocalAnnotationTypeInfo>
|
|
{
|
|
public LocalAnnotationTypeInfoList(AnnotationTypeInfoList ail)
|
|
{
|
|
foreach (AnnotationTypeInfo ai in ail)
|
|
Add(new LocalAnnotationTypeInfo(ai));
|
|
}
|
|
}
|
|
|
|
} |