Exemplo n.º 1
0
        public ShowView CreateView(ShowModel model)
        {
            Type modelType = model.GetType();

            if (customTypeFactories.ContainsKey(modelType))
            {
                CreateViewHandler handler = customTypeFactories[modelType];
                return(handler(model));
            }

            if (model is TokenModel)
            {
                return(null);
            }
            if (model is ShowSettings)
            {
                return(null);
            }
            if (model is ShowZoneModel)
            {
                ShowZoneModel zoneModel = model as ShowZoneModel;
                //if (zoneModel.IsMap)
                //{
                //    return new ShowMapView(zoneModel);
                //}
                //else
                {
                    return(new ShowZoneView(zoneModel));
                }
            }
            if (model is ShowTextModel)
            {
                return(new ShowTextView(model as ShowTextModel));
            }
            if (model is ShowImageModel)
            {
                return(new ShowImageView(model as ShowImageModel));
            }
            //if (model is ShowArrowModel)
            //{
            //    return new ShowArrowView(model as ShowArrowModel);
            //}
            if (model is ShowSlidePartModel)
            {
                return(new ShowSlidePartView(model as ShowSlidePartModel));
            }
            if (model is ShowObjectModel)
            {
                //Model is just a generic ShowObject
                return(new ShowObjectView(model as ShowObjectModel));
            }
            if (model is ShowModel)
            {
                return(new ShowView(model));
            }

            return(null);
        }