Example #1
0
        protected async override Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
        {
            IInvoker invoker    = JavaScope.GetJavaInvoker(context);
            var      fieldName  = FieldName.Get(context) ?? throw new ArgumentNullException(Resources.FieldName);
            var      javaObject = TargetObject.Get(context);
            var      className  = TargetType.Get(context);

            if (javaObject == null && className == null)
            {
                throw new InvalidOperationException(Resources.InvokationObjectException);
            }

            JavaObject instance;

            try
            {
                instance = await invoker.InvokeGetField(javaObject, fieldName, className, cancellationToken);
            }
            catch (Exception e)
            {
                Trace.TraceError($"Could not get java field: {e}");
                throw new InvalidOperationException(Resources.GetFieldException, e);
            }

            return(asyncCodeActivityContext =>
            {
                Result.Set(asyncCodeActivityContext, instance);
            });
        }
Example #2
0
 public override void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services) => sw.Format(formatterContext, services)
 .CommentLine(FieldName.Get(_fieldMapId))
 .StaticType(nameof(IFieldService))
 .Method(nameof(IFieldService.GoTo))
 .Enum(_fieldMapId)
 .Argument("walkmeshId", _walkmeshId)
 .Comment(nameof(MapJumpO));
Example #3
0
 public override void Format(ScriptWriter sw, IScriptFormatterContext formatterContext, IServices services)
 {
     sw.Format(formatterContext, services)
     .CommentLine(FieldName.Get(_fieldMapId))
     .StaticType(nameof(IFieldService))
     .Method(nameof(IFieldService.PrepareGoTo))
     .Enum(_fieldMapId)
     .Comment(nameof(PREMAPJUMP2));
 }