示例#1
0
        private IWidgetModel GetModelFromJsonString(WidgetConfig widget, string jsonModel)
        {
            if (jsonModel != null)
            {
                return(JsonConvert.DeserializeObject(jsonModel, widget.ModelType) as IWidgetModel);
            }

            return(null);
        }
示例#2
0
        private IWidgetModel GetNamedModel(WidgetConfig widget, string namedModel)
        {
            foreach (var modelProvider in _namedModelProviders)
            {
                var model = modelProvider.GetModel(widget.WidgetType, namedModel, widget.ModelType);

                if (model != null)
                {
                    return(model);
                }
            }

            return(null);
        }
示例#3
0
        private IWidgetModel GetModelFromJsonFile(WidgetConfig widget, string jsonFilePath)
        {
            if (!string.IsNullOrEmpty(jsonFilePath))
            {
                var jsonModel = File.ReadAllText(jsonFilePath);

                if (string.IsNullOrEmpty(jsonModel.Trim()))
                {
                    throw new NullReferenceException($"Cannot convert widget model. Null or empty file {jsonFilePath}");
                }

                return(GetModelFromJsonString(widget, jsonModel));
            }

            return(null);
        }
示例#4
0
 internal WidgetFormEntry(WidgetConfig widget, Type componentType)
 {
     Widget        = widget;
     ComponentType = componentType;
     Tabs          = new List <string>();
 }
示例#5
0
 public WidgetBuilder(WidgetConfig config)
 {
     _widget = config;
 }
示例#6
0
 internal WidgetEditorEntry(WidgetConfig widget, Type componentType)
 {
     Widget        = widget;
     ComponentType = componentType;
 }