public static MessageState SendMessage(MessageState state, SendMessageAction action)
 {
     return(state with
     {
         ClientMessages = state.ClientMessages
     });
 }
Ejemplo n.º 2
0
        public void DoSR(string subscriptionKey, SendMessageAction onResult, Action onClose, string locale, string endpoint = null, string region = "westus")
        {
            this._sendMessage = onResult;
            this._onClose     = onClose;

            WriteLine("client created");
        }
Ejemplo n.º 3
0
        // messages.receivedMessages#28abcb68 max_id:int = Vector<int>;
        // messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool;
        public async Task <bool> SetTyping(InputPeer inputPeer, SendMessageAction action)
        {
            var request = new SetTypingRequest(inputPeer, action);

            await SendRpcRequest(request);

            return(request.state);
        }
 private void TryActions(SendMessageAction[] actions, Transform actor)
 {
     if (actions == null) return;
     foreach (SendMessageAction action in actions) {
         if (action != null && action.condition != null && action.condition.IsTrue(actor)) {
             DoAction(action, actor);
         }
     }
 }
 /// <summary>
 /// Executes an action.
 /// </summary>
 /// <param name='action'>
 /// The details of the action to perform. If the action.parameter is empty, this method sends
 /// a reference to the sender's game object as the parameter.
 /// </param>
 /// <param name='actor'>
 /// The actor performing the action (versus the target, which is specified in the action details.
 /// </param>
 private void DoAction(SendMessageAction action, Transform actor)
 {
     if (action != null) {
         Transform target = Tools.Select(action.target, this.transform);
         string parameter = string.IsNullOrEmpty(action.parameter) ? null : action.parameter;
         if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Sending message '{1}' to {2} (parameter={3}).", new System.Object[] { DialogueDebug.Prefix, action.methodName, target, parameter }), this);
         target.BroadcastMessage(action.methodName, parameter, SendMessageOptions.DontRequireReceiver);
     }
 }
Ejemplo n.º 6
0
    protected override void CopyTo(Action _messageData)
    {
        SendMessageAction sendMessageAction = _messageData as SendMessageAction;

        sendMessageAction.TargetObject       = TargetObject;
        sendMessageAction.MethodName         = MethodName;
        sendMessageAction.DataString         = DataString;
        sendMessageAction.IsReceiverRequired = IsReceiverRequired;
        base.CopyTo(_messageData);
    }
Ejemplo n.º 7
0
 /// <summary>
 /// Executes an action.
 /// </summary>
 /// <param name='action'>
 /// The details of the action to perform. If the action.parameter is empty, this method sends
 /// a reference to the sender's game object as the parameter.
 /// </param>
 /// <param name='actor'>
 /// The actor performing the action (versus the target, which is specified in the action details.
 /// </param>
 private void DoAction(SendMessageAction action, Transform actor)
 {
     if (action != null)
     {
         Transform target    = Tools.Select(action.target, this.transform);
         string    parameter = string.IsNullOrEmpty(action.parameter) ? null : action.parameter;
         if (DialogueDebug.LogInfo)
         {
             Debug.Log(string.Format("{0}: Sending message '{1}' to {2} (parameter={3}).", new System.Object[] { DialogueDebug.Prefix, action.methodName, target, parameter }), this);
         }
         target.BroadcastMessage(action.methodName, parameter, SendMessageOptions.DontRequireReceiver);
     }
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Initialisiert eine neue Instanz der Klasse <see cref="RemoteControlSingleton" />.
        /// </summary>
        /// <param name="start">Die optionale Logik für <see cref="RemoteControlSingleton.Start(string, string, byte[], out bool)" />.</param>
        /// <param name="startResult">Die optionale Logik, um die Rückgabedaten für <see cref="RemoteControlSingleton.Start(string, string, byte[], out bool)" /> zu generieren.</param>
        /// <param name="sendMessage">Die optionale Logik für <see cref="RemoteControlSingleton.SendMessage(int, string)" />.</param>
        public RemoteControlSingleton(StartPredicate start           = null,
                                      StartResultFactory startResult = null,
                                      SendMessageAction sendMessage  = null)
        {
            this._START        = start;
            this._SEND_MESSAGE = sendMessage;
            this._START_RESULT = startResult;

            this._CALLBACKS = new ConcurrentDictionary <string, IRemoteControlCallback>();

            OperationContext.Current.InstanceContext.Closed  += this.OperationContext_Closed;
            OperationContext.Current.InstanceContext.Faulted += this.OperationContext_Faulted;
        }
Ejemplo n.º 9
0
        public void DoSR(string subscriptionKey, SendMessageAction OnResult, Action OnClose, string locale, string endpoint = null)
        {
            this.SendMessage = OnResult;
            this.OnClose     = OnClose;

            this.dataClient = SpeechRecognitionServiceFactory.CreateDataClient(SpeechRecognitionMode.ShortPhrase, locale, subscriptionKey, "", endpoint);

            // Event handlers for speech recognition results
            this.dataClient.OnResponseReceived        += this.OnResponseReceivedHandler;
            this.dataClient.OnPartialResponseReceived += this.OnPartialResponseReceivedHandler;
            this.dataClient.OnConversationError       += this.OnConversationErrorHandler;
            WriteLine("client created");

            timer = new Timer(OnTimerCallback, this, CutoffSeconds * 1000, Timeout.Infinite);
        }
        CallTreeNode GetMessageNode(SendMessageAction msg, Stack <object> stack)
        {
            if (!stack.Contains(msg))
            {
                stack.Push(msg);
                var rootNode = new CallTreeNode(msg, CallTreeNodeType.Message, $"{msg.MessageToSend} : ({msg.gameObject.name}.{msg.Name})");
                var all      = Resources.FindObjectsOfTypeAll <OnMessageEvent>().Where(o => o.MessageName == msg.MessageToSend).ToList();

                foreach (var evt in all)
                {
                    rootNode.Children.Add(GetNode(evt, stack));
                }
                return(rootNode);
            }
            else
            {
                return(new CallTreeNode(msg, GetType(msg), $"RECURSED :{msg.MessageToSend} : ({msg.gameObject.name}.{msg.Name})"));
            }
        }
Ejemplo n.º 11
0
 public void LinkAction(SendMessageAction onResult, Action onClose)
 {
     this._sendMessage = onResult;
     this._onClose     = onClose;
 }
Ejemplo n.º 12
0
        static async Task DoAction(CmdArguments args)
        {
            switch (args.Action)
            {
            case Action.AddDevices:
                await AddDeviceAction.Do(args);

                break;

            case Action.DeleteDevices:
                await DeleteDeviceAction.Do(args);

                break;

            case Action.QueryDevices:
                await QueryDevicesAction.Do(args);

                break;

            case Action.UpdateTwin:
                await UpdateTwinAction.Do(args);

                break;

            case Action.ScheduleTwinUpdate:
                await ScheduleTwinUpdateAction.Do(args);

                break;

            case Action.InvokeMethod:
                await InvokeMethodAction.Do(args);

                break;

            case Action.ScheduleDeviceMethod:
                await ScheduleDeviceMethodAction.Do(args);

                break;

            case Action.QueryJobs:
                await QueryJobsAction.Do(args);

                break;

            case Action.QueryJobSummary:
                await QueryJobSummaryAction.Do(args);

                break;

            case Action.CancelJobs:
                await CancelJobsAction.Do(args);

                break;

            case Action.SendMessage:
                await SendMessageAction.Do(args);

                break;

            default:
                throw new ApplicationException($"Unexpected action: {args.Action}");
            }
        }
Ejemplo n.º 13
0
 public SetTypingRequest(InputPeer peer, SendMessageAction action)
 {
     this.peer   = peer;
     this.action = action;
 }
Ejemplo n.º 14
0
 public static void SetSendMessageAction(SendMessageAction action)
 {
     MessageManager.action = action;
 }
Ejemplo n.º 15
0
 public void SendAction(SendMessageAction action)
 {
     this._connection.WriteLine(action.ToString());
 }