private void DisplayErrors() { _errors.Clear(); foreach (var error in Parent.GetErrors()) { IDataObject obj = error as IDataObject; if (obj == null && error is ViewModel) { var vmdl = (ViewModel)error; if (vmdl.Parent is DataObjectViewModel) { obj = ((DataObjectViewModel)vmdl.Parent).Object; } } _errors.Add(ViewModelFactory.CreateViewModel <ErrorDescriptor.Factory>().Invoke( DataContext, this, obj == null ? null : DataObjectViewModel.Fetch(ViewModelFactory, DataContext, this, obj), new List <string>() { error.Error })); } }
public ErrorDescriptor(IViewModelDependencies dependencies, IZetboxContext dataCtx, ViewModel parent, DataObjectViewModel item, IList<string> errors) : base(dependencies, dataCtx, parent) { this._item = item; this._errors = errors; }
private DataObjectViewModel CreateNewDataObjectViewModel() { var newMock = scope.Resolve<ZetboxMockFactory>().CreateTestObject(); var dom = new DataObjectViewModel(null, GetContext(), null, newMock.Object); models[objMock.Object] = dom; return dom; }
public void CreateRelation() { var rel = _class.CreateRelation(); ViewModelFactory.ShowModel(DataObjectViewModel.Fetch(ViewModelFactory, DataContext, this, rel), true); }
public string ExtractFormattedValue(DataObjectViewModel obj) { if (obj == null) return string.Empty; string val = null; switch (this.Type) { case ColumnDisplayModel.ColumnType.ViewModelProperty: var propVal = obj.GetPropertyValue<object>(this.Path); val = propVal != null ? propVal.ToString() : string.Empty; break; case ColumnDisplayModel.ColumnType.PropertyModel: DataObjectViewModel objVmdl = obj; IFormattedValueViewModel resultVMdl = null; foreach (var current in this.Path.Split('.')) { if (objVmdl == null) break; resultVMdl = objVmdl.PropertyModelsByName[current]; if (resultVMdl is ObjectReferenceViewModel) { objVmdl = ((ObjectReferenceViewModel)resultVMdl).Value; } } val = resultVMdl != null ? resultVMdl.FormattedValue : string.Empty; break; } return val; }
public JavaScriptObjectMoniker(DataObjectViewModel m) { Init(m); }
private void Init(DataObjectViewModel m) { ID = m.ID; Type = m.GetInterfaceType().ToSerializableType(); Text = m.Name; }
public ErrorDescriptor(IViewModelDependencies dependencies, IZetboxContext dataCtx, ViewModel parent, DataObjectViewModel item, IList <string> errors) : base(dependencies, dataCtx, parent) { this._item = item; this._errors = errors; }