本文整理汇总了C#中NotificationEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# NotificationEventArgs类的具体用法?C# NotificationEventArgs怎么用?C# NotificationEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NotificationEventArgs类属于命名空间,在下文中一共展示了NotificationEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PushChannel_ShellToastNotificationReceived
private void PushChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
{
StringBuilder message = new StringBuilder();
string relativeUri = string.Empty;
message.AppendFormat("Received Toast {0}:\n", DateTime.Now.ToShortTimeString());
// Parse out the information that was part of the message.
foreach (string key in e.Collection.Keys)
{
message.AppendFormat("{0}: {1}\n", key, e.Collection[key]);
if (string.Compare(
key,
"wp:Param",
System.Globalization.CultureInfo.InvariantCulture,
System.Globalization.CompareOptions.IgnoreCase) == 0)
{
relativeUri = e.Collection[key];
}
}
// Display a dialog of all the fields in the toast.
Dispatcher.BeginInvoke(() => MessageBox.Show(message.ToString()));
}
示例2: PushJson
/// <summary>
/// Extract the JSON dictionary used to send this push.
/// </summary>
/// <param name="args">The args parameter passed to a push received event.</param>
/// <returns>The JSON dictionary used to send this push.</returns>
public static IDictionary<string, object> PushJson(NotificationEventArgs args) {
string launchString = null;
if (!args.Collection.TryGetValue("wp:Param", out launchString)) {
return new Dictionary<string, object>();
}
return PushJson(launchString);
}
示例3: PushChannel_ShellToastNotificationReceived
private void PushChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
{
string message = String.Empty;
string relativeUri = string.Empty;
foreach (string key in e.Collection.Keys)
{
if (string.Compare(
key,
"wp:Param",
System.Globalization.CultureInfo.InvariantCulture,
System.Globalization.CompareOptions.IgnoreCase) == 0)
{
relativeUri = e.Collection[key];
}
}
message = $"{e.Collection["wp:Text1"]} diz: {e.Collection["wp:Text2"]}";
Dispatcher.BeginInvoke(() => {
if (MessageBox.Show(message, "Nova mensagem", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
{
NavigationService.Navigate(new Uri(relativeUri, UriKind.Relative));
}
});
}
示例4: NotifyObserver
public void NotifyObserver(HttpSessionState currentSession, bool isFinised)
{
const string message = "finished.";
if (NotifyLogger != null) NotifyLogger(message); //+ "\n"
var args = new NotificationEventArgs(currentSession, message, isFinised);
OnAsyncNotificationEvent(args);//for web
}
示例5: HttpChannelToastNotificationReceived
public void HttpChannelToastNotificationReceived(object sender, NotificationEventArgs e)
{
var sb = new StringBuilder();
foreach (var kvp in e.Collection)
{
sb.Append(string.Format("Key:{0} Value:{1}, ", kvp.Key, kvp.Value));
}
result = sb.ToString();
}
示例6: OnNotificationReceived
private async void OnNotificationReceived(object sender, NotificationEventArgs httpNotificationEventArgs)
{
await Task.Run(() =>
{
_messageService.FetchMessages();
_messageService.FetchContacts();
});
_messenger.Publish(new ContentReceivedMessage(this));
}
示例7: httpChannel_ShellToastNotificationReceived
void httpChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
{
string msg = string.Empty;
foreach (var key in e.Collection.Keys)
{
msg += key + " : " + e.Collection[key] + Environment.NewLine;
}
Dispatcher.BeginInvoke(() =>
msgTextBlock.Text = msg);
}
示例8: channel_ShellToastNotificationReceived
private void channel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
{
string message = "";
foreach (var text in e.Collection.Values)
{
message += text + "\r\n";
}
Dispatcher.BeginInvoke(() => output.Text += message);
}
示例9: PushChannel_ShellToastNotificationReceived
private void PushChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
{
string message = e.Collection["wp:Text1"];
IDictionary<string, string> data = null;
if (e.Collection.ContainsKey("wp:Param") && e.Collection["wp:Param"] != null)
{
data = UrlQueryParser.ParseQueryString(e.Collection["wp:Param"]);
}
OnPushNotification(message, data);
}
示例10: channel_ShellToastNotificationReceived
void channel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
{
string title, content, parameter;
e.Collection.TryGetValue("wp:Text1", out title);
e.Collection.TryGetValue("wp:Text2", out content);
e.Collection.TryGetValue("wp:Param", out parameter);
string message = string.Format("Toast notification received.\nTitle: {0}\nContent: {1}\nParameter: {2}\n\n{3}",
title, content, parameter, DateTime.Now);
Dispatcher.BeginInvoke(() => notificationMessage.Text = message);
}
示例11: PushChannel_ShellToastNotificationReceived
void PushChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
{
StringBuilder message = new StringBuilder();
string relativeUri = string.Empty;
Toast toast = new Toast();
if (e.Collection.ContainsKey("wp:Text1"))
{
toast.Title = e.Collection["wp:Text1"];
}
if (e.Collection.ContainsKey("wp:Text2"))
{
toast.Subtitle = e.Collection["wp:Text2"];
}
if (e.Collection.ContainsKey("wp:Param"))
{
toast.Param = e.Collection["wp:Param"];
}
PluginResult result = new PluginResult(PluginResult.Status.OK, toast);
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame;
if (frame != null)
{
PhoneApplicationPage page = frame.Content as PhoneApplicationPage;
if (page != null)
{
CordovaView cView = page.FindName("CordovaView") as CordovaView; // was: PGView
if (cView != null)
{
cView.Browser.Dispatcher.BeginInvoke((ThreadStart)delegate()
{
try
{
cView.Browser.InvokeScript("execScript", this.toastCallback + "(" + result.Message + ")");
}
catch (Exception ex)
{
Debug.WriteLine("ERROR: Exception in InvokeScriptCallback :: " + ex.Message);
}
});
}
}
}
});
}
示例12: pushChannel_ShellToastNotificationReceived
private void pushChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
{
foreach (var key in e.Collection.Keys)
{
Debug.WriteLine("Key: " + key);
}
if (e.Collection.ContainsKey("wp:Param"))
{
IDictionary<string, string> parameters = ParseQueryString(e.Collection["wp:Param"]);
string subscriptionId = parameters["subscriptionId"];
string devicePin = parameters["devicePin"];
SubscriptionNotificationManager.SendNewSubscriptionReceivedEvents(subscriptionId, devicePin);
}
}
示例13: pushChannel_ShellToastNotificationReceived
private void pushChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
{
if (SubscriptionReceived != null)
{
SubscriptionReceived(this, null);
}
}
示例14: httpChannel_ShellToastNotificationReceived
void httpChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
{
App.Trace("===============================================");
App.Trace("Toast/Tile notification arrived:");
string msg = e.Collection["wp:Text2"];
App.Trace(msg);
UpdateStatus("Toast/Tile message: " + msg);
App.Trace("===============================================");
}
示例15: httpChannel_ShellToastNotificationReceived
void httpChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e)
{
Dispatcher.BeginInvoke(() =>
{
Debug.WriteLine("Toast Notification Message Received: ");
if (e.Collection != null)
{
Dictionary<string, string> collection = (Dictionary<string, string>)e.Collection;
foreach (string elementName in collection.Keys)
{
Debug.WriteLine(string.Format("Key: {0}, Value:{1}\r\n", elementName, collection[elementName]));
}
}
});
}