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
19
View Source File : DbManagerTest.cs
License : MIT License
Project Creator : 0x1000000
License : MIT License
Project Creator : 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
View Source File : HelloService.cs
License : MIT License
Project Creator : 1100100
License : MIT License
Project Creator : 1100100
[NonIntercept]
[ServerMethodInterceptor]
public async Task<ResultModel> SayHello(string name)
{
//await Task.Delay(5000);
return await Task.FromResult(new ResultModel { Message = name });
}
19
View Source File : HelloService.cs
License : MIT License
Project Creator : 1100100
License : MIT License
Project Creator : 1100100
public async Task<ResultModel> SayHello(TestModel testModel)
{
return await Task.FromResult(new ResultModel
{
Message = "Rec " + testModel.Name
});
}
19
View Source File : HelloService.cs
License : MIT License
Project Creator : 1100100
License : MIT License
Project Creator : 1100100
public async Task<ResponseResult<string>> Test()
{
return await Task.FromResult(new ResponseResult<string>
{
Success = true,
Result = "OK"
});
}
19
View Source File : MemoryCacheHandler.cs
License : MIT License
Project Creator : 17MKH
License : MIT License
Project Creator : 17MKH
public Task<string> Get(string key)
{
var value = _cache.Get(key);
return Task.FromResult(value?.ToString());
}
19
View Source File : MemoryCacheHandler.cs
License : MIT License
Project Creator : 17MKH
License : MIT License
Project Creator : 17MKH
public Task<T> Get<T>(string key)
{
return Task.FromResult(_cache.Get<T>(key));
}
19
View Source File : MemoryCacheHandler.cs
License : MIT License
Project Creator : 17MKH
License : MIT License
Project Creator : 17MKH
public Task<bool> Exists(string key)
{
return Task.FromResult(_cache.TryGetValue(key, out _));
}
19
View Source File : TestB2CAuthService.cs
License : MIT License
Project Creator : 1iveowl
License : MIT License
Project Creator : 1iveowl
public async Task<IUserContext> SignIn(IEnumerable<string> scopes = null, bool silentlyOnly = false, CancellationToken cancellationToken = default)
{
return await Task.FromResult(_userContext);
}
19
View Source File : AuditoriumLayoutRepository.cs
License : Apache License 2.0
Project Creator : 42skillz
License : Apache License 2.0
Project Creator : 42skillz
public Task<AuditoriumDto> GetAuditoriumSeatingFor(string showId)
{
if (_repository.ContainsKey(showId))
{
return Task.FromResult(_repository[showId]);
}
return Task.FromResult(new AuditoriumDto());
}
19
View Source File : ReservationsProvider.cs
License : Apache License 2.0
Project Creator : 42skillz
License : Apache License 2.0
Project Creator : 42skillz
public Task<ReservedSeatsDto> GetReservedSeats(string showId)
{
if (_repository.ContainsKey(showId))
{
return Task.FromResult(_repository[showId]);
}
return Task.FromResult(new ReservedSeatsDto());
}
19
View Source File : RoleAppService.cs
License : MIT License
Project Creator : 52ABP
License : MIT License
Project Creator : 52ABP
public Task<ListResultDto<PermissionDto>> GetAllPermissions()
{
var permissions = PermissionManager.GetAllPermissions();
return Task.FromResult(new ListResultDto<PermissionDto>(
ObjectMapper.Map<List<PermissionDto>>(permissions)
));
}
19
View Source File : Identity.cs
License : GNU Lesser General Public License v3.0
Project Creator : 8720826
License : GNU Lesser General Public License v3.0
Project Creator : 8720826
public static async Task<bool> HasLogin(this HttpContext content)
{
return await Task.FromResult(content.User.Idenreplacedy.IsAuthenticated);
}
19
View Source File : WareCommandHandler.cs
License : GNU Lesser General Public License v3.0
Project Creator : 8720826
License : GNU Lesser General Public License v3.0
Project Creator : 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
View Source File : User.cshtml.cs
License : GNU Lesser General Public License v3.0
Project Creator : 8720826
License : GNU Lesser General Public License v3.0
Project Creator : 8720826
public async Task<IActionResult> OnPostAsync([FromBody]EnableData enableData)
{
await _userAppService.SetEnabled(enableData.SId, enableData.IsEnable);
return await Task.FromResult(new JsonResult(enableData));
}
19
View Source File : Index.cshtml.cs
License : GNU Lesser General Public License v3.0
Project Creator : 8720826
License : GNU Lesser General Public License v3.0
Project Creator : 8720826
public async Task<IActionResult> OnPostAsync([FromBody]EnableData enableData)
{
await _userAppService.SetEnabled(enableData.SId, enableData.IsEnable);
return await Task.FromResult(new JsonResult(enableData));
}
19
View Source File : ModifyPassword.cshtml.cs
License : GNU Lesser General Public License v3.0
Project Creator : 8720826
License : GNU Lesser General Public License v3.0
Project Creator : 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
View Source File : Reg.cshtml.cs
License : GNU Lesser General Public License v3.0
Project Creator : 8720826
License : GNU Lesser General Public License v3.0
Project Creator : 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
View Source File : ResetPassword.cshtml.cs
License : GNU Lesser General Public License v3.0
Project Creator : 8720826
License : GNU Lesser General Public License v3.0
Project Creator : 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
View Source File : NpcCommandHandler.cs
License : GNU Lesser General Public License v3.0
Project Creator : 8720826
License : GNU Lesser General Public License v3.0
Project Creator : 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
View Source File : CreatePlayer.cshtml.cs
License : GNU Lesser General Public License v3.0
Project Creator : 8720826
License : GNU Lesser General Public License v3.0
Project Creator : 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
View Source File : ForgotPassword.cshtml.cs
License : GNU Lesser General Public License v3.0
Project Creator : 8720826
License : GNU Lesser General Public License v3.0
Project Creator : 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
View Source File : Login.cshtml.cs
License : GNU Lesser General Public License v3.0
Project Creator : 8720826
License : GNU Lesser General Public License v3.0
Project Creator : 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
View Source File : QuestCommandHandler.cs
License : GNU Lesser General Public License v3.0
Project Creator : 8720826
License : GNU Lesser General Public License v3.0
Project Creator : 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
View Source File : QuestCommandHandler.cs
License : GNU Lesser General Public License v3.0
Project Creator : 8720826
License : GNU Lesser General Public License v3.0
Project Creator : 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
View Source File : Index.cshtml.cs
License : GNU Lesser General Public License v3.0
Project Creator : 8720826
License : GNU Lesser General Public License v3.0
Project Creator : 8720826
public async Task<IActionResult> OnPostAsync([FromBody]EnableData enableData)
{
await _npcAppService.SetEnabled(enableData.SId, enableData.IsEnable);
return await Task.FromResult(new JsonResult(enableData));
}
19
View Source File : SendVerifyEmail.cshtml.cs
License : GNU Lesser General Public License v3.0
Project Creator : 8720826
License : GNU Lesser General Public License v3.0
Project Creator : 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
View Source File : VerifyEmail.cshtml.cs
License : GNU Lesser General Public License v3.0
Project Creator : 8720826
License : GNU Lesser General Public License v3.0
Project Creator : 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
View Source File : MockDataStore.cs
License : GNU General Public License v3.0
Project Creator : 9vult
License : GNU General Public License v3.0
Project Creator : 9vult
public async Task<Item> GereplacedemAsync(string id)
{
return await Task.FromResult(items.FirstOrDefault(s => s.Id == id));
}
19
View Source File : IOServer.cs
License : MIT License
Project Creator : a11s
License : MIT License
Project Creator : 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
View Source File : InMemoryTradeEventPublisher.cs
License : Apache License 2.0
Project Creator : Aaronontheweb
License : Apache License 2.0
Project Creator : 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
View Source File : InMemoryTradeEventPublisher.cs
License : Apache License 2.0
Project Creator : Aaronontheweb
License : Apache License 2.0
Project Creator : 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
View Source File : NoOpTradeEventSubscriptionManager.cs
License : Apache License 2.0
Project Creator : Aaronontheweb
License : Apache License 2.0
Project Creator : Aaronontheweb
public Task<TradeSubscribeAck> Subscribe(string tickerSymbol, TradeEventType[] events, IActorRef subscriber)
{
return Task.FromResult(new TradeSubscribeAck(tickerSymbol, TradeEventHelpers.AllTradeEventTypes));
}
19
View Source File : NoOpTradeEventSubscriptionManager.cs
License : Apache License 2.0
Project Creator : Aaronontheweb
License : Apache License 2.0
Project Creator : Aaronontheweb
public Task<TradeUnsubscribeAck> Unsubscribe(string tickerSymbol, TradeEventType[] events, IActorRef subscriber)
{
return Task.FromResult(new TradeUnsubscribeAck(tickerSymbol, events));
}
19
View Source File : SampleAppService.cs
License : MIT License
Project Creator : AbpApp
License : MIT License
Project Creator : AbpApp
public Task<SampleDto> GetAsync()
{
return Task.FromResult(
new SampleDto
{
Value = 42
}
);
}
19
View Source File : SampleAppService.cs
License : MIT License
Project Creator : AbpApp
License : MIT License
Project Creator : AbpApp
[Authorize]
public Task<SampleDto> GetAuthorizedAsync()
{
return Task.FromResult(
new SampleDto
{
Value = 42
}
);
}
19
View Source File : IRecordRepository.cs
License : Apache License 2.0
Project Creator : acblog
License : Apache License 2.0
Project Creator : acblog
public virtual Task<RepositoryStatus> GetStatus(CancellationToken cancellationToken = default) => Task.FromResult(_status);
19
View Source File : IRecordRepository.cs
License : Apache License 2.0
Project Creator : acblog
License : Apache License 2.0
Project Creator : acblog
public virtual Task<QueryStatistic> Statistic(TQuery query, CancellationToken cancellationToken = default) => Task.FromResult(QueryStatistic.Empty());
19
View Source File : MarkdownRenderService.cs
License : Apache License 2.0
Project Creator : acblog
License : Apache License 2.0
Project Creator : acblog
public Task<string> RenderPlainText(string markdown)
{
return Task.FromResult(Markdown.ToPlainText(markdown, _pipeline.Value));
}
19
View Source File : ListatStatisticRepository.cs
License : Apache License 2.0
Project Creator : acblog
License : Apache License 2.0
Project Creator : acblog
public Task<RepositoryStatus> GetStatus(CancellationToken cancellationToken = default) => Task.FromResult(_status.Value);
19
View Source File : RecordFSReaderBase.cs
License : Apache License 2.0
Project Creator : acblog
License : Apache License 2.0
Project Creator : acblog
public override Task<RepositoryStatus> GetStatus(CancellationToken cancellationToken = default) => Task.FromResult(_status.Value);
19
View Source File : RecordDBRepository.cs
License : Apache License 2.0
Project Creator : acblog
License : Apache License 2.0
Project Creator : acblog
public virtual Task<RepositoryStatus> GetStatus(CancellationToken cancellationToken = default) => Task.FromResult(_status.Value);
19
View Source File : FileSystemBlogService.cs
License : Apache License 2.0
Project Creator : acblog
License : Apache License 2.0
Project Creator : acblog
public Task<QueryResponse<string>> Query(BlogQueryRequest query, CancellationToken cancellationToken = default)
{
return Task.FromResult(QueryResponse.Error<string>()); // TODO: use generated sitemap
}
19
View Source File : PostFSRepo.cs
License : Apache License 2.0
Project Creator : acblog
License : Apache License 2.0
Project Creator : acblog
public Task<KeywordCollection> GetKeywords(CancellationToken cancellationToken = default) => Task.FromResult(new KeywordCollection());
19
View Source File : HttpFileInfo.cs
License : Apache License 2.0
Project Creator : acblog
License : Apache License 2.0
Project Creator : acblog
public Task<bool> Exists() => Task.FromResult(Response.IsSuccessStatusCode);
19
View Source File : HttpFileInfo.cs
License : Apache License 2.0
Project Creator : acblog
License : Apache License 2.0
Project Creator : acblog
public Task<long> Length() => Task.FromResult(Response.Content.Headers.ContentLength ?? 0);
19
View Source File : IFileProvider.cs
License : Apache License 2.0
Project Creator : acblog
License : Apache License 2.0
Project Creator : acblog
public Task<Stream> CreateReadStream() => Task.FromResult(_fileInfo.CreateReadStream());
19
View Source File : IFileProvider.cs
License : Apache License 2.0
Project Creator : acblog
License : Apache License 2.0
Project Creator : acblog
public Task<bool> Exists() => Task.FromResult(_fileInfo.Exists);
19
View Source File : IFileProvider.cs
License : Apache License 2.0
Project Creator : acblog
License : Apache License 2.0
Project Creator : acblog
public Task<long> Length() => Task.FromResult(_fileInfo.Length);
19
View Source File : PostFSRepo.cs
License : Apache License 2.0
Project Creator : acblog
License : Apache License 2.0
Project Creator : acblog
public Task<CategoryTree> GetCategories(CancellationToken cancellationToken = default) => Task.FromResult(new CategoryTree());
19
View Source File : SignInView.vm.cs
License : MIT License
Project Creator : Accelerider
License : MIT License
Project Creator : 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