Example #1
0
        public PresetTrigger AddTrigger()
        {
            if (!Triggers.Any())
            {
                Triggers.Add(new PresetTrigger());
            }

            return(Triggers.First());
        }
Example #2
0
        public override List <string> GetDisplayValues(Config config = null)
        {
            var values = new List <string>();

            values.Add(name);

            var deviceString = "Global";

            if (!string.IsNullOrEmpty(DeviceMacAddress))
            {
                if (LgDevices != null)
                {
                    var device = LgDevices.FirstOrDefault(d => !string.IsNullOrEmpty(d.MacAddress) && d.MacAddress.Equals(DeviceMacAddress));
                    if (device != null)
                    {
                        deviceString = device.Name;
                    }
                    else
                    {
                        deviceString = "Unknown: device not found";
                    }
                }
                else
                {
                    deviceString = DeviceMacAddress;
                }
            }
            values.Add(deviceString);

            var app = appId;

            if (LgApps != null)
            {
                var item = LgApps.FirstOrDefault(x => x.appId.Equals(appId));
                if (item != null)
                {
                    app = item.title + " (" + appId + ")";
                }
            }
            values.Add(app);
            values.Add(GetStepsDisplay());
            values.Add(shortcut);

            if (Triggers.Any())
            {
                values.Add(Triggers.First().ToString());
            }

            return(values);
        }
Example #3
0
        public void UpdateTrigger(PresetTriggerType triggerType, PresetConditionType conditions, string includedProcesses, string excludedProcesses)
        {
            if (!Triggers.Any())
            {
                Triggers.Add(new PresetTrigger());
            }

            var trigger = Triggers.First();

            trigger.Trigger    = triggerType;
            trigger.Conditions = conditions;

            if (trigger.IncludedProcesses == null)
            {
                trigger.IncludedProcesses = new List <string>();
            }
            if (trigger.ExcludedProcesses == null)
            {
                trigger.ExcludedProcesses = new List <string>();
            }
            Utils.ParseWords(trigger.IncludedProcesses, includedProcesses);
            Utils.ParseWords(trigger.ExcludedProcesses, excludedProcesses);
        }