Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator not saving gradient colour

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Indicator not saving gradient colour

    HI
    Im the author of BarTimerHyrbid.
    Come across something that is a bit beyond me.

    I can't seem to save the gradient colours in a template or as default - it keeps reverting to the given colour in the code which is DarkBlue.

    Code:
    //In OnState == State.Default
    Gradient_Mixer_Colour         = Brushes.DarkBlue;
                    Gradient_Mixer_Colour1         = Brushes.Cyan;​
    
    
    //In Properties
                [XmlIgnore]
                [Display(GroupName = "Flash_Settings", Order = 5, Name = "Flash Gradient"+"\n"+"Mix",
                Description = "Mix Colour for Gradient.")]
                public SolidColorBrush Gradient_Mixer_Colour { get; set; }
                
              
                [Browsable(false)]
                public string gradient_Mixer_Colour
                {
                  get { return Serialize.BrushToString(Gradient_Mixer_Colour); }
                  set {if (Gradient_Mixer_Colour != null)
                                {
                                    if (Gradient_Mixer_Colour.IsFrozen)
                                        Gradient_Mixer_Colour = Gradient_Mixer_Colour.Clone();
                                        Gradient_Mixer_Colour.Freeze();
                                }
                      }
                }​
    Can anyone advise how i can sort this - then I can update the indicator for everyone.

    #2
    Hello Mindset,

    Are you seeing any errors in the log? If any error happens during saving or loading that would explain a default color being used. You may otherwise need to use a Print in the property to see what value is observed when loading the string to check if that is the problem or if saving is the problem.

    You may also need to change the set in your serialization property. I don't see where you are deserializing a value to a gradient, only where you are doing freeze operations

    Comment


      #3
      HI
      Ok I have found an error message

      PHP Code:
      2024-05-06 18:07:53:676 There was an error generating the XML document.
      2024-05-06 18:07:53:676 The type System.Windows.Media.MatrixTransform was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically.
      2024-05-06 18:07:53:676 System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: The type System.Windows.Media.MatrixTransform was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically.
         at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterBarTimerHybrid.Write32_Transform(String n, String ns, Transform o, Boolean isNullable, Boolean needType)
         at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterBarTimerHybrid.Write35_SolidColorBrush(String n, String ns, SolidColorBrush o, Boolean isNullable, Boolean needType)
         at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterBarTimerHybrid.Write36_BarTimerHybrid(String n, String ns, BarTimerHybrid o, Boolean isNullable, Boolean needType)
         at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterBarTimerHybrid.Write37_BarTimerHybrid(Object o)
         --- End of inner exception stack trace ---
      ​ 
      
      I will be honest this is a bit above me - I tried using XML Include as it suggested and just got another error message.
      This is not something I have come across before.

      I did add the following

      Code:
                  [Browsable(false)]
                  public string gradient_Mixer_Colour1
                  {
                    get { return Serialize.BrushToString(Gradient_Mixer_Colour1); }
                    set {[COLOR=#c0392b][B]Serialize.StringToBrush(value);[/B]  [/COLOR]      
                        if (Gradient_Mixer_Colour1 != null)
                                  {
                                      if (Gradient_Mixer_Colour1.IsFrozen)
                                          Gradient_Mixer_Colour1 = Gradient_Mixer_Colour1.Clone();
                                          Gradient_Mixer_Colour1.Freeze();    
                                  }
                          
                        }
                  }​
      But it made no difference.

      Comment


        #4
        Hello Mindset,

        From this error it looks like you may have something else that is marked public without the [XmlIgnore] attached.The error shows a MatrixTransform, do you have a variable of type MatrixTransform marked as public? If so add [XmlIgnore]

        Regarding brushes, those should all be defined like this:

        Code:
        [XmlIgnore]
        public Brush MyBrush { get; set; }​
        
        [Browsable(false)]
        public string MyBrushSerialize
        {
        get { return Serialize.BrushToString(MyBrush); }
        set { MyBrush = Serialize.StringToBrush(value); }
        }​

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        666 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        377 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        110 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        575 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        580 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X