Beispiel #1
0
 public async Task ProcessExternalInputAsync(Object sender, TypeHandledEventArgs <Byte[]> e)
 {
     if (!e.Handled)
     {
         e.Handled = await ProcessExternalInputHandlerAsync(e.Value).ConfigureAwait(false);
     }
 }
Beispiel #2
0
            private async Task HandleReceivedMessageAsync(AppDataMessage message, TypeHandledEventArgs <Byte[]> args)
            {
                if (args.Handled)
                {
                    return;
                }

                if (args.Value.TryDeserialize(out StartedAppDataMessage msg))
                {
                    args.Handled = true;

                    if (!message.Equals(msg.This))
                    {
                        return;
                    }

                    AnotherDomainHandled?.Invoke(new TypeHandledEventArgs <StartedAppDataMessage>(msg));
                }
                else if (args.Value.TryDeserialize(out AppDataMessage another))
                {
                    TypeHandledEventArgs <AppDataMessage> handler = new TypeHandledEventArgs <AppDataMessage>(another);
                    AnotherDomainStarted?.Invoke(handler);

                    await Data.SendMessageAsync(new StartedAppDataMessage(message, another, handler.Handled).Serialize()).ConfigureAwait(false);

                    args.Handled = true;
                }
            }
Beispiel #3
0
 private async void ProcessConsoleInputAsync(TypeHandledEventArgs <String> e)
 {
     if (!e.Handled && await ProcessInputAsync(new ReaderStringMessage(e.Value)).ConfigureAwait(false))
     {
         e.Handled = true;
     }
 }
Beispiel #4
0
            private void OnMessageReceivedToReader(Object sender, TypeHandledEventArgs <Byte[]> args)
            {
                if (args.Handled)
                {
                    return;
                }

                _reader.ProcessExternalInputAsync(sender, args).RunSynchronously();
            }
        private void OnAction(TypeHandledEventArgs <ActionType> e)
        {
            if (e.Handled)
            {
                return;
            }

            Action action = e.Value switch
            {
                ActionType.Select => OnSelectAction,
                ActionType.View => OnViewAction,
                ActionType.Copy => OnCopyAction,
                ActionType.Paste => OnPasteAction,
                ActionType.Cut => OnCutAction,
                ActionType.Add => OnAddAction,
                ActionType.Remove => OnRemoveAction,
                ActionType.Edit => OnEditAction,
                ActionType.Change => OnChangeAction,
                ActionType.Reset => OnResetAction,
                _ => null
            };

            action?.Invoke();
        }
Beispiel #6
0
 private void OnMessageReceive(Object sender, TypeHandledEventArgs <Byte[]> e)
 {
     MessageReceived?.Invoke(sender, e);
 }