C
Chuckie72
Guest
I realise that I have manage this manually with a bool flag, but take this:
private bool ReadMaterialsData(ref CutToolsDatabase docMaterialsDB)
{
bool bRead = false;
try
{
System.Reflection.Module mod = GetType().Module;
string strPath = Path.GetDirectoryName(mod.FullyQualifiedName);
XmlSerializer x = new XmlSerializer(docMaterialsDB.GetType());
using (StreamReader reader = new StreamReader(Path.Combine(strPath, "Materials.xml")))
{
docMaterialsDB = (CutToolsDatabase)x.Deserialize(reader);
bRead = true;
}
}
catch (System.Exception ex)
{
_AcAp.Application.ShowAlertDialog(
string.Format("\nError: {0}\nStackTrace: {1}", ex.Message, ex.StackTrace));
}
return bRead;
}
Imagine that a user has delete items or added items to the docMaterialsDB object. Is there a way to detect that this object has been modified and warn if they click cancel button on my form?
As I say, I know I can manually add a bool and keep track of when operations were performed on the database but wondered if there was a built in mechanism.
Continue reading...
private bool ReadMaterialsData(ref CutToolsDatabase docMaterialsDB)
{
bool bRead = false;
try
{
System.Reflection.Module mod = GetType().Module;
string strPath = Path.GetDirectoryName(mod.FullyQualifiedName);
XmlSerializer x = new XmlSerializer(docMaterialsDB.GetType());
using (StreamReader reader = new StreamReader(Path.Combine(strPath, "Materials.xml")))
{
docMaterialsDB = (CutToolsDatabase)x.Deserialize(reader);
bRead = true;
}
}
catch (System.Exception ex)
{
_AcAp.Application.ShowAlertDialog(
string.Format("\nError: {0}\nStackTrace: {1}", ex.Message, ex.StackTrace));
}
return bRead;
}
Imagine that a user has delete items or added items to the docMaterialsDB object. Is there a way to detect that this object has been modified and warn if they click cancel button on my form?
As I say, I know I can manually add a bool and keep track of when operations were performed on the database but wondered if there was a built in mechanism.
Continue reading...