67 lines
1.7 KiB
C#
67 lines
1.7 KiB
C#
using System;
|
|
using System.Windows.Forms;
|
|
using VEPROMS.CSLA.Library;
|
|
|
|
namespace VEPROMS
|
|
{
|
|
public partial class frmPropGrid : DevComponents.DotNetBar.Office2007Form
|
|
{
|
|
private readonly object _PGobject;
|
|
|
|
public frmPropGrid(object pgobject)
|
|
{
|
|
InitializeComponent();
|
|
_PGobject = pgobject;
|
|
}
|
|
|
|
public frmPropGrid(object pgobject, string title)
|
|
{
|
|
InitializeComponent();
|
|
_PGobject = pgobject;
|
|
Text = title;
|
|
}
|
|
|
|
private void btnOK_Click(object sender, EventArgs e)
|
|
{
|
|
DialogResult = DialogResult.OK;
|
|
if (_PGobject is DocVersionConfig dvcfg && dvcfg.IsDirty)
|
|
{
|
|
dvcfg.MyDocVersion.Save();
|
|
}
|
|
Close();
|
|
}
|
|
|
|
private void btnCancel_Click(object sender, EventArgs e)
|
|
{
|
|
DialogResult = DialogResult.Cancel;
|
|
Close();
|
|
}
|
|
|
|
private void frmPropGrid_Load(object sender, EventArgs e)
|
|
{
|
|
Show();
|
|
pg.SelectedObject = _PGobject;
|
|
}
|
|
|
|
private void pg_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
|
|
{
|
|
if (_PGobject is DocVersionConfig dvcfg)
|
|
dvcfg.IsDirty = true;
|
|
// check if folder config & if so, check for name change
|
|
if (_PGobject is FolderConfig tstfoldercfg)
|
|
{
|
|
if ((string)e.OldValue != tstfoldercfg.Name)
|
|
{
|
|
bool isunique = tstfoldercfg.CheckUniqueName(tstfoldercfg.Name);
|
|
if (!isunique)
|
|
{
|
|
MessageBox.Show(string.Format("The Name '{0}' that was entered is not a unique folder name", tstfoldercfg.Name));
|
|
tstfoldercfg.Name = (string)e.OldValue;
|
|
}
|
|
}
|
|
}
|
|
Refresh();
|
|
|
|
}
|
|
}
|
|
} |