예제 #1
0
 public static XpandListView CreateListView(XafApplication xafApplication, string viewId, CollectionSourceBase collectionSource,
                                       bool isRoot) {
     IModelView modelView = xafApplication.FindModelView(viewId);
     if (modelView == null) {
         throw new Exception(SystemExceptionLocalizer.GetExceptionMessage(ExceptionId.NodeWasNotFound, viewId));
     }
     var modelListView = ((IModelListView)modelView);
     if (modelListView == null) {
         throw new ArgumentException(string.Format(
             "A '{0}' node was passed while a '{1}' node was expected. Node id: '{2}'",
             typeof(IModelDetailView).Name, typeof(IModelListView).Name, modelListView.Id));
     }
     var result = new XpandListView(collectionSource, xafApplication, isRoot);
     result.SetModel(modelListView);
     return result;
 }
예제 #2
0
        public static XpandListView CreateListView(XafApplication xafApplication, string viewId, CollectionSourceBase collectionSource,
                                                   bool isRoot)
        {
            IModelView modelView = xafApplication.FindModelView(viewId);

            if (modelView == null)
            {
                throw new Exception(SystemExceptionLocalizer.GetExceptionMessage(ExceptionId.NodeWasNotFound, viewId));
            }
            var modelListView = ((IModelListView)modelView);

            if (modelListView == null)
            {
                throw new ArgumentException(
                          $"A '{typeof(IModelDetailView).Name}' node was passed while a '{typeof(IModelListView).Name}' node was expected. Node id: '{modelListView.Id}'");
            }
            var result = new XpandListView(collectionSource, xafApplication, isRoot);

            result.SetModel(modelListView);
            return(result);
        }