Ejemplo n.º 1
0
        private void onNodeStateChange(virtualNodeBase sender, nodeState newState)
        {
            if (sender != ourNode)
                return;

            mainForm.Invoke(new Action( () => lblNodeState.Text = newState.ToString() ) , null);
        }
Ejemplo n.º 2
0
        private void onChangeSensor(virtualNodeBase senderNode, virtualNodeSensor changingSensor, int newValue)
        {
            if (senderNode.id != ourNode.id)
                return;

            sensorCtlsByID[changingSensor.id].updateValue(newValue);
        }
Ejemplo n.º 3
0
        public void loadNode(virtualNodeBase newNode)
        {
            ourNode = newNode;

            lblNodeName.Text = ourNode.name;
            lblNodeID.Text = ourNode.id.ToString();
            lblNodeState.Text = ourNode.state.ToString();

            foreach (virtualNodeSensor sensor in ourNode.sensors.Values)
            {
                ctlNodeSensor newSensorCtl = new ctlNodeSensor();

                newSensorCtl.loadSensor(sensor);

                newSensorCtl.Left = grpNodeSensors.DisplayRectangle.Left;
                newSensorCtl.Top = grpNodeSensors.DisplayRectangle.Top;
                newSensorCtl.Top += (sensor.id - 1) * newSensorCtl.Height;

                sensorCtlsByID.Add(sensor.id, newSensorCtl);

                grpNodeSensors.Controls.Add(newSensorCtl);
            }

            ourNode.onChangeSensor += onChangeSensor;
            ourNode.onStateChange += onNodeStateChange;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Fire the onCryptoError event
        /// </summary>
        protected void cryptoError(virtualNodeBase virtualNodeBase)
        {
            log(logLevel.warn, "Crypto error detected.");

            if (onCryptoError != null)
                onCryptoError.Invoke();
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Called when a node on this network changes state.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="newState"></param>
 private void nodeStateChange(virtualNodeBase sender, nodeState newState)
 {
     log(logLevel.info, "Node state change on id " + sender.id + " to " + newState);
 }