Esempio n. 1
0
        public LookupControl(PropertyInfo prop, IAfterglowPlugin plugin) : base(prop)
        {
            ConfigLookupAttribute configAttribute = Attribute.GetCustomAttribute(prop, typeof(ConfigLookupAttribute)) as ConfigLookupAttribute;

            if (configAttribute == null)
            {
                throw new Exception("prop is not a ConfigLookupAttribute");
            }
            _propertyInfo = prop;
            _plugin       = plugin;

            //Create value Combo Box
            _valueComboBox      = new ComboBox();
            _valueComboBox.Name = Guid.NewGuid().ToString();

            //Populate Combo and set current item
            IEnumerable <object> availableValues = GetLookupValues(prop, plugin, configAttribute);

            if (availableValues != null)
            {
                _valueComboBox.DataSource       = availableValues;
                _valueComboBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
                _valueComboBox.DropDownStyle    = ComboBoxStyle.DropDownList;
            }
            else
            {
                plugin.Logger.Error("{0} could not be set as no lookup values could not be loaded", prop.Name);
            }
            this.Controls.Add(_valueComboBox);

            InitializeComponent();
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the details of list of a afterglow plugin types
        /// </summary>
        /// <param name="pluginTypes">An array of IAfterglowPlugin types</param>
        public static IEnumerable<AvailablePluginDetails> GetAvailblePlugins(Type[] pluginTypes)
        {
            List<AvailablePluginDetails> result = new List<AvailablePluginDetails>();

            foreach (Type pluginType in pluginTypes)
            {
                AvailablePluginDetails availablePlugin = new AvailablePluginDetails();

                availablePlugin.Type = pluginType.Name;

                IAfterglowPlugin newObject = Activator.CreateInstance(pluginType) as IAfterglowPlugin;
                if (newObject != null)
                {
                    PropertyInfo nameProperty = pluginType.GetProperty("Name");
                    if (nameProperty != null)
                    {
                        availablePlugin.Name = nameProperty.GetValue(newObject, null) as string;
                    }
                    PropertyInfo descriptionProperty = pluginType.GetProperty("Description");
                    if (descriptionProperty != null)
                    {
                        availablePlugin.Description = descriptionProperty.GetValue(newObject, null) as string;
                    }
                }
                result.Add(availablePlugin);
            }

            return result;
        }
Esempio n. 3
0
        public LookupControl(PropertyInfo prop, IAfterglowPlugin plugin)
            : base(prop)
        {
            ConfigLookupAttribute configAttribute = Attribute.GetCustomAttribute(prop, typeof(ConfigLookupAttribute)) as ConfigLookupAttribute;

            if (configAttribute == null)
            {
                throw new Exception("prop is not a ConfigLookupAttribute");
            }
            _propertyInfo = prop;
            _plugin = plugin;

            //Create value Combo Box
            _valueComboBox = new ComboBox();
            _valueComboBox.Name = Guid.NewGuid().ToString();

            //Populate Combo and set current item
            IEnumerable<object> availableValues = GetLookupValues(prop, plugin, configAttribute);
            if (availableValues != null)
            {
                _valueComboBox.DataSource = availableValues;
                _valueComboBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
                _valueComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
            }
            else
            {
                plugin.Logger.Error("{0} could not be set as no lookup values could not be loaded", prop.Name);
            }
            this.Controls.Add(_valueComboBox);

            InitializeComponent();
        }
Esempio n. 4
0
        public ReadOnlyControl(PropertyInfo prop, IAfterglowPlugin plugin)
            : base(prop, FONT_SIZE)
        {
            ConfigReadOnlyAttribute configAttribute = Attribute.GetCustomAttribute(prop, typeof(ConfigReadOnlyAttribute)) as ConfigReadOnlyAttribute;

            if (configAttribute == null)
            {
                throw new Exception("prop is not a ConfigReadOnlyAttribute");
            }
            //Create value Label
            if (configAttribute.IsHyperlink)
            {
                string link = prop.GetValue(plugin, null).ToString();
                _valueLinkLabel      = new LinkLabel();
                _valueLinkLabel.Name = Guid.NewGuid().ToString();
                _valueLinkLabel.Text = link;
                Font font = new Font(_valueLinkLabel.Font.FontFamily, FONT_SIZE);
                _valueLinkLabel.Font = font;
                _valueLinkLabel.Links.Add(0, link.Length, link);
                _valueLinkLabel.LinkClicked += new LinkLabelLinkClickedEventHandler(LinkClicked);
                this.Controls.Add(_valueLinkLabel);
            }
            else
            {
                _valueLabel      = new Label();
                _valueLabel.Name = Guid.NewGuid().ToString();
                _valueLabel.Text = prop.GetValue(plugin, null).ToString();
                Font font = new Font(_valueLabel.Font.FontFamily, FONT_SIZE);
                _valueLabel.Font = font;
                this.Controls.Add(_valueLabel);
            }

            InitializeComponent();
        }
Esempio n. 5
0
        private void SetChildNodes(TreeNode parent, IAfterglowPlugin objectToAdd)
        {
            if (objectToAdd == null)
            {
                return;
            }
            List <IAfterglowPlugin> list = new List <IAfterglowPlugin>();

            list.Add(objectToAdd);
            SetChildNodes(parent, list);
        }
Esempio n. 6
0
        private IEnumerable<object> GetLookupValues(PropertyInfo prop, IAfterglowPlugin plugin, ConfigLookupAttribute configAttribute)
        {
            Type pluginType = plugin.GetType();
            Type propertyType = prop.PropertyType;

            string displayName = configAttribute.DisplayName;
            IEnumerable<object> availableValues = null;
            if (propertyType.IsEnum)
            {
                availableValues = propertyType.GetEnumNames() as IEnumerable<object>;
            }
            else if (configAttribute.RetrieveValuesFrom != null)
            {
                var member = pluginType.GetMember(configAttribute.RetrieveValuesFrom);
                if (member.Length > 0)
                {
                    if (member[0].MemberType == MemberTypes.Property)
                    {
                        PropertyInfo pi = pluginType.GetProperty(configAttribute.RetrieveValuesFrom);

                        var propertyValue = pi.GetValue(plugin, null);
                        if (typeof(IEnumerable<>).MakeGenericType(propertyType).IsAssignableFrom(propertyValue.GetType()))
                        {
                            availableValues = propertyValue as IEnumerable<object>;
                        }
                        else
                        {
                            throw new ArgumentException("incorrect type", "RetrieveValuesFrom");
                        }

                    }
                    else if (member[0].MemberType == MemberTypes.Method)
                    {
                        MethodInfo mi = pluginType.GetMethod(configAttribute.RetrieveValuesFrom);

                        var propertyValue = mi.Invoke(plugin, null);
                        if (typeof(IEnumerable<>).MakeGenericType(propertyType).IsAssignableFrom(propertyValue.GetType()))
                        {
                            availableValues = propertyValue as IEnumerable<object>;
                        }
                        else
                        {
                            throw new ArgumentException("incorrect type", "RetrieveValuesFrom");
                        }
                    }
                }
            }
            return availableValues;
        }
Esempio n. 7
0
        public StringControl(PropertyInfo prop, IAfterglowPlugin plugin) : base(prop)
        {
            ConfigStringAttribute configAttribute = Attribute.GetCustomAttribute(prop, typeof(ConfigStringAttribute)) as ConfigStringAttribute;

            if (configAttribute == null)
            {
                throw new Exception("prop is not a ConfigStringAttribute");
            }

            //Create value Text Box
            _valueTextBox           = new TextBox();
            _valueTextBox.Name      = Guid.NewGuid().ToString();
            _valueTextBox.MaxLength = configAttribute.MaxLength;
            _valueTextBox.DataBindings.Add("Text", plugin, prop.Name, false, DataSourceUpdateMode.OnPropertyChanged, null);
            this.Controls.Add(_valueTextBox);

            InitializeComponent();
        }
Esempio n. 8
0
        public StringControl(PropertyInfo prop, IAfterglowPlugin plugin)
            : base(prop)
        {
            ConfigStringAttribute configAttribute = Attribute.GetCustomAttribute(prop, typeof(ConfigStringAttribute)) as ConfigStringAttribute;

            if (configAttribute == null)
            {
                throw new Exception("prop is not a ConfigStringAttribute");
            }

            //Create value Text Box
            _valueTextBox = new TextBox();
            _valueTextBox.Name = Guid.NewGuid().ToString();
            _valueTextBox.MaxLength = configAttribute.MaxLength;
            _valueTextBox.DataBindings.Add("Text", plugin, prop.Name,false, DataSourceUpdateMode.OnPropertyChanged, null);
            this.Controls.Add(_valueTextBox);

            InitializeComponent();
        }
Esempio n. 9
0
        public NumberControl(PropertyInfo prop, IAfterglowPlugin plugin)
            : base(prop)
        {
            ConfigNumberAttribute configAttribute = Attribute.GetCustomAttribute(prop, typeof(ConfigNumberAttribute)) as ConfigNumberAttribute;

            if (configAttribute == null)
            {
                throw new Exception("prop is not a ConfigNumberAttribute");
            }
            this._propertyInfo = prop;
            this._plugin       = plugin;

            //Create value Text Box
            _valueNumericUpDown         = new NumericUpDown();
            _valueNumericUpDown.Name    = Guid.NewGuid().ToString();
            _valueNumericUpDown.Minimum = Convert.ToDecimal(configAttribute.Min);
            _valueNumericUpDown.Maximum = Convert.ToDecimal(configAttribute.Max);


            //Configure decimal Places
            if (prop.PropertyType == typeof(int?))
            {
                _valueNumericUpDown.DecimalPlaces = 0;
            }
            else if (configAttribute.Min != 0 || configAttribute.Max != 0)
            {
                List <int> decimalPlaces = new List <int> {
                    configAttribute.Min.ToString().SkipWhile(c => c != '.').Skip(1).Count(), configAttribute.Max.ToString().SkipWhile(c => c != '.').Skip(1).Count()
                };
                _valueNumericUpDown.DecimalPlaces = decimalPlaces.OrderBy(d => d).FirstOrDefault();
            }

            decimal value = 0;

            value = Convert.ToDecimal(prop.GetValue(plugin, null));
            _valueNumericUpDown.Value         = value;
            _valueNumericUpDown.ValueChanged += new EventHandler(_valueNumericUpDown_ValueChanged);

            this.Controls.Add(_valueNumericUpDown);

            InitializeComponent();
        }
        public BasicLightSetupUserControl(IAfterglowPlugin plugin)
        {
            InitializeComponent();
            this._plugin = plugin as BasicLightSetup;

            dgvRegions.AllowUserToOrderColumns = false;
            dgvRegions.AllowUserToResizeColumns = false;
            dgvRegions.AllowUserToResizeRows = false;
            dgvRegions.ShowEditingIcon = false;
            dgvRegions.AllowUserToAddRows = false;
            dgvRegions.AllowUserToDeleteRows = false;
            dgvRegions.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders | DataGridViewRowHeadersWidthSizeMode.DisableResizing;
            dgvRegions.CellEnter += new DataGridViewCellEventHandler(dgvRegions_CellEnter);
            dgvRegions.KeyDown += new KeyEventHandler(dgvRegions_KeyDown);
            dgvRegions.CellValidating += new DataGridViewCellValidatingEventHandler(dgvRegions_CellValidating);
            dgvRegions.CellValidated += new DataGridViewCellEventHandler(dgvRegions_CellValidated);
            dgvRegions.PreviewKeyDown += new PreviewKeyDownEventHandler(dgvRegions_PreviewKeyDown);
            //dgvRegions.
            dgvRegions.Resize += new EventHandler(dgvRegions_Resize);
        }
Esempio n. 11
0
        public BasicLightSetupUserControl(IAfterglowPlugin plugin)
        {
            InitializeComponent();
            this._plugin = plugin as BasicLightSetup;

            dgvRegions.AllowUserToOrderColumns  = false;
            dgvRegions.AllowUserToResizeColumns = false;
            dgvRegions.AllowUserToResizeRows    = false;
            dgvRegions.ShowEditingIcon          = false;
            dgvRegions.AllowUserToAddRows       = false;
            dgvRegions.AllowUserToDeleteRows    = false;
            dgvRegions.RowHeadersWidthSizeMode  = DataGridViewRowHeadersWidthSizeMode.AutoSizeToDisplayedHeaders | DataGridViewRowHeadersWidthSizeMode.DisableResizing;
            dgvRegions.CellEnter      += new DataGridViewCellEventHandler(dgvRegions_CellEnter);
            dgvRegions.KeyDown        += new KeyEventHandler(dgvRegions_KeyDown);
            dgvRegions.CellValidating += new DataGridViewCellValidatingEventHandler(dgvRegions_CellValidating);
            dgvRegions.CellValidated  += new DataGridViewCellEventHandler(dgvRegions_CellValidated);
            dgvRegions.PreviewKeyDown += new PreviewKeyDownEventHandler(dgvRegions_PreviewKeyDown);
            //dgvRegions.
            dgvRegions.Resize += new EventHandler(dgvRegions_Resize);
        }
Esempio n. 12
0
        public NumberControl(PropertyInfo prop, IAfterglowPlugin plugin)
            : base(prop)
        {
            ConfigNumberAttribute configAttribute = Attribute.GetCustomAttribute(prop, typeof(ConfigNumberAttribute)) as ConfigNumberAttribute;

            if (configAttribute == null)
            {
                throw new Exception("prop is not a ConfigNumberAttribute");
            }
            this._propertyInfo = prop;
            this._plugin = plugin;

            //Create value Text Box
            _valueNumericUpDown = new NumericUpDown();
            _valueNumericUpDown.Name = Guid.NewGuid().ToString();
            _valueNumericUpDown.Minimum = Convert.ToDecimal(configAttribute.Min);
            _valueNumericUpDown.Maximum = Convert.ToDecimal(configAttribute.Max);

            //Configure decimal Places
            if (prop.PropertyType == typeof(int?))
            {
                _valueNumericUpDown.DecimalPlaces = 0;
            }
            else if (configAttribute.Min != 0 || configAttribute.Max != 0)
            {
                List<int> decimalPlaces = new List<int>{configAttribute.Min.ToString().SkipWhile(c => c != '.').Skip(1).Count(), configAttribute.Max.ToString().SkipWhile(c => c != '.').Skip(1).Count()};
                _valueNumericUpDown.DecimalPlaces = decimalPlaces.OrderBy(d => d).FirstOrDefault();
            }

            decimal value = 0;
            value = Convert.ToDecimal(prop.GetValue(plugin, null));
            _valueNumericUpDown.Value = value;
            _valueNumericUpDown.ValueChanged += new EventHandler(_valueNumericUpDown_ValueChanged);

            this.Controls.Add(_valueNumericUpDown);

            InitializeComponent();
        }
Esempio n. 13
0
 private void SetChildNodes(TreeNode parent, IAfterglowPlugin objectToAdd)
 {
     if (objectToAdd == null)
     {
         return;
     }
     List<IAfterglowPlugin> list = new List<IAfterglowPlugin>();
     list.Add(objectToAdd);
     SetChildNodes(parent, list);
 }
 public AutoGenPluginUserControl(IAfterglowPlugin plugin)
 {
     this._plugin = plugin;
     InitializeComponent();
 }
Esempio n. 15
0
 public AutoGenPluginUserControl(IAfterglowPlugin plugin)
 {
     this._plugin = plugin;
     InitializeComponent();
 }
Esempio n. 16
0
        private IEnumerable <object> GetLookupValues(PropertyInfo prop, IAfterglowPlugin plugin, ConfigLookupAttribute configAttribute)
        {
            Type pluginType   = plugin.GetType();
            Type propertyType = prop.PropertyType;

            string displayName = configAttribute.DisplayName;
            IEnumerable <object> availableValues = null;

            if (propertyType.IsEnum)
            {
                availableValues = propertyType.GetEnumNames() as IEnumerable <object>;
            }
            else if (configAttribute.RetrieveValuesFrom != null)
            {
                var member = pluginType.GetMember(configAttribute.RetrieveValuesFrom);
                if (member.Length > 0)
                {
                    if (member[0].MemberType == MemberTypes.Property)
                    {
                        PropertyInfo pi = pluginType.GetProperty(configAttribute.RetrieveValuesFrom);

                        var propertyValue = pi.GetValue(plugin, null);
                        if (typeof(IEnumerable <>).MakeGenericType(propertyType).IsAssignableFrom(propertyValue.GetType()))
                        {
                            availableValues = propertyValue as IEnumerable <object>;
                        }
                        else
                        {
                            throw new ArgumentException("incorrect type", "RetrieveValuesFrom");
                        }
                    }
                    else if (member[0].MemberType == MemberTypes.Method)
                    {
                        MethodInfo mi = pluginType.GetMethod(configAttribute.RetrieveValuesFrom);

                        var propertyValue = mi.Invoke(plugin, null);
                        if (typeof(IEnumerable <>).MakeGenericType(propertyType).IsAssignableFrom(propertyValue.GetType()))
                        {
                            availableValues = propertyValue as IEnumerable <object>;
                        }
                        else
                        {
                            throw new ArgumentException("incorrect type", "RetrieveValuesFrom");
                        }
                    }
                    else if (member[0].MemberType == MemberTypes.Field)
                    {
                        FieldInfo fi = pluginType.GetField(configAttribute.RetrieveValuesFrom);

                        var propertyValue = fi.GetValue(plugin);
                        if (typeof(System.Collections.ObjectModel.ObservableCollection <string>) == propertyValue.GetType())
                        {
                            availableValues     = propertyValue as IEnumerable <object>;
                            _useCollectionIndex = true;
                        }
                        else
                        {
                            throw new ArgumentException("incorrect type", "RetrieveValuesFrom");
                        }
                    }
                }
            }
            return(availableValues);
        }
        public PluginResponse Post(UpdatePluginRequest request)
        {
            PluginResponse response = new PluginResponse();
            Profile        profile  = (from p in Program.Runtime.Setup.Profiles
                                       where p.Id == request.ProfileId
                                       select p).FirstOrDefault();

            bool             newPlugin = request.Id == 0;
            int              newId     = 0;
            IAfterglowPlugin plugin    = null;
            Type             type      = null;

            switch (request.PluginType)
            {
            case 1:
                if (newPlugin)
                {
                    type  = Program.Runtime.Setup.AvailableLightSetupPlugins.Where(a => a.Name == request.Type).FirstOrDefault();
                    newId = Program.Runtime.Setup.GetNewId <ILightSetupPlugin>();
                }
                else
                {
                    plugin = profile.LightSetupPlugins.Where(l => l.Id == request.Id).FirstOrDefault();
                }
                break;

            case 2:
                if (newPlugin)
                {
                    type  = Program.Runtime.Setup.AvailableCapturePlugins.Where(a => a.Name == request.Type).FirstOrDefault();
                    newId = Program.Runtime.Setup.GetNewId <ICapturePlugin>();
                }
                else
                {
                    plugin = profile.CapturePlugins.Where(l => l.Id == request.Id).FirstOrDefault();
                }
                break;

            case 3:
                if (newPlugin)
                {
                    type  = Program.Runtime.Setup.AvailableColourExtractionPlugins.Where(a => a.Name == request.Type).FirstOrDefault();
                    newId = Program.Runtime.Setup.GetNewId <IColourExtractionPlugin>();
                }
                else
                {
                    plugin = profile.ColourExtractionPlugins.Where(l => l.Id == request.Id).FirstOrDefault();
                }
                break;

            case 4:
                if (newPlugin)
                {
                    type  = Program.Runtime.Setup.AvailablePostProcessPlugins.Where(a => a.Name == request.Type).FirstOrDefault();
                    newId = Program.Runtime.Setup.GetNewId <IPostProcessPlugin>();
                }
                else
                {
                    plugin = profile.PostProcessPlugins.Where(l => l.Id == request.Id).FirstOrDefault();
                }
                break;

            case 5:
                if (newPlugin)
                {
                    type  = Program.Runtime.Setup.AvailablePreOutputPlugins.Where(a => a.Name == request.Type).FirstOrDefault();
                    newId = Program.Runtime.Setup.GetNewId <IPreOutputPlugin>();
                }
                else
                {
                    plugin = profile.PreOutputPlugins.Where(l => l.Id == request.Id).FirstOrDefault();
                }
                break;

            case 6:
                if (newPlugin)
                {
                    type  = Program.Runtime.Setup.AvailableOutputPlugins.Where(a => a.Name == request.Type).FirstOrDefault();
                    newId = Program.Runtime.Setup.GetNewId <IOutputPlugin>();
                }
                else
                {
                    plugin = profile.OutputPlugins.Where(l => l.Id == request.Id).FirstOrDefault();
                }
                break;

            default:
                plugin = null;
                break;
            }

            if (newPlugin && type != null)
            {
                plugin = Activator.CreateInstance(type) as IAfterglowPlugin;
            }

            if (SetPluginProperties(plugin, request.Properties))
            {
                if (newPlugin)
                {
                    plugin.Id = newId;
                    switch (request.PluginType)
                    {
                    case 1:
                        profile.LightSetupPlugins[0] = plugin as ILightSetupPlugin;
                        break;

                    case 2:
                        profile.CapturePlugins[0] = plugin as ICapturePlugin;
                        break;

                    case 3:
                        profile.ColourExtractionPlugins[0] = plugin as IColourExtractionPlugin;
                        break;

                    case 4:
                        profile.PostProcessPlugins.Add(plugin as IPostProcessPlugin);
                        break;

                    case 5:
                        profile.PreOutputPlugins.Add(plugin as IPreOutputPlugin);
                        break;

                    case 6:
                        profile.OutputPlugins.Add(plugin as IOutputPlugin);
                        break;

                    default:
                        plugin = null;
                        break;
                    }
                }

                Program.Runtime.Save();

                // Load the saved version
                PluginRequest newRequest = new PluginRequest();
                newRequest.Id         = plugin.Id;
                newRequest.PluginType = request.PluginType;
                newRequest.ProfileId  = profile.Id;

                return(Post(newRequest));
            }
            return(null);
        }
        public PluginResponse Post(PluginRequest request)
        {
            PluginResponse response = new PluginResponse();
            Profile        profile  = (from p in Program.Runtime.Setup.Profiles
                                       where p.Id == request.ProfileId
                                       select p).FirstOrDefault();

            if (profile == null)
            {
                return(response);
            }

            bool newPlugin = request.Id == 0;
            Type type      = null;

            IAfterglowPlugin plugin = null;

            switch (request.PluginType)
            {
            case 1:
                if (newPlugin)
                {
                    type = Program.Runtime.Setup.AvailableLightSetupPlugins.Where(a => a.Name == request.Type).FirstOrDefault();
                }
                else
                {
                    plugin = profile.LightSetupPlugins.Where(l => l.Id == request.Id).FirstOrDefault();
                }
                break;

            case 2:
                if (newPlugin)
                {
                    type = Program.Runtime.Setup.AvailableCapturePlugins.Where(a => a.Name == request.Type).FirstOrDefault();
                }
                else
                {
                    plugin = profile.CapturePlugins.Where(l => l.Id == request.Id).FirstOrDefault();
                }
                break;

            case 3:
                if (newPlugin)
                {
                    type = Program.Runtime.Setup.AvailableColourExtractionPlugins.Where(a => a.Name == request.Type).FirstOrDefault();
                }
                else
                {
                    plugin = profile.ColourExtractionPlugins.Where(l => l.Id == request.Id).FirstOrDefault();
                }
                break;

            case 4:
                if (newPlugin)
                {
                    type = Program.Runtime.Setup.AvailablePostProcessPlugins.Where(a => a.Name == request.Type).FirstOrDefault();
                }
                else
                {
                    plugin = profile.PostProcessPlugins.Where(l => l.Id == request.Id).FirstOrDefault();
                }
                break;

            case 5:
                if (newPlugin)
                {
                    type = Program.Runtime.Setup.AvailablePreOutputPlugins.Where(a => a.Name == request.Type).FirstOrDefault();
                }
                else
                {
                    plugin = profile.PreOutputPlugins.Where(l => l.Id == request.Id).FirstOrDefault();
                }
                break;

            case 6:
                if (newPlugin)
                {
                    type = Program.Runtime.Setup.AvailableOutputPlugins.Where(a => a.Name == request.Type).FirstOrDefault();
                }
                else
                {
                    plugin = profile.OutputPlugins.Where(l => l.Id == request.Id).FirstOrDefault();
                }
                break;

            default:
                plugin = null;
                break;
            }

            if (newPlugin && type != null)
            {
                plugin = Activator.CreateInstance(type) as IAfterglowPlugin;
            }
            else if (plugin == null)
            {
                return(response);
            }

            response.Id          = plugin.Id;
            response.Name        = plugin.Name;
            response.Title       = string.Format("{0} - {1}", profile.Name, plugin.Name);
            response.Description = plugin.Description;
            response.Author      = plugin.Author;
            response.Version     = plugin.Version;
            response.Website     = plugin.Website;
            response.PluginType  = request.PluginType;
            response.ProfileId   = profile.Id;

            response.Properties = GetPluginProperties(plugin);

            return(response);
        }
Esempio n. 19
-1
        public ReadOnlyControl(PropertyInfo prop, IAfterglowPlugin plugin)
            : base(prop, FONT_SIZE)
        {
            ConfigReadOnlyAttribute configAttribute = Attribute.GetCustomAttribute(prop, typeof(ConfigReadOnlyAttribute)) as ConfigReadOnlyAttribute;

            if (configAttribute == null)
            {
                throw new Exception("prop is not a ConfigReadOnlyAttribute");
            }
            //Create value Label
            if (configAttribute.IsHyperlink)
            {
                string link = prop.GetValue(plugin, null).ToString();
                _valueLinkLabel = new LinkLabel();
                _valueLinkLabel.Name = Guid.NewGuid().ToString();
                _valueLinkLabel.Text = link;
                Font font = new Font(_valueLinkLabel.Font.FontFamily, FONT_SIZE);
                _valueLinkLabel.Font = font;
                _valueLinkLabel.Links.Add(0,link.Length,link);
                _valueLinkLabel.LinkClicked += new LinkLabelLinkClickedEventHandler(LinkClicked);
                this.Controls.Add(_valueLinkLabel);
            }
            else
            {
                _valueLabel = new Label();
                _valueLabel.Name = Guid.NewGuid().ToString();
                _valueLabel.Text = prop.GetValue(plugin, null).ToString();
                Font font = new Font(_valueLabel.Font.FontFamily, FONT_SIZE);
                _valueLabel.Font = font;
                this.Controls.Add(_valueLabel);
            }

            InitializeComponent();
        }