///------------------------------------------------------------------------------------------------- /// <summary> /// Prepare a new schema builder from an existing definition. /// </summary> /// <typeparam name="T"> /// Generic type parameter. /// </typeparam> /// <param name="schemas"> /// The schemas to act on. /// </param> /// <param name="definition"> /// The definition. /// </param> /// <returns> /// A SchemaBuilder. /// </returns> ///------------------------------------------------------------------------------------------------- public static SchemaBuilder <T> New <T>(this IModelList <ISchema> schemas, T definition) where T : class, ISchemaDefinition { Contract.Requires(definition, "definition"); var store = schemas.Store as IDomainManager; return(new SchemaBuilder <T>(store, definition)); }
///------------------------------------------------------------------------------------------------- /// <summary> /// Unload a domain or an extension. /// </summary> /// <param name="models"> /// The models to act on. /// </param> /// <param name="scope"> /// domain or extension to unload. /// </param> ///------------------------------------------------------------------------------------------------- public static void Unload(this IModelList <IDomainModel> models, IDomainModel scope) { Contract.Requires(scope, "scope"); var store = models.Store as IDomainManager; store.UnloadDomainOrExtension(scope); }
public static IModelLayoutViewItem AddItem(this IModelList <IModelViewLayoutElement> group, string viewItem, int index) { var item = ((IModelNode)group).AddNode <IModelLayoutViewItem>(); item.ViewItem = item.ViewItems[viewItem]; item.Index = index; return(item); }
public ViewModel(IModelList list, IXamlScriptGenerator generator) { _modelList = list; _xamlscriptgenerator = generator; ItemsCollection = new ObservableCollection <Item>(_xamlscriptgenerator.GetData(datafile).Select( x => new Item { Path = x.Path, Image = _modelList.GetBitmap(x.Image), Name = x.Name }).ToList()); DragCommand = new RelayCommand(Execute, CanExecute); ClickStartCommand = new RelayCommand(StartApplication, CanExecute); }
private void Initialize() { changeVariantController = Frame.GetController <ChangeVariantController>(); if (changeVariantController != null) { changeVariantController.ChangeVariantAction.Executed += ChangeVariantAction_ExecutedCompleted; } modelViews = (IModelList <IModelView>)View.Model.Application.Views; variantsProvider = Application.Modules.FindModule <ViewVariantsModule>().VariantsProvider; rootModelViewVariants = (IModelList <IModelVariant>)((IModelViewVariants)modelViews[GetRootViewId()]).Variants; }
protected override void Dispose(bool disposing) // It is important to release references here and not within the overridden OnDeactivated method, because this Controller is deactivated when changing the current View variant. { if (disposing) { UnsubscribeFromEvents(); changeVariantController = null; variantsProvider = null; rootModelViewVariants = null; modelViews = null; } base.Dispose(disposing); }
public void WriteList(IModelList modelList, PropertyInfo property) { if (modelList == null) { return; } _writer.WriteStartElement(property.Name); XmlArrayItemAttribute xmlArrayItem = FindAttributeOnProperty <XmlArrayItemAttribute>(property); string overrideElementName = (xmlArrayItem == null) ? string.Empty : xmlArrayItem.ElementName; foreach (var modelListItem in modelList) { WriteClass(modelListItem, overrideElementName); } _writer.WriteEndElement(); }
///------------------------------------------------------------------------------------------------- /// <summary> /// Prepare a new domain builder. /// </summary> /// <param name="models"> /// The models to act on. /// </param> /// <param name="definition"> /// (Optional) the definition. /// </param> /// <returns> /// A DomainBuilder. /// </returns> ///------------------------------------------------------------------------------------------------- public static DomainBuilder New(this IModelList <IDomainModel> models, IDomainConfiguration definition = null) { var store = models.Store as IDomainManager; return(new DomainBuilder(store, definition ?? new DomainConfiguration())); }
///------------------------------------------------------------------------------------------------- /// <summary> /// Prepare a new schema builder using a definition. /// </summary> /// <typeparam name="T"> /// Type of the schema definition to use. /// </typeparam> /// <param name="schemas"> /// The schemas to act on. /// </param> /// <returns> /// A SchemaBuilder. /// </returns> ///------------------------------------------------------------------------------------------------- public static SchemaBuilder <T> New <T>(this IModelList <ISchema> schemas) where T : class, ISchemaDefinition, new() { var store = schemas.Store as IDomainManager; return(new SchemaBuilder <T>(store, new T())); }
///------------------------------------------------------------------------------------------------- /// <summary> /// Enumerates all in this collection. /// </summary> /// <typeparam name="T"> /// Generic type parameter. /// </typeparam> /// <param name="list"> /// The list to act on. /// </param> /// <returns> /// An enumerator that allows foreach to be used to process all in this collection. /// </returns> ///------------------------------------------------------------------------------------------------- public static IEnumerable <T> All <T>(this IModelList <T> list) where T : class, IDomainModel { var scopes = list as IScopeManager <T>; return(scopes.GetScopes(ScopesSelector.Enabled, Session.Current != null ? Session.Current.SessionId : 0)); }
/// <summary> /// Override default constructor. /// Dependency Injections(Constructor injection) /// </summary> public ModelListTest() { model = new ModelList(); }
public override object Execute(Expression expression) { LinqQueryDescription queryDescription = Translate(expression); // Call the API.. string xml = _proxy.FindElements(queryDescription); Response response = ModelSerializer.DeserializeTo <Response>(xml); // Guard against an empty response.. IModelList elementCollection = (response == null) ? (IModelList)Activator.CreateInstance(queryDescription.ElementListType) // TODO: too much going on here, needs tidying up : response.GetTypedProperty(queryDescription.ElementListType); if (queryDescription.ClientSideExpression == null) { return(elementCollection); } switch (queryDescription.ClientSideExpression) { case "FirstOrDefault": return(elementCollection.Count == 0 ? null : elementCollection[0]); case "First": if (elementCollection.Count == 0) { throw new InvalidOperationException("The ModelList contains no items"); } return(elementCollection[0]); case "SingleOrDefault": if (elementCollection.Count > 1) { throw new InvalidOperationException("The ModelList contains no items"); } if (elementCollection.Count == 0) { return(null); } return(elementCollection[0]); case "Single": if (elementCollection.Count != 1) { throw new InvalidOperationException("The ModelList contains no items"); } return(elementCollection[0]); case "Count": return(elementCollection.Count); default: throw new NotImplementedException(string.Format("The client side aggregator {0} cannot currently be performed", queryDescription.ClientSideExpression)); } }
public ViewVariantParameterObject(IModelList <IModelVariant> variants) { this.variants = variants; }