Hello,
I’m trying to create a View from the Background Plugin. I’m aware it needs to include the part with “Application.Current.Dispatcher.Invoke() =>” and that I’m not using a Temporary Viewgroup to do this.
Apart from that here is my code, ran inside the Invoke():
Rectangle[] rect = new Rectangle[vs];
for (int i = 1; i < vs + 1; i++)
{
rect[i - 1] = new Rectangle(newViewLayout[i]["Position"]["X"]
, newViewLayout[i]["Position"]["Y"]
, newViewLayout[i]["Size"]["Width"]
, newViewLayout[i]["Size"]["Height"]);
}
ViewAndLayoutItem _newView = (ViewAndLayoutItem)tempParent.AddChild(windowData.View, Kind.View, FolderType.No);
_newView.Layout = rect;
_newView.Save();
It is fairly standard based on the MIPSDK plugin examples, but basically it is duplicating the View that is created, so I just get two Views with the same name but different objectId. I wonder if it is just a threading issue, since I’m sure the method that is calling this code is ran only once, so I’ve discarded that as well. Can it be an interaction from running on the Background Plugin?
On the meantime what I’ve done is a workaround where I just remove one of the duplicates.
What else am I missing?
Thank you for your time.