Saving config in a background thread, cause "refresh before save" error.

Hello,

I’m doing some updates of custom item configuration in background. My plugin is in the ManagementClient based on ItemManager class exemple.

After the user has finished his configuration, i’m saving it. Then, I open a thread that add and update few config and adding new hardware in a batch mode.

But this error happens, almost every time:

is-it possible to prevent this to happen ? Or at least, hide it until my batch-thread is complete?

I’ve already tried theese:

  • Configuration.Instance.BeginMassUpdate();
  • EnvironmentManager.Instance.EnableConfigurationChangedService = false;
  • _userControl.ParentForm.Enabled = false;

Or maybe I’ve to play more with this one?

  • Configuration.Instance.RefreshConfiguration(x);

Thanks.

I believe that before you start updating configuration you should do a Configuration.Instance.RefreshConfiguration(x);

When you have done the update, you should send a message

--

ApplicationRefreshTreeViewCommand = “System.ApplicationRefreshTreeViewCommand”

-

This message can be send by a plug-in in the administrators when the plug-in has an updated list of items to show in the TreeView.

This message should not be used during normal Add/Delete/Rename operations.

--

if not sending the message, the user might get that same error when working in the Management Client afterwards.

Thanks, I could manage to have much less this prompt.

But I’m still having issue with refreshing configuration. My plugin add MIPdriver to recording server in background. So my Management Client doesn’t see the change until user press F5.

I’m now trying to send a message to force the ManagementClient to refresh, but I can’t get them working. Is it also a ApplicationRefreshTreeViewCommand for fully-refresh the RecordingServer tab, like “F5” does ?

EnvironmentManager.Instance.SendMessage(

new VideoOS.Platform.Messaging.Message(

MessageId.System.ApplicationRefreshTreeViewCommand

) { Data = ??? }

);

Thanks again for your help,

The send message will only refresh MIP items, not the main corporate objects, like hardware and cameras.

My best suggestion is that you simply display a text on the screen to ask the admin press the F5 function key to get an updated list of hardware.