public int CompareTo(object obj) { if (obj == null || !(obj is TemplateItemModel)) { return(-1); } TemplateItemModel target = obj as TemplateItemModel; if (target.Template == null || target.Template.TemplateData == null) { return(-1); } if (this.Template == null || this.Template.TemplateData == null) { return(1); } if (this.Template.TemplateData.SortOrder < target.Template.TemplateData.SortOrder) { return(-1); } else if (this.Template.TemplateData.SortOrder > target.Template.TemplateData.SortOrder) { return(1); } else { return(0); } }
public void AddTemplateModel(TemplateItemModel model) { if (model == null) { return; } model.SetParent(this); this.TemplateList.SortedAdd <TemplateItemModel>(model); }