Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Acumatica移动推送通知,不使用业务事件_C#_Acumatica_Acumatica Kb - Fatal编程技术网

C# Acumatica移动推送通知,不使用业务事件

C# Acumatica移动推送通知,不使用业务事件,c#,acumatica,acumatica-kb,C#,Acumatica,Acumatica Kb,如何在不使用业务事件的情况下发送移动推送通知?当用户点击通知时,可以发送移动推送通知,而不使用业务事件在移动应用程序中打开屏幕 下面的示例描述了该方法: 使用系统; 使用系统集合; 使用System.Linq; 使用系统线程; 使用CommonServiceLocator; 使用PX.Api.Mobile.PushNotifications; 使用PX.Common; 使用PX数据; 使用PX.Objects.SO; 命名空间PX.pushNotificationOinSample.Ext {

如何在不使用业务事件的情况下发送移动推送通知?

当用户点击通知时,可以发送
移动推送通知
,而不使用
业务事件
在移动应用程序中打开屏幕

下面的示例描述了该方法:

使用系统;
使用系统集合;
使用System.Linq;
使用系统线程;
使用CommonServiceLocator;
使用PX.Api.Mobile.PushNotifications;
使用PX.Common;
使用PX数据;
使用PX.Objects.SO;
命名空间PX.pushNotificationOinSample.Ext
{
公共类SOOrderEntryPXExt:PXGraphExtension
{
公共行动观;
[PXUIField(DisplayName=Messages.ViewActionDisplayName,
MapEnableRights=PXCacheRights.Select,MapViewRights=PXCacheRights.Select)]
[PXButton(SpecialType=PXSpecialButtonType.Default)]
公共虚拟IEnumerable ViewOnMobilePP(PXAdapter适配器)
{
if(Base.Document.Cache.GetStatus(Base.Document.Current)==PXEntryStatus.Inserted||
Base.Document.Cache.GetStatus(Base.Document.Current)=PXEntryStatus.InsertedDeleted{return adapter.Get();}
//获取PushNotification服务的实例
var pushNotificationSender=ServiceLocator.Current.GetInstance();
//将向其发送消息的用户
var userIds=new[]{PXAccess.GetUserID()};
//检查用户是否正在使用Acumatica移动应用程序
var-activeTokens=pushNotificationSender.CountActiveTokens(用户标识);
如果(activeTokens==0)
{
抛出新的PXException(Messages.NoDeviceError);
}
字符串sOrderNbr=Base.Document.Current.OrderNbr;
字符串sScreenID=Base.Accessinfo.ScreenID.Replace(“.”,”);
Guid noteID=Base.Document.Current.noteID.Value;
PXLongOperation.StartOperation(基本,()=>
{
尝试
{
pushNotificationSender.SendNotificationAsync(
userid:userid,
//推送通知标题
标题:Messages.PushNotificationTitle,
//推送通知消息正文
文本:$“{Messages.PushNotificationMessageBody}{sOrderNbr}.”,
//链接到屏幕,点击后打开,销售订单数据与NoteID关联
链接:(sScreenID,noteID),
取消:取消令牌。无);
}
捕获(聚合异常)
{
var message=string.Join(“;”,ex.InnerExceptions.Select(c=>c.message));
抛出新的InvalidOperationException(消息);
}
});
返回适配器Get();
}
}
[可本地化]
公共静态类消息
{
public const string ViewActionDisplayName=“在移动应用程序上查看”;
public const string NoDeviceError=“您需要设置Acumatica移动应用程序。”;
public const string PushNotificationTitle=“查看销售订单”;
public const string PushNotificationMessageBody=“点击查看销售订单”;
}
}

您鼓励使用标有[PXInternalUseOnlyAttribute]的接口的目的是什么?此属性意味着Acumatica可以在任何版本(大调或小调)中更改或删除它,并且不会在发行说明中注意到它,因为它不会破坏更改。