System.Collections.Generic.List.ForEach(System.Action)

Here are the examples of the csharp api System.Collections.Generic.List.ForEach(System.Action) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

6344 Examples 7

19 Source : MultiThread.cs
with MIT License
from alicommit-malp

[Test]
        public async Task RoundRobin_StartTo()
        {
            var rb = new RoundRobinList<int>(_data);
            rb.ResetTo(4);

            var result = new List<int>();
            var tasks = new Task[10];
            for (var i = 0; i < 10; i++)
            {
                tasks[i] = Task.Run(() => { result.Add(rb.Next()); });
            }

            await Task.WhenAll(tasks);
            result.ToList().ForEach(z => { TestContext.Write($"{z},"); });

            var mustBe = new List<int>()
            {
                5, 1, 2, 3, 4, 5,1,2,3,4
            };

            replacedert.AreEqual(result, mustBe);
        }

19 Source : Pool.cs
with MIT License
from AliakseiFutryn

private static void CleanUp(TValue item)
		{
			// Sets default values to all properties.
			item.GetType()
				.GetProperties(BindingFlags.Public)
				.ToList()
				.ForEach(propertyInfo => propertyInfo.SetValue(item, GetDefaultValue(propertyInfo.PropertyType)));

			// Sets default values to all fields.
			item.GetType()
				.GetFields(BindingFlags.Public)
				.ToList()
				.ForEach(fieldInfo => fieldInfo.SetValue(item, GetDefaultValue(fieldInfo.FieldType)));
		}

19 Source : SampleLauncher.cs
with MIT License
from AliakseiFutryn

static void Main(string[] args)
		{
			List<ICompany> companies = new List<ICompany>
			{
				new Apple(),
				new Alphabet(),
				new MicrosoftCompany()
			};

			Console.WriteLine("Companies revenue:");
			companies.ForEach(company => Console.WriteLine(company.ToString()));
			Console.ReadKey();
		}

19 Source : MultiThread.cs
with MIT License
from alicommit-malp

[Test]
        public async Task RoundRobinChunkByChunk()
        {
            var rb = new RoundRobinList<int>(_data);

            var result = new List<int>();
            var tasks = new Task[2];
            for (var i = 0; i < 2; i++)
            {
                tasks[i] = Task.Run(() =>
                {
                    var taskResult = rb.Nexts(5);
                    result.AddRange(taskResult);
                });
            }

            await Task.WhenAll(tasks);

            result.ToList().ForEach(z => { TestContext.Write($"{z},"); });

            replacedert.AreEqual(new List<int>()
            {
                1, 2, 3, 4, 5, 1, 2, 3, 4, 5
            }, result);
        }

19 Source : IsolateInfo.cs
with Apache License 2.0
from allenai

public static void Hide() { if (Instance && Instance.HiddenObjects != null) Instance.HiddenObjects.Where(go => go).ToList().ForEach(go => go.SetActive(false)); }

19 Source : IsolateInfo.cs
with Apache License 2.0
from allenai

public static void Show() { if (Instance && Instance.HiddenObjects != null) Instance.HiddenObjects.Where(go => go).ToList().ForEach(go => go.SetActive(true)); }

19 Source : DumpCreator.cs
with GNU Lesser General Public License v3.0
from Alois-xx

public string Dump(string[] procdumpArgs)
        {
            string args = GetProcDumpArgs(procdumpArgs);

            ProcessStartInfo info = new ProcessStartInfo(ProcDumpExe, $"-accepteula {args}")
            {
                CreateNoWindow = true,
                RedirectStandardOutput = true, 
                UseShellExecute = false,
            };

            var p = Process.Start(info);
            string line;
            string dumpFileName = null;
            List<string> lines = new List<string>();
            bool procDumpError = false;
            while( (line = p.StandardOutput.ReadLine()) != null )
            {
                lines.Add(line);
                if (ShowOutput)
                {
                    Console.WriteLine(line);
                }

                if( line.Contains("Error creating dump file"))
                {
                    procDumpError = true;
                }

                if (dumpFileName == null && procDumpError == false)
                { 
                    dumpFileName = GetDumpFileName(line);
                }
            }

            if( dumpFileName == null )
            {
                if(!ShowOutput)
                {
                    lines.ForEach(Console.WriteLine);
                }
                Console.WriteLine($"Error: Could not create dump file with procdump args: {args}!");
                return null;
            }
            else
            {
                Console.WriteLine($"Dump file {dumpFileName} created.");
            }


            int pid = FindPidInProcDumpArgs(procdumpArgs, out string exeName);

            if(pid == 0)
            {
                ProcessFilter filter = new ProcessFilter(exeName ?? "");
                pid = filter.GetMatchingPids().FirstOrDefault();
            }

            if (pid != 0)
            {
                string outFile = TargetInformation.GetreplacedociatedVMMapFile(dumpFileName);
                VMMap.SaveVMmapDataToFile(pid, outFile);
            }
            else
            {
                Console.WriteLine($"Error: Could not create find process id of dumped process {exeName}. No VMMap information is saved. ");
            }

            if (VerifyDump && !CanLoadDump(dumpFileName))
            {
                Console.WriteLine($"Error: Dump file cannot be parsed with Memreplacedyzer. Managed Heap might be in an inconsistent state.");
                dumpFileName = null;
            }


            return dumpFileName;
        }

19 Source : SwaggerExtensions.cs
with MIT License
from alonsoalon

public static void UseSwaggerMiddleware(this IApplicationBuilder app) {

            string ApiName = "AlonsoAdmin";

            //启用swagger中间件
            app.UseSwagger();

            //启用中间件服务swagger-ui (HTML, JS, CSS等),
            //指定Swagger JSON端点。
            app.UseSwaggerUI(c =>
            {
                //c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
                //根据版本名称倒序 遍历展示
                typeof(ApiVersions).GetEnumNames().OrderBy(e => e).ToList().ForEach(version =>
                {
                    c.SwaggerEndpoint($"/swagger/{version}/swagger.json", $"{ApiName} {version}");
                });
                c.RoutePrefix = "";//直接根目录访问
                c.DocExpansion(Swashbuckle.AspNetCore.SwaggerUI.DocExpansion.None);//折叠Api
            });

        }

19 Source : SwaggerExtensions.cs
with MIT License
from alonsoalon

public static void RegisterSwagger(this IServiceCollection services)
        {

            string ApiName = "AlonsoAdmin";

            #region Swagger 接口文档定义
            // 注册Swagger生成器,定义一个或多个Swagger文档
            services.AddSwaggerGen(c =>
            {
                //c.SwaggerDoc("v1", new OpenApiInfo { replacedle = "My API", Version = "v1" });

                //根据版本名称倒序 遍历展示
                typeof(ApiVersions).GetEnumNames().OrderBy(e => e).ToList().ForEach(version =>
                {
                    c.SwaggerDoc(version, new OpenApiInfo
                    {
                        Version = version,
                        replacedle = $"{ApiName} API",
                        Description = "Mulreplacedenant + MultiDatabase. SingleTenant + MultiDatabase. MultiApiVersion. Base on Netcore3.x + FreeSql",
                        TermsOfService = new Uri("https://www.xxx.com/"),//服务条款
                        Contact = new OpenApiContact
                        {
                            Name = "Alonso",
                            Email = string.Empty
                            //Url = new Uri("https://www.xxx.com/alonso"),
                        },
                        License = new OpenApiLicense
                        {
                            Name = "License",
                            Url = new Uri("https://www.xxx.com/license"),
                        }
                    });

                });




                var xmlFile = $"{System.Reflection.replacedembly.GetExecutingreplacedembly().GetName().Name}.xml";
                var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
                if (File.Exists(xmlPath))
                {
                    //添加注释到SwaggerUI
                    c.IncludeXmlComments(xmlPath);
                }

                #region 为SwaggerUI添加全局token验证
                c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme()
                {
                    Description = "在下框中输入请求头中需要添加Jwt授权Token:Bearer Token",
                    Name = "Authorization",
                    In = ParameterLocation.Header,
                    Type = SecuritySchemeType.ApiKey,
                    BearerFormat = "JWT",
                    Scheme = "Bearer"
                });

                c.AddSecurityRequirement(new OpenApiSecurityRequirement{
                    {
                        new OpenApiSecurityScheme{ Reference = new OpenApiReference {Type = ReferenceType.SecurityScheme,Id = "Bearer" }},
                        new string[] { }
                    }});
                #endregion
            });
            #endregion

        }

19 Source : SharedServicesRegistration.cs
with MIT License
from AlphaYu

public virtual void AddRpcService<TRpcService>(string serviceName
        , List<IAsyncPolicy<HttpResponseMessage>> policies)
         where TRpcService : clreplaced, IRpcService
        {
            var prefix = serviceName.Substring(0, 7);
            bool isConsulAdderss = prefix != "http://" && prefix != "https:/";

            var refitSettings = new RefitSettings(new SystemTextJsonContentSerializer(SystemTextJson.GetAdncDefaultOptions()));
            //注册RefitClient,设置httpclient生命周期时间,默认也是2分钟。
            var clientbuilder = _services.AddRefitClient<TRpcService>(refitSettings)
                                                         .SetHandlerLifetime(TimeSpan.FromMinutes(2));
            //如果参数是服务名字,那么需要从consul获取地址
            if (isConsulAdderss)
                clientbuilder.ConfigureHttpClient(client => client.BaseAddress = new Uri($"http://{serviceName}"))
                                    .AddHttpMessageHandler<ConsulDiscoverDelegatingHandler>();
            else
                clientbuilder.ConfigureHttpClient(client => client.BaseAddress = new Uri(serviceName))
                                    .AddHttpMessageHandler<SimpleDiscoveryDelegatingHandler>();

            //添加polly相关策略
            policies?.ForEach(policy => clientbuilder.AddPolicyHandler(policy));
        }

19 Source : EfRepository.cs
with MIT License
from AlphaYu

public async Task<int> UpdateRangeAsync(Dictionary<long, List<(string propertyName, dynamic propertyValue)>> propertyNameAndValues, CancellationToken cancellationToken = default)
        {
            var existsEnreplacedies = DbContext.Set<TEnreplacedy>().Local.Where(x => propertyNameAndValues.Keys.Contains(x.Id));

            foreach (var item in propertyNameAndValues)
            {
                var enity = existsEnreplacedies?.FirstOrDefault(x => x.Id == item.Key) ?? new TEnreplacedy { Id = item.Key };
                var entry = DbContext.Entry(enity);
                if (entry.State == EnreplacedyState.Detached)
                    entry.State = EnreplacedyState.Unchanged;

                if (entry.State == EnreplacedyState.Unchanged)
                {
                    var info = propertyNameAndValues.FirstOrDefault(x => x.Key == item.Key).Value;
                    info.ForEach(x =>
                    {
                        entry.Property(x.propertyName).CurrentValue = x.propertyValue;
                        entry.Property(x.propertyName).IsModified = true;
                    });
                }
            }

            return await DbContext.SaveChangesAsync();
        }

19 Source : MainPageViewModel.cs
with MIT License
from Altevir

private void ExecuteSelectDateCommand(DateItem model)
        {
            Dates.ToList().ForEach((item) =>
            {
                item.selected = false;
                item.backgroundColor = "Transparent";
                item.textColor = "#FFFFFF";
            });

            var index = Dates.ToList().FindIndex(p => p.day == model.day && p.dayWeek == model.dayWeek);
            if (index > -1)
            {
                Dates[index].backgroundColor = "#FCCD00";
                Dates[index].textColor = "#000000";
                Dates[index].selected = true;
            }
        }

19 Source : MainPageViewModel.cs
with MIT License
from Altevir

private void ExecuteSelectEventTypeCommand(EventType model)
        {
            EventTypes.ToList().ForEach((item) =>
            {
                item.selected = false;
                item.backgroundColor = "#29404E";
                item.textColor = "#FFFFFF";
            });

            var index = EventTypes.ToList().FindIndex(p => p.name == model.name);
            if (index > -1)
            {
                EventTypes[index].backgroundColor = "#FCCD00";
                EventTypes[index].textColor = "#000000";
                EventTypes[index].selected = true;
            }
        }

19 Source : InstantiationHelper.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn

public static List<Party> FilterPartiesByAllowedPartyTypes(List<Party> parties, PartyTypesAllowed partyTypesAllowed)
        {
            List<Party> allowed = new List<Party>();
            if (parties == null || partyTypesAllowed == null)
            {
                return allowed;
            }

            parties.ForEach(party =>
            {
                bool canPartyInstantiate = IsPartyAllowedToInstantiate(party, partyTypesAllowed);
                bool isChildPartyAllowed = false;
                List<Party> allowedChildParties = null;
                if (party.ChildParties != null)
                {
                    allowedChildParties = new List<Party>();
                    foreach (Party childParty in party.ChildParties)
                    {
                        if (IsPartyAllowedToInstantiate(childParty, partyTypesAllowed))
                        {
                            allowedChildParties.Add(childParty);
                            isChildPartyAllowed = true;
                        }
                    }
                }

                if (canPartyInstantiate && isChildPartyAllowed)
                {
                    party.ChildParties = new List<Party>();
                    party.ChildParties.AddRange(allowedChildParties);
                    allowed.Add(party);
                }
                else if (!canPartyInstantiate && isChildPartyAllowed)
                {
                    party.ChildParties = new List<Party>();
                    party.OnlyHierarchyElementWithNoAccess = true;
                    party.ChildParties.AddRange(allowedChildParties);
                    allowed.Add(party);
                }
                else if (canPartyInstantiate)
                {
                    party.ChildParties = new List<Party>();
                    allowed.Add(party);
                }
            });
            return allowed;
        }

19 Source : InstanceMockSI.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn

private static (string LastChangedBy, DateTime? LastChanged) FindLastChanged(Instance instance)
        {
            string lastChangedBy = instance.LastChangedBy;
            DateTime? lastChanged = instance.LastChanged;
            if (instance.Data == null || instance.Data.Count == 0)
            {
                return (lastChangedBy, lastChanged);
            }

            List<DataElement> newerDataElements = instance.Data.FindAll(dataElement =>
                dataElement.LastChanged != null
                && dataElement.LastChangedBy != null
                && dataElement.LastChanged > instance.LastChanged);

            if (newerDataElements.Count == 0)
            {
                return (lastChangedBy, lastChanged);
            }

            lastChanged = (DateTime)instance.LastChanged;
            newerDataElements.ForEach((DataElement dataElement) =>
            {
                if (dataElement.LastChanged > lastChanged)
                {
                    lastChangedBy = dataElement.LastChangedBy;
                    lastChanged = (DateTime)dataElement.LastChanged;
                }
            });

            return (lastChangedBy, lastChanged);
        }

19 Source : InstanceHelper.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn

public static (string LastChangedBy, DateTime? LastChanged) FindLastChanged(Instance instance)
        {
            string lastChangedBy = instance.LastChangedBy;
            DateTime? lastChanged = instance.LastChanged;
            if (instance.Data == null || instance.Data.Count == 0)
            {
                return (lastChangedBy, lastChanged);
            }

            List<DataElement> newerDataElements = instance.Data.FindAll(dataElement =>
                dataElement.LastChanged != null
                && dataElement.LastChangedBy != null
                && dataElement.LastChanged > instance.LastChanged);

            if (newerDataElements.Count == 0)
            {
                return (lastChangedBy, lastChanged);
            }

            lastChanged = (DateTime)instance.LastChanged;
            newerDataElements.ForEach((DataElement dataElement) =>
            {
                if (dataElement.LastChanged > lastChanged)
                {
                    lastChangedBy = dataElement.LastChangedBy;
                    lastChanged = (DateTime)dataElement.LastChanged;
                }
            });

            return (lastChangedBy, lastChanged);
        }

19 Source : InstanceRepository.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn

public async Task<InstanceQueryResponse> GetInstancesFromQuery(Dictionary<string, StringValues> queryParams, string continuationToken, int size)
        {
            List<string> validQueryParams = new List<string>
            {
                "org",
                "appId",
                "process.currentTask",
                "process.isComplete",
                "process.endEvent",
                "process.ended",
                "instanceOwner.partyId",
                "lastChanged",
                "created",
                "visibleAfter",
                "dueBefore",
                "excludeConfirmedBy",
                "size",
                "language",
                "status.isSoftDeleted",
                "status.isArchived",
                "status.isHardDeleted",
                "status.isArchivedOrSoftDeleted",
                "status.isActiveorSoftDeleted",
                "sortBy",
                "archiveReference"
            };

            string invalidKey = queryParams.FirstOrDefault(q => !validQueryParams.Contains(q.Key)).Key;

            if (!string.IsNullOrEmpty(invalidKey))
            {
                throw new ArgumentException($"Invalid query parameter {invalidKey}");
            }

            if (!queryParams.ContainsKey("appId"))
            {
                throw new NotImplementedException($"Queries for instances must include applicationId in local test.");
            }

            List<Instance> instances = new List<Instance>();

            string instancesPath = GetInstanceFolder();

            if (Directory.Exists(instancesPath))
            {
                string[] files = Directory.GetFiles(instancesPath, "*.json");

                foreach (var file in files)
                {
                    string content = File.ReadAllText(file);
                    Instance instance = (Instance)JsonConvert.DeserializeObject(content, typeof(Instance));
                    if (instance != null && instance.Id != null)
                    {
                        instances.Add(instance);
                    }
                }
            }

            if (queryParams.ContainsKey("org"))
            {
                string org = queryParams.GetValueOrDefault("org").ToString();
                instances.RemoveAll(i => !i.Org.Equals(org, StringComparison.OrdinalIgnoreCase));
            }

            if (queryParams.ContainsKey("appId"))
            {
                string appId = queryParams.GetValueOrDefault("appId").ToString();
                instances.RemoveAll(i => !i.AppId.Equals(appId, StringComparison.OrdinalIgnoreCase));
            }

            if (queryParams.ContainsKey("instanceOwner.partyId"))
            {
                instances.RemoveAll(i => !queryParams["instanceOwner.partyId"].Contains(i.InstanceOwner.PartyId));
            }

            if (queryParams.ContainsKey("archiveReference"))
            {
                string archiveRef = queryParams.GetValueOrDefault("archiveReference").ToString();
                instances.RemoveAll(i => !i.Id.EndsWith(archiveRef.ToLower()));
            }

            bool match;

            if (queryParams.ContainsKey("status.isArchived") && bool.TryParse(queryParams.GetValueOrDefault("status.isArchived"), out match))
            {
                instances.RemoveAll(i => i.Status.IsArchived != match);
            }

            if (queryParams.ContainsKey("status.isHardDeleted") && bool.TryParse(queryParams.GetValueOrDefault("status.isHardDeleted"), out match))
            {
                instances.RemoveAll(i => i.Status.IsHardDeleted != match);
            }

            if (queryParams.ContainsKey("status.isSoftDeleted") && bool.TryParse(queryParams.GetValueOrDefault("status.isSoftDeleted"), out match))
            {
                instances.RemoveAll(i => i.Status.IsSoftDeleted != match);
            }

            instances.RemoveAll(i => i.Status.IsHardDeleted == true);

            instances.ForEach(async i => await PostProcess(i));

            return new InstanceQueryResponse
            {
                Instances = instances,
                Count = instances.Count,
            };
        }

19 Source : CloudEventRepositoryMock.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn

public Task<List<CloudEvent>> Get(string after, DateTime? from, DateTime? to, string subject, List<string> source, List<string> type, int size)
        {
            string eventsPath = Path.Combine(GetEventsPath(), $@"{_eventsCollection}.json");

            if (File.Exists(eventsPath))
            {
                string content = File.ReadAllText(eventsPath);
                List<EventsTableEntry> tableEntries = JsonConvert.DeserializeObject<List<EventsTableEntry>>(content);

                // logic for filtering on source and type not implemented.
                IEnumerable<EventsTableEntry> filter = tableEntries;

                if (!string.IsNullOrEmpty(after))
                {
                    int sequenceNo = filter.Where(te => te.Id.Equals(after)).Select(te => te.SequenceNo).FirstOrDefault();
                    filter = filter.Where(te => te.SequenceNo > sequenceNo);
                }

                if (from.HasValue)
                {
                    filter = filter.Where(te => te.Time >= from);
                }

                if (to.HasValue)
                {
                    filter = filter.Where(te => te.Time <= to);
                }

                if (!string.IsNullOrEmpty(subject))
                {
                    filter = filter.Where(te => te.Subject.Equals(subject));
                }

                if (source != null && source.Count > 0)
                {
                    // requires more logic to match all fancy cases.
                    filter = filter.Where(te => source.Contains(te.Source.ToString()));
                }

                if (type != null && type.Count > 0)
                {
                    // requires more logic to match all fancy cases.
                    filter = filter.Where(te => type.Contains(te.Type.ToString()));
                }

                List<CloudEvent> result = filter.Select(t => t.CloudEvent)
                    .Take(size)
                    .ToList();

                result.ForEach(ce => ce.Time = ce.Time.Value.ToUniversalTime());
                return Task.FromResult(result);
            }

            return null;
        }

19 Source : EventsServiceMock.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn

public Task<List<CloudEvent>> Get(string after, DateTime? from, DateTime? to, int partyId, List<string> source, List<string> type, int size)
        {
            string eventsPath = Path.Combine(GetEventsPath(), $@"{_eventsCollection}.json");

            if (File.Exists(eventsPath))
            {
                string content = File.ReadAllText(eventsPath);
                List<EventsTableEntry> tableEntries = JsonConvert.DeserializeObject<List<EventsTableEntry>>(content);

                // logic for filtering on source and type not implemented.
                IEnumerable<EventsTableEntry> filter = tableEntries;

                if (!string.IsNullOrEmpty(after))
                {
                    int sequenceNo = filter.Where(te => te.Id.Equals(after)).Select(te => te.SequenceNo).FirstOrDefault();
                    filter = filter.Where(te => te.SequenceNo > sequenceNo);
                }

                if (from.HasValue)
                {
                    filter = filter.Where(te => te.Time >= from);
                }

                if (to.HasValue)
                {
                    filter = filter.Where(te => te.Time <= to);
                }

                if (partyId > 0)
                {
                    string subject = $"/party/{partyId}";
                    filter = filter.Where(te => te.Subject.Equals(subject));
                }

                List<CloudEvent> result = filter.Select(t => t.CloudEvent)
                    .Take(size)
                    .ToList();

                result.ForEach(ce => ce.Time = ce.Time.Value.ToUniversalTime());
                return Task.FromResult(result);
            }

            return null;
        }

19 Source : AuthorizationHelper.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn

public async Task<List<MessageBoxInstance>> AuthorizeMesseageBoxInstances(ClaimsPrincipal user, List<Instance> instances)
        {
            if (instances.Count <= 0)
            {
                return new List<MessageBoxInstance>();
            }

            List<MessageBoxInstance> authorizedInstanceList = new List<MessageBoxInstance>();
            List<string> actionTypes = new List<string> { "read", "write", "delete" };

            XacmlJsonRequestRoot xacmlJsonRequest = CreateMultiDecisionRequest(user, instances, actionTypes);

            _logger.LogInformation($"// AuthorizationHelper // AuthorizeMsgBoxInstances // xacmlJsonRequest: {JsonConvert.SerializeObject(xacmlJsonRequest)}");
            XacmlJsonResponse response = await _pdp.GetDecisionForRequest(xacmlJsonRequest);

            foreach (XacmlJsonResult result in response.Response)
            {
                if (DecisionHelper.ValidateDecisionResult(result, user))
                {
                    string instanceId = string.Empty;
                    string actiontype = string.Empty;

                    // Loop through all attributes in Category from the response
                    foreach (XacmlJsonCategory category in result.Category)
                    {
                        var attributes = category.Attribute;

                        foreach (var attribute in attributes)
                        {
                            if (attribute.AttributeId.Equals(XacmlResourceActionId))
                            {
                                actiontype = attribute.Value;
                            }

                            if (attribute.AttributeId.Equals(AltinnXacmlUrns.InstanceId))
                            {
                                instanceId = attribute.Value;
                            }
                        }
                    }

                    // Find the instance that has been validated to add it to the list of authorized instances.
                    Instance authorizedInstance = instances.First(i => i.Id == instanceId);

                    // Checks if the instance has already been authorized
                    if (authorizedInstanceList.Any(i => i.Id.Equals(authorizedInstance.Id.Split("/")[1])))
                    {
                        switch (actiontype)
                        {
                            case "write":
                                authorizedInstanceList.Where(i => i.Id.Equals(authorizedInstance.Id.Split("/")[1])).ToList().ForEach(i => i.AuthorizedForWrite = true);
                                break;
                            case "delete":
                                authorizedInstanceList.Where(i => i.Id.Equals(authorizedInstance.Id.Split("/")[1])).ToList().ForEach(i => i.AllowDelete = true);
                                break;
                            case "read":
                                break;
                        }
                    }
                    else
                    {
                        MessageBoxInstance messageBoxInstance = InstanceHelper.ConvertToMessageBoxInstance(authorizedInstance);

                        switch (actiontype)
                        {
                            case "write":
                                messageBoxInstance.AuthorizedForWrite = true;
                                break;
                            case "delete":
                                messageBoxInstance.AllowDelete = true;
                                break;
                            case "read":
                                break;
                        }

                        authorizedInstanceList.Add(messageBoxInstance);
                    }
                }
            }

            return authorizedInstanceList;
        }

19 Source : ApplicationRepository.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn

private static void PostProcess(List<Application> applications)
        {
            applications.ForEach(a => PostProcess(a));
        }

19 Source : CosmosService.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn

public async Task<List<Application>> GetApplications(List<string> applicationIds)
        {
            if (!_clientConnectionEstablished)
            {
                _clientConnectionEstablished = await ConnectClient();
            }

            applicationIds = applicationIds.Select(id => id = AppIdToCosmosId(id)).ToList();

            List<Application> applications = new List<Application>();
            FeedOptions feedOptions = new FeedOptions
            {
                EnableCrossParreplacedionQuery = true
            };

            IQueryable<Application> filter;
            Uri applicationsCollectionUri = UriFactory.CreateDoreplacedentCollectionUri(databaseId, applicationsCollectionId);

            filter = _client.CreateDoreplacedentQuery<Application>(applicationsCollectionUri, feedOptions)
                .Where(a => applicationIds.Contains(a.Id));

            try
            {
                IDoreplacedentQuery<Application> query = filter.AsDoreplacedentQuery();

                while (query.HasMoreResults)
                {
                    FeedResponse<Application> feedResponse = await query.ExecuteNextAsync<Application>();
                    applications.AddRange(feedResponse);
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"CosmosService // GetApplications // Exeption: {ex.Message}");
            }

            applications.ForEach(a => a.Id = CosmosIdToAppId(a.Id));

            return applications;
        }

19 Source : MessageboxInstancesController.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn

[Authorize]
        [HttpGet("search")]
        public async Task<ActionResult> SearchMessageBoxInstances(
            [FromQuery(Name = "instanceOwner.partyId")] int instanceOwnerPartyId,
            [FromQuery] string appId,
            [FromQuery] bool includeActive,
            [FromQuery] bool includeArchived,
            [FromQuery] bool includeDeleted,
            [FromQuery] string lastChanged,
            [FromQuery] string created,
            [FromQuery] string searchString,
            [FromQuery] string archiveReference,
            [FromQuery] string language)
        {
            string[] acceptedLanguages = { "en", "nb", "nn" };

            string languageId = "nb";

            if (language != null && acceptedLanguages.Contains(language.ToLower()))
            {
                languageId = language.ToLower();
            }

            Dictionary<string, StringValues> queryParams = QueryHelpers.ParseQuery(Request.QueryString.Value);

            if (!string.IsNullOrEmpty(archiveReference))
            {
                if ((includeActive == includeArchived) && (includeActive == includeDeleted))
                {
                    includeActive = false;
                    includeDeleted = true;
                    includeArchived = true;
                }
                else if (includeActive && !includeArchived && !includeDeleted)
                {
                    return Ok(new List<MessageBoxInstance>());
                }
                else if (includeActive && (includeArchived || includeDeleted))
                {
                    includeActive = false;
                }
            }

            GetStatusFromQueryParams(includeActive, includeArchived, includeDeleted, queryParams);
            queryParams.Add("sortBy", "desc:lastChanged");
            queryParams.Add("status.isHardDeleted", "false");

            if (!string.IsNullOrEmpty(searchString))
            {
                StringValues applicationIds = await MatchStringToAppreplacedle(searchString);
                if (!applicationIds.Any() || (!string.IsNullOrEmpty(appId) && !applicationIds.Contains(appId)))
                {
                    return Ok(new List<MessageBoxInstance>());
                }
                else if (string.IsNullOrEmpty(appId))
                {
                    queryParams.Add("appId", applicationIds);
                }

                queryParams.Remove(nameof(searchString));
            }

            InstanceQueryResponse queryResponse = await _instanceRepository.GetInstancesFromQuery(queryParams, string.Empty, 100);

            if (queryResponse?.Exception != null)
            {
                if (queryResponse.Exception.StartsWith("Unknown query parameter"))
                {
                    return BadRequest(queryResponse.Exception);
                }

                return StatusCode(500, queryResponse.Exception);
            }

            if (queryResponse == null || queryResponse.Count <= 0)
            {
                return Ok(new List<MessageBoxInstance>());
            }

            List<Instance> allInstances = queryResponse.Instances;
            await RemoveHiddenInstances(allInstances);

            if (!allInstances.Any())
            {
                return Ok(new List<MessageBoxInstance>());
            }

            allInstances.ForEach(i =>
            {
                if (i.Status.IsArchived || i.Status.IsSoftDeleted)
                {
                    i.DueBefore = null;
                }
            });

            List<MessageBoxInstance> authorizedInstances =
                    await _authorizationHelper.AuthorizeMesseageBoxInstances(HttpContext.User, allInstances);

            if (!authorizedInstances.Any())
            {
                return Ok(new List<MessageBoxInstance>());
            }

            List<string> appIds = authorizedInstances.Select(i => InstanceHelper.GetAppId(i)).Distinct().ToList();

            List<TextResource> texts = await _textRepository.Get(appIds, languageId);
            InstanceHelper.ReplaceTextKeys(authorizedInstances, texts, languageId);

            return Ok(authorizedInstances);
        }

19 Source : TextResourceService.cs
with BSD 3-Clause "New" or "Revised" License
from Altinn

public async Task UpdateTextResourcesAsync(string org, string app, string shortCommitId, EnvironmentModel environmentModel)
        {
            string textResourcesPath = GetTextResourceDirectoryPath();
            List<FileSystemObject> folder = await _giteaApiWrapper.GetDirectoryAsync(org, app, textResourcesPath, shortCommitId);
            if (folder != null)
            {
                folder.ForEach(async textResourceFromRepo =>
                {
                    if (!Regex.Match(textResourceFromRepo.Name, "^(resource\\.)..(\\.json)").Success)
                    {
                        return;
                    }

                    FileSystemObject populatedFile = await _giteaApiWrapper.GetFileAsync(org, app, textResourceFromRepo.Path, shortCommitId);
                    byte[] data = Convert.FromBase64String(populatedFile.Content);
                    PlatformStorageModels.TextResource content;

                    try
                    {
                        content = data.Deserialize<PlatformStorageModels.TextResource>();
                    }
                    catch (SerializationException e)
                    {
                        _logger.LogError($" // TextResourceService // UpdatedTextResourcesAsync // Error when trying to deserialize text resource file {org}/{app}/{textResourceFromRepo.Path} // Exception {e}");
                        return;
                    }

                    PlatformStorageModels.TextResource textResourceStorage = await GetTextResourceFromStorage(org, app, content.Language, environmentModel);
                    if (textResourceStorage == null)
                    {
                        await _storageTextResourceClient.Create(org, app, content, environmentModel);
                    }
                    else
                    {
                        await _storageTextResourceClient.Update(org, app, content, environmentModel);
                    }
                });
            }
        }

19 Source : AnnotationPackageListControl.cs
with MIT License
from AlturosDestinations

private async void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var dialogResult = MessageBox.Show("Are you sure you want to delete the selected package(s)?", "Confirm deletion", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
            if (dialogResult == DialogResult.Cancel)
            {
                return;
            }
                
            var successful = true;
            var failedPackages = new List<AnnotationPackage>();

            foreach (var package in this._selectedPackages)
            {
                if (!await this._annotationPackageProvider.DeletePackageAsync(package))
                {
                    successful = false;
                    failedPackages.Add(package);

                    continue;
                }

                this._annotationPackages.Remove(package);
            }

            if (!successful)
            {
                var sb = new StringBuilder();
                failedPackages.ForEach(o => sb.AppendLine(o.PackageName));
                MessageBox.Show("Couldn't delete the following packages:\n\n" + sb.ToString(), "Deletion failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            this.dataGridView1.Invoke((MethodInvoker)delegate
            {
                this.RefreshDataBindings();
            });
        }

19 Source : AnnotationPackageListControl.cs
with MIT License
from AlturosDestinations

private void DownloadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this._selectedPackages.ForEach(o => Task.Run(() => this.DownloadPackage(o)));
        }

19 Source : frmMain.cs
with GNU General Public License v3.0
from amakvana

private async Task ProcessYuzu(string yuzuLocation)
        {
            ToggleControls(false);

            // create temp directory for downloads 
            string tempDir = yuzuLocation + "\\TempUpdate";
            if (!Directory.Exists(tempDir))
            {
                Directory.CreateDirectory(tempDir);
            }

            // get latest yuzu version & download 
            using (var wc = new WebClient())
            {
                // fetch latest Yuzu release 
                string latestYuzu = "https://github.com";
                string repo = "https://github.com/yuzu-emu/yuzu-mainline/releases/latest";
                string repoHtml = wc.DownloadString(repo);
                string version = "";
                Regex r = new Regex(@"(?:\/yuzu-emu\/yuzu-mainline\/releases\/download\/[^""]+)");
                foreach (Match m in r.Matches(repoHtml))
                {
                    string url = m.Value.Trim();
                    if (url.Contains(".zip") && !url.Contains("debugsymbols"))
                    {
                        latestYuzu += url;
                        version = url.Split('/')[5].Trim().Remove(0, 11);
                    }
                }

                // download it 
                wc.DownloadFileCompleted += (s, e) =>
                {
                    // unpack 
                    SetProgressLabelStatus("Unpacking Yuzu ...");
                    ZipFile.ExtractToDirectory(tempDir + "\\yuzu.zip", yuzuLocation);

                    // update version number 
                    using (StreamWriter sw = File.CreateText(yuzuLocation + "\\version"))
                    {
                        sw.Write(version);
                    }

                    // cleanup 
                    DirectoryUtilities.Copy(yuzuLocation + "\\yuzu-windows-msvc", yuzuLocation, true);
                    Directory.Delete(yuzuLocation + "\\yuzu-windows-msvc", true);
                    Directory.Delete(tempDir, true);
                    Directory.EnumerateFiles(yuzuLocation, "*.xz").ToList().ForEach(item => File.Delete(item));
                    SetProgressLabelStatus("Done!");
                    ToggleControls(true);
                    pbarProgress.Value = 0;
                };
                wc.DownloadProgressChanged += Wc_DownloadProgressChanged;
                SetProgressLabelStatus("Downloading Yuzu ...");
                await wc.DownloadFileTaskAsync(new Uri(latestYuzu), tempDir + "\\yuzu.zip");
            }
        }

19 Source : ModPopupInput.cs
with MIT License
from amazingalek

private void SetupCommands()
		{
			var listenerObject = new GameObject();
			CommandListener = listenerObject.AddComponent<ModCommandListener>();
			_openCommands.ForEach(CommandListener.AddToListener);
			CommandListener.OnNewlyPressed += OnOpenCommand;
		}

19 Source : ModsMenu.cs
with MIT License
from amazingalek

public void Initialize(IModMenus menus, IModOWMenu owMenu)
		{
			_modConfigMenus.ForEach(x => x.RemoveAllListeners());
			OwmlMenu.RemoveAllListeners();

			_menus = menus;
			Menu = owMenu.Menu;

			var modsButton = owMenu.OptionsButton.Duplicate(Modsreplacedle);
			modsButton.Button.name = Modsreplacedle + "_button";
			var options = owMenu.OptionsMenu;

			var modsMenu = CreateModsMenu(options);
			modsButton.OnClick += modsMenu.Open;
			_modConfigMenus.ForEach(x => x.OnClosed += modsMenu.Open);
			OwmlMenu.OnClosed += modsMenu.Open;
		}

19 Source : ModUIStyleApplier.cs
with MIT License
from amazingalek

public void Initialize(UIStyleApplier oldStyleApplier)
		{
			ClearAllArrays();
			var fields = typeof(UIStyleApplier).GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).ToList();
			fields.ForEach(field => field.SetValue(this, field.GetValue(oldStyleApplier)));
		}

19 Source : OWPatcher.cs
with MIT License
from amazingalek

private void CopyFiles(string[] filesToCopy, string pathPrefix, string destination)
		{
			var uncopiedFiles = new List<string>();
			foreach (var filename in filesToCopy)
			{
				try
				{
					File.Copy($"{pathPrefix}{filename}", $"{destination}/{filename}", true);
				}
				catch
				{
					uncopiedFiles.Add(filename);
				}
			}

			if (uncopiedFiles.Any())
			{
				_writer.WriteLine($"Warning - Failed to copy the following files to {destination} :", MessageType.Warning);
				uncopiedFiles.ForEach(file => _writer.WriteLine($"* {file}", MessageType.Warning));
			}
		}

19 Source : ReleaseTests.cs
with MIT License
from amazingalek

private void replacedertFolderContainsFiles(string folder, string[] files) =>
			files.ToList().ForEach(file => replacedertFileExists(folder, file));

19 Source : App.cs
with MIT License
from amazingalek

private void ExecutePatchers(IEnumerable<IModData> mods)
		{
			_writer.WriteLine("Executing patchers...", MessageType.Debug);
			mods
				.Where(ShouldExecutePatcher)
				.ToList()
				.ForEach(ExecutePatcher);
		}

19 Source : LoadCustomAssets.cs
with MIT License
from amazingalek

private void OnStartSceneChange(OWScene oldScene, OWScene newScene)
		{
			if (oldScene == OWScene.SolarSystem)
			{
				_ducks.ForEach(Destroy);
			}
		}

19 Source : ModPopupManager.cs
with MIT License
from amazingalek

private void CleanUp()
		{
			_toDestroy.ForEach(popup => popup.DestroySelf());
			_toDestroy.Clear();
		}

19 Source : PlottingDataManager.cs
with MIT License
from Analogy-LogViewer

public void SetRefreshInterval(float seconds)
        {
            GraphsData.ForEach(((string series, PlottingGraphData data) entry) =>
            {
                entry.data.SetIntervalValue(seconds);
            });
        }

19 Source : PlottingDataManager.cs
with MIT License
from Analogy-LogViewer

public void SetDataWindow(int windowValue)
        {
            GraphsData.ForEach(((string series, PlottingGraphData data) entry) =>
            {
                entry.data.SetWindowValue(windowValue);
            });
        }

19 Source : PlottingDataManager.cs
with MIT License
from Analogy-LogViewer

public void ClearAllData()
        {
            GraphsData.ForEach(((string series, PlottingGraphData data) entry) =>
            {
                entry.data.Clear();
            });
        }

19 Source : MeshProjection.cs
with MIT License
from Anatta336

public void Abort()
        {
            if (!InProgress) return;

            // even though we don't need their work, we have to call Complete to give
            // the main thread ownership of NativeArrays ready for their disposal
            foreach (var jobHandle in trimJobHandles) jobHandle.Complete();
            foreach (var resultingTriangles in allResultingTriangles) resultingTriangles.Dispose();
            rawMeshes.ForEach(rawMesh => rawMesh.Dispose());

            InProgress = false;
        }

19 Source : Admin_Panel.cs
with GNU Affero General Public License v3.0
from anderscripts

private void SessionResponse(dynamic session)
        {
            try
            {
                List<dynamic> sessionAccounts = JsonConvert.DeserializeObject<List<dynamic>>(session);
                string text = "";
                sessionAccounts.ForEach(k =>
                {
                    text = $"{text}<tr>" +
                    $"<td>{k["Handle"]}</td>" +
                    $"<td>{k["License"]}</td>" +
                    $"<td>{k["Steam"]}</td>" +
                    $"<td>{k["Name"]}</td>" +
                    $"<td>{Enum.GetName(typeof(Reserved), (int)k["Reserved"])}</td>" +
                    $"<td>{Enum.GetName(typeof(Reserved), (int)k["ReservedUsed"])}</td>" +
                    $"<td>{k["Priority"]}</td>" +
                    $"<td>{Enum.GetName(typeof(SessionState), (int)k["State"])}</td>" +
                    $"<td><button clreplaced=button onclick=Change('{k["License"]}')>Change</button></td>" +
                    $"</tr>";
                });
                API.SendNuiMessage($@"{{ ""sessionlist"" : ""{text}"" }}");
                API.SetNuiFocus(true, true);
            }
            catch (Exception)
            {
                Debug.WriteLine($"[{resourceName} - Admin_Panel ERROR] - SessionResponse()");
            }
        }

19 Source : LocationService.cs
with GNU Lesser General Public License v3.0
from andisturber

public void ListeningDevice()
        {
            var num = 0;
            var deviceError = iDevice.idevice_get_device_list(out var devices, ref num);
            if (deviceError != iDeviceError.Success)
            {
                PrintMessage("无法继续.可能本工具权限不足, 或者未正确安装iTunes工具.");
                return;
            }
            ThreadPool.QueueUserWorkItem(o =>
            {
                while (true)
                {
                    deviceError = iDevice.idevice_get_device_list(out devices, ref num);
                    if (devices.Count > 0)
                    {
                        var lst = Devices.Select(s => s.UDID).ToList().Except(devices).ToList();

                        var dst = devices.Except(Devices.Select(s => s.UDID)).ToList();

                        foreach (string udid in dst)
                        {
                            iDeviceHandle iDeviceHandle;
                            iDevice.idevice_new(out iDeviceHandle, udid).ThrowOnError();
                            LockdownClientHandle lockdownClientHandle;

                            lockdown.lockdownd_client_new_with_handshake(iDeviceHandle, out lockdownClientHandle, "Quamotion").ThrowOnError("无法读取设备Quamotion");

                            lockdown.lockdownd_get_device_name(lockdownClientHandle, out var deviceName).ThrowOnError("获取设备名称失败.");

                            lockdown.lockdownd_client_new_with_handshake(iDeviceHandle, out lockdownClientHandle, "waua").ThrowOnError("无法读取设备waua");

                            lockdown.lockdownd_get_value(lockdownClientHandle, null, "ProductVersion", out var node).ThrowOnError("获取设备系统版本失败.");

                            LibiMobileDevice.Instance.Plist.plist_get_string_val(node, out var version);

                            iDeviceHandle.Dispose();
                            lockdownClientHandle.Dispose();
                            var device = new DeviceModel
                            {
                                UDID = udid,
                                Name = deviceName,
                                Version = version
                            };

                            PrintMessage($"发现设备: {deviceName}  {version}");
                            LoadDevelopmentTool(device);
                            Devices.Add(device);
                        }

                    }
                    else
                    {
                        Devices.ForEach(itm => PrintMessage($"设备 {itm.Name} {itm.Version} 已断开连接."));
                        Devices.Clear();
                    }
                    Thread.Sleep(1000);
                }
            });
        }

19 Source : NgProxyMiddleware.cs
with MIT License
from andfomin

private static IEnumerable<string> FilterOptionsListByPortAvailability(IEnumerable<string> optionsList)
        {
            // An NG Develpment Server might be started manually from the Command Prompt. Check if that is the case.
            var optionsListWithPortAvailability = optionsList
                .Select(i =>
                {
                    var port = GetNgServerPort(i);
                    return new
                    {
                        OptionsLine = i,
                        Port = port,
                        IsPortAvailable = IsPortAvailable(port),
                    };
                })
                .ToList()
                ;
            optionsListWithPortAvailability.ForEach(i =>
            {
                if (!i.IsPortAvailable)
                {
                    Debug.WriteLine(String.Format(WarningPortUnavailable, i.Port));
                }
            })
            ;
            var filteredOptionsList = optionsListWithPortAvailability
               .Where(i => i.IsPortAvailable)
               .Select(i => i.OptionsLine)
               ;
            return filteredOptionsList;
        }

19 Source : LocationService.cs
with GNU Lesser General Public License v3.0
from andisturber

public void ClearLocation()
        {
            if (Devices.Count == 0)
            {
                PrintMessage($"修改失败! 未发现任何设备.");
                return;
            }

            iDevice.idevice_set_debug_level(1);

            PrintMessage($"发起还原位置.");

            Devices.ForEach(itm =>
                    {
                        PrintMessage($"开始还原设备 {itm.Name} {itm.Version}");
                        var num = 0u;
                        iDevice.idevice_new(out var device, itm.UDID);
                        var lockdowndError = lockdown.lockdownd_client_new_with_handshake(device, out LockdownClientHandle client, "com.alpha.jailout");//com.alpha.jailout
                        lockdowndError = lockdown.lockdownd_start_service(client, "com.apple.dt.simulatelocation", out var service2);//com.apple.dt.simulatelocation
                        var se = service.service_client_new(device, service2, out var client2);

                        se = service.service_send(client2, new byte[4] { 0, 0, 0, 0 }, 4, ref num);
                        se = service.service_send(client2, new byte[4] { 0, 0, 0, 1 }, 4, ref num);

                        device.Dispose();
                        client.Dispose();
                        PrintMessage($"设备 {itm.Name} {itm.Version} 还原成功.");
                    });
        }

19 Source : LocationService.cs
with GNU Lesser General Public License v3.0
from andisturber

public void UpdateLocation(Location location)
        {
            if (Devices.Count == 0)
            {
                PrintMessage($"修改失败! 未发现任何设备。");
                return;
            }

            iDevice.idevice_set_debug_level(1);

            var Longitude = location.Longitude.ToString();
            var Lareplacedude = location.Lareplacedude.ToString();

            PrintMessage($"尝试修改位置。");
            PrintMessage($"经度:{location.Longitude}");
            PrintMessage($"纬度:{location.Lareplacedude}");

            var size = BitConverter.GetBytes(0u);
            Array.Reverse(size);
            Devices.ForEach(itm =>
            {
                PrintMessage($"开始修改设备 {itm.Name} {itm.Version}");

                var num = 0u;
                iDevice.idevice_new(out var device, itm.UDID);
                lockdown.lockdownd_client_new_with_handshake(device, out var client, "com.alpha.jailout").ThrowOnError();//com.alpha.jailout
                lockdown.lockdownd_start_service(client, "com.apple.dt.simulatelocation", out var service2).ThrowOnError();//com.apple.dt.simulatelocation
                var se = service.service_client_new(device, service2, out var client2);
                // 先置空
                se = service.service_send(client2, size, 4u, ref num);

                num = 0u;
                var bytesLocation = Encoding.ASCII.GetBytes(Lareplacedude);
                size = BitConverter.GetBytes((uint)Lareplacedude.Length);
                Array.Reverse(size);
                se = service.service_send(client2, size, 4u, ref num);
                se = service.service_send(client2, bytesLocation, (uint)bytesLocation.Length, ref num);


                bytesLocation = Encoding.ASCII.GetBytes(Longitude);
                size = BitConverter.GetBytes((uint)Longitude.Length);
                Array.Reverse(size);
                se = service.service_send(client2, size, 4u, ref num);
                se = service.service_send(client2, bytesLocation, (uint)bytesLocation.Length, ref num);



                //device.Dispose();
                //client.Dispose();
                PrintMessage($"设备 {itm.Name} {itm.Version} 位置修改完成。");
            });
        }

19 Source : Notebook.cs
with MIT License
from andreaschiavinato

public void AddCellFromJson(string cellJson)
        {
            var cell = JsonConvert.DeserializeObject<CellBase>(cellJson, new CellConverter());
            cells.Add(cell);
            cell.owner = this;
            OnInsertedCell?.Invoke(this, cell);
            _isDirty = true;

            if (cell is CodeCell codeCell)
            {
                codeCell.outputs.ForEach(output => OnInsertedCellOutput?.Invoke(this, (codeCell, output)));
            }
            
        }

19 Source : CompositeMenuControlHandler.cs
with GNU General Public License v3.0
from AndreiFedarets

public void OnControlAttached(IMenuControl control)
        {
            _handlers.ForEach(x => x.OnControlAttached(control));
        }

19 Source : CompositeMenuControlHandler.cs
with GNU General Public License v3.0
from AndreiFedarets

public void OnViewModelAttached(IViewModel ownerViewModel)
        {
            _handlers.ForEach(x => x.OnViewModelAttached(ownerViewModel));
        }

19 Source : CompositeMenuControlHandler.cs
with GNU General Public License v3.0
from AndreiFedarets

public virtual void OnAction()
        {
            _handlers.ForEach(x => x.OnAction());
        }

19 Source : CompositeMenuControlHandler.cs
with GNU General Public License v3.0
from AndreiFedarets

public virtual void Dispose()
        {
            _handlers.ForEach(x => x.Dispose());
        }

19 Source : BookLoanGetAllQueryHandler.cs
with MIT License
from andresantarosa

public async Task<BookLoanGetAllQueryResponseViewModel> Handle(BookLoanGetAllQuery request, CancellationToken cancellationToken)
        {
            BookLoanGetAllQueryResponseViewModel response = new BookLoanGetAllQueryResponseViewModel();

            List<BookLoan> bookLoans = await _bookLoanReadOnlyRepository.GetAll(true, true);

            bookLoans.ForEach(x =>
            {
                response.BookLoans.Add(new BookLoanGetAllQueryResponseViewModelItem
                {
                    BookLoanId = x.BookLoanId,
                    BookId = x.BookId,
                    Bookreplacedle = x.Book.replacedle,
                    TakerId = x.Taker.PersonId,
                    TakerName = x.Taker.Name,
                    CheckoutDate = x.CheckoutDate,
                    ExpectedReturnDate = x.ExpectedReturnDate
                });
            });

            return response;

        }

See More Examples