168 lines
5.0 KiB
C#
168 lines
5.0 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;
|
|
|
|
namespace VEPROMS
|
|
{
|
|
public partial class frmSectionProperties : DevComponents.DotNetBar.Office2007Form
|
|
{
|
|
private string _DefaultFormatName = null;
|
|
private bool _Initializing;
|
|
private SectionConfig _SectionConfig;
|
|
|
|
public frmSectionProperties(SectionConfig sectionConfig)
|
|
{
|
|
_SectionConfig = sectionConfig;
|
|
InitializeComponent();
|
|
btnGeneral.PerformClick(); // always start with General tab or button
|
|
if (sectionConfig.Number.Length > 0)
|
|
this.Text = string.Format("{0} {1} Properties", sectionConfig.Number, sectionConfig.Title);
|
|
else
|
|
this.Text = string.Format("{0} Properties", sectionConfig.Title);
|
|
}
|
|
|
|
private void btnFlderPropOK_Click(object sender, EventArgs e)
|
|
{
|
|
sectionConfigBindingSource.EndEdit();
|
|
// Save Default settings for User
|
|
//
|
|
// Save whether we should display the default values on this property page
|
|
Settings.Default.ShowDefaultSectionProp = ppCbShwDefSettings.Checked;
|
|
Settings.Default.Save();
|
|
DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
|
|
private void btnFldrPropCancel_Click(object sender, EventArgs e)
|
|
{
|
|
sectionConfigBindingSource.CancelEdit();
|
|
this.Close();
|
|
}
|
|
|
|
private void FindDefaultValues()
|
|
{
|
|
_SectionConfig.ParentLookup = true;
|
|
// Get the default format name
|
|
_DefaultFormatName = _SectionConfig.DefaultFormatSelection;
|
|
if (_DefaultFormatName != null && !(_DefaultFormatName.Equals("")))
|
|
{
|
|
ppLblFormatDefault.Text = string.Format("({0})", _DefaultFormatName);
|
|
ppCmbxFormat.WatermarkText = string.Format("{0}", _DefaultFormatName);
|
|
}
|
|
_SectionConfig.ParentLookup = false;
|
|
}
|
|
|
|
private void frmSectionProperties_Load(object sender, EventArgs e)
|
|
{
|
|
_Initializing = true;
|
|
sectionConfigBindingSource.DataSource = _SectionConfig;
|
|
|
|
formatInfoListBindingSource.DataSource = FormatInfoList.Get();
|
|
|
|
// Get the saved settings for this user
|
|
//
|
|
// Get setting telling us whether to display the default values on this property page
|
|
ppCbShwDefSettings.Checked = (Settings.Default["ShowDefaultSectionProp"] != null) ? Settings.Default.ShowDefaultSectionProp : false;
|
|
|
|
// Get the User's property page style "PropPageStyle"
|
|
// 1 - Button Dialog (default)
|
|
// 2 - Tab Dialog
|
|
if ((int)Settings.Default["PropPageStyle"] == 2) // tabbed interface
|
|
{
|
|
tcSectionProp.TabsVisible = true;
|
|
panSectBtns.Visible = false;
|
|
this.Width -= panSectBtns.Width;
|
|
}
|
|
|
|
|
|
// Get the default values for the property page information
|
|
FindDefaultValues();
|
|
|
|
ppCmbxSectPagination.DataSource = EnumDetail<SectionConfig.SectionPagination>.Details();
|
|
ppCmbxSectPagination.DisplayMember = "Description";
|
|
ppCmbxSectPagination.ValueMember = "EValue";
|
|
|
|
ppCmbxNumColumns.DataSource = EnumDetail<SectionConfig.SectionColumnMode>.Details();
|
|
ppCmbxNumColumns.DisplayMember = "Description";
|
|
ppCmbxNumColumns.ValueMember = "EValue";
|
|
|
|
_Initializing = false;
|
|
}
|
|
|
|
|
|
private void ppBtnDefaultFmt_Click(object sender, EventArgs e)
|
|
{
|
|
ppCmbxFormat.SelectedIndex = -1;
|
|
}
|
|
|
|
private void ppCmbxFormat_SelectedValueChanged(object sender, EventArgs e)
|
|
{
|
|
if ((ppCmbxFormat.SelectedIndex != -1) && _DefaultFormatName.Equals(ppCmbxFormat.SelectedValue))
|
|
{
|
|
ppBtnDefaultFmt.Focus();
|
|
ppBtnDefaultFmt.PerformClick();
|
|
}
|
|
ppBtnDefaultFmt.Visible = (ppCmbxFormat.SelectedValue != null);
|
|
ppLblFormatDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultFmt.Visible;
|
|
}
|
|
|
|
private void defaultSettingsVisiblity()
|
|
{
|
|
ppLblDefSettingsInfo.Visible = ppCbShwDefSettings.Checked;
|
|
ppLblFormatDefault.Visible = ppCbShwDefSettings.Checked && ppBtnDefaultFmt.Visible;
|
|
}
|
|
|
|
private void ppCbShwDefSettings_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
defaultSettingsVisiblity();
|
|
}
|
|
|
|
private void tabGeneral_Layout(object sender, LayoutEventArgs e)
|
|
{
|
|
if (!_Initializing)
|
|
defaultSettingsVisiblity();
|
|
}
|
|
|
|
private void btnGeneral_Click(object sender, EventArgs e)
|
|
{
|
|
ClearAllCheckedButtons();
|
|
tcSectionProp.SelectedTab = tiGeneral;
|
|
btnGeneral.Checked = true;
|
|
}
|
|
|
|
private void btnFormat_Click(object sender, EventArgs e)
|
|
{
|
|
ClearAllCheckedButtons();
|
|
tcSectionProp.SelectedTab = tiFormat;
|
|
btnFormat.Checked = true;
|
|
}
|
|
|
|
private void btnLibDocs_Click(object sender, EventArgs e)
|
|
{
|
|
ClearAllCheckedButtons();
|
|
tcSectionProp.SelectedTab = tiLibDoc;
|
|
btnLibDocs.Checked = true;
|
|
}
|
|
|
|
private void btnViewStngs_Click(object sender, EventArgs e)
|
|
{
|
|
ClearAllCheckedButtons();
|
|
tcSectionProp.SelectedTab = tiViewStnns;
|
|
btnViewStngs.Checked = true;
|
|
}
|
|
|
|
private void ClearAllCheckedButtons()
|
|
{
|
|
btnGeneral.Checked = false;
|
|
btnFormat.Checked = false;
|
|
btnLibDocs.Checked = false;
|
|
btnViewStngs.Checked = false;
|
|
}
|
|
}
|
|
} |