Exemplo n.º 1
0
        private void So_OnRaiseFeebackEvent(object sender, BaseNode.FeebackEventArgs e)
        {
            if (e.Feedback is ConnectionStateEventArgs a)
            {
                switch (a.State)
                {
                case EnumConnectionState.start: State = a; isConnectingNodes = true; break;

                case EnumConnectionState.moving: State = a; break;

                case EnumConnectionState.finished: State = null; isConnectingNodes = false; break;

                case EnumConnectionState.create:
                    if (a.GetPair != null)
                    {
                        connectionPairs.Add(a.GetPair);
                        //Console.WriteLine($"Input {a.GetPair.Input.ID} Output {a.GetPair.Output.ID}");
                        Actalize();
                    }
                    break;

                case EnumConnectionState.remove: connectionPairs.RemoveAll(x => x.Input == a.Sender || x.Output == a.Sender); Actalize(); break;
                }

                State = a; Refresh();
            }
        }
Exemplo n.º 2
0
 private void Application_ConnectionStateChanged(object sender, ConnectionStateEventArgs e)
 {
     if (!application.IsInitialized())
     {
         initDone = false;
     }
 }
 private void Client_ConnectionStateChanged(object sender, ConnectionStateEventArgs e)
 {
     if (e.isConnected)
     {
         if (Client.IsUserAuthorized())
         {
             CallbackOnAuthenticated();
             //InitUpdateListener();
         }
         else
         {
             CallbackOnConnected();
         }
     }
     ;
 }
Exemplo n.º 4
0
        private static void ConnectionStateChanged(object sender, ConnectionStateEventArgs eventArgs)
        {
            if (eventArgs.NewState == ConnectionState.Connected)
            {
                Console.WriteLine("device is connected");
                var thingface = (IThingfaceClient)sender;
                //thingface.OnCommand(CommandHandler, SenderType.User, "mirrobozik");
                //thingface.OnCommand(CommandHandler, SenderType.User);
                thingface.OnCommand((context) =>
                {
                    Console.WriteLine($"Received command '{context.CommandName}' from '{context.SenderId}'");
                    Task.Delay(3000).GetAwaiter().GetResult();
                    return(0);
                });

                //timer = new Timer(TimerCallback1, null, 6000, 7000);
            }
            if (eventArgs.NewState == ConnectionState.Disconnected)
            {
                timer?.Dispose();
                Console.WriteLine("device is disconnected");
            }
        }
Exemplo n.º 5
0
 internal void OnConnectionStateChanged(object sender, ConnectionStateEventArgs args)
 {
     ConnectionStateChanged.Raise(sender, args);
 }
Exemplo n.º 6
0
        protected virtual void OnConnectionStateChanged(MessengerConnectionState state, string email = null, string reason = null)
        {
            var args = new ConnectionStateEventArgs(state, email, reason);

            ConnectionStateChanged?.Invoke(this, args);
        }
Exemplo n.º 7
0
 void FootlooseConnection_ConnectionStateChanged(object sender, ConnectionStateEventArgs e)
 {
     SetControlStatus(e.ConnectionState == ConnectionState.Connected);
     Text = "Footloose Client - Connection Status is " + e.ConnectionState;
 }