public override void DoAction(IEventArgs args) { FreeRuleEventArgs fr = (FreeRuleEventArgs)args; IGameUnit player = GetPlayer(args); if (StringUtil.IsNullOrEmpty(count) || count.Equals("0")) { count = "0"; } method = new SelectMethod(FreeUtil.ReplaceVar(exp, args)); if (player != null) { FreeData fd = (FreeData)player; ItemPosition[] currentItems = fd.freeInventory.Select(method); fr.TempUse("current", fd); int c = FreeUtil.ReplaceInt(count, args); for (int i = 0; i < currentItems.Length; i++) { ItemPosition ip = currentItems[i]; ip.SetCount(c); ip.GetKey().SetCount(c); ip.GetInventory().GetInventoryUI().UpdateItem(fr, ip.GetInventory(), ip); } fr.Resume("current"); } }
public virtual ItemPosition[] Select(SelectMethod sm) { IList<ItemPosition> items = new List<ItemPosition>(); DataBlock bl = new DataBlock(); foreach (string inv in inventoryManager.GetInventoryNames()) { ItemInventory ii = inventoryManager.GetInventory(inv); foreach (ItemPosition ip in ii.GetItems()) { bl.AddData(ip); } } if (sm != null) { foreach (IFeaturable fe in sm.Select(bl).GetAllDatas()) { items.Add((ItemPosition)fe); } } else { foreach (IFeaturable fe in bl.GetDataList()) { items.Add((ItemPosition)fe); } } return Sharpen.Collections.ToArray(items, new ItemPosition[0]); }
//private MapFieldSelector fieldSelector; public AzureSearchResults(AzureSearchContext context, AzureQuery query, DocumentSearchResult searchHits, int startIndex, int endIndex, SelectMethod selectMethod, IEnumerable <IExecutionContext> executionContexts, IEnumerable <IFieldQueryTranslator> virtualFieldProcessors, FieldNameTranslator fieldNameTranslator) { this.context = context; this.query = query; this.searchHits = searchHits; this.startIndex = startIndex; this.endIndex = endIndex; this.selectMethod = selectMethod; this.virtualFieldProcessors = virtualFieldProcessors; this.fieldNameTranslator = fieldNameTranslator; this.configuration = (AzureIndexConfiguration)context.Index.Configuration; //this.fieldSelector = (MapFieldSelector)null; this.executionContexts = executionContexts; var executionContext = this.executionContexts != null?Enumerable.FirstOrDefault <IExecutionContext>(this.executionContexts, (Func <IExecutionContext, bool>)(c => c is OverrideExecutionContext <IIndexDocumentPropertyMapper <Document> >)) as OverrideExecutionContext <IIndexDocumentPropertyMapper <Document> > : (OverrideExecutionContext <IIndexDocumentPropertyMapper <Document> >)null; this.mapper = (executionContext != null ? executionContext.OverrideObject : null) ?? this.configuration.IndexDocumentPropertyMapper; //if (selectMethod != null && selectMethod.FieldNames != null && selectMethod.FieldNames.Length > 0) //{ // this.fieldSelector = this.GetMapFieldSelector(context, (IEnumerable<string>)selectMethod.FieldNames); //} //else //{ // if (this.selectMethod != null) // return; // IEnumerable<string> documentFieldsToRead = this.mapper.GetDocumentFieldsToRead<TElement>(executionContexts); // this.fieldSelector = this.GetMapFieldSelector(context, documentFieldsToRead); //} }
private static void SelectExample() { Console.WriteLine("=====Example 2 (Select example)====="); Console.WriteLine(); var bandSummariesClassic = SelectMethod.GetBandSummariesClassic(bandsList); WriteBandSummaries(bandSummariesClassic); Console.WriteLine(); var bandSummariesLinqSql = SelectMethod.GetBandSummariesLinqSql(bandsList); WriteBandSummaries(bandSummariesLinqSql); Console.WriteLine(); var bandSummariesLinqLambda = SelectMethod.GetBandSummariesLinqLambda(bandsList); WriteBandSummaries(bandSummariesLinqLambda); //TODO 2: Implement SelectMethod.GetBandsReadableDescriptions Console.WriteLine(); var bandsReadableDescriptions = SelectMethod.GetBandsReadableDescriptions(bandsList); WriteStrings(bandsReadableDescriptions); Console.WriteLine(); }
public ActionResult PromotionEdit(uint id, SelectMethod method) { if (method == SelectMethod.SelectFromPrice) { return(RedirectToAction("PromotionEditFromPrice", new { id = id })); } return(RedirectToAction("PromotionEdit", new { id = id })); }
public ElasticSearchResults(ElasticSearchContext context, IQueryResponse <Dictionary <string, object> > searchResults, SelectMethod selectMethod, IEnumerable <IFieldQueryTranslator> virtualFieldProcessors) { _context = context; _elasticSearchIndexConfiguration = (ElasticSearchIndexConfiguration)_context.Index.Configuration; _mapper = (ElasticSearchDocumentPropertyMapper)_elasticSearchIndexConfiguration.IndexDocumentPropertyMapper; _selectMethod = selectMethod; _virtualFieldProcessors = virtualFieldProcessors; _resultsTotal = searchResults.Total; _searchResults = ApplySecurity(searchResults, context.SecurityOptions, ref _resultsTotal); }
public virtual IList <ParaList> Select(IList <ParaList> list, string order, int capacity) { ICollection <string> exists = new HashSet <string>(); IList <ParaList> result = new List <ParaList>(); if (StringUtil.IsNullOrEmpty(order)) { foreach (ParaList pl in list) { string key = GetKey(pl); if (StringUtil.IsNullOrEmpty(key) || !exists.Contains(key)) { result.Add(pl); if (!StringUtil.IsNullOrEmpty(key)) { exists.Add(key); } } if (capacity > 0 && result.Count >= capacity) { break; } } } else { DataBlock bl = new DataBlock(); foreach (ParaList pl in list) { bl.AddData(new ParaListSet.ParaFeature(pl)); } SelectMethod sm = new SelectMethod(order); int i = 1; foreach (IFeaturable fe in sm.Select(bl).GetAllDatas()) { ParaList pl_1 = ((ParaListSet.ParaFeature)fe).paraList; pl_1.AddPara(new IntPara(PARA_ORDER, i++)); string key = GetKey(pl_1); if (StringUtil.IsNullOrEmpty(key) || !exists.Contains(key)) { result.Add(pl_1); if (!StringUtil.IsNullOrEmpty(key)) { exists.Add(key); } } if (capacity > 0 && result.Count >= capacity) { break; } } } return(result); }
public override TElement MapToType <TElement>(Document document, SelectMethod selectMethod, IEnumerable <IFieldQueryTranslator> virtualFieldProcessors, IEnumerable <IExecutionContext> executionContexts, SearchSecurityOptions securityOptions) { var mappingResult = _synthesisMapper.MapToType <TElement>(() => ExtractFieldsFromDocument(document, virtualFieldProcessors), selectMethod); // if the result type is not IStandardTemplateItem, use the default functionality if (!mappingResult.MappedSuccessfully) { return(base.MapToType <TElement>(document, selectMethod, virtualFieldProcessors, executionContexts, securityOptions)); } return(mappingResult.Document); }
public SolrSearchResults(SolrSearchContext context, SolrQueryResults <Dictionary <string, object> > searchResults, SelectMethod selectMethod, IEnumerable <IExecutionContext> executionContexts, IEnumerable <IFieldQueryTranslator> virtualFieldProcessors) { this._context = context; this._solrIndexConfiguration = (SolrIndexConfiguration)this._context.Index.Configuration; this._selectMethod = selectMethod; this._virtualFieldProcessors = virtualFieldProcessors; this._executionContexts = executionContexts; this._numberFound = searchResults.NumFound; this._searchResults = ApplySecurity(searchResults, context.SecurityOptions, ServiceLocator.ServiceProvider.GetService <BaseCorePipelineManager>(), context.Index.Locator.GetInstance <IAccessRight>(), ref this._numberFound); var executionContext = this._executionContexts != null?this._executionContexts.FirstOrDefault(c => c is OverrideExecutionContext <IIndexDocumentPropertyMapper <Dictionary <string, object> > >) as OverrideExecutionContext <IIndexDocumentPropertyMapper <Dictionary <string, object> > > : null; this._mapper = (executionContext != null ? executionContext.OverrideObject : null) ?? this._solrIndexConfiguration.IndexDocumentPropertyMapper; }
//--------------------------------------------------------------------- public void Remove(SelectMethod <ICohort> selectMethod) { // Go through list of species cohorts from back to front so that // a removal does not mess up the loop. for (int i = cohorts.Count - 1; i >= 0; i--) { cohorts[i].Remove(selectMethod); if (cohorts[i].Count == 0) { cohorts.RemoveAt(i); } } }
public override TElement MapToType <TElement>(Document document, SelectMethod selectMethod, IEnumerable <IFieldQueryTranslator> virtualFieldProcessors, IEnumerable <IExecutionContext> executionContexts, SearchSecurityOptions securityOptions) { var typeOfTElement = typeof(TElement); if (!typeof(IItemWrapper).IsAssignableFrom(typeOfTElement)) { return(base.MapToType <TElement>(document, selectMethod, virtualFieldProcessors, executionContexts, securityOptions)); } Guid itemId; Guid templateId; var fields = ExtractFieldsFromDocument(document, virtualFieldProcessors); if (fields.ContainsKey(Templates.Fields.Group) && fields.ContainsKey(Templates.Fields.TemplateName) && Guid.TryParse(fields[Templates.Fields.Group].ToString(), out itemId) && Guid.TryParse(fields[Templates.Fields.TemplateName].ToString(), out templateId)) { var item = Global.SpawnProvider.FromItem(itemId, templateId, typeOfTElement, fields); if (item is TElement) { return((TElement)item); } } if (fields.ContainsKey(Templates.Fields.UniqueId)) { var id = fields[Templates.Fields.UniqueId].ToString(); var uri = ItemUri.Parse(id); var item = Sitecore.Context.Database.GetItem(uri.ToDataUri()); if (item != null) { var mappedItem = Global.SpawnProvider.FromItem(item); if (mappedItem is TElement) { return((TElement)mappedItem); } } } return(default(TElement)); }
//--------------------------------------------------------------------- public void Remove(SelectMethod <ICohort> selectMethod, ActiveSite site) { // Go through list of species cohorts from back to front so that // a removal does not mess up the loop. foreach (int i in Indexes.Of(cohorts).Reverse) { cohorts[i].Remove(selectMethod, site); if (cohorts[i].Count == 0) { cohorts.RemoveAt(i); } } }
//--------------------------------------------------------------------- public void Remove(SelectMethod <ICohort> selectMethod, ActiveSite site) { // Go backwards through list of ages, so the removal of an age // doesn't mess up the loop. foreach (int i in Indexes.Of(ages).Reverse) { ICohort cohort = new Cohort(species, ages[i]); if (selectMethod(cohort)) { ages.RemoveAt(i); Cohort.Died(cohort, site); } } }
private void ActionAllBalls(SelectMethod _deleghat) { object[] allBalls = GameObject.FindGameObjectsWithTag("Ball"); foreach (GameObject thisBall in allBalls) { _deleghat(thisBall); } object[] allBallsSmall = GameObject.FindGameObjectsWithTag("SmallBall"); foreach (GameObject thisBall in allBallsSmall) { _deleghat(thisBall); } //if (((GameObject) thisBall).activeInHierarchy) //print(thisBall + " is an active object") ; }
public static void InvokeSelect(this KMSelectable selectable, bool playSound, bool andInteract = false) { InputInvoker.Instance.Enqueue(delegate() { Component internalSelectable = selectable.GetComponent(SelectableType); foreach (UnityEngine.Object selectableManager in SelectableManagers) { SelectMethod.Invoke(selectableManager, new object[] { internalSelectable, playSound }); } }); if (andInteract) { InvokeInteract(); } }
public virtual void Resort(ISkillArgs args, string order) { ItemPosition[] ips = GetItems(); this.Clear(); ItemPosition[] newOrder = ips; if (!StringUtil.IsNullOrEmpty(order)) { IList <ItemPosition> ipList = new List <ItemPosition>(); DataBlock bl = new DataBlock(); foreach (ItemPosition ip in ips) { bl.AddData(ip); } IList <IFeaturable> list = new SelectMethod(order).Select(bl).GetAllDatas(); foreach (IFeaturable fe in list) { ipList.Add((ItemPosition)fe); } newOrder = Sharpen.Collections.ToArray(ipList, new ItemPosition[0]); } bool canReorder = true; foreach (ItemPosition ip_1 in newOrder) { if (inventoryUI != null) { inventoryUI.DeleteItem(args, this, ip_1); } ip_1.key.SetCount(ip_1.count); if (!AddItem(null, ip_1.key, false)) { canReorder = false; } } if (!canReorder) { this.Clear(); foreach (ItemPosition ip in ips) { AddItem(null, ip.key, false); } } if (inventoryUI != null) { inventoryUI.ReDraw(args, this, false); } }
List<string> CollectMethods(SelectMethod m) { if (m == null || !m.TargetObject) { return null; } List<string> result = new List<string>(); result.Add("None"); var methods = m.TargetObject.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public) .Where(x => x.DeclaringType == m.TargetObject.GetType()) .Where(x => x.GetParameters().Length <= 1) .Select(x => x.Name) .ToArray(); result.AddRange(methods); return result; }
//--------------------------------------------------------------------- public void Remove(SelectMethod <ICohort> selectMethod) { // Go backwards through list of ages, so the removal of an age // doesn't mess up the loop. isMaturePresent = false; for (int i = ages.Count - 1; i >= 0; i--) { ICohort cohort = new Cohort(species, ages[i]); if (selectMethod(cohort)) { ages.RemoveAt(i); } else if (ages[i] >= species.Maturity) { isMaturePresent = true; } } }
private AzureSearchResults <TElement> ApplySearchMethods <TElement>(AzureQuery query, DocumentSearchResult searchHits) { var list = query.Methods != null ? new List <QueryMethod>(query.Methods) : new List <QueryMethod>(); list.Reverse(); SelectMethod selectMethod = null; foreach (var queryMethod in list) { if (queryMethod.MethodType == QueryMethodType.Select) { selectMethod = (SelectMethod)queryMethod; } } int startIndex = 0; int endIndex = searchHits.Results.Count - 1; return(new AzureSearchResults <TElement>(context, query, searchHits, startIndex, endIndex, selectMethod, query.ExecutionContexts, query.VirtualFieldProcessors, FieldNameTranslator)); }
public override TElement MapToType <TElement>(Document document, SelectMethod selectMethod, IEnumerable <IFieldQueryTranslator> virtualFieldProcessors, SearchSecurityOptions securityOptions) { if (typeof(TElement) == typeof(SitecoreUISearchResultItem)) { return(base.MapToType <TElement>(document, selectMethod, virtualFieldProcessors, securityOptions)); } _sitecoreContext = new SitecoreContext(); if (selectMethod != null) { var parameters = selectMethod.Delegate.Method.GetParameters(); if (parameters.Length != 2) { throw new InvalidOperationException("Invalid number of select delegate parameters."); } var underlyingSystemType = parameters[1].ParameterType.UnderlyingSystemType; var instance = Activator.CreateInstance(underlyingSystemType); var strArray = selectMethod.FieldNames == null || selectMethod.FieldNames.Length <= 0 ? null : selectMethod.FieldNames; ReadDocumentFields(document, strArray, GetTypeMap(underlyingSystemType), virtualFieldProcessors, instance); return((TElement)selectMethod.Delegate.DynamicInvoke(instance)); } else { var documentFieldNames = GetDocumentFieldNames(document); var templateId = document.Get("_template"); var instance = CreateInstance <TElement>(templateId); var typeMap = GetTypeMap(instance.GetType()); //TODO: use ID.Parse on document.Get("_id") ? Guid id; if (Guid.TryParse(document.Get("_group"), out id)) { SetupProxy(id, document.GetFields().Select(x => x.Name.ToLower()), (object)instance as IProxyTargetAccessor); } ReadDocumentFields(document, documentFieldNames, typeMap, virtualFieldProcessors, instance); return(instance); } }
public override void DoAction(IEventArgs args) { FreeRuleEventArgs fr = (FreeRuleEventArgs)args; IGameUnit player = GetPlayer(args); if (player != null) { if (!StringUtil.IsNullOrEmpty(item)) { IParable pe = args.GetUnit(item); if (pe != null && pe is ItemPosition) { args.TempUse("current", (FreeData)player); ItemPosition ip = (ItemPosition)pe; ip.GetInventory().RemoveItem(fr, ip); RemoveUI(ip, fr); args.Resume("current"); } } else { method = new SelectMethod(FreeUtil.ReplaceVar(exp, args)); FreeData fd = (FreeData)player; ItemPosition[] currentItems = fd.freeInventory.Select(method); if (StringUtil.IsNullOrEmpty(count)) { count = "1"; } int c = FreeUtil.ReplaceInt(count, args); for (int i = 0; i < MyMath.Min(c, currentItems.Length); i++) { args.TempUse("current", (FreeData)player); ItemPosition ip = currentItems[i]; ip.GetInventory().RemoveItem(fr, ip); RemoveUI(ip, fr); args.Resume("current"); } } } }
//--------------------------------------------------------------------- public void Remove(SelectMethod <ICohort> selectMethod) { // Go backwards through list of cohort data, so the removal of an // item doesn't mess up the loop. isMaturePresent = false; for (int i = cohortData.Count - 1; i >= 0; i--) { ICohort cohort = new Cohort(species, cohortData[i]); if (selectMethod(cohort)) { cohortData.RemoveAt(i); Cohorts.CohortDeath(cohort, null /* current site? */); // FIXME: Need to pass in current site, which means // modifying the interface in core } else if (cohortData[i].Age >= species.Maturity) { isMaturePresent = true; } } }
public override void DoAction(IEventArgs args) { FreeRuleEventArgs fr = (FreeRuleEventArgs)args; IGameUnit player = GetPlayer(args); if (StringUtil.IsNullOrEmpty(count) || count.Equals("0")) { count = "10000000"; } if (StringUtil.IsNullOrEmpty(item)) { item = "item"; } if (player != null) { FreeData fd = (FreeData)player; if (!StringUtil.IsNullOrEmpty(id)) { ItemPosition ip = fd.freeInventory.GetItemById(FreeUtil.ReplaceInt(id, args)); if (ip != null) { HandleItem(ip, fr); } } else { if (!StringUtil.IsNullOrEmpty(exp)) { method = new SelectMethod(FreeUtil.ReplaceVar(exp, args)); ItemPosition[] currentItems = fd.freeInventory.Select(method); for (int i = 0; i < MyMath.Min(FreeUtil.ReplaceInt(count, args), currentItems.Length); i++) { ItemPosition ip = currentItems[i]; HandleItem(ip, fr); } } } } }
public DocumentMappingResult <TElement> MapToType <TElement>(Func <Dictionary <string, string> > getFieldsMethod, SelectMethod selectMethod) { // if the result type is not IStandardTemplateItem, use the default functionality if (!IsSynthesisType <TElement>()) { return(new DocumentMappingResult <TElement>(default(TElement), false)); } // initializers can't really support sub-selects of objects. Error if that's what's being used. if (selectMethod != null) { throw new NotSupportedException("Using Select on a Synthesis object type is supported. Convert the query to a list or array before selecting, then select using LINQ to objects."); } var evaluatedFields = getFieldsMethod(); ShortID templateId; if (!evaluatedFields.ContainsKey("_template") || !ShortID.TryParse(evaluatedFields["_template"], out templateId)) { templateId = ID.Null.ToShortID(); } var initializer = _overrideInitializer ?? ProviderResolver.FindGlobalInitializer(templateId.ToID()); var result = initializer.CreateInstanceFromSearch(evaluatedFields); if (result is TElement) { return(new DocumentMappingResult <TElement>((TElement)result, true)); } return(new DocumentMappingResult <TElement>(default(TElement), true)); // note that this is still 'success', because we mapped onto a Synthesis type so we do not want to use default mapping }
//--------------------------------------------------------------------- void ISpeciesCohorts <AgeCohort.ICohort> .Remove(SelectMethod <AgeCohort.ICohort> selectMethod) { Remove(new WrappedSelectMethod(selectMethod).Select); }
public override void DoAction(IEventArgs args) { Ini(args); List <FreeData> list = new List <FreeData>(); foreach (PlayerEntity unit in args.GameContext.player.GetInitializedPlayerEntities()) { if (unit.hasFreeData) { FreeData fd = (FreeData)unit.freeData.FreeData; args.TempUse(selectedName, fd); if (con == null || con.Meet(args)) { list.Add(fd); } args.Resume(selectedName); } } if (!StringUtil.IsNullOrEmpty(order)) { DataBlock bl = new DataBlock(); foreach (FreeData fd in list) { bl.AddData(fd); } if (method == null || FreeUtil.IsVar(order)) { method = new SelectMethod(order); } list.Clear(); foreach (IFeaturable fe in method.Select(bl).GetAllDatas()) { list.Add((FreeData)fe); } } if (list.Count > 0) { if (count > 0) { int[] ids = RandomUtil.Random(0, list.Count - 1, count); if (!StringUtil.IsNullOrEmpty(order)) { ids = new int[(int)MyMath.Min(count, list.Count)]; for (int i = 0; i < ids.Length; i++) { ids[i] = i; } } for (int i = 0; i < ids.Length; i++) { int id = ids[i]; FreeData unit = list[id]; args.TempUsePara(new IntPara("index", i + 1)); args.TempUsePara(new IntPara("count", ids.Length)); args.TempUse(selectedName, unit); action.Act(args); args.Resume(selectedName); args.ResumePara("index"); args.ResumePara("count"); } } else { int i = 1; foreach (FreeData unit in list) { args.TempUsePara(new IntPara("index", i++)); args.TempUsePara(new IntPara("count", list.Count)); args.TempUse(selectedName, unit); action.Act(args); args.Resume(selectedName); args.ResumePara("index"); args.ResumePara("count"); } } } else { if (noneAction != null) { noneAction.Act(args); } } }
public override object GetValue(IEventArgs args) { if (!StringUtil.IsNullOrEmpty(autoCondition)) { select = new SelectMethod(FreeUtil.ReplaceVar(autoCondition, args)); } IList <ParaList> list = new List <ParaList>(); ParaListSet pls = null; foreach (UnitPara sort in UnitPara.Parse(sorts)) { IParable pa = args.GetUnit(sort.GetUnit()); if (pa == null) { continue; } IPara para = pa.GetParameters().Get(sort.GetPara()); if (para == null) { continue; } if (para != null && para is ParaListSet) { ParaListSet ps = (ParaListSet)para; pls = ps; foreach (ParaList pl in ps) { list.Add(pl); } } } IList <SimpleProto> results = new List <SimpleProto>(); if (pls != null && list.Count > 0) { IList <ParaList> r = pls.Select(list, FreeUtil.ReplaceVar(order, args), capacity); int min = 0; int max = 0; if (!StringUtil.IsNullOrEmpty(range)) { string[] vs = StringUtil.Split(FreeUtil.ReplaceVar(range, args), "-"); if (vs.Length == 2) { min = int.Parse(vs[0]); max = int.Parse(vs[1]); } } foreach (ParaList pl in r) { if (min != max) { int paraOrder = (int)pl.GetFeatureValue(ParaListSet.PARA_ORDER); if (paraOrder < min || paraOrder > max) { continue; } } SimpleProto b = FreePool.Allocate(); b.Ks.Add(0); b.Key = 0; b.Ss.Add("0"); string[] fs = StringUtil.Split(fields, ","); for (int i = 0; i < fs.Length; i++) { b.Ks.Add(i + 1); b.Ss.Add(pl.GetFeatureValue(fs[i]).ToString()); if (select != null) { pl.TempUse(new IntPara("seq", i + 1)); if (select.Meet(pl)) { b.Ins.Add(2 * 100); } else { b.Ins.Add(0); } pl.Resume("seq"); } else { b.Ins.Add(0); } } results.Add(b); } } return(results.ToArray()); }
public void SelectHoveringMethod() { selectMethod = SelectMethod.Hovering; }
public void SelectClickingMethod() { selectMethod = SelectMethod.Clicking; }
public override TElement MapToType <TElement>(Dictionary <string, object> document, SelectMethod selectMethod, IEnumerable <IFieldQueryTranslator> virtualFieldProcessors, SearchSecurityOptions securityOptions) { var typeOfTElement = typeof(TElement); if (!typeof(IItemWrapper).IsAssignableFrom(typeOfTElement)) { return(base.MapToType <TElement>(document, selectMethod, virtualFieldProcessors, securityOptions)); } Guid itemId; Guid templateId; if (document.ContainsKey(Templates.Fields.Group) && document.ContainsKey(Templates.Fields.TemplateName) && Guid.TryParse(document[Templates.Fields.Group].ToString(), out itemId) && Guid.TryParse(document[Templates.Fields.TemplateName].ToString(), out templateId)) { var item = Global.SpawnProvider.FromItem(itemId, templateId, typeOfTElement, document); if (item is TElement) { return((TElement)item); } } return(default(TElement)); }
//--------------------------------------------------------------------- public WrappedSelectMethod(SelectMethod<AgeCohort.ICohort> selectMethod) { this.selectMethod = selectMethod; }
public SelectMusicTask(ObservableCollection<MusicEntry> musicEntries, long maxSpace) { _musicEntries = musicEntries; _maxSpace = maxSpace; _selectMethod = SelectMethod.Space; }
public SelectMusicTask(ObservableCollection<MusicEntry> musicEntries, int maxNumber) { _musicEntries = musicEntries; _maxNumber = maxNumber; _selectMethod = SelectMethod.Count; }