コード例 #1
0
        public async Task AddNotificationAsync()
        {
            DoLongWork();
            try
            {
                RawNotification.SharedLibs.JSONObjectSerializer <string> serializer = new RawNotification.SharedLibs.JSONObjectSerializer <string>();
                byte[] previewDatainBytes = serializer.ObjectToBytes(PreviewData);
                byte[] contentDatainBytes = serializer.ObjectToBytes(ContentData);
                ObservableCollection <string> selectedList = new ObservableCollection <string>(_Customers.Where(c => c.Selected == true).Select(c => c.Id.ToString()));

                RNServerService.RNServerCommunicatorClient sv = new RNServerService.RNServerCommunicatorClient();
                var result = await sv.AddNotificationAsync(contentDatainBytes, previewDatainBytes, selectedList);

                if (result.StatusCode != RawNotification.Models.ResultStatusCodes.OK)
                {
                    throw new Exception(result.Message);
                }
                else
                {
                    await new MessageDialog("Adding notification successfull", "Success").ShowAsync();
                }
            }
            catch (Exception ex)
            {
                await new MessageDialog(ex.Message, "Error").ShowAsync();
            }
            FinishDoLongWork();
        }
コード例 #2
0
        internal void AddNotification()
        {
            try
            {
                using (var service = AppGlobal.getRNServerService())
                {
                    RawNotification.SharedLibs.JSONObjectSerializer <string> serializer = new RawNotification.SharedLibs.JSONObjectSerializer <string>();

                    var result = service.AddNotification
                                 (
                        serializer.ObjectToBytes(NotificationContent),
                        serializer.ObjectToBytes(_NotificationPreviewContent),
                        _Receivers.Select(r => r.RNReceiverOldID).ToArray()
                                 );

                    if (result.StatusCode != RawNotification.Models.ResultStatusCodes.OK)
                    {
                        throw new Exception(result.Message);
                    }
                    else
                    {
                        MessageBox.Show("Adding notification successfull", "Success");
                    }
                }
            } catch (Exception ex)
            {
                FireHandledExeptionAndLogErorrAsync(new HandledError(ex, "Error occurred while sending notification", "None"));
            }
        }
コード例 #3
0
        public async Task InitializeContent(PreviewModel model)
        {
            DoLongWork();
            try
            {
                byte[] data = await RawNotification.DotNetCoreBL.RNAdapter.GetNotificationContentAsync(model.NotificationId, model.NotificationAccessKey);

                RawNotification.SharedLibs.JSONObjectSerializer <string> serializer = new RawNotification.SharedLibs.JSONObjectSerializer <string>();
                Content = serializer.BytesToObject(data);
            }
            catch (Exception ex)
            {
                await new MessageDialog(ex.Message).ShowAsync();
            }
            finally
            {
                FinishDoLongWork();
            }
        }