10 Replies Latest reply on Mar 25, 2018 10:38 PM by alanR

    AF System Explorer wont save data entered using custom data reference

    alanR

      Hi,

       

      Im  able to enter in data into the custom reference and check in those changes and when i do a refresh the data still appears but when i close down and reopen system explorer the entered data that was in the config string disappears.

       

      Thanks,

        • Re: AF System Explorer wont save data entered using custom data reference
          John Messinger

          Alan,

           

          Can you post your overridden implementation of the ConfigString property? Also, are you calling SaveConfigChanges() in the ConfigString setter? Are you calling SaveConfigChanges() in the setter for each public property representing your DR configuration items?

            • Re: AF System Explorer wont save data entered using custom data reference
              alanR

              John ,

               

              I have declared SaveConfigChanges(); in both.

                • Re: AF System Explorer wont save data entered using custom data reference
                  John Messinger

                  Can you still post your implementation of the overridden ConfigString property?

                    • Re: AF System Explorer wont save data entered using custom data reference
                      alanR
                      public override string ConfigString
                              {
                           
                                  get
                                  {
                                      StringBuilder configBuilder = new StringBuilder();
                               
                                      if (!(TargetAttributeName == null || TargetAttributeName.Length <= 0))
                                      {
                                          configBuilder.AppendFormat("A={0}", TargetAttributeName);
                                        
                                          if (ByTime != null)
                                          {
                                              configBuilder.AppendFormat(";ByTime={0}", ByTime);
                                             
                                          }
                                         
                                      }
                                      if (SourceUnits != null)
                                      {
                                          configBuilder.AppendFormat(";UOM={0}", SourceUnits);
                                         
                                      }
                                    
                                      return configBuilder.ToString();
                      
                      
                                  }
                                  set
                                  {
                                      if (ConfigString != value)
                                      {
                                          // reset to defaults
                                          TargetAttributeName = "";
                                          SourceUnits = "";
                      
                      
                                          if (value != null)
                                          {
                                              string[] tokens = value.Split(';', '=');
                                              for (int i = 0; i < tokens.Length; i++)
                                              {
                                                  string paramName = tokens[i];
                                                  string paramValue = "";
                      
                      
                                                  if (++i < tokens.Length)
                                                      paramValue = tokens[i];
                      
                      
                                                  switch (paramName.ToUpper())
                                                  {
                                                      case "TargetAttributeName":
                                                          TargetAttributeName = paramValue;
                                                          break;
                      
                      
                                                      case "SourceUnits":
                                                          SourceUnits = paramValue;
                                                          break;
                      
                      
                      
                      
                      
                                                      default:
                                                          throw new ArgumentException(String.Format("Error", paramName, value));
                                                  }
                                              }
                                          }
                                          SaveConfigChanges();
                                      }
                                  }
                              }