예제 #1
0
        protected override void Execute(CodeActivityContext context)
        {
            string systemname = SystemName.Get(context);
            string path       = Path.Get(context);
            string actionname = ActionName.Get(context);
            var    parameters = Parameters.Get(context);

            // object[] parameters = Parameters.Get(context);
            //var _params = new List<object>();
            //Dictionary<string, object> arguments = (from argument in Arguments
            //                                        where argument.Value.Direction != ArgumentDirection.Out
            //                                        select argument).ToDictionary((KeyValuePair<string, Argument> argument) => argument.Key, (KeyValuePair<string, Argument> argument) => argument.Value.Get(context));
            //foreach (var a in arguments)
            //{
            //    _params.Add(a.Value);
            //}
            // var data = new SAPInvokeMethod(systemname, path, actionname, _params.ToArray());
            object[] _parameters = null;
            if (!string.IsNullOrEmpty(parameters))
            {
                _parameters = JsonConvert.DeserializeObject <object[]>(parameters);
            }
            var data    = new SAPInvokeMethod(systemname, path, actionname, _parameters);
            var message = new SAPEvent("invokemethod");

            message.Set(data);
            var result = SAPhook.Instance.SendMessage(message, TimeSpan.FromMinutes(10));
        }
예제 #2
0
        protected override void Execute(CodeActivityContext context)
        {
            string systemname = SystemName.Get(context);
            string path       = Path.Get(context);
            string actionname = ActionName.Get(context);

            object[] _parameters = null;
            var      data        = new SAPInvokeMethod(systemname, path, actionname, _parameters);
            var      message     = new SAPEvent("getproperty");

            message.Set(data);
            var reply = SAPhook.Instance.SendMessage(message, TimeSpan.FromSeconds(PluginConfig.bridge_timeout_seconds));

            data = reply.Get <SAPInvokeMethod>();
            Result.Set(context, data.Result);
        }
예제 #3
0
        protected override void Execute(CodeActivityContext context)
        {
            string systemname = SystemName.Get(context);
            string path       = Path.Get(context);
            string actionname = ActionName.Get(context);
            var    parameters = Parameters.Get(context);

            object[] _parameters = null;
            if (!string.IsNullOrEmpty(parameters))
            {
                _parameters = JsonConvert.DeserializeObject <object[]>(parameters);
            }
            var result = SAPhook.Instance.InvokeMethod(systemname, path, actionname, _parameters, TimeSpan.FromSeconds(PluginConfig.bridge_timeout_seconds));

            try
            {
                if (result == null)
                {
                    Result.Set(context, null);
                }
                else
                {
                    var res = result as string;
                    if (res != null)
                    {
                        Result.Set(context, result);
                    }
                    else
                    {
                        Result.Set(context, result.ToString());
                    }
                }
            }
            catch (Exception)
            {
                Result.Set(context, result.ToString());
            }
        }