nilFM

nerdblog - musings, art, etc. of Derek Stevens: drkste@zoho.com

Milestone Integration Platform SDK Part II: Mysterious Behavior

2020-12-14

In part I of this series, I gave an expositon of the craziness that is the Milestone MIP SDK (and what turned out to be a very glaring fault in the documentation), in my attempts to create a new Alarm Definition using the SDK. Now, I've made some progress, and have some interesting things to share!

So, after being informed by the developers of the SDK of what the documentation should have made obvious, I was able to craft a WPF control that creates AlarmDefinitions, and without muchado I was able to get said form to list available Alarms from the server and also delete and edit them.

Except...

When editing existing AlarmDefinitions, everything goes well -- set the dropdowns, add stuff to the multiselects, hit save -- Looks like success.

What..?

Refresh the alarm and... it didn't save...

For whatever reason, even if I log all the properties of the alarm right before saving and they all look as they should. And I can call
AlarmDefinition.Save()
and it comes back without exception, indicating a successful save, but when you reload the alarm the save doesn't go through.

I debugged this backwards and forwards off and on for a few weeks, and finally made headway by taking a step back and making an automated edit to a single alarm and saving it right when the window loaded. So I modified my saving routine to fetch a new copy of the alarm I'm editing and copy all the properties of the instance I edited with the form (and validated), and save that one. I have no idea why it seems that calling
AlarmDefinition.ValidateItem()
causes
AlarmDefinition.Save()
to cease working.

So, take one mystery and replace it with another... Hell, at least I can ship my feature now!