private void SettingChanged(string setting, Visibility vis, TaskPaneAttribute tpa) { if (TaskPaneAttributeChanged != null) { TaskPaneAttributeChanged(this, new TaskPaneAttributeChangedEventArgs(new TaskPaneAttribteContainer(setting, vis, tpa))); } }
public static TaskPaneAttribute[] GetSettingsProperties(this Type type, Type pluginType) { if (type == null || pluginType == null) { return(new TaskPaneAttribute[0]); } try { List <TaskPaneAttribute> taskPaneAttributes = new List <TaskPaneAttribute>(); foreach (PropertyInfo pInfo in type.GetProperties()) { TaskPaneAttribute[] attributes = (TaskPaneAttribute[])pInfo.GetCustomAttributes(typeof(TaskPaneAttribute), false); if (attributes != null && attributes.Length == 1) { TaskPaneAttribute attr = attributes[0]; attr.PropertyInfo = pInfo; attr.PropertyName = pInfo.Name; // does plugin have a resource file for translation? if (pluginType.GetPluginInfoAttribute().ResourceFile != null) { attr.PluginType = pluginType; } taskPaneAttributes.Add(attr); } } foreach (MethodInfo mInfo in type.GetMethods()) { if (mInfo.IsPublic && mInfo.GetParameters().Length == 0) { TaskPaneAttribute[] attributes = (TaskPaneAttribute[])mInfo.GetCustomAttributes(typeof(TaskPaneAttribute), false); if (attributes != null && attributes.Length == 1) { TaskPaneAttribute attr = attributes[0]; attr.Method = mInfo; attr.MethodInfo = mInfo; attr.PropertyName = mInfo.Name; // does plugin have a resource file for translation? if (pluginType.GetPluginInfoAttribute().ResourceFile != null) { attr.PluginType = pluginType; } taskPaneAttributes.Add(attr); } } } return(taskPaneAttributes.ToArray()); } catch (Exception ex) { GuiLogMessage(ex.Message, NotificationLevel.Error); } return(null); }
public TaskPaneAttribteContainer(string property, Visibility visibility, TaskPaneAttribute taskPaneAttribute) { if (property == null || property == string.Empty) { throw new ArgumentException("property is null or empty"); } this.Property = property; this.Visibility = visibility; this.TaskPaneAttribute = taskPaneAttribute; }
// helper functions for common CT2 Workspace UI tasks protected void UpdateVisibility(string key, Visibility vis, TaskPaneAttribute tpa = null) { if (tpa != null) { TaskPaneAttributeChanged(this, new TaskPaneAttributeChangedEventArgs(new TaskPaneAttribteContainer(key, vis, tpa))); } else { TaskPaneAttributeChanged(this, new TaskPaneAttributeChangedEventArgs(new TaskPaneAttribteContainer(key, vis))); } }