protected override async void OnBackgroundActivated(BackgroundActivatedEventArgs args) { var deferral = args.TaskInstance.GetDeferral(); switch (args.TaskInstance.Task.Name) { case "ToastBackgroundTask": var details = args.TaskInstance.TriggerDetails as ToastNotificationActionTriggerDetail; if (details != null) { QueryString arguments = QueryString.Parse(details.Argument); var userInput = details.UserInput; ToastNotificationHistory notificationHistory = ToastNotificationManager.History; switch (arguments["action"]) { case "DismissMessages": notificationHistory.RemoveGroup("messages"); break; case "ReplyMessage": SBConversation conversation = NotificationServerConnection.ReturnConversationFromConversationId(arguments["conversationId"]); string reply = (string)userInput["ReplyBox"]; await conversation.SendTextMessage(reply); break; case "acceptContact": Contact contact = JsonConvert.DeserializeObject <Contact>(arguments["contact"]); await NotificationServerConnection.AcceptNewContact(contact); break; } } break; } deferral.Complete(); }
/// <summary> /// Do not call this. Instead, call <see cref="DesktopNotificationManagerCompat.History"/> to obtain an instance. /// </summary> /// <param name="aumid"></param> internal DesktopNotificationHistoryCompat(string aumid) { _aumid = aumid; _history = ToastNotificationManager.History; }
NotificationService NotificationService.setup() { history = ToastNotificationManager.History; return(this); }
private async Task OnLaunchedOrActived(IActivatedEventArgs e) { await RegisterBackgroundTask(); Frame rootFrame = Window.Current.Content as Frame; // Não repita a inicialização do aplicativo quando a Janela já tiver conteúdo, // apenas verifique se a janela está ativa if (rootFrame == null) { // Crie um Quadro para atuar como o contexto de navegação e navegue para a primeira página rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { // TODO: Carregue o estado do aplicativo suspenso anteriormente } // Coloque o quadro na Janela atual Window.Current.Content = rootFrame; } if (e is LaunchActivatedEventArgs) { var args = e as LaunchActivatedEventArgs; if (args.PrelaunchActivated == false) { if (rootFrame.Content == null) { // Quando a pilha de navegação não for restaurada, navegar para a primeira página, // configurando a nova página passando as informações necessárias como um parâmetro // de navegação rootFrame.Navigate(typeof(LoginPage), args.Arguments); } // Verifique se a janela atual está ativa Window.Current.Activate(); ExtendAcrylicIntoTitleBar(); } } else if (e is ToastNotificationActivatedEventArgs) { var args = e as ToastNotificationActivatedEventArgs; if (rootFrame.Content == null) { // Quando a pilha de navegação não for restaurada, navegar para a primeira página, // configurando a nova página passando as informações necessárias como um parâmetro // de navegação rootFrame.Navigate(typeof(LoginPage)); // Verifique se a janela atual está ativa Window.Current.Activate(); ExtendAcrylicIntoTitleBar(); } else { ToastNotificationHistory notificationHistory = ToastNotificationManager.History; QueryString arguments = QueryString.Parse(args.Argument); switch (arguments["action"]) { case "newMessage": notificationHistory.RemoveGroup("messages"); if (rootFrame.Content is ChatPage && (rootFrame.Content as ChatPage).ConversationId.Equals(arguments["conversationId"])) { break; } _ = rootFrame.Navigate(typeof(ChatPage), new ChatPageNavigationParameters() { NotificationServerConnection = NotificationServerConnection, SbConversationId = arguments["conversationId"] }); break; } } } }
private void MainPage_Loaded(object sender, RoutedEventArgs e) { // show bibles List <Arguments> _args = new List <Arguments>() { new Arguments() { Value = "和合本" }, new Arguments() { Value = "现代中文译本" }, new Arguments() { Value = "ESV" }, new Arguments() { Value = "中文新译本" }, new Arguments() { Value = "吕振中译本" }, new Arguments() { Value = "NIV" }, new Arguments() { Value = "WEV" }, new Arguments() { Value = "KJV" } }; gvBibleVersion.ItemsSource = _args; // remove toasts var toastNotifier = ToastNotificationManager.CreateToastNotifier(); // remove the toast from action center ToastNotificationHistory toastHistory = ToastNotificationManager.History; toastHistory.Remove("qbible"); // remove all scheduled toast by Me from the history IList <ScheduledToastNotification> toasts = toastNotifier.GetScheduledToastNotifications().ToList(); foreach (var item in toasts) { if (item.Tag == "qbible") { toastNotifier.RemoveFromSchedule(item); } } // hide status bar //StatusBar statusbar = StatusBar.GetForCurrentView(); //await statusbar.HideAsync(); }
internal NotificationHistory(string aumid) { this.aumid = aumid; history = ToastNotificationManager.History; }
public BridgeToastNotificationDispatchService() { this.history = ToastNotificationManager.History; }
public ToastManager() { _toastNotifier = ToastNotificationManager.CreateToastNotifier("App"); _toastHistory = ToastNotificationManager.History; }
public DesktopToastNotificationDispatchService(string aumid) { this.aumid = aumid; this.history = ToastNotificationManager.History; }