本文整理汇总了C#中INotificationService.SendNotification方法的典型用法代码示例。如果您正苦于以下问题:C# INotificationService.SendNotification方法的具体用法?C# INotificationService.SendNotification怎么用?C# INotificationService.SendNotification使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类INotificationService
的用法示例。
在下文中一共展示了INotificationService.SendNotification方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Post
public HttpResponseMessage Post([FromBody]JToken jsonbody)
{
// Process the jsonbody
var requestStream = HttpContext.Current.Request.InputStream;
Stream req = requestStream;
req.Seek(0, System.IO.SeekOrigin.Begin);
string json = jsonbody.ToString();
ActionRequest ar = null;
try
{
// assuming JSON.net/Newtonsoft library from http://json.codeplex.com/
ar = JsonConvert.DeserializeObject<ActionRequest>(json);
}
catch
{
// Try and handle malformed POST body
return new HttpResponseMessage(HttpStatusCode.BadRequest);
}
_notificationService = new NotificationService();
ProgressState ps = ar.ToProgressObject(ar, ar.StateString);
_notificationService.SendNotification(ps);
_progressHub.sendProgressUpdate(ps);
return new HttpResponseMessage(HttpStatusCode.Created);
}
示例2: NotifyUsers
private static void NotifyUsers()
{
_notificationService = new NotificationService();
var engineers = new List<User>
{
new User("Xing"),
new User("Saurav"),
new User("Saurabh"),
new User("Gerry"),
new User("Te"),
new User("Rupesh"),
new User("Chris"),
new User("Micheal"),
new User("Will"),
new User("Eric"),
new User("Ray"),
new User("Sameeri")
};
_notificationService.SendNotification(engineers);
}
示例3: SendNotification
private async Task SendNotification(NotificationRequest request,
INotificationService service,
string title,
string description,
User user,
CancellationToken cancellationToken)
{
var notification = new UserNotification
{
Date = request.Date,
Description = description,
Level = request.Level,
Name = title,
Url = request.Url,
User = user
};
_logger.Debug("Sending notification via {0} to user {1}", service.Name, user.Name);
try
{
await service.SendNotification(notification, cancellationToken).ConfigureAwait(false);
}
catch (Exception ex)
{
_logger.ErrorException("Error sending notification to {0}", ex, service.Name);
}
}