本文整理汇总了C#中INotification类的典型用法代码示例。如果您正苦于以下问题:C# INotification类的具体用法?C# INotification怎么用?C# INotification使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
INotification类属于命名空间,在下文中一共展示了INotification类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleNotification
public override void HandleNotification (INotification notification)
{
switch((NotificationEnum)notification.NotifyEnum)
{
case NotificationEnum.HERO_INIT:
{
HeroRecord record = notification.Body as HeroRecord;
HandleHeroInit(record);
break;
}
case NotificationEnum.MOUSE_HIT_OBJECT:
{
HandleHeroClick();
break;
}
case NotificationEnum.HERO_CONVERT:
{
int heroKid = (int)notification.Body;
HandleHeroConvert(heroKid);
break;
}
case NotificationEnum.BATTLE_PAUSE:
{
bool isPause = (bool)notification.Body;
HandleBattlePause(isPause);
break;
}
case NotificationEnum.HERO_TRANSPORT:
{
Vector3 destPosition = (Vector3)notification.Body;
HandleHeroTransport(destPosition);
break;
}
}
}
示例2: SendNotification
public void SendNotification(INotification notification, SendNotificationCallbackDelegate callback)
{
if (string.IsNullOrEmpty(googleAuthToken))
RefreshGoogleAuthToken();
var msg = notification as C2dmNotification;
var result = new C2dmMessageTransportResponse();
result.Message = msg;
//var postData = msg.GetPostData();
var webReq = (HttpWebRequest)WebRequest.Create(C2DM_SEND_URL);
//webReq.ContentLength = postData.Length;
webReq.Method = "POST";
webReq.ContentType = "application/x-www-form-urlencoded";
webReq.UserAgent = "PushSharp (version: 1.0)";
webReq.Headers.Add("Authorization: GoogleLogin auth=" + googleAuthToken);
webReq.BeginGetRequestStream(requestStreamCallback, new C2dmAsyncParameters()
{
Callback = callback,
WebRequest = webReq,
WebResponse = null,
Message = msg,
GoogleAuthToken = googleAuthToken,
SenderId = androidSettings.SenderID,
ApplicationId = androidSettings.ApplicationID
});
}
示例3: Execute
/**
* Constructor.
*/
/**
* Fabricate a result by multiplying the input by 2
*
* @param event the <code>IEvent</code> carrying the <code>MacroCommandTestVO</code>
*/
public override void Execute(INotification note)
{
MacroCommandTestVO vo = (MacroCommandTestVO) note.Body;
// Fabricate a result
vo.result1 = 2 * vo.input;
}
示例4: SaveNotificationToXml
public override void SaveNotificationToXml(INotification notification, XmlElement notificationElement)
{
var n = notification as PopupNotification;
notificationElement.SetAttribute("notificationText", n.NotificationText);
notificationElement.SetAttribute("caption", n.Caption);
notificationElement.SetAttribute("icon", n.Icon.ToString());
}
示例5: validate
protected override void validate(object target, object rawValue, INotification notification)
{
if (rawValue == null || rawValue.ToString() == string.Empty)
{
logMessage(notification, GetMessage(this, Property));
}
}
示例6: SaveSettingsToNotification
public void SaveSettingsToNotification(INotification notification)
{
var n = notification as UsbLampNotification;
n.Enabled = this.settingsPanel.NotificationEnabled;
n.FlashCount = this.settingsPanel.FlashesCount;
n.FlashColor = this.settingsPanel.LampColor;
}
示例7: SendNotification
public void SendNotification(INotification notification, SendNotificationCallbackDelegate callback)
{
var message = notification as FirefoxOSNotification;
var data = Encoding.UTF8.GetBytes(message.ToString());
var request = (HttpWebRequest)WebRequest.Create(message.EndPointUrl);
request.Method = "PUT";
request.ContentLength = data.Length;
request.UserAgent = string.Format("PushSharp (version: {0})", version);
using (var rs = request.GetRequestStream())
{
rs.Write(data, 0, data.Length);
}
try
{
request.BeginGetResponse(ResponseCallback, new object[] { request, message, callback });
}
catch (WebException ex)
{
callback(this, new SendNotificationResult(message, false, ex));
}
}
示例8: NotifyAsync
public override async Task NotifyAsync(IVssRequestContext requestContext, INotification notification, BotElement bot, EventRuleElement matchingRule)
{
var token = bot.GetSetting("token");
if (string.IsNullOrEmpty(token)) throw new ArgumentException("Missing token!");
var tasks = new List<Task>();
var slackClient = new SlackClient();
foreach (string tfsUserName in notification.TargetUserNames)
{
var userId = bot.GetMappedUser(tfsUserName);
if (userId != null)
{
Message slackMessage = ToSlackMessage((dynamic)notification, bot, null, true);
if (slackMessage != null)
{
slackMessage.AsUser = true;
var t = Task.Run(async () =>
{
var response = await slackClient.SendApiMessageAsync(slackMessage, token, userId);
response.EnsureSuccessStatusCode();
var content = await response.Content.ReadAsStringAsync();
});
tasks.Add(t);
}
}
}
await Task.WhenAll(tasks);
}
示例9: HandleNotification
public override void HandleNotification (INotification notification)
{
switch((NotificationEnum)notification.NotifyEnum)
{
case NotificationEnum.NPC_INIT:
HandleNPCInit();
break;
case NotificationEnum.NPC_DISPOSE:
HandleNPCDispose();
break;
case NotificationEnum.TOWN_NPC_SPAWN:
HandleTownNPCSpawn();
break;
case NotificationEnum.BLOCK_SPAWN:
{
Block block = notification.Body as Block;
HandleNPCSpawn(block);
break;
}
case NotificationEnum.BLOCK_DESPAWN:
{
Block block = notification.Body as Block;
HandleNPCDespawn(block);
break;
}
case NotificationEnum.NPC_DIALOG_SHOW:
NPC npc = notification.Body as NPC;
HandleDialogShow(npc);
break;
}
}
示例10: ProcessEvent
/// <summary>
/// This is the one where all the magic happens.
/// </summary>
/// <returns>The outcome of the policy Execution as per ISubscriber's contract</returns>
/// <param name="requestContext">TFS Request Context</param>
/// <param name="notification">The <paramref name="notification"/> containing the WorkItemChangedEvent</param>
public ProcessingResult ProcessEvent(IRequestContext requestContext, INotification notification)
{
var result = new ProcessingResult();
Policy[] policies = this.FilterPolicies(this.settings.Policies, requestContext, notification).ToArray();
if (policies.Any())
{
IWorkItem workItem = this.store.GetWorkItem(notification.WorkItemId);
foreach (var policy in policies)
{
this.logger.ApplyingPolicy(policy.Name);
this.ApplyRules(workItem, policy.Rules);
}
this.SaveChangedWorkItems();
result.StatusCode = 0;
result.StatusMessage = "Success";
}
else
{
result.StatusCode = 1;
result.StatusMessage = "No operation";
}
return result;
}
示例11: Execute
public override void Execute(INotification notification)
{
var programArgsProxy = Facade.RetrieveProxy<ProgramArgsProxy>(Globals.ProgramArgsProxy);
var typeOfCommand = programArgsProxy.Args.OutputFileFormat;
var serializationResult = string.Empty;
switch (typeOfCommand)
{
case OutputReportType.FLAT:
serializationResult = OutputCommandsToFlat();
break;
case OutputReportType.JSON:
serializationResult = OutputCommandsToJson();
break;
case OutputReportType.XML:
serializationResult = OutputCommandsToXml();
break;
}
switch (programArgsProxy.Args.OutputFile)
{
case "":
Console.WriteLine(serializationResult);
break;
default:
using (var outFile = new StreamWriter(programArgsProxy.Args.OutputFile))
{
outFile.Write(serializationResult);
}
break;
}
}
示例12: HandleNotification
public override void HandleNotification( INotification note )
{
UserVo User = note.Body as UserVo;
switch( note.Name )
{
case ApplicationFacade.NEW_USER:
ClearForm();
UserForm.Username.IsEnabled = true;
UserForm.User = User;
UserForm.Mode = UserForm.MODE_ADD;
UserForm.SubmitButton.Content = "Add User";
UserForm.IsEnabled = true;
UserForm.First.Focus();
UserForm.Username.IsEnabled = true;
break;
case ApplicationFacade.USER_DELETED:
UserForm.User = null;
ClearForm();
break;
case ApplicationFacade.USER_SELECTED:
ClearForm();
UserForm.IsEnabled = true;
UserForm.Username.IsEnabled = false;
UserForm.User = User;
UserForm.Confirm.Password = User.Password;
UserForm.Mode = UserForm.MODE_EDIT;
UserForm.First.Focus();
UserForm.SubmitButton.Content = "Update User";
break;
}
}
示例13: GetWindow
/// <summary>
/// Returns the window to display as part of the trigger action.
/// </summary>
/// <param name="notification">The notification to be set as a DataContext in the window.</param>
/// <returns></returns>
protected override Window GetWindow(INotification notification)
{
Window wrapperWindow;
if (WindowContent != null)
{
wrapperWindow = CreateWindow();
if (wrapperWindow == null)
throw new NullReferenceException("CreateWindow cannot return null");
// If the WindowContent does not have its own DataContext, it will inherit this one.
wrapperWindow.DataContext = notification;
wrapperWindow.Title = notification.Title;
PrepareContentForWindow(notification, wrapperWindow);
}
else
{
wrapperWindow = CreateDefaultWindow(notification);
}
if (AssociatedObject != null)
wrapperWindow.Owner = Window.GetWindow(AssociatedObject);
// If the user provided a Style for a Window we set it as the window's style.
if (WindowStyle != null)
wrapperWindow.Style = WindowStyle;
return wrapperWindow;
}
示例14: HandleNotification
public void HandleNotification(INotification notification)
{
if (_interestNotifications.Contains(notification.name))
{
_HandleNotification(notification);
}
}
示例15: HandleNotification
public override void HandleNotification (INotification notification)
{
switch((NotificationEnum)notification.NotifyEnum)
{
case NotificationEnum.BLOCK_INIT:
{
HandleBlockInit();
break;
}
case NotificationEnum.BLOCK_DISPOSE:
{
HandleBlockDispose();
break;
}
case NotificationEnum.BLOCK_REFRESH:
{
Vector3 position = (Vector3)notification.Body;
HandleRefreshBlocks(position);
break;
}
case NotificationEnum.BLOCK_SHOW_ALL:
{
HandleShowAllBlocks();
break;
}
}
}