Exemplo n.º 1
0
        /// <summary>
        /// Loads specified view object, creates new one if it doesn't exist.
        /// </summary>
        public ViewObject LoadViewObject(string viewName, bool addIfNotExist)
        {
            if (_viewObjects == null)
            {
                _viewObjects = new Dictionary <string, ViewObject>();
                foreach (var item in ViewObjects)
                {
                    _viewObjects.Add(item.Name, item);
                }
            }

            ViewObject viewObject;

            if (_viewObjects.TryGetValue(viewName, out viewObject))
            {
                return(viewObject);
            }

            // create new view object if it doesn't exist
            viewObject = new ViewObject {
                Name = viewName, TypeName = viewName, HasXml = false
            };
            if (addIfNotExist)
            {
                ViewObjects.Add(viewObject);
                _viewObjects.Add(viewName, viewObject);
            }
            return(viewObject);
        }
Exemplo n.º 2
0
 public void Clear()
 {
     Name             = null;
     Namespace        = null;
     TypeName         = null;
     FilePath         = null;
     BasedOn          = null;
     NeedUpdate       = false;
     ContentContainer = null;
     PropertyExpressions.Clear();
     ViewDeclarations.Clear();
     Module         = null;
     HideInDesigner = false;
     ContentTemplates.Clear();
     HasContentTemplates = false;
     HasCode             = false;
     HasXml = false;
 }