private void SetupPluginOptions(Plugins.INotifier plugin, System.Xml.Linq.XElement settingElement)
        {
            var options = plugin.GetAllAvailableOptions();

            if (settingElement != null)
            {
                foreach (var optionElement in (from configuredOption in settingElement.Descendants("Option") select configuredOption))
                {
                    var numericsElement = optionElement.Element("Numerics");
                    var numerics = new List<int>();

                    if (numericsElement != null)
                    {
                        foreach (var numericElement in (from numeric in numericsElement.Descendants("Numeric") select numeric))
                        {
                            numerics.Add(Convert.ToInt32(numericElement.Value));
                        }
                    }

                    var gesturesElement = optionElement.Element("Gestures");
                    var gestures = new List<int>();

                    if (gesturesElement != null)
                    {
                        foreach (var gestureElement in (from gesture in gesturesElement.Descendants("Gesture") select gesture))
                        {
                            gestures.Add(Convert.ToInt32(gestureElement.Value));
                        }
                    }

                    var active = Convert.ToBoolean(optionElement.Attribute("Active").Value);

                    int index = options.FindIndex(x => x.OptionId == Convert.ToInt32(optionElement.Attribute("Id").Value));

                    var newOption = new Objects.Option(Convert.ToInt32(optionElement.Attribute("Id").Value), gestures, numerics, active);

                    if (index == -1)
                    {
                        options.Add(newOption);
                    }
                    else
                    {
                        options[index] = newOption;
                    }
                }
            }

            plugin.ResetLastAccessed(options, PollingInterval);
            pluginOptions[plugin.NotificationApplication] = options;
        }
Ejemplo n.º 2
0
        private void SetupPluginOptions(Plugins.INotifier plugin, System.Xml.Linq.XElement settingElement)
        {
            var options = plugin.GetAllAvailableOptions();

            if (settingElement != null)
            {
                foreach (var optionElement in (from configuredOption in settingElement.Descendants("Options") select configuredOption))
                {
                    var numericsElement = optionElement.Element("Numerics");
                    var numerics = new List<int>();
                    // TODO: loop through and set up all numerics

                    var gesturesElement = optionElement.Element("Gestures");
                    var gestures = new List<int>();
                    // TODO: loop through and set up all gestures

                    var active = Convert.ToBoolean(optionElement.Attribute("Active").Value);

                    int index = options.FindIndex(x => x.OptionId == Convert.ToInt32(optionElement.Attribute("Id").Value));

                    var newOption = new Objects.Option(Convert.ToInt32(optionElement.Attribute("Id").Value), gestures, numerics, active);
                    if (index == -1)
                    {
                        options.Add(newOption);
                    }
                    else
                    {
                        options[index] = newOption;
                    }
                }
            }

            pluginOptions[plugin.NotificationApplication] = options;
        }