示例#1
0
 /// <summary>
 /// Adds an item to the processor's list of elements. Attempts to parse the path for a default value.
 /// </summary>
 /// <param name="elementID">The 1-based ID of the element, which should match the Simpl+ module parameter's index.</param>
 /// <param name="elementPath">The path provided by the Simpl+ module parameter.</param>
 /// <param name="defaultValue">The default value of the element.</param>
 public void AddValue(ushort elementID, string elementPath, short defaultValue)
 {
     try
     {
         var   path   = elementPath;
         short defVal = 0;
         if (elementPath.Contains(DefaultValueDelimiter))
         {
             path = elementPath.Split(DefaultValueDelimiter)[0];
             //Debug.PrintLine("Element " + elementID + "'s Path = " + path);
             try
             {
                 defVal = short.Parse(elementPath.Split(DefaultValueDelimiter)[1]);
                 //Debug.PrintLine("Element " + elementID + "'s DefaultValue = " + defVal);
             }
             catch
             {
                 Debug.PrintLine("Couldn't parse default signed analog value from: " + elementPath);
                 defVal = defaultValue;
             }
         }
         else
         {
             defVal = defaultValue;
         }
         var element = new SignedAnalogElement(elementID, path, defVal);
         Elements.Add(element);
     }
     catch (Exception ex)
     {
         Debug.PrintLine("Exception encountered while adding Signed Analog value.");
         Debug.PrintLine(ex.Message);
     }
 }
示例#2
0
 /// <summary>
 /// Adds an item to the processor's list of elements.
 /// </summary>
 /// <param name="elementID">The 1-based ID of the element, which should match the Simpl+ module parameter's index.</param>
 /// <param name="elementPath">The path provided by the Simpl+ module parameter.</param>
 /// <param name="defaultValue">The default value of the element.</param>
 public void AddValue(ushort elementID, string elementPath, short defaultValue)
 {
     using (var secure = new CCriticalSection())
     {
         var element = new SignedAnalogElement(elementID, elementPath);
         element.AttributeValue = defaultValue;
         Elements.Add(element);
     }
 }
示例#3
0
 public ushort Initialize(ushort managerID, string elementPath)
 {
     if (PropertyValues == null)
     {
         return(0);
     }
     if (IsInitialized)
     {
         return(1);
     }
     try
     {
         var   path   = elementPath;
         short defVal = 0;
         if (elementPath.Contains(DefaultValueDelimiter))
         {
             path = elementPath.Split(DefaultValueDelimiter)[0];
             try
             {
                 defVal = short.Parse(elementPath.Split(DefaultValueDelimiter)[1]);
             }
             catch
             {
                 Debug.PrintLine("Couldn't parse default signed analog value from: " + elementPath);
             }
         }
         Element = new SignedAnalogElement(1, path, defVal);
         if (Manager.AddProcessorToManager(managerID, this))
         {
             ManagerId     = managerID;
             IsInitialized = true;
         }
     }
     catch (Exception ex)
     {
         Debug.PrintLine("Exception encountered while initializing Signed Analog Property Interlock.");
         Debug.PrintLine(ex.ToString());
         return(0);
     }
     if (IsInitialized)
     {
         ReportIsInitialized(1);
         return(1);
     }
     return(0);
 }