Пример #1
0
 /// <summary>
 /// Stores the "EcellObject" 4 the "Stepper".
 /// </summary>
 /// <param name="simulator">The simulator</param>
 /// <param name="dmm">The "DynamicModuleManager"</param>
 /// <param name="ecellObject">The stored "Stepper"</param>
 internal static void DataStored4Stepper(
     WrappedSimulator simulator,
     DMDescriptorKeeper dmm,
     EcellObject ecellObject)
 {
     string key = Constants.xpathStepper + Constants.delimiterColon + Constants.delimiterColon + ecellObject.Key;
     List<EcellData> stepperEcellDataList = new List<EcellData>();
     IList<string> wrappedPolymorph = null;
     //
     // Property List
     //
     try
     {
         wrappedPolymorph = simulator.GetStepperPropertyList(ecellObject.Key);
     }
     catch (Exception ex)
     {
         Trace.WriteLine(ex.StackTrace);
         return;
     }
     //
     // Sets the class name.
     //
     if (string.IsNullOrEmpty(ecellObject.Classname))
     {
         ecellObject.Classname = simulator.GetStepperClassName(ecellObject.Key);
     }
     //
     // Checks the stored "EcellData"
     //
     Dictionary<string, EcellData> storedEcellDataDic = new Dictionary<string, EcellData>();
     if (ecellObject.Value != null && ecellObject.Value.Count > 0)
     {
         foreach (EcellData storedEcellData in ecellObject.Value)
         {
             storedEcellDataDic[storedEcellData.Name] = storedEcellData;
             stepperEcellDataList.Add(storedEcellData);
         }
     }
     //
     // Stores the "EcellData"
     //
     foreach (string name in wrappedPolymorph)
     {
         string entityPath = key + Constants.delimiterColon + name;
         PropertyAttributes flag = simulator.GetStepperPropertyAttributes(ecellObject.Key, name);
         if (!flag.Gettable)
         {
             continue;
         }
         EcellValue value = null;
         try
         {
             object property = simulator.GetStepperProperty(ecellObject.Key, name);
             value = new EcellValue(property);
         }
         catch (Exception ex)
         {
             Trace.WriteLine(ex);
             value = GetValueFromDMM(dmm, ecellObject.Type, ecellObject.Classname, name);
         }
         EcellData ecellData = CreateEcellData(name, value, entityPath, flag);
         if (storedEcellDataDic.ContainsKey(name))
         {
             if (value.IsString && value.ToString().Equals(""))
             {
                 continue;
             }
             else
             {
                 stepperEcellDataList.Remove(storedEcellDataDic[name]);
             }
         }
         stepperEcellDataList.Add(ecellData);
     }
     ecellObject.SetEcellDatas(stepperEcellDataList);
 }