Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a dynamic via ViewData.CreateView<T> is not working #68

Open
khalilovcmd opened this issue Sep 24, 2016 · 1 comment
Open

Creating a dynamic via ViewData.CreateView<T> is not working #68

khalilovcmd opened this issue Sep 24, 2016 · 1 comment

Comments

@khalilovcmd
Copy link

khalilovcmd commented Sep 24, 2016

This doesn't work:

ViewData.LoadXuml ("<MyExample>\n<Panel>\n \n</Panel>\n</MyExample>", "MyExample");
ViewData.CreateView<MyExample> ( this.LayoutParent, Parent);

In class ViewData.cs, function LoadViewXuml, we are:

var viewTypeData = new ViewTypeData();
viewPresenter.ViewTypeDataList.Add(viewTypeData);

Then when creating a view, we try in class ViewPresenter.cs function GetViewTypeData:

if (_viewTypeDataDictionary == null )
{
  LoadViewTypeDataDictionary();
}

ViewTypeData viewTypeData;
if (!_viewTypeDataDictionary.TryGetValue(viewTypeName, out viewTypeData))
{
  Debug.LogError(String.Format("[MarkLight] Can't find view type \"{0}\".", viewTypeName));
                return null;
}

So I believe this was recently introduced for performance improvements, but _viewTypeDataDictionary is not going to have all the records as ViewTypeDataList in both need to be synchronised.

@khalilovcmd
Copy link
Author

A quick fix would be synchronizing both as:

if (_viewTypeDataDictionary == null || _viewTypeDataDictionary.Count < ViewTypeDataList.Count)
{
  LoadViewTypeDataDictionary();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant