Esempio n. 1
0
        public static void OnNotificationReceivedInBGTask(NotificationInfoForRequesting args)
        {
            SharedLibs.JSONObjectSerializer <string> serializer = new SharedLibs.JSONObjectSerializer <string>();
            string content = serializer.BytesToObject(args.NotificationPreviewContent);

            DotNetCoreLibs.ToastNotificationHelper.Show("New Notification received in BG", content);
        }
Esempio n. 2
0
        public static byte[] NotificationReceivedAsync(string notifiGeneralInfoData)
        {
            Monitor.Enter(ReceiveNotificationLock);
            byte[] result = Task.Run <byte[]>(async() =>
            {
                JSONObjectSerializer <NotificationInfoForRequesting> serializer = new SharedLibs.JSONObjectSerializer <NotificationInfoForRequesting>();
                var notifiinfo = serializer.StringToObject(notifiGeneralInfoData);
                await(await DAProvider.GetNotifiInfoDataProviderAsync()).AddNotificationAsync(notifiinfo);

                bool?isReadAlready = null;
                try
                {
                    isReadAlready = (await DAProvider.GetServiceProviderAsync().CheckIfNotificationReadAsync(notifiinfo.ReiceiverNotificationID)).Data;
                }
                catch
                {
                }
                if (isReadAlready != null && !isReadAlready.Value)
                {
                    NotificationReceived?.Invoke(notifiinfo);
                }
                return(notifiinfo.NotificationPreviewContent);
            }).Result;
            Monitor.Exit(ReceiveNotificationLock);
            return(result);
        }