public bool SaveData()
{
bool newObject = false;
if (_representedObject == null)
{
hMailServer.Application app = APICreator.Application;
hMailServer.Settings settings = app.Settings;
hMailServer.IncomingRelays IncomingRelays = settings.IncomingRelays;
_representedObject = IncomingRelays.Add();
newObject = true;
Marshal.ReleaseComObject(settings);
Marshal.ReleaseComObject(IncomingRelays);
}
_representedObject.Name = textName.Text;
_representedObject.LowerIP = textLower.Text;
_representedObject.UpperIP = textUpper.Text;
_representedObject.Save();
// Refresh the node in the tree if the name has changed.
IMainForm mainForm = Instances.MainForm;
mainForm.RefreshCurrentNode(textName.Text);
// Set the object to clean.
DirtyChecker.SetClean(this);
if (newObject)
{
SearchNodeText crit = new SearchNodeText(_representedObject.Name);
mainForm.SelectNode(crit);
}
return true;
}