コード例 #1
0
 internal Dictionary <object, MeasurePointDefinition> MapMeasurepointDefinitions(Dictionary <object, MeasurePointDefinition> definitions)
 {
     //definitions = null; //TODO fix caching
     if (definitions == null)
     {
         this.measurepointDefinitions = new Dictionary <object, MeasurePointDefinition>();
         UInt16[] availablemeasurepoints = GetAvailableMeasurePoints();
         for (int i = 0; i < availablemeasurepoints.Length; i++)
         {
             try
             {
                 var mpd = GetMeasurePointInformation(availablemeasurepoints[i]);
                 measurepointDefinitions[mpd.Key] = mpd;
             }
             catch
             {
                 //Log.ErrorFormat("{0} failed", i);
             }
         }
         foreach (TSettingsId settingId in Enum.GetValues(typeof(TSettingsId)))
         {
             ushort usId = (ushort)(V45Setting.MeasurementKeyOffset + ((ushort)settingId * 3));
             for (ushort i = 0; i < 3; i++)
             {
                 measurepointDefinitions[usId + i] = new MeasurePointDefinitionShortKey("", 1.0, 2, (ushort)(usId + i));
             }
         }
     }
     else
     {
         this.measurepointDefinitions = definitions;
     }
     return(this.measurepointDefinitions);
 }
コード例 #2
0
        public Dictionary <object, MeasurePointDefinition> MapMeasurePointDefinitions(Dictionary <object, MeasurePointDefinition> definitions = null)
        {
            if (definitions == null)
            {
                this.MeasurePointDefinitionMap = new Dictionary <object, MeasurePointDefinition>();

                for (ushort nativeId = 0, n = GetNumMeasurePoints(); nativeId < n; nativeId++)
                {
                    var def = GetMeasurePointInformation(nativeId);
                    MeasurePointDefinitionMap[def.Name] = def;
                    MeasurePointDefinitionMap[nativeId] = new MeasurePointDefinitionShortKey(def.Name, 0, (ushort)0, (ushort)nativeId);
                }

                for (ushort nativeId = 0, n = GetNumStringPoints(); nativeId < n; nativeId++)
                {
                    string nativeName = GetStringPointInfo(nativeId);
                    MeasurePointDefinitionMap[nativeName] = new MeasurePointDefinitionStringKey(nativeName, 0, (ushort)0, (ushort)nativeId);
                }
            }
            else
            {
                this.MeasurePointDefinitionMap = definitions;
            }

            return(this.MeasurePointDefinitionMap);
        }