private void readNumericSignal(NodeSignal signal, byte numericAddress)
        {
            var readNumericResponse = this.m_arduinoRuntimeProtocol.ReadNumeric(numericAddress);

            signal.Value = readNumericResponse.Value;
            this.m_runtimeService.Value.NotifyValueChanged(signal, readNumericResponse.Value);
        }
Beispiel #2
0
        private CompiledBooleanSignal booleanSignal(NodeSignal signal, SignalTable signalTable)
        {
            var signalAddress  = signalTable.GetBooleanSignalAddress(signal);
            var compiledSignal = new CompiledBooleanSignal(false, signalAddress, signalTable.BooleanAddressBits);

            return(compiledSignal);
        }
        private void readBooleanSignal(NodeSignal signal, Int16 booleanAddress)
        {
            var readBooleanResponse = this.m_arduinoRuntimeProtocol.ReadBoolean(booleanAddress);

            signal.Value = readBooleanResponse.Value;
            this.m_runtimeService.Value.NotifyValueChanged(signal, readBooleanResponse.Value);
        }
Beispiel #4
0
 void runtimeService_ValuesChanged(NodeSignal signal, object value)
 {
     if (Signal != null && Signal.SignalId == signal.SignalId)
     {
         setText(value);
     }
 }
Beispiel #5
0
        private void readTextBox()
        {
            var    tb           = textBox;
            var    selectedText = tb.SelectedText;
            string unselectedText;

            if (selectedText.Length > 0)
            {
                unselectedText = tb.Text.Replace(selectedText, string.Empty);
            }
            else
            {
                unselectedText = tb.Text;
            }

            if (unselectedText.Length > 0)
            {
                // check to see if the value entered is a valid literal
                object parseResult;
                if (Signal.DataType.TryParse(unselectedText, out parseResult))
                {
                    tb.Text = parseResult.ToString();
                }
                else
                {
                    m_editedSignal = Signal;
                }
            }
            else
            {
                m_editedSignal = Signal;
            }
        }
        private InstructionLDCoil(IEditorItem parent, NodeInstruction instruction)
            : base(parent, m_InstructionType)
        {
            if (instruction == null)
            {
                var newInstruction = NodeInstruction.BuildWith(InstructionType);
                // Output signal: Named boolean - the coil signal
                newInstruction = newInstruction.NodeSignalChildren.Append(
                    NodeSignal.BuildWith(
                        new FieldSignalName(Resources.Strings.LD_Snap_Coil_DefaultCoilName),
                        new FieldDataType(FieldDataType.DataTypeEnum.BOOL),
                        new FieldBool(false),
                        FieldConstant.Constants.BOOL.LOW) // not forced
                    );
                Instruction = newInstruction;
            }
            else
            {
                if (instruction.InstructionType != InstructionType)
                {
                    throw new InvalidOperationException("Tried to instantiate InstructionLDCoil but passed a different instruction type.");
                }
                Instruction = instruction;
            }

            // Build the context menu
            if (extensionService != null)
            {
                ContextMenu        = extensionService.SortAndJoin(ldInstructionContextMenu, m_staticMenuItemSeparator, contextMenu);
                ContextMenuEnabled = true;
            }
        }
Beispiel #7
0
        /// <summary>
        /// Restores the state of all signals from a blob string created by signalStateToBlob
        /// </summary>
        /// <param name="rta">Runtime application to restore to</param>
        /// <param name="blob">blob</param>
        private static void restoreSignalStateFromBlob(NodeRuntimeApplication rta, string blob)
        {
            if (rta == null)
            {
                throw new ArgumentNullException("rta");
            }
            if (blob == null)
            {
                return;
            }
            var signalValues = EncodedSignalValue.ParseEncodedSignals(blob, rta.Signals);

            foreach (var signalTuple in signalValues)
            {
                NodeSignal signal = signalTuple.Item1;
                object     value  = signalTuple.Item2;
                try
                {
                    signal.Value = value;
                }
                catch
                {
                    // FIXME - tie into error reporting feature, to be developed
                }
            }
        }
        protected InstructionLDAbstractEdge(IEditorItem parent, NodeInstruction instruction, FieldInstructionType instructionType)
            : base(parent, instructionType)
        {
            if (instruction == null)
            {
                var newInstruction = NodeInstruction.BuildWith(InstructionType);
                // Output signal: Named boolean - memory of last rung in
                newInstruction = newInstruction.NodeSignalChildren.Append(
                    NodeSignal.BuildWith(
                        new FieldSignalName(InstructionName),
                        new FieldDataType(FieldDataType.DataTypeEnum.BOOL),
                        new FieldBool(false), // not forced
                        FieldConstant.Constants.BOOL.LOW)
                    );
                Instruction = newInstruction;
            }
            else
            {
                if (instruction.InstructionType != InstructionType)
                {
                    throw new InvalidOperationException("Tried to instantiate an edge but passed a different instruction type.");
                }
                Instruction = instruction;
            }

            // Build the context menu
            if (extensionService != null)
            {
                ContextMenu        = extensionService.SortAndJoin(ldInstructionContextMenu, m_staticMenuItemSeparator, contextMenu);
                ContextMenuEnabled = true;
            }
        }
Beispiel #9
0
        public void RegisterValueWatcher(INodeWrapper nodeItem, NodeSignal signal)
        {
            if (nodeItem == null)
            {
                throw new ArgumentNullException("nodeItem");
            }
            if (signal == null)
            {
                throw new ArgumentNullException("signal");
            }
            var rta = FindParentRuntimeApplicationItem(nodeItem);

            if (rta != null)
            {
                lock (m_valueWatchers_Lock)
                {
                    if (!m_valueWatchers.ContainsKey(rta))
                    {
                        m_valueWatchers.Add(rta, new Dictionary <NodeSignal, int>());
                    }
                    if (!m_valueWatchers[rta].ContainsKey(signal))
                    {
                        m_valueWatchers[rta].Add(signal, 1);
                        m_rtaLookup[nodeItem] = rta;
                    }
                    else
                    {
                        m_valueWatchers[rta][signal] += 1;
                    }
                }
            }
        }
Beispiel #10
0
 void runtimeService_SignalChanged(NodeSignal signal)
 {
     if (SignalIn != null && SignalIn.SignalId == signal.SignalId)
     {
         setText();
     }
 }
Beispiel #11
0
 void runtimeService_ValueChanged(NodeSignal signal, object value)
 {
     if (signal.SignalId == DiscreteInput.Signal.SignalId && value.GetType() == typeof(bool))
     {
         setIcons((bool)value);
     }
 }
Beispiel #12
0
        private CompiledNumericSignal numericSignal(NodeSignal signal, SignalTable signalTable)
        {
            var signalAddress  = signalTable.GetNumericSignalAddress(signal);
            var compiledSignal = new CompiledNumericSignal(false, signalAddress, signalTable.NumericAddressBits);

            return(compiledSignal);
        }
Beispiel #13
0
 public SignalValue(INodeWrapper nodeItem, NodeSignal initialSignal, double maxWidth, TextAlignment textAlignment, string formatString)
 {
     Signal = initialSignal;
     NodeItem = nodeItem;
     MaxWidth = maxWidth;
     TextAlignment = textAlignment;
     FormatString = formatString;
 }
 public SignalValue(INodeWrapper nodeItem, NodeSignal initialSignal, double maxWidth, TextAlignment textAlignment, string formatString)
 {
     Signal        = initialSignal;
     NodeItem      = nodeItem;
     MaxWidth      = maxWidth;
     TextAlignment = textAlignment;
     FormatString  = formatString;
 }
        protected InstructionLDAbstractCounter(IEditorItem parent, NodeInstruction instruction, FieldInstructionType instructionType)
            : base(parent, instructionType)
        {
            if (instruction == null)
            {
                var newInstruction = NodeInstruction.BuildWith(InstructionType);
                // Output signal: Named boolean - the counter done signal
                newInstruction = newInstruction.NodeSignalChildren.Append(
                    NodeSignal.BuildWith(
                        new FieldSignalName(Resources.Strings.LD_Snap_Ctr_DefaultName),
                        new FieldDataType(FieldDataType.DataTypeEnum.BOOL),
                        new FieldBool(false), // not forced
                        FieldConstant.Constants.BOOL.LOW)
                    );
                newInstruction = newInstruction.NodeSignalChildren.Append( // memory of counter value
                    NodeSignal.BuildWith(
                        new FieldSignalName(Resources.Strings.LD_Snap_Ctr_DefaultName + SEPARATOR + Resources.Strings.LD_Snap_Ctr_CountName),
                        new FieldDataType(FieldDataType.DataTypeEnum.NUMBER),
                        new FieldBool(false), // not forced
                        FieldConstant.Constants.NUMBER.ZERO)
                    );
                newInstruction = newInstruction.NodeSignalChildren.Append( // previous rung-in condition
                    NodeSignal.BuildWith(
                        new FieldSignalName(Resources.Strings.LD_Snap_Ctr_DefaultName + SEPARATOR + Resources.Strings.LD_Snap_Ctr_OneshotStateName),
                        new FieldDataType(FieldDataType.DataTypeEnum.BOOL),
                        new FieldBool(false), // not forced
                        FieldConstant.Constants.BOOL.LOW)
                    );
                // Input signal: setpoint
                newInstruction = newInstruction.NodeSignalInChildren.Append(
                    NodeSignalIn.BuildWith(
                        new FieldDataType(FieldDataType.DataTypeEnum.NUMBER),
                        new FieldConstant(FieldDataType.DataTypeEnum.NUMBER, 0)));
                // Input signal: reset
                newInstruction = newInstruction.NodeSignalInChildren.Append(
                    NodeSignalIn.BuildWith(
                        new FieldDataType(FieldDataType.DataTypeEnum.BOOL),
                        new FieldConstant(FieldDataType.DataTypeEnum.BOOL, false)));
                Instruction = newInstruction;
            }
            else
            {
                if (instruction.InstructionType != InstructionType)
                {
                    throw new InvalidOperationException("Tried to instantiate a Counter but passed a different instruction type.");
                }
                Instruction = instruction;
            }

            // Build the context menu
            if (extensionService != null)
            {
                ContextMenu        = extensionService.SortAndJoin(ldInstructionContextMenu, m_staticMenuItemSeparator, contextMenu);
                ContextMenuEnabled = true;
            }
        }
Beispiel #16
0
 public bool TryGetNumericSignalByAddress(Byte address, out NodeSignal signal)
 {
     if (address < 0 || address >= this.m_numericSignalsByAddress.Length)
     {
         signal = null;
         return(false);
     }
     signal = this.m_numericSignalsByAddress[address];
     return(signal != null);
 }
 public SignalTreeItem(SignalChooserDialog dlg, string text, NodeSignal sig)
 {
     if (dlg == null)
     {
         throw new ArgumentNullException("dlg");
     }
     m_dlg        = dlg;
     Text         = text;
     m_NodeSignal = sig;
 }
Beispiel #18
0
 public bool TryGetBooleanSignalByAddress(Int16 address, out NodeSignal signal)
 {
     if (address < 0 || address >= this.m_booleanSignalsByAddress.Length)
     {
         signal = null;
         return(false);
     }
     signal = this.m_booleanSignalsByAddress[address];
     return(signal != null);
 }
Beispiel #19
0
        public bool TryGetNumericAddressBySignal(NodeSignal signal, out Byte?numericAddress)
        {
            var signalId = Guid.Parse(signal.SignalId.ToString());

            if (this.m_numericAddressBySignal.ContainsKey(signalId))
            {
                numericAddress = this.m_numericAddressBySignal[signalId];
                return(true);
            }
            numericAddress = null;
            return(false);
        }
        protected InstructionLDMathBase(IEditorItem parent, FieldInstructionType instructionType, NodeInstruction instruction,
                                        string defaultName, bool factory, string instructionName, string firstSignalName, string secondSignalName)
            : base(parent, instructionType)
        {
            if (factory)
            {
                return;
            }

            this.InstructionName  = instructionName;
            this.FirstSignalName  = firstSignalName;
            this.SecondSignalName = secondSignalName;

            if (instruction == null)
            {
                var newInstruction = NodeInstruction.BuildWith(InstructionType);
                // Output signal: Named number - result
                newInstruction = newInstruction.NodeSignalChildren.Append(
                    NodeSignal.BuildWith(
                        new FieldSignalName(defaultName),
                        new FieldDataType(FieldDataType.DataTypeEnum.NUMBER),
                        new FieldBool(false), // not forced
                        FieldConstant.Constants.NUMBER.ZERO)
                    );
                // Input signal: First
                newInstruction = newInstruction.NodeSignalInChildren.Append(
                    NodeSignalIn.BuildWith(
                        new FieldDataType(FieldDataType.DataTypeEnum.NUMBER),
                        new FieldConstant(FieldDataType.DataTypeEnum.NUMBER, 0)));
                // Input signal: Second
                newInstruction = newInstruction.NodeSignalInChildren.Append(
                    NodeSignalIn.BuildWith(
                        new FieldDataType(FieldDataType.DataTypeEnum.NUMBER),
                        new FieldConstant(FieldDataType.DataTypeEnum.NUMBER, 0)));
                Instruction = newInstruction;
            }
            else
            {
                if (instruction.InstructionType != InstructionType)
                {
                    throw new InvalidOperationException("Tried to instantiate a different instruction type.");
                }
                Instruction = instruction;
            }

            // Build the context menu
            if (extensionService != null)
            {
                ContextMenu        = extensionService.SortAndJoin(ldInstructionContextMenu, m_staticMenuItemSeparator, contextMenu);
                ContextMenuEnabled = true;
            }
        }
Beispiel #21
0
        public Int16 GetBooleanSignalAddress(NodeSignal signal)
        {
            if (signal == null)
            {
                throw new ArgumentNullException("signal");
            }
            Int16 result;

            if (!this.TryGetBooleanAddressBySignal(signal, out result))
            {
                throw new Exception("Signal not found.");
            }
            return(result);
        }
Beispiel #22
0
        public byte GetNumericSignalAddress(NodeSignal signal)
        {
            if (signal == null)
            {
                throw new ArgumentNullException("signal");
            }
            Byte?result;

            if (!this.TryGetNumericAddressBySignal(signal, out result))
            {
                throw new Exception("Signal not found.");
            }
            return(result.Value);
        }
Beispiel #23
0
        public bool TryGetBooleanAddressBySignal(NodeSignal signal, out Int16 booleanAddress)
        {
            if (signal == null)
            {
                throw new ArgumentNullException("signal");
            }
            var signalId = Guid.Parse(signal.SignalId.ToString());

            if (this.m_booleanAddressBySignal.ContainsKey(signalId))
            {
                booleanAddress = this.m_booleanAddressBySignal[signalId];
                return(true);
            }
            booleanAddress = -1;
            return(false);
        }
Beispiel #24
0
        protected InstructionLDStringContains(IEditorItem parent, NodeInstruction instruction)
            : base(parent, m_InstructionType)
        {
            if (instruction == null)
            {
                var newInstruction = NodeInstruction.BuildWith(InstructionType);
                // Output signal: Named boolean - result of the comparison
                newInstruction = newInstruction.NodeSignalChildren.Append(
                    NodeSignal.BuildWith(
                        new FieldSignalName(Resources.Strings.LD_Snap_StringContains_DefaultName),
                        new FieldDataType(FieldDataType.DataTypeEnum.BOOL),
                        new FieldBool(false), // not forced
                        FieldConstant.Constants.BOOL.LOW)
                    );
                // Input signal: string to search
                newInstruction = newInstruction.NodeSignalInChildren.Append(
                    NodeSignalIn.BuildWith(
                        new FieldDataType(FieldDataType.DataTypeEnum.STRING),
                        new FieldConstant(FieldDataType.DataTypeEnum.STRING, string.Empty)));
                // Input signal: string to find
                newInstruction = newInstruction.NodeSignalInChildren.Append(
                    NodeSignalIn.BuildWith(
                        new FieldDataType(FieldDataType.DataTypeEnum.STRING),
                        new FieldConstant(FieldDataType.DataTypeEnum.STRING, string.Empty)));
                // Input signal: case sensitive
                newInstruction = newInstruction.NodeSignalInChildren.Append(
                    NodeSignalIn.BuildWith(
                        new FieldDataType(FieldDataType.DataTypeEnum.BOOL),
                        new FieldConstant(FieldDataType.DataTypeEnum.BOOL, false)));
                Instruction = newInstruction;
            }
            else
            {
                if (instruction.InstructionType != InstructionType)
                {
                    throw new InvalidOperationException("Tried to instantiate a StringContains but passed a different instruction type.");
                }
                Instruction = instruction;
            }

            // Build the context menu
            if (extensionService != null)
            {
                ContextMenu        = extensionService.SortAndJoin(ldInstructionContextMenu, m_staticMenuItemSeparator, contextMenu);
                ContextMenuEnabled = true;
            }
        }
Beispiel #25
0
        public void DeregisterValueWatcher(INodeWrapper nodeItem, NodeSignal signal)
        {
            if (nodeItem == null)
            {
                throw new ArgumentNullException("nodeItem");
            }
            if (signal == null)
            {
                throw new ArgumentNullException("signal");
            }
            var rta = FindParentRuntimeApplicationItem(nodeItem);

            if (rta == null)
            {
                lock (m_valueWatchers_Lock)
                {
                    if (m_rtaLookup.ContainsKey(nodeItem))
                    {
                        rta = m_rtaLookup[nodeItem];
                    }
                }
            }
            if (rta != null)
            {
                lock (m_valueWatchers_Lock)
                {
                    if (m_valueWatchers.ContainsKey(rta))
                    {
                        if (m_valueWatchers[rta].ContainsKey(signal))
                        {
                            m_valueWatchers[rta][signal] -= 1;
                            if (m_valueWatchers[rta][signal] <= 0)
                            {
                                m_rtaLookup.Remove(nodeItem);
                                m_valueWatchers[rta].Remove(signal);
                                if (m_valueWatchers[rta].Count == 0)
                                {
                                    m_valueWatchers.Remove(rta);
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #26
0
 public void NotifyValueChanged(NodeSignal signal, object value)
 {
     if (signal != null)
     {
         ValueChangedHandler evt;
         lock (m_valuesChanged_Lock)
         {
             evt = m_valueChanged;
         }
         // Fire the event on the UI thread
         mainWindow.Value.Dispatcher.BeginInvoke(new Action(delegate()
         {
             if (evt != null)
             {
                 evt(signal, value);
             }
         }));
     }
 }
 // Encodes it as:
 // SignalId (guid) followed by a comma (,)
 // DataType (BOOL, NUMBER, DATETIME, STRING) followed by a comma (,)
 // Value Length (uint) followed by a comma (,)
 // Data Value as string - fixed length
 public static string EncodeSignalValue(NodeSignal signal)
 {
     if (signal != null)
     {
         string value  = signal.Value.ToString();
         var    retVal = new StringBuilder();
         retVal.Append(signal.SignalId.ToString());
         retVal.Append(SEPARATOR);
         retVal.Append(signal.DataType.DataType.ToString());
         retVal.Append(SEPARATOR);
         retVal.Append(value.Length.ToString());
         retVal.Append(SEPARATOR);
         retVal.Append(value);
         // don't really need this, but it makes the resultant string a big easier to work with and debug
         retVal.Append(END_OF_LINE);
         return(retVal.ToString());
     }
     else
     {
         return(string.Empty);
     }
 }
 // Encodes it as:
 // SignalId (guid) followed by a comma (,)
 // DataType (BOOL, NUMBER, DATETIME, STRING) followed by a comma (,)
 // Value Length (uint) followed by a comma (,)
 // Data Value as string - fixed length
 public static string EncodeSignalValue(NodeSignal signal)
 {
     if (signal != null)
     {
         string value = signal.Value.ToString();
         var retVal = new StringBuilder();
         retVal.Append(signal.SignalId.ToString());
         retVal.Append(SEPARATOR);
         retVal.Append(signal.DataType.DataType.ToString());
         retVal.Append(SEPARATOR);
         retVal.Append(value.Length.ToString());
         retVal.Append(SEPARATOR);
         retVal.Append(value);
         // don't really need this, but it makes the resultant string a big easier to work with and debug
         retVal.Append(END_OF_LINE);
         return retVal.ToString();
     }
     else
     {
         return string.Empty;
     }
 }
Beispiel #29
0
 public void DeregisterValueWatcher(INodeWrapper nodeItem, NodeSignal signal)
 {
     if (nodeItem == null)
     {
         throw new ArgumentNullException("nodeItem");
     }
     if (signal == null)
     {
         throw new ArgumentNullException("signal");
     }
     var rta = FindParentRuntimeApplicationItem(nodeItem);
     if (rta == null)
     {
         lock (m_valueWatchers_Lock)
         {
             if (m_rtaLookup.ContainsKey(nodeItem))
             {
                 rta = m_rtaLookup[nodeItem];
             }
         }
     }
     if (rta != null)
     {
         lock (m_valueWatchers_Lock)
         {
             if (m_valueWatchers.ContainsKey(rta))
             {
                 if (m_valueWatchers[rta].ContainsKey(signal))
                 {
                     m_valueWatchers[rta][signal] -= 1;
                     if (m_valueWatchers[rta][signal] <= 0)
                     {
                         m_rtaLookup.Remove(nodeItem);
                         m_valueWatchers[rta].Remove(signal);
                         if (m_valueWatchers[rta].Count == 0)
                         {
                             m_valueWatchers.Remove(rta);
                         }
                     }
                 }
             }
         }
     }
 }
 public static void SetControlFillColorBySignal(DependencyObject target, NodeSignal value)
 {
     target.SetValue(SignalValueBehavior.ControlFillColorBySignalProperty, value);
 }
Beispiel #31
0
 public void NotifyValueChanged(NodeSignal signal, object value)
 {
     if (signal != null)
     {
         ValueChangedHandler evt;
         lock (m_valuesChanged_Lock)
         {
             evt = m_valueChanged;
         }
         // Fire the event on the UI thread
         mainWindow.Value.Dispatcher.BeginInvoke(new Action(delegate()
         {
             if (evt != null)
             {
                 evt(signal, value);
             }
         }));
     }
 }
        private void readTextBox()
        {
            var tb = textBox;
            var selectedText = tb.SelectedText;
            string unselectedText;
            if (selectedText.Length > 0)
            {
                unselectedText = tb.Text.Replace(selectedText, string.Empty);
            }
            else
            {
                unselectedText = tb.Text;
            }

            if (unselectedText.Length > 0)
            {
                // check to see if the value entered is a valid literal
                object parseResult;
                if (Signal.DataType.TryParse(unselectedText, out parseResult))
                {
                    tb.Text = parseResult.ToString();
                }
                else
                {
                    m_editedSignal = Signal;
                }
            }
            else
            {
                m_editedSignal = Signal;
            }
        }
Beispiel #33
0
 public NodeAnalogInput SetSignal(NodeSignal NewSignal)
 {
     if (NewSignal == null)
     {
         throw new ArgumentNullException(m_SignalName);
     }
     return m_Signal.Set(NewSignal);
 }
 void runtimeService_ValuesChanged(NodeSignal signal, object value)
 {
     if (Signal != null && Signal.SignalId == signal.SignalId)
     {
         setText(value);
     }
 }
Beispiel #35
0
 public void RegisterValueWatcher(INodeWrapper nodeItem, NodeSignal signal)
 {
     if (nodeItem == null)
     {
         throw new ArgumentNullException("nodeItem");
     }
     if (signal == null)
     {
         throw new ArgumentNullException("signal");
     }
     var rta = FindParentRuntimeApplicationItem(nodeItem);
     if (rta != null)
     {
         lock (m_valueWatchers_Lock)
         {
             if (!m_valueWatchers.ContainsKey(rta))
             {
                 m_valueWatchers.Add(rta, new Dictionary<NodeSignal, int>());
             }
             if (!m_valueWatchers[rta].ContainsKey(signal))
             {
                 m_valueWatchers[rta].Add(signal,1);
                 m_rtaLookup[nodeItem] = rta;
             }
             else
             {
                 m_valueWatchers[rta][signal] += 1;
             }
         }
     }
 }
Beispiel #36
0
 public byte GetNumericSignalAddress(NodeSignal signal)
 {
     if (signal == null) throw new ArgumentNullException("signal");
     Byte? result;
     if (!this.TryGetNumericAddressBySignal(signal, out result))
     {
         throw new Exception("Signal not found.");
     }
     return result.Value;
 }
Beispiel #37
0
 public bool TryGetNumericSignalByAddress(Byte address, out NodeSignal signal)
 {
     if (address < 0 || address >= this.m_numericSignalsByAddress.Length)
     {
         signal = null;
         return false;
     }
     signal = this.m_numericSignalsByAddress[address];
     return signal != null;
 }
Beispiel #38
0
 public bool TryGetBooleanSignalByAddress(Int16 address, out NodeSignal signal)
 {
     if (address < 0 || address >= this.m_booleanSignalsByAddress.Length)
     {
         signal = null;
         return false;
     }
     signal = this.m_booleanSignalsByAddress[address];
     return signal != null;
 }
Beispiel #39
0
 public bool TryGetNumericAddressBySignal(NodeSignal signal, out Byte? numericAddress)
 {
     var signalId = Guid.Parse(signal.SignalId.ToString());
     if (this.m_numericAddressBySignal.ContainsKey(signalId))
     {
         numericAddress = this.m_numericAddressBySignal[signalId];
         return true;
     }
     numericAddress = null;
     return false;
 }
 public static void SetControlFillColorBySignal(DependencyObject target, NodeSignal value)
 {
     target.SetValue(SignalValueBehavior.ControlFillColorBySignalProperty, value);
 }
Beispiel #41
0
 public bool TryGetBooleanAddressBySignal(NodeSignal signal, out Int16 booleanAddress)
 {
     if (signal == null) throw new ArgumentNullException("signal");
     var signalId = Guid.Parse(signal.SignalId.ToString());
     if (this.m_booleanAddressBySignal.ContainsKey(signalId))
     {
         booleanAddress = this.m_booleanAddressBySignal[signalId];
         return true;
     }
     booleanAddress = -1;
     return false;
 }
 void runtimeService_ValueChanged(NodeSignal signal, object value)
 {
     if (signal.SignalId == DiscreteInput.Signal.SignalId && value.GetType() == typeof(bool))
     {
         setIcons((bool)value);
     }
 }
 public SignalTreeItem(SignalChooserDialog dlg, string text, NodeSignal sig)
 {
     if (dlg == null)
     {
         throw new ArgumentNullException("dlg");
     }
     m_dlg = dlg;
     Text = text;
     m_NodeSignal = sig;
 }
 void runtimeService_SignalChanged(NodeSignal signal)
 {
     if (SignalIn != null && SignalIn.SignalId == signal.SignalId)
     {
         setText();
     }
 }
Beispiel #45
0
 public Int16 GetBooleanSignalAddress(NodeSignal signal)
 {
     if (signal == null) throw new ArgumentNullException("signal");
     Int16 result;
     if (!this.TryGetBooleanAddressBySignal(signal, out result))
     {
         throw new Exception("Signal not found.");
     }
     return result;
 }