Exemple #1
0
 public void OptionChanged(TextViewGroupOption option)
 {
     if (optionsStorage is null)
     {
         return;
     }
     if (writeOptionHash.Contains(option))
     {
         return;
     }
     try {
         writeOptionHash.Add(option);
         optionsStorage.Write(groupName, option);
         foreach (var textView in textViews.ToArray())
         {
             var coll = GetCollection(textView.TextDataModel.ContentType);
             if (!StringComparer.OrdinalIgnoreCase.Equals(option.Definition.ContentType, coll.ContentType.TypeName))
             {
                 continue;
             }
             try {
                 textView.Options.SetOptionValue(option.OptionId, option.Value);
             }
             catch (ArgumentException) {
                 // Invalid option value
             }
         }
         TextViewOptionChanged?.Invoke(this, new TextViewOptionChangedEventArgs(option.Definition.ContentType, option.Definition.Name));
     }
     finally {
         writeOptionHash.Remove(option);
     }
 }
 public void OptionChanged(TextViewGroupOption option)
 {
     if (optionsStorage == null)
     {
         return;
     }
     if (writeOptionHash.Contains(option))
     {
         return;
     }
     try {
         writeOptionHash.Add(option);
         optionsStorage.Write(groupName, option);
         foreach (var textView in textViews.ToArray())
         {
             try {
                 textView.Options.SetOptionValue(option.OptionId, option.Value);
             }
             catch (ArgumentException) {
                 // Invalid option value
             }
         }
         TextViewOptionChanged?.Invoke(this, new TextViewOptionChangedEventArgs(option.Definition.ContentType, option.Definition.Name));
     }
     finally {
         writeOptionHash.Remove(option);
     }
 }