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 System.Drawing.Imaging; using VEPROMS.Properties; using DescriptiveEnum; using DevComponents.DotNetBar; using DevComponents.DotNetBar.Controls; namespace VEPROMS { public partial class frmVersionsProperties : DevComponents.DotNetBar.Office2007Form { // Default values private string _DefaultFormatName = null; private string _DefaultROPrefix = null; private string _DefaultImagePrefix = 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 bool _DefaultDisableDuplex = false; // For the initial release, we are assuming there will be only one rofst for a docversion. Changes // will be needed here if more than 1. private ROFstInfo _SelectedROFst; public ROFstInfo SelectedROFst { get { if (_SelectedROFst == null) { if (_DocVersionConfig.MyDocVersion.DocVersionAssociationCount < 1) return null; _SelectedROFst = ROFstInfo.Get(_DocVersionConfig.MyDocVersion.DocVersionAssociations[0].MyROFst.ROFstID); } return _SelectedROFst; } set { _SelectedROFst = value; } } // private bool _Initializing; private DocVersionConfig _DocVersionConfig; public frmVersionsProperties(DocVersionConfig docVersionConfig) { _DocVersionConfig = docVersionConfig; _Initializing = true; InitializeComponent(); btnGeneral.PerformClick(); // always start with General tab or button _Initializing = false; //build the caption this.Text = string.Format("{0} Properties", _DocVersionConfig.Name); } private void btnVersionsPropOK_Click(object sender, EventArgs e) { docVersionConfigBindingSource.EndEdit(); // Save Default settings for User // // Save whether we should display the default values on this property page Settings.Default.ShowDefaultVersionProp = ppCbShwDefSettings.Checked; Settings.Default.Save(); DialogResult = DialogResult.OK; _DocVersionConfig.MyDocVersion.Save().Dispose(); this.Close(); } private void btnFldrPropCancel_Click(object sender, EventArgs e) { docVersionConfigBindingSource.CancelEdit(); this.Close(); } /// /// 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. /// private void FindDefaultValues() { _DocVersionConfig.ParentLookup = true; // get default format _DefaultFormatName = _DocVersionConfig.DefaultFormatSelection; SetupDefault(_DefaultFormatName, ppLblFormatDefault, ppCmbxFormat); // Get the default Change Bar Type _DefaultChgBarType = _DocVersionConfig.Print_ChangeBar.ToString(); SetupDefault(EnumDescConverter.GetEnumDescription(_DocVersionConfig.Print_ChangeBar), ppLblChangeBarTypeDefault, ppCmbxChangeBarType); // Get the default Change Bar Location _DefaultChgBarLoc = _DocVersionConfig.Print_ChangeBarLoc.ToString(); SetupDefault(EnumDescConverter.GetEnumDescription(_DocVersionConfig.Print_ChangeBarLoc), ppLblChgBarPosDefault, ppCmbxChgBarPos); // Get the default Change Bar text _DefaultChgBarText = _DocVersionConfig.Print_ChangeBarText.ToString(); SetupDefault(EnumDescConverter.GetEnumDescription(_DocVersionConfig.Print_ChangeBarText), ppLblChgBarTxtTypeDefault, ppCmbxChgBarTxtType); // Get the default User Change Bar Message 1 _DefaultChgBarUsrMsg1 = _DocVersionConfig.Print_UserCBMess1; if (!(_DefaultChgBarUsrMsg1.Equals(""))) { ppLblChgBarUserMsgOneDefault.Text = string.Format("({0})", _DefaultChgBarUsrMsg1); } // Get the default User Change Bar Message 2 _DefaultChgBarUsrMsg2 = _DocVersionConfig.Print_UserCBMess2; if (!(_DefaultChgBarUsrMsg2.Equals(""))) { ppLblChgBarUserMsgTwoDefault.Text = string.Format("{0}", _DefaultChgBarUsrMsg2); } // Get the ro path - there is no 'default' if (_DocVersionConfig.MyDocVersion.DocVersionAssociationCount > 0) { RODbInfo rdi = RODbInfo.Get(SelectedROFst.MyRODb.RODbID); tbRoDb.Text = string.Format("{0} ({1})", rdi.ROName, rdi.FolderPath); } else { int selindx = -1; cmbRoDb.Items.Clear(); int myrodbid = -1; if (_DocVersionConfig.MyDocVersion.DocVersionAssociationCount >= 1) myrodbid = SelectedROFst.RODbID; foreach (RODbInfo rdi in RODbInfoList.Get()) { int i = cmbRoDb.Items.Add(string.Format("{0} ({1})", rdi.ROName, rdi.FolderPath)); if (rdi.RODbID == myrodbid) selindx = i; } if (cmbRoDb.Items.Count > 0) cmbRoDb.SelectedIndex = selindx; } // Get the default Print Pagination _DefaultPagination = _DocVersionConfig.Print_Pagination.ToString(); SetupDefault(EnumDescConverter.GetEnumDescription(_DocVersionConfig.Print_Pagination), ppLblPaginationDefault, ppCmbxPagination); // Get the default Watermark _DefaultWatermark = _DocVersionConfig.Print_Watermark.ToString(); SetupDefault(EnumDescConverter.GetEnumDescription(_DocVersionConfig.Print_Watermark), ppLblWatermarkDefault, ppCmbxWatermark); // Get the default Disable Duplex _DefaultDisableDuplex = _DocVersionConfig.Print_DisableDuplex; ppLblAutoDuplexDefault.Text = string.Format("(Duplex {0})", (_DefaultDisableDuplex) ? "OFF" : "ON"); _DocVersionConfig.ParentLookup = false; } private void frmVersionsProperties_Load(object sender, EventArgs e) { docVersionConfigBindingSource.DataSource = _DocVersionConfig; //formatInfoListBindingSource.DataSource = FormatInfoList.Get(); imageCodecInfoBindingSource.DataSource = ImageCodecInfo.GetImageDecoders(); ppCmbxFormat.DataSource = null; ppCmbxFormat.DisplayMember = "FullName"; ppCmbxFormat.ValueMember = "FullName"; ppCmbxFormat.DataSource = FormatInfoList.SortedFormatInfoList; // Get the saved settings for this user // // Get setting telling us whether to display the default values on this property page ppCbShwDefSettings.Checked = (Settings.Default["ShowDefaultVersionProp"] != null) ? Settings.Default.ShowDefaultVersionProp : 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) { tcVersions.TabsVisible = true; panVerBtns.Visible = false; this.Width -= panVerBtns.Width; } // Get the default values for the property page information FindDefaultValues(); ppCmbxChangeBarType.DataSource = EnumDetail.Details(); ppCmbxChangeBarType.DisplayMember = "Description"; ppCmbxChangeBarType.ValueMember = "EValue"; ppCmbxChangeBarType.SelectedIndex = -1; ppCmbxChgBarPos.DataSource = EnumDetail.Details(); ppCmbxChgBarPos.DisplayMember = "Description"; ppCmbxChgBarPos.ValueMember = "EValue"; ppCmbxChgBarPos.SelectedIndex = -1; ppCmbxChgBarTxtType.DataSource = EnumDetail.Details(); ppCmbxChgBarTxtType.DisplayMember = "Description"; ppCmbxChgBarTxtType.ValueMember = "EValue"; ppCmbxChgBarTxtType.SelectedItem = -1; ppCmbxWatermark.DataSource = EnumDetail.Details(); ppCmbxWatermark.DisplayMember = "Description"; ppCmbxWatermark.ValueMember = "EValue"; ppCmbxWatermark.SelectedIndex = -1; ppCmbxPagination.DataSource = EnumDetail.Details(); ppCmbxPagination.DisplayMember = "Description"; ppCmbxPagination.ValueMember = "EValue"; ppCmbxPagination.SelectedIndex = -1; ppCmbxProcSetType.DataSource = EnumDetail.Details(); ppCmbxProcSetType.DisplayMember = "Description"; ppCmbxProcSetType.ValueMember = "EValue"; ppCmbxProcSetType.Enabled = false; // maybe enable this if used for version creation documentInfoListBindingSource.DataSource = DocumentInfoList.GetLibraries(false); ppBtnRoDbBrowse.Visible = cmbRoDb.Visible = _DocVersionConfig.MyDocVersion.DocVersionAssociationCount == 0; btnRoDbProperties.Visible = tbRoDb.Visible = !(_DocVersionConfig.MyDocVersion.DocVersionAssociationCount == 0); ppBtnUpRoVals.Enabled = !(_DocVersionConfig.MyDocVersion.DocVersionAssociationCount == 0); // only allow update if association } #region General tab /// /// This is the General button used on the button interface design /// /// object /// EventArgs private void btnGeneral_Click(object sender, EventArgs e) { ProcessButtonClick(tiGeneral, btnGeneral); } #endregion #region Referenced Objects /// /// This is the Referenced Objects button used on the button interface design /// /// object /// EventArgs private void btnRefObjs_Click(object sender, EventArgs e) { ProcessButtonClick(tiRefObjs, btnRefObjs); } #endregion #region Output Settings /// /// This is the Output Settings button used on the button interface design /// /// object /// EventArgs private void btnOutputSettings_Click(object sender, EventArgs e) { ProcessButtonClick(tiOutputSettings, btnOutputSettings); } /// /// Selection in Pagination combo box changed. /// /// object /// EventArgs private void ppCmbxPagination_SelectedValueChanged(object sender, EventArgs e) { if (!_Initializing) { DocVersionConfig.PrintPagination pgtn = (DocVersionConfig.PrintPagination)Enum.Parse(typeof(DocVersionConfig.PrintPagination), _DefaultPagination); ProcessCmbxSelectionEnumChanged(ppCmbxPagination, pgtn, ppBtnDefPagination, ppLblPaginationDefault); } } /// /// Reset to the parent setting. /// Find the parent setting and assign it to _DocVersionConfig.Print_Pagination. /// This will force the database to be updated. /// /// /// private void ppBtnDefPagination_Click(object sender, EventArgs e) { // Get the parent setting DocVersionConfig.PrintPagination pgtn = (DocVersionConfig.PrintPagination)Enum.Parse(typeof(DocVersionConfig.PrintPagination), _DefaultPagination); // Compare parent setting with current setting if (pgtn != _DocVersionConfig.Print_Pagination) _DocVersionConfig.Print_Pagination = pgtn; // this will force a database update (write) ppCmbxPagination.SelectedIndex = -1; } /// /// Selection in Watermark combo box changed. /// /// object /// EventArgs private void ppCmbxWatermark_SelectedValueChanged(object sender, EventArgs e) { if (!_Initializing) { DocVersionConfig.PrintWatermark wtr = (DocVersionConfig.PrintWatermark)Enum.Parse(typeof(DocVersionConfig.PrintWatermark), _DefaultWatermark); ProcessCmbxSelectionEnumChanged(ppCmbxWatermark, wtr, ppBtnDefWatermark, ppLblWatermarkDefault); } } /// /// Reset to the parent setting. /// Find the parent setting and assign it to _DocVersionConfig.Print_Watermark. /// This will force the database to be updated. /// /// /// private void ppBtnDefWatermark_Click(object sender, EventArgs e) { // Get the parent setting DocVersionConfig.PrintWatermark wtr = (DocVersionConfig.PrintWatermark)Enum.Parse(typeof(DocVersionConfig.PrintWatermark), _DefaultWatermark); // Compare parent setting with current setting if (wtr != _DocVersionConfig.Print_Watermark) _DocVersionConfig.Print_Watermark = wtr; // this will force a database update (write) ppCmbxWatermark.SelectedIndex = -1; } #endregion #region Format Settings /// /// This is the Format Settings button used on the button interface design /// /// object /// EventArgs private void btnFmtSettings_Click(object sender, EventArgs e) { ProcessButtonClick(tiFmtSettings, btnFmtSettings); } private void ppBtnDefaultFmt_Click(object sender, EventArgs e) { ppCmbxFormat.SelectedIndex = -1; } /// /// If checked, will disable automatic duplexing (ex Foldout Pages) /// /// /// private void ppChbxDisAutoDuplex_CheckedChanged(object sender, EventArgs e) { if (!_Initializing) { ppBtnDeftDisAutoDuplx.Visible = (_DefaultDisableDuplex != ppChbxDisAutoDuplex.Checked); ppLblAutoDuplexDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDeftDisAutoDuplx.Visible; } } /// /// Selection in Format combo box changed. /// /// object /// EventArgs private void ppCmbxFormat_SelectedValueChanged(object sender, EventArgs e) { ProcessCmbxSelectedValueChange(ppCmbxFormat, _DefaultFormatName, ppBtnDefaultFmt, ppLblFormatDefault); } /// /// Enable or disable the user specified change bar options base on the type /// of change bar selected. /// private void setEnabledUserSpecifiedChgBarCombos(DocVersionConfig.PrintChangeBar pcb) { ppGpbxUserSpecCB.Enabled = ppCmbxChgBarPos.Enabled = ppCmbxChgBarTxtType.Enabled = ppBtnDefaultCbPos.Enabled = ppBtnDefCbTxtTyp.Enabled = (ppCmbxChangeBarType.SelectedValue != null && ppCmbxChangeBarType.SelectedValue.Equals(DocVersionConfig.PrintChangeBar.WithUserSpecified)) || (ppCmbxChangeBarType.SelectedValue == null && pcb.Equals(DocVersionConfig.PrintChangeBar.WithUserSpecified)); } /// /// Selection in Change Bar combo box changed. /// /// object /// EventArgs private void ppCmbxChangeBarType_SelectedValueChanged(object sender, EventArgs e) { if (!_Initializing) { DocVersionConfig.PrintChangeBar pcb = (DocVersionConfig.PrintChangeBar)Enum.Parse(typeof(DocVersionConfig.PrintChangeBar), _DefaultChgBarType); ProcessCmbxSelectionEnumChanged(ppCmbxChangeBarType, pcb, ppBtnDefaultChgBar, ppLblChangeBarTypeDefault); setEnabledUserSpecifiedChgBarCombos(pcb); } } /// /// Reset to the parent setting. /// Find the parent setting and assign it to _DocVersionConfig.PrintChangeBar. /// This will force the database to be updated. /// /// /// private void ppBtnDefaultChgBar_Click(object sender, EventArgs e) { // Get the parent setting DocVersionConfig.PrintChangeBar pcb = (DocVersionConfig.PrintChangeBar)Enum.Parse(typeof(DocVersionConfig.PrintChangeBar), _DefaultChgBarType); // Compare parent setting with current setting if (pcb != _DocVersionConfig.Print_ChangeBar) _DocVersionConfig.Print_ChangeBar = pcb; // this will force a database update (write) ppCmbxChangeBarType.SelectedIndex = -1; //reset combo box to the default Change Bar setting } /// /// Selection in Change Bar Position combo box changed. /// /// object /// EventArgs private void ppCmbxChgBarPos_SelectedValueChanged(object sender, EventArgs e) { if (!_Initializing) { DocVersionConfig.PrintChangeBarLoc cbl = (DocVersionConfig.PrintChangeBarLoc)Enum.Parse(typeof(DocVersionConfig.PrintChangeBarLoc), _DefaultChgBarLoc); ProcessCmbxSelectionEnumChanged(ppCmbxChgBarPos, cbl, ppBtnDefaultCbPos, ppLblChgBarPosDefault); } } /// /// Reset to the parent setting. /// Find the parent setting and assign it to _DocVersionConfig.Print_ChangeBarLoc. /// This will force the database to be updated. /// /// /// private void ppBtnDefaultCbPos_Click(object sender, EventArgs e) { // Get the parent setting DocVersionConfig.PrintChangeBarLoc cbl = (DocVersionConfig.PrintChangeBarLoc)Enum.Parse(typeof(DocVersionConfig.PrintChangeBarLoc), _DefaultChgBarLoc); // Compare parent setting with current setting if (cbl != _DocVersionConfig.Print_ChangeBarLoc) _DocVersionConfig.Print_ChangeBarLoc = cbl; // this will force a database update (write) ppCmbxChgBarPos.SelectedIndex = -1; } /// /// 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) /// private void setEnabledUserSpecifiedChgBarText() { ppGpbxUserSpecTxt.Enabled = ppTxbxChangeBarUserMsgOne.Enabled = ppTxbxChangeBarUserMsgTwo.Enabled = ppBtnDefCbTxt1.Enabled = ppBtnDefCbTxt2.Enabled = (ppCmbxChgBarTxtType.SelectedValue != null && ppCmbxChgBarTxtType.SelectedValue.Equals(DocVersionConfig.PrintChangeBarText.UserDef)); } /// /// Selection in Change Bar Text Type combo box changed. /// /// object /// EventArgs private void ppCmbxChgBarTxtType_SelectedValueChanged(object sender, EventArgs e) { if (!_Initializing) { DocVersionConfig.PrintChangeBarText cbt = (DocVersionConfig.PrintChangeBarText)Enum.Parse(typeof(DocVersionConfig.PrintChangeBarText), _DefaultChgBarText); ProcessCmbxSelectionEnumChanged(ppCmbxChgBarTxtType, cbt, ppBtnDefCbTxtTyp, ppLblChgBarTxtTypeDefault); setEnabledUserSpecifiedChgBarText(); } } /// /// Reset to the parent setting. /// Find the parent setting and assign it to _DocVersionConfig.Print_ChangeBarText. /// This will force the database to be updated. /// /// /// private void ppBtnDefCbTxtTyp_Click(object sender, EventArgs e) { // Get the parent setting DocVersionConfig.PrintChangeBarText cbt = (DocVersionConfig.PrintChangeBarText)Enum.Parse(typeof(DocVersionConfig.PrintChangeBarText), _DefaultChgBarText); // Compare parent setting with current setting if (cbt != _DocVersionConfig.Print_ChangeBarText) _DocVersionConfig.Print_ChangeBarText = cbt; // this will force a database update (write) ppCmbxChgBarTxtType.SelectedIndex = -1; } /// /// Selection in Change Bar User Message One text changed. /// /// object /// EventArgs private void ppTxbxChangeBarUserMsgOne_TextChanged(object sender, EventArgs e) { if (!_Initializing) ppBtnDefCbTxt1.Visible = (ppTxbxChangeBarUserMsgOne.Text != null); } /// /// Selection in Change Bar User Message Two text changed. /// /// object /// EventArgs private void ppTxbxChangeBarUserMsgTwo_TextChanged(object sender, EventArgs e) { if (!_Initializing) ppBtnDefCbTxt2.Visible = (ppTxbxChangeBarUserMsgTwo.Text != null); } #endregion #region Library Documents /// /// This is the Library Documents button used on the button interface design /// /// object /// EventArgs private void btnLibDocs_Click(object sender, EventArgs e) { ProcessButtonClick(tiLibDocs, btnLibDocs); } #endregion #region Generic functions used on this property page /// /// 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. /// /// type object /// type EventArgs private void tabpage_Enter(object sender, EventArgs e) { // Show or hide the labels containing the default values if (!_Initializing) defaultSettingsVisiblity(); } /// /// Determines what labels (showing default values) are visable on the property pages /// private void defaultSettingsVisiblity() { ppLblChgBarUserMsgOneDefault.Visible = ppLblChgBarUserMsgTwoDefault.Visible = ppLblDefSettingsInfo.Visible = ppCbShwDefSettings.Checked; ppLblFormatDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultFmt.Visible; ppLblChangeBarTypeDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultChgBar.Visible; ppLblChgBarPosDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultCbPos.Visible; ppLblChgBarTxtTypeDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefCbTxtTyp.Visible; ppLblPaginationDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefPagination.Visible; ppLblWatermarkDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefWatermark.Visible; ppLblAutoDuplexDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDeftDisAutoDuplx.Visible; } /// /// 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. /// private void ClearAllCheckedButtons() { btnGeneral.Checked = false; btnRefObjs.Checked = false; btnOutputSettings.Checked = false; btnFmtSettings.Checked = false; btnLibDocs.Checked = false; } /// /// Select the corresponding tab and set the button's state to checked /// /// Property Page Tab /// Corresponding Property Page Button private void ProcessButtonClick(TabItem tab, ButtonX button) { ClearAllCheckedButtons(); tcVersions.SelectedTab = tab; button.Checked = true; } /// /// Process a change in the enum combo box selection /// /// Combo Box Name /// the default enum value /// button to reset to default value /// label containing the default private void ProcessCmbxSelectionEnumChanged(ComboBoxEx cmbx, object enumval, ButtonX button, Label deflabel) { if ((cmbx.SelectedIndex != -1) && cmbx.SelectedValue.Equals(enumval)) { button.Focus(); button.PerformClick(); } button.Visible = (cmbx.SelectedValue != null); deflabel.Visible = ppCbShwDefSettings.Checked && button.Visible; } /// /// Process a change in the combo box selection /// /// Combo Box Name /// string containing default text /// button to reset to default value /// label containing the default 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; deflabel.Visible = ppCbShwDefSettings.Checked && button.Visible; } /// /// Set the watermark and default label /// /// The default text /// Label that displays the current default when view defaults is set /// Combo box with a watermark property private static void SetupDefault(string defaultText, Label lbl, ComboBoxEx cmbo) { if (defaultText != null && !(defaultText.Equals(""))) { lbl.Text = string.Format("({0})", defaultText); cmbo.WatermarkText = string.Format("{0}", defaultText); } } #endregion private void btnRoDbProperties_Click(object sender, EventArgs e) { frmRODbProperties dlgROProperties = new frmRODbProperties(_DocVersionConfig.MyDocVersion, SelectedROFst == null ? null : SelectedROFst.MyRODb); if (dlgROProperties.ShowDialog() == DialogResult.OK) { tbRoDb.Text = string.Format("{0} ({1})", SelectedROFst.MyRODb.ROName, SelectedROFst.MyRODb.FolderPath); ppBtnUpRoVals.Enabled = !(_DocVersionConfig.MyDocVersion.DocVersionAssociationCount == 0); // only allow update if association } } private void ppBtnUpRoVals_Click(object sender, EventArgs e) { // use rodb directory path of the first rofst for the this document version. Bring up a file // selection dialog starting with this path. The user can select another path. // RHM question - we talked about just using the current path, but what is the current path when // a docversion can have more than one rofst (for now, just use first?) - should I bring up a dialog? if (_DocVersionConfig.MyDocVersion.DocVersionAssociations.Count < 1) { MessageBox.Show("Error Updating ro.fst. No associated ro.fst"); return; } foreach (DocVersionAssociation dva in _DocVersionConfig.MyDocVersion.DocVersionAssociations) { RODbInfo rdi = RODbInfo.Get(dva.ROFst_RODbID); string rofstPath = rdi.FolderPath + @"\ro.fst"; if (!File.Exists(rofstPath)) { MessageBox.Show("No existing ro.fst in path " + rdi.FolderPath + ". Check for invalid path"); break; } FileInfo fiRofst = new FileInfo(rofstPath); if (SelectedROFst.DTS == fiRofst.LastWriteTime) { MessageBox.Show("ro.fst files are same for path " + rdi.FolderPath + ", import of that ro.fst will not be done"); break; } if (SelectedROFst.DTS > fiRofst.LastWriteTime) { MessageBox.Show("Cannot copy older ro.fst from " + rdi.FolderPath + ", import of that ro.fst will not be done"); break; } Cursor = Cursors.WaitCursor; ROFst newrofst = ROFstInfo.UpdateRoFst(rdi, dva, _DocVersionConfig.MyDocVersion, SelectedROFst); Cursor = Cursors.Default; } } private void ppBtnResetRoVals_Click(object sender, EventArgs e) { // This will not be supported in the first release. A discussion was held on 1/6/09 with MRC, JSJ, RHM & // KBR & it was decided that we'd wait to see if users end up needing this. It can be done by going // into the sql database and modify/delete records if needed. } private void cmbRoDb_SelectedIndexChanged(object sender, EventArgs e) { // The only way that a selected index can change on the rodb combo box is if there was no rofst // to docversion association. If a selection is made, make that association and then change the // combo box to a non-editable text box with button becoming a properties rather than browse. if (_Initializing) return; // add the rofst for the selected rodb (note that it may already exist, and will use the current // one. // get the rodb from the selection - and then do an 'update rofst'... RODbInfoList rdil = RODbInfoList.Get(); RODbInfo rdi = rdil[cmbRoDb.SelectedIndex]; ROFst tmp = ROFstInfo.AddRoFst(rdi, _DocVersionConfig.MyDocVersion); cmbRoDb.Visible = ppBtnRoDbBrowse.Visible = false; tbRoDb.Visible = btnRoDbProperties.Visible = true; tbRoDb.Text = string.Format("{0} ({1})", tmp.MyRODb.ROName, tmp.MyRODb.FolderPath); } private void ppBtnRoDbBrowse_Click(object sender, EventArgs e) { frmRODbProperties dlgROProperties = new frmRODbProperties(_DocVersionConfig.MyDocVersion, SelectedROFst == null ? null : SelectedROFst.MyRODb); // if a user has entered a valid rodb, then this docversion will be conntected to it - change // to a non-editable text box and the button becomes a properties button rather than browse. if (dlgROProperties.ShowDialog() == DialogResult.OK) { cmbRoDb.Items.Clear(); if (_DocVersionConfig.MyDocVersion.DocVersionAssociationCount > 1) { cmbRoDb.Visible = ppBtnRoDbBrowse.Visible = false; tbRoDb.Visible = btnRoDbProperties.Visible = true; tbRoDb.Text = string.Format("{0} ({1})", SelectedROFst.MyRODb.ROName, SelectedROFst.MyRODb.FolderPath); return; } RODbInfoList.Reset(); int selindx = -1; int myrodbid = (SelectedROFst == null) ? -1 : SelectedROFst.RODbID; foreach (RODbInfo rdi in RODbInfoList.Get()) { int i = cmbRoDb.Items.Add(rdi.ROName + " (" + rdi.FolderPath + ")"); if (rdi.RODbID == myrodbid) selindx = i; } if (cmbRoDb.Items.Count > 0) cmbRoDb.SelectedIndex = selindx; } } private void ppBtnPDFLoc_Click(object sender, EventArgs e) { PDFLocationBrowserDialog.SelectedPath = ppTxtBxPDFLoc.Text; DialogResult dr = PDFLocationBrowserDialog.ShowDialog(); if (dr == DialogResult.OK) ppTxtBxPDFLoc.Text = PDFLocationBrowserDialog.SelectedPath; } } }