コード例 #1
0
        private async void RNAdapter_ReceivedNotification1(NotificationInfoForRequesting args)
        {
            JSONObjectSerializer <string> serializer = new JSONObjectSerializer <string>();
            var content = serializer.BytesToObject(args.NotificationPreviewContent);

            await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => {
                Messages.Add(new PreviewModel {
                    Content = content, NotificationAccessKey = args.NotificationAccessKey, NotificationId = args.NotificationId
                });
                NoNotificationVisibility = _Messages.Count > 0 ? Visibility.Collapsed : Visibility.Visible;
            });
        }
コード例 #2
0
        private async Task InitializeMessages()
        {
            JSONObjectSerializer <string> serializer = new JSONObjectSerializer <string>();
            IEnumerable <NotificationInfoForRequesting> previewRawdatas = await RawNotification.DotNetCoreBL.RNAdapter.GetAllPreviewData();

            List <PreviewModel> previewData = new List <PreviewModel>(previewRawdatas.Count());

            foreach (var item in previewRawdatas)
            {
                previewData.Add(new PreviewModel {
                    Content = serializer.BytesToObject(item.NotificationPreviewContent), NotificationId = item.NotificationId, NotificationAccessKey = item.NotificationAccessKey
                });
            }
            Messages = new ObservableCollection <PreviewModel>(previewData);
            NoNotificationVisibility = _Messages.Count > 0 ? Visibility.Collapsed : Visibility.Visible;
        }