private void UpdateStorables() { if (!storablesStale_) { return; } List <string> list = null; var a = holder_?.Atom; if (a != null) { bool pluginsOnly = false; string type = type_; if (type.EndsWith(PluginSuffix)) { type = type.Substring(0, type.Length - PluginSuffix.Length); pluginsOnly = true; } list = new List <string>(); if (type == "") { foreach (var id in a.GetStorableIDs()) { if (!pluginsOnly || Utilities.StorableIsPlugin(id)) { list.Add(id); } } } else { var p = new StorableParameterFactory().Create(type); if (p == null) { Synergy.LogError($"unknown type {type}"); } else { list = new List <string>(p.GetStorableNames(a, pluginsOnly)); } } } if (list == null) { list = new List <string>(); } Utilities.NatSort(list); storables_.Choices = list; storablesStale_ = false; }
private void UpdateList(List <string> filter) { var displayNames = new StorableParameterFactory().GetAllDisplayNames(); var typeNames = new StorableParameterFactory().GetAllFactoryTypeNames(); var displayChoices = new List <string>(); var choices = new List <string>(); if (filter.Count == 0 || filter.Contains("all")) { displayChoices.Add("All (plugins only)"); choices.Add(StorableWidgets.PluginSuffix); } // plugins only for (int i = 0; i < typeNames.Count; ++i) { if (filter.Count == 0 || filter.Contains(typeNames[i])) { displayChoices.Add(displayNames[i] + " (plugins only)"); choices.Add(typeNames[i] + StorableWidgets.PluginSuffix); } } // any for (int i = 0; i < typeNames.Count; ++i) { if (filter.Count == 0 || filter.Contains(typeNames[i])) { displayChoices.Add(displayNames[i]); choices.Add(typeNames[i]); } } if (filter.Count == 0 || filter.Contains("all")) { displayChoices.Add("All (very slow)"); choices.Add(""); } DisplayChoices = displayChoices; Choices = choices; // todo Value = "action" + StorableWidgets.PluginSuffix; }
private void UpdateParameters() { if (!parametersStale_) { return; } List <string> list = null; var s = holder_?.Storable; if (s != null) { string type = type_; if (type.EndsWith(PluginSuffix)) { type = type.Substring(0, type.Length - PluginSuffix.Length); } if (type == "") { list = s.GetAllParamAndActionNames(); } else { var p = new StorableParameterFactory().Create(type); if (p == null) { Synergy.LogError($"unknown type {type_}"); } else { list = new List <string>(p.GetParameterNames(s)); } } } if (list == null) { list = new List <string>(); } Utilities.NatSort(list); parameters_.Choices = list; parametersStale_ = false; }
public void SetParameter(JSONStorableParam sp) { if (Parameter != null && Parameter.TryParameter(sp)) { return; } var p = StorableParameterFactory.Create(sp); if (p == null) { Synergy.LogError("unknown parameter type " + sp.ToString()); return; } Parameter = p; }