System.Threading.Tasks.Task.FromResult(TResult)

Here are the examples of the csharp api System.Threading.Tasks.Task.FromResult(TResult) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

14144 Examples 7

19 Source : DbManagerTest.cs
with MIT License
from 0x1000000

Task<LoadIndexesResult> IDbStrategy.LoadIndexes()
        {
            Dictionary<TableRef, PrimaryKeyModel> pks = new Dictionary<TableRef, PrimaryKeyModel>();
            Dictionary<TableRef, List<IndexModel>> inds = new Dictionary<TableRef, List<IndexModel>>();

            pks.Add(new TableRef("dbo", "TableA"), new PrimaryKeyModel(new List<IndexColumnModel> { new IndexColumnModel(false, new ColumnRef("dbo", "TableA", "Id")) }, "PK_TableA"));
            pks.Add(new TableRef("dbo", "TableZ"), new PrimaryKeyModel(new List<IndexColumnModel> { new IndexColumnModel(false, new ColumnRef("dbo", "TableZ", "Id")) }, "PK_TableZ"));

            inds.Add(new TableRef("dbo", "TableA"),
                new List<IndexModel>
                {
                    new IndexModel(new List<IndexColumnModel> {new IndexColumnModel(true, new ColumnRef("dbo", "TableA", "Value"))},
                        "IX_TableA_Value",
                        true,
                        false)
                });

            LoadIndexesResult result = new LoadIndexesResult(pks, inds);

            return Task.FromResult(result);
        }

19 Source : HelloService.cs
with MIT License
from 1100100

[NonIntercept]
        [ServerMethodInterceptor]
        public async Task<ResultModel> SayHello(string name)
        {
            //await Task.Delay(5000);
            return await Task.FromResult(new ResultModel { Message = name });
        }

19 Source : HelloService.cs
with MIT License
from 1100100

public async Task<ResultModel> SayHello(TestModel testModel)
        {
            return await Task.FromResult(new ResultModel
            {
                Message = "Rec " + testModel.Name
            });
        }

19 Source : HelloService.cs
with MIT License
from 1100100

public async Task<ResponseResult<string>> Test()
        {
            return await Task.FromResult(new ResponseResult<string>
            {
                Success = true,
                Result = "OK"
            });
        }

19 Source : MemoryCacheHandler.cs
with MIT License
from 17MKH

public Task<string> Get(string key)
    {
        var value = _cache.Get(key);
        return Task.FromResult(value?.ToString());
    }

19 Source : MemoryCacheHandler.cs
with MIT License
from 17MKH

public Task<T> Get<T>(string key)
    {
        return Task.FromResult(_cache.Get<T>(key));
    }

19 Source : MemoryCacheHandler.cs
with MIT License
from 17MKH

public Task<bool> Exists(string key)
    {
        return Task.FromResult(_cache.TryGetValue(key, out _));
    }

19 Source : TestB2CAuthService.cs
with MIT License
from 1iveowl

public async Task<IUserContext> SignIn(IEnumerable<string> scopes = null, bool silentlyOnly = false, CancellationToken cancellationToken = default)
        {
            return await Task.FromResult(_userContext);
        }

19 Source : AuditoriumLayoutRepository.cs
with Apache License 2.0
from 42skillz

public Task<AuditoriumDto> GetAuditoriumSeatingFor(string showId)
        {
            if (_repository.ContainsKey(showId))
            {
                return Task.FromResult(_repository[showId]);
            }

            return Task.FromResult(new AuditoriumDto());
        }

19 Source : ReservationsProvider.cs
with Apache License 2.0
from 42skillz

public Task<ReservedSeatsDto> GetReservedSeats(string showId)
        {
            if (_repository.ContainsKey(showId))
            {
                return Task.FromResult(_repository[showId]);
            }

            return Task.FromResult(new ReservedSeatsDto());
        }

19 Source : RoleAppService.cs
with MIT License
from 52ABP

public Task<ListResultDto<PermissionDto>> GetAllPermissions()
        {
            var permissions = PermissionManager.GetAllPermissions();

            return Task.FromResult(new ListResultDto<PermissionDto>(
                ObjectMapper.Map<List<PermissionDto>>(permissions)
            ));
        }

19 Source : Identity.cs
with GNU Lesser General Public License v3.0
from 8720826

public static async Task<bool> HasLogin(this HttpContext content)
        {
            return await Task.FromResult(content.User.Idenreplacedy.IsAuthenticated);
        }

19 Source : WareCommandHandler.cs
with GNU Lesser General Public License v3.0
from 8720826

private async Task<WareModel> Computed(WareEnreplacedy ware, PlayerWareEnreplacedy playerWare)
        {
            var wareModel = _mapper.Map<WareModel>(ware);
            wareModel.PlayerWareId = playerWare.Id;
            wareModel.Number = playerWare.Number;
            wareModel.Status = playerWare.Status;

            var wareEffectAttr = new WareEffectAttr();
            var effects = JsonConvert.DeserializeObject<List<WareEffect>>(ware.Effect);
            foreach (var effect in effects)
            {
                foreach (var attr in effect.Attrs)
                {
                    int.TryParse(attr.Val, out int val);

                    switch (attr.Attr)
                    {
                        case "Atk":
                            wareEffectAttr.Atk += val;
                            break;

                        case "Def":
                            wareEffectAttr.Def += val;
                            break;

                        case "Hp":
                            wareEffectAttr.Hp += val;
                            break;

                        case "Mp":
                            wareEffectAttr.Mp += val;
                            break;
                    }
                }
            }

            wareModel.WareEffect = wareEffectAttr;

            return await Task.FromResult(wareModel);
        }

19 Source : User.cshtml.cs
with GNU Lesser General Public License v3.0
from 8720826

public async Task<IActionResult> OnPostAsync([FromBody]EnableData enableData)
        {
            await _userAppService.SetEnabled(enableData.SId, enableData.IsEnable);

            return await Task.FromResult(new JsonResult(enableData));

        }

19 Source : Index.cshtml.cs
with GNU Lesser General Public License v3.0
from 8720826

public async Task<IActionResult> OnPostAsync([FromBody]EnableData enableData)
        {
            await _userAppService.SetEnabled(enableData.SId, enableData.IsEnable);


            return await Task.FromResult(new JsonResult(enableData));

        }

19 Source : ModifyPassword.cshtml.cs
with GNU Lesser General Public License v3.0
from 8720826

public async Task<IActionResult> OnPostAsync([FromBody]ModifyPreplacedwordDto dto)
        {
            if (!ModelState.IsValid)
            {
                return await Task.FromResult(new JsonResult(new
                {
                    Status = false,
                    ErrorMessage = ModelState.Where(e => e.Value.Errors.Count > 0).Select(e => e.Value.Errors.First().ErrorMessage).First()
                }));
            }

            var userId = _accountContext.UserId;

            var command = new ModifyPreplacedwordCommand(userId, dto.Preplacedword, dto.NewPreplacedword);
            await _bus.SendCommand(command);

            if (_notifications.HasNotifications())
            {
                var errorMessage = string.Join(";", _notifications.GetNotifications().Select(x => x.Content));
                return await Task.FromResult(new JsonResult(new
                {
                    status = false,
                    errorMessage
                }));
            }

            return await Task.FromResult(new JsonResult(new
            {
                status = true
            }));

        }

19 Source : Reg.cshtml.cs
with GNU Lesser General Public License v3.0
from 8720826

public async Task<IActionResult> OnPostAsync([FromBody]UserRegDto dto)
        {

            if (!ModelState.IsValid)
            {
                return await Task.FromResult(new JsonResult(new
                {
                    Status = false,
                    ErrorMessage = ModelState.Where(e => e.Value.Errors.Count > 0).Select(e => e.Value.Errors.First().ErrorMessage).First()
                }));
            }

            var userId = _accountContext.UserId;

            var command = new RegCommand(dto.Email, dto.Preplacedword);
            await _bus.SendCommand(command);

            if (_notifications.HasNotifications())
            {
                var errorMessage = string.Join(";", _notifications.GetNotifications().Select(x => x.Content));
                return await Task.FromResult(new JsonResult(new
                {
                    status = false,
                    errorMessage
                }));
            }

            return await Task.FromResult(new JsonResult(new
            {
                status = true
            }));

        }

19 Source : ResetPassword.cshtml.cs
with GNU Lesser General Public License v3.0
from 8720826

public async Task<IActionResult> OnPostAsync([FromBody]ResetPreplacedwordDto dto)
        {
            if (!ModelState.IsValid)
            {
                return await Task.FromResult(new JsonResult(new
                {
                    Status = false,
                    ErrorMessage = ModelState.Where(e => e.Value.Errors.Count > 0).Select(e => e.Value.Errors.First().ErrorMessage).First()
                }));
            }

            var userId = _accountContext.UserId;

            var command = new ResetPreplacedwordCommand(dto.Email, dto.Preplacedword, dto.Code);
            await _bus.SendCommand(command);

            if (_notifications.HasNotifications())
            {
                var errorMessage = string.Join(";", _notifications.GetNotifications().Select(x => x.Content));
                return await Task.FromResult(new JsonResult(new
                {
                    status = false,
                    errorMessage
                }));
            }

            return await Task.FromResult(new JsonResult(new
            {
                status = true
            }));

        }

19 Source : NpcCommandHandler.cs
with GNU Lesser General Public License v3.0
from 8720826

private async Task<ResultModel> TakeQuestReward(PlayerEnreplacedy player, string rewardStr)
        {
            var result = new ResultModel
            {
                IsSuccess = false
            };
            if (!string.IsNullOrEmpty(rewardStr))
            {
                List<QuestReward> questRewards = new List<QuestReward>();
                try
                {
                    questRewards = JsonConvert.DeserializeObject<List<QuestReward>>(rewardStr);
                }
                catch (Exception ex)
                {
                    _logger.LogError($"Convert QuestReward:{ex}");
                }

                foreach (var questReward in questRewards)
                {
                    int.TryParse(questReward.Attrs.FirstOrDefault(x => x.Attr == "NpcId")?.Val, out int npcId);
                    int.TryParse(questReward.Attrs.FirstOrDefault(x => x.Attr == "Exp")?.Val, out int exp);
                    long.TryParse(questReward.Attrs.FirstOrDefault(x => x.Attr == "Money")?.Val, out long money);
                    int.TryParse(questReward.Attrs.FirstOrDefault(x => x.Attr == "WareId")?.Val, out int wareId);
                    int.TryParse(questReward.Attrs.FirstOrDefault(x => x.Attr == "Number")?.Val, out int number);

                    var rewardEnum = (QuestRewardEnum)Enum.Parse(typeof(QuestRewardEnum), questReward.Reward, true);


                    switch (rewardEnum)
                    {


                        case QuestRewardEnum.物品:
                            var ware = await _wareDomainService.Get(wareId);
                            if (ware != null)
                            {
                                await _mudProvider.ShowMessage(player.Id, $"获得 {number}{ware.Unit}[{ware.Name}]");
                            }
                            // 添加物品

                            break;

                        case QuestRewardEnum.经验:
                            player.Exp += exp;
                            await _mudProvider.ShowMessage(player.Id, $"获得经验 +{exp}");
                            break;

                        case QuestRewardEnum.金钱:
                            player.Money += money;
                            await _mudProvider.ShowMessage(player.Id, $"获得 +{money.ToMoney()}");
                            break;


                    }

                }

                await _playerDomainService.Update(player);
            }

            result.IsSuccess = true;
            return await Task.FromResult(result);
        }

19 Source : CreatePlayer.cshtml.cs
with GNU Lesser General Public License v3.0
from 8720826

public async Task<IActionResult> OnPostAsync([FromBody]PlayerCreateDto dto)
        {
            if (!ModelState.IsValid)
            {
                return await Task.FromResult(new JsonResult(new
                {
                    Status = false,
                    ErrorMessage = ModelState.Where(e => e.Value.Errors.Count > 0).Select(e => e.Value.Errors.First().ErrorMessage).First()
                }));
            }

            var userId = _accountContext.UserId;

            var command = new CreateCommand(dto.Name, dto.Gender, userId, dto.Str, dto.Con, dto.Dex, dto.Int);
            await _bus.SendCommand(command);

            if (_notifications.HasNotifications())
            {
                var errorMessage = string.Join(";", _notifications.GetNotifications().Select(x => x.Content));
                return await Task.FromResult(new JsonResult(new
                {
                    status = false,
                    errorMessage
                }));
            }

            return await Task.FromResult(new JsonResult(new
            {
                status = true
            }));

        }

19 Source : ForgotPassword.cshtml.cs
with GNU Lesser General Public License v3.0
from 8720826

public async Task<IActionResult> OnPostAsync([FromBody]SendResetEmailDto dto)
        {
            if (!ModelState.IsValid)
            {
                return await Task.FromResult(new JsonResult(new
                {
                    Status = false,
                    ErrorMessage = ModelState.Where(e => e.Value.Errors.Count > 0).Select(e => e.Value.Errors.First().ErrorMessage).First()
                }));
            }

            var userId = _accountContext.UserId;

            var command = new SendResetEmailCommand(dto.Email);
            await _bus.SendCommand(command);

            if (_notifications.HasNotifications())
            {
                var errorMessage = string.Join(";", _notifications.GetNotifications().Select(x => x.Content));
                return await Task.FromResult(new JsonResult(new
                {
                    status = false,
                    errorMessage
                }));
            }

            return await Task.FromResult(new JsonResult(new
            {
                status = true
            }));

        }

19 Source : Login.cshtml.cs
with GNU Lesser General Public License v3.0
from 8720826

public async Task<IActionResult> OnPostAsync([FromBody]UserLoginDto dto)
        {
            if (!ModelState.IsValid)
            {
                return await Task.FromResult(new JsonResult(new
                {
                    Status = false,
                    ErrorMessage = ModelState.Where(e => e.Value.Errors.Count > 0).Select(e => e.Value.Errors.First().ErrorMessage).First()
                }));
            }

            var userId = _accountContext.UserId;

            var command = new LoginCommand(dto.Email, dto.Preplacedword);
            await _bus.SendCommand(command);

            if (_notifications.HasNotifications())
            {
                var errorMessage = string.Join(";", _notifications.GetNotifications().Select(x => x.Content));
                return await Task.FromResult(new JsonResult(new
                {
                    status = false,
                    errorMessage
                }));
            }

            return await Task.FromResult(new JsonResult(new
            {
                status = true
            }));

        }

19 Source : QuestCommandHandler.cs
with GNU Lesser General Public License v3.0
from 8720826

private async Task<ResultModel> CheckQuestConsume(PlayerEnreplacedy player, string consumeStr)
        {
            var result = new ResultModel
            {
                IsSuccess = false
            };
            if (!string.IsNullOrEmpty(consumeStr))
            {
                List<QuestConsume> questConsumes = new List<QuestConsume>();
                try
                {
                    questConsumes = JsonConvert.DeserializeObject<List<QuestConsume>>(consumeStr);
                }
                catch (Exception ex)
                {
                    _logger.LogError($"Convert QuestConsume:{ex}");
                }

                foreach (var questConsume in questConsumes)
                {
                    var npcId = questConsume.Attrs.FirstOrDefault(x => x.Attr == "NpcId")?.Val;
                    int.TryParse(questConsume.Attrs.FirstOrDefault(x => x.Attr == "Exp")?.Val, out int exp);
                    long.TryParse(questConsume.Attrs.FirstOrDefault(x => x.Attr == "Money")?.Val, out long money);

                    var consumeEnum = (QuestConsumeEnum)Enum.Parse(typeof(QuestConsumeEnum), questConsume.Consume, true);


                    switch (consumeEnum)
                    {


                        case QuestConsumeEnum.物品:

                            //TODO
                            result.ErrorMessage = $"完成任务需要消耗物品";
                            return result;

                        case QuestConsumeEnum.经验:
                            if (player.Exp < exp)
                            {
                                result.ErrorMessage = $"完成任务需要消耗经验 {exp}";
                                return result;
                            }
                            break;

                        case QuestConsumeEnum.金钱:
                            if (player.Money < money)
                            {
                                result.ErrorMessage = $"完成任务需要消耗 {money.ToMoney()}";
                                return result;
                            }

                            break;


                    }

                }
            }

            result.IsSuccess = true;
            return await Task.FromResult(result);
        }

19 Source : QuestCommandHandler.cs
with GNU Lesser General Public License v3.0
from 8720826

private async Task<ResultModel> DoQuestConsume(PlayerEnreplacedy player, string consumeStr)
        {
            var result = new ResultModel
            {
                IsSuccess = false
            };
            if (!string.IsNullOrEmpty(consumeStr))
            {
                List<QuestConsume> questConsumes = new List<QuestConsume>();
                try
                {
                    questConsumes = JsonConvert.DeserializeObject<List<QuestConsume>>(consumeStr);
                }
                catch (Exception ex)
                {
                    _logger.LogError($"Convert QuestConsume:{ex}");
                }

                foreach (var questConsume in questConsumes)
                {
                    var npcId = questConsume.Attrs.FirstOrDefault(x => x.Attr == "NpcId")?.Val;
                    int.TryParse(questConsume.Attrs.FirstOrDefault(x => x.Attr == "Exp")?.Val, out int exp);
                    long.TryParse(questConsume.Attrs.FirstOrDefault(x => x.Attr == "Money")?.Val, out long money);

                    var consumeEnum = (QuestConsumeEnum)Enum.Parse(typeof(QuestConsumeEnum), questConsume.Consume, true);


                    switch (consumeEnum)
                    {


                        case QuestConsumeEnum.物品:

                            //TODO 减少物品
                            return result;

                        case QuestConsumeEnum.经验:
                            player.Exp -= exp;
                            break;

                        case QuestConsumeEnum.金钱:
                            player.Money -= money;
                            break;


                    }

                }

                await _playerDomainService.Update(player);
            }

            result.IsSuccess = true;
            return await Task.FromResult(result);
        }

19 Source : Index.cshtml.cs
with GNU Lesser General Public License v3.0
from 8720826

public async Task<IActionResult> OnPostAsync([FromBody]EnableData enableData)
        {
            await _npcAppService.SetEnabled(enableData.SId, enableData.IsEnable);


            return await Task.FromResult(new JsonResult(enableData));

        }

19 Source : SendVerifyEmail.cshtml.cs
with GNU Lesser General Public License v3.0
from 8720826

public async Task<IActionResult> OnPostAsync([FromBody] SendVerifyEmailDto dto)
        {
            if (!ModelState.IsValid)
            {
                return await Task.FromResult(new JsonResult(new
                {
                    Status = false,
                    ErrorMessage = ModelState.Where(e => e.Value.Errors.Count > 0).Select(e => e.Value.Errors.First().ErrorMessage).First()
                }));
            }

            var userId = _accountContext.UserId;

            var command = new SendVerifyEmailCommand(dto.Email);
            await _bus.SendCommand(command);

            if (_notifications.HasNotifications())
            {
                var errorMessage = string.Join("��", _notifications.GetNotifications().Select(x => x.Content));
                return await Task.FromResult(new JsonResult(new
                {
                    status = false,
                    errorMessage
                }));
            }

            return await Task.FromResult(new JsonResult(new
            {
                status = true
            }));

        }

19 Source : VerifyEmail.cshtml.cs
with GNU Lesser General Public License v3.0
from 8720826

public async Task<IActionResult> OnPostAsync([FromBody]VerifyEmailDto dto)
        {
            if (!ModelState.IsValid)
            {
                return await Task.FromResult(new JsonResult(new
                {
                    Status = false,
                    ErrorMessage = ModelState.Where(e => e.Value.Errors.Count > 0).Select(e => e.Value.Errors.First().ErrorMessage).First()
                }));
            }

            var userId = _accountContext.UserId;

            var command = new VerifyEmailCommand(dto.Email,dto.Code);
            await _bus.SendCommand(command);

            if (_notifications.HasNotifications())
            {
                var errorMessage = string.Join(";", _notifications.GetNotifications().Select(x => x.Content));
                return await Task.FromResult(new JsonResult(new
                {
                    status = false,
                    errorMessage
                }));
            }

            return await Task.FromResult(new JsonResult(new
            {
                status = true
            }));

        }

19 Source : MockDataStore.cs
with GNU General Public License v3.0
from 9vult

public async Task<Item> GereplacedemAsync(string id)
        {
            return await Task.FromResult(items.FirstOrDefault(s => s.Id == id));
        }

19 Source : IOServer.cs
with MIT License
from a11s

internal Task<bool> InitServerAsync(ChannelHandlerAdapter handler, IPEndPoint localipep,Action afterchannel)
        {
            iogroup = new MulreplacedhreadEventLoopGroup();
            //workergroup = new MulreplacedhreadEventLoopGroup();
            try
            {
                if (bootstrap != null)
                {
                    throw new InvalidOperationException("重复init");
                }
                bootstrap = new Bootstrap();
                bootstrap.Group(iogroup)
                    .Channel<SocketDatagramChannel>()
                    .Option(ChannelOption.SoBroadcast, true)
                    .Handler(handler);
                var _channel = bootstrap.BindAsync(localipep);
                //channel = _channel.Result;
                _channel.ContinueWith((c) =>
                {
                    var ch = c.Result;
                    this.Channel = ch;
                    if (ch.LocalAddress is IPEndPoint ipep)
                    {
                        IPAddress[] ipaddrs = Dns.GetHostAddresses(Environment.MachineName);
                        foreach (var ipaddr in ipaddrs)
                        {
                            DebugLog(ipaddr.ToString());
                        }
                    }
                    DebugLog($"inited {ch.LocalAddress}");
                    afterchannel.Invoke();
                });
                return Task.FromResult(true);
            }
            catch (System.Threading.ThreadInterruptedException e)
            {
                DebugLog(e.ToString());
                DebugLog("shutdown");
                iogroup.ShutdownGracefullyAsync();
            }
            return Task.FromResult(false);
        }

19 Source : InMemoryTradeEventPublisher.cs
with Apache License 2.0
from Aaronontheweb

public Task<TradeSubscribeAck> Subscribe(string tickerSymbol, TradeEventType[] events, IActorRef subscriber)
        {
            foreach (var e in events)
            {
                EnsureSub(e);
                _subscribers[e].Add(subscriber);
            }

            return Task.FromResult(new TradeSubscribeAck(tickerSymbol, events));
        }

19 Source : InMemoryTradeEventPublisher.cs
with Apache License 2.0
from Aaronontheweb

public Task<TradeUnsubscribeAck> Unsubscribe(string tickerSymbol, TradeEventType[] events, IActorRef subscriber)
        {
            foreach (var e in events)
            {
                EnsureSub(e);
                _subscribers[e].Remove(subscriber);
            }

            return Task.FromResult(new TradeUnsubscribeAck(tickerSymbol, events));
        }

19 Source : NoOpTradeEventSubscriptionManager.cs
with Apache License 2.0
from Aaronontheweb

public Task<TradeSubscribeAck> Subscribe(string tickerSymbol, TradeEventType[] events, IActorRef subscriber)
        {
            return Task.FromResult(new TradeSubscribeAck(tickerSymbol, TradeEventHelpers.AllTradeEventTypes));
        }

19 Source : NoOpTradeEventSubscriptionManager.cs
with Apache License 2.0
from Aaronontheweb

public Task<TradeUnsubscribeAck> Unsubscribe(string tickerSymbol, TradeEventType[] events, IActorRef subscriber)
        {
            return Task.FromResult(new TradeUnsubscribeAck(tickerSymbol, events));
        }

19 Source : SampleAppService.cs
with MIT License
from AbpApp

public Task<SampleDto> GetAsync()
        {
            return Task.FromResult(
                new SampleDto
                {
                    Value = 42
                }
            );
        }

19 Source : SampleAppService.cs
with MIT License
from AbpApp

[Authorize]
        public Task<SampleDto> GetAuthorizedAsync()
        {
            return Task.FromResult(
                new SampleDto
                {
                    Value = 42
                }
            );
        }

19 Source : IRecordRepository.cs
with Apache License 2.0
from acblog

public virtual Task<RepositoryStatus> GetStatus(CancellationToken cancellationToken = default) => Task.FromResult(_status);

19 Source : IRecordRepository.cs
with Apache License 2.0
from acblog

public virtual Task<QueryStatistic> Statistic(TQuery query, CancellationToken cancellationToken = default) => Task.FromResult(QueryStatistic.Empty());

19 Source : MarkdownRenderService.cs
with Apache License 2.0
from acblog

public Task<string> RenderPlainText(string markdown)
        {
            return Task.FromResult(Markdown.ToPlainText(markdown, _pipeline.Value));
        }

19 Source : ListatStatisticRepository.cs
with Apache License 2.0
from acblog

public Task<RepositoryStatus> GetStatus(CancellationToken cancellationToken = default) => Task.FromResult(_status.Value);

19 Source : RecordFSReaderBase.cs
with Apache License 2.0
from acblog

public override Task<RepositoryStatus> GetStatus(CancellationToken cancellationToken = default) => Task.FromResult(_status.Value);

19 Source : RecordDBRepository.cs
with Apache License 2.0
from acblog

public virtual Task<RepositoryStatus> GetStatus(CancellationToken cancellationToken = default) => Task.FromResult(_status.Value);

19 Source : FileSystemBlogService.cs
with Apache License 2.0
from acblog

public Task<QueryResponse<string>> Query(BlogQueryRequest query, CancellationToken cancellationToken = default)
        {
            return Task.FromResult(QueryResponse.Error<string>()); // TODO: use generated sitemap
        }

19 Source : PostFSRepo.cs
with Apache License 2.0
from acblog

public Task<KeywordCollection> GetKeywords(CancellationToken cancellationToken = default) => Task.FromResult(new KeywordCollection());

19 Source : HttpFileInfo.cs
with Apache License 2.0
from acblog

public Task<bool> Exists() => Task.FromResult(Response.IsSuccessStatusCode);

19 Source : HttpFileInfo.cs
with Apache License 2.0
from acblog

public Task<long> Length() => Task.FromResult(Response.Content.Headers.ContentLength ?? 0);

19 Source : IFileProvider.cs
with Apache License 2.0
from acblog

public Task<Stream> CreateReadStream() => Task.FromResult(_fileInfo.CreateReadStream());

19 Source : IFileProvider.cs
with Apache License 2.0
from acblog

public Task<bool> Exists() => Task.FromResult(_fileInfo.Exists);

19 Source : IFileProvider.cs
with Apache License 2.0
from acblog

public Task<long> Length() => Task.FromResult(_fileInfo.Length);

19 Source : PostFSRepo.cs
with Apache License 2.0
from acblog

public Task<CategoryTree> GetCategories(CancellationToken cancellationToken = default) => Task.FromResult(new CategoryTree());

19 Source : SignInView.vm.cs
with MIT License
from Accelerider

private async Task<bool> AuthenticateAsync(string username, string preplacedwordMd5)
        {
            var result = await _nonAuthenticationApi.LoginAsync(new LoginArgs
            {
                Email = username,
                Preplacedword = preplacedwordMd5
            }).RunApi();

            //if (!result.Success) return false;

            var acceleriderApi = RestService.For<IAcceleriderApi>(AcceleriderUrls.ApiBaseAddress, new RefitSettings
            {
                AuthorizationHeaderValueGetter = () => Task.FromResult(result.AccessToken)
            });

            var user = await acceleriderApi.GetCurrentUserAsync().RunApi();

            if (user == null) return false;

            RegisterInstance(user, acceleriderApi);

            return true;
        }

See More Examples