コード例 #1
0
        void ojs_client_MethodCallReceived(OrchestratorJSEventArgs e)
        {
            Debug.Print(e.capabilityName);
            Debug.Print(e.methodCallName);

            if (e.methodCallName == "blue")
            {
                multicolorLed.RemoveGreen();
                multicolorLed.RemoveRed();
                multicolorLed.AddBlue();
            }
            else if (e.methodCallName == "green")
            {
                multicolorLed.RemoveBlue();
                multicolorLed.RemoveRed();
                multicolorLed.AddGreen();
            }
            else if (e.methodCallName == "red")
            {
                multicolorLed.RemoveBlue();
                multicolorLed.RemoveGreen();
                multicolorLed.AddRed();
            }

            orchestratorJSClient.sendResponse();
        }
コード例 #2
0
        // handle your own specified event types here
        public override void onEvent(string name, ArrayList arguments)
        {
            try
            {
                Debug.Print("got event: " + name);
                ArrayList args = (ArrayList)arguments[0];

                currentActionId = (String)args[0];
                currentMethodcallId = (String)args[1];

                String capabilityName = (String)args[2];
                String methodCallName = (String)args[3];

                ArrayList methodCallArgs = new ArrayList();
                if (args.Count > 4 && args[4].GetType() == typeof(ArrayList))
                {
                    methodCallArgs = (ArrayList)args[4];
                    foreach (Object item in methodCallArgs)
                    {
                        if (item != null)
                        {
                            Debug.Print("Arg value:");
                            Debug.Print(item.ToString());
                        }
                    }
                }

                OrchestratorJSEventArgs ea = new OrchestratorJSEventArgs();
                ea.capabilityName = capabilityName;
                ea.methodCallName = methodCallName;
                ea.methodCallArgs = methodCallArgs;

                this.MethodCallReceived(ea);
            }
            catch (Exception e)
            {
                sendException(e.ToString());
            }
        }